initscripts-shr: remove devtmpfs initscript for palmpre machine
[openembedded.git] / recipes / scim / files / 53_scim-1.4.7-trayicon.dpatch
blob666d39ef86cd83da1f0c3ce3279beb2819043013
1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## 53_scim-1.4.7-trayicon.dpatch by Ikuya Awashiro <ikuya@fruitsbasket.info>
3 ##
4 ## All lines beginning with `## DP:' are a description of the patch.
5 ## DP: Use better tray icon
6 ## DP: https://bugzilla.redhat.com/show_bug.cgi?id=447848
8 @DPATCH@
9 diff -urNad scim-1.4.9~/extras/panel/scim_panel_gtk.cpp scim-1.4.9/extras/panel/scim_panel_gtk.cpp
10 --- scim-1.4.9~/extras/panel/scim_panel_gtk.cpp 2008-11-02 06:43:13.000000000 +0000
11 +++ scim-1.4.9/extras/panel/scim_panel_gtk.cpp 2009-07-20 11:54:40.000000000 +0000
12 @@ -60,7 +60,7 @@
13 #include "scimstringview.h"
15 #if ENABLE_TRAY_ICON
16 - #include "scimtrayicon.h"
17 +// #include "scimtrayicon.h"
18 #endif
20 using namespace scim;
21 @@ -276,6 +276,13 @@
22 #if ENABLE_TRAY_ICON
23 static void ui_tray_icon_destroy_cb (GtkObject *object,
24 gpointer user_data);
25 +static void ui_tray_icon_popup_menu_cb (GtkStatusIcon *status_icon,
26 + guint button,
27 + guint activate_time,
28 + gpointer user_data);
30 +static void ui_tray_icon_activate_cb (GtkStatusIcon *status_icon,
31 + gpointer user_data);
32 #endif
34 // Client Property Callback
35 @@ -399,9 +406,9 @@
36 static PangoFontDescription *_default_font_desc = 0;
38 #if ENABLE_TRAY_ICON
39 -static ScimTrayIcon *_tray_icon = 0;
40 -static GtkWidget *_tray_icon_factory_button = 0;
41 -static gulong _tray_icon_destroy_signal_id = 0;
42 +static GtkStatusIcon *_tray_icon = 0;
43 +// static GtkWidget *_tray_icon_factory_button = 0;
44 +// static gulong _tray_icon_destroy_signal_id = 0;
45 #endif
47 static gboolean _input_window_draging = FALSE;
48 @@ -647,9 +654,9 @@
50 #if ENABLE_TRAY_ICON
51 if (_tray_icon) {
52 - g_signal_handler_disconnect (G_OBJECT (_tray_icon),
53 - _tray_icon_destroy_signal_id);
54 - gtk_widget_destroy (GTK_WIDGET (_tray_icon));
55 + // g_signal_handler_disconnect (G_OBJECT (_tray_icon),
56 + // _tray_icon_destroy_signal_id);
57 + g_object_unref (_tray_icon);
59 _tray_icon = 0;
60 #endif
61 @@ -1312,9 +1319,9 @@
64 #if ENABLE_TRAY_ICON
65 - if (_tray_icon) {
66 - gtk_window_set_screen (GTK_WINDOW (_tray_icon), screen);
67 - }
68 + // if (_tray_icon) {
69 + // gtk_window_set_screen (GTK_WINDOW (_tray_icon), screen);
70 + // }
71 #endif
73 if (_help_dialog) {
74 @@ -1337,65 +1344,75 @@
75 #endif
77 #if ENABLE_TRAY_ICON
78 -static gboolean
79 -ui_tray_icon_expose_event_cb (GtkWidget *widget, GdkEventExpose *event)
81 - gdk_window_clear_area (widget->window, event->area.x, event->area.y,
82 - event->area.width, event->area.height);
83 - return FALSE;
86 -static void
87 -ui_tray_icon_style_set_cb (GtkWidget *widget, GtkStyle *previous_style)
89 - gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
92 -static void
93 -ui_tray_icon_realize_cb (GtkWidget *widget)
95 - if (GTK_WIDGET_NO_WINDOW (widget) || GTK_WIDGET_APP_PAINTABLE (widget))
96 - return;
98 - gtk_widget_set_app_paintable (widget, TRUE);
99 - gtk_widget_set_double_buffered (widget, FALSE);
100 - gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
101 - g_signal_connect (widget, "expose_event",
102 - G_CALLBACK (ui_tray_icon_expose_event_cb), NULL);
103 - g_signal_connect_after (widget, "style_set",
104 - G_CALLBACK (ui_tray_icon_style_set_cb), NULL);
106 +// static gboolean
107 +// ui_tray_icon_expose_event_cb (GtkWidget *widget, GdkEventExpose *event)
108 +// {
109 +// gdk_window_clear_area (widget->window, event->area.x, event->area.y,
110 +// event->area.width, event->area.height);
111 +// return FALSE;
112 +// }
113 +//
114 +// static void
115 +// ui_tray_icon_style_set_cb (GtkWidget *widget, GtkStyle *previous_style)
116 +// {
117 +// gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
118 +// }
119 +//
120 +// static void
121 +// ui_tray_icon_realize_cb (GtkWidget *widget)
122 +// {
123 +// if (GTK_WIDGET_NO_WINDOW (widget) || GTK_WIDGET_APP_PAINTABLE (widget))
124 +// return;
125 +//
126 +// gtk_widget_set_app_paintable (widget, TRUE);
127 +// gtk_widget_set_double_buffered (widget, FALSE);
128 +// gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
129 +// g_signal_connect (widget, "expose_event",
130 +// G_CALLBACK (ui_tray_icon_expose_event_cb), NULL);
131 +// g_signal_connect_after (widget, "style_set",
132 +// G_CALLBACK (ui_tray_icon_style_set_cb), NULL);
133 +// }
135 static gboolean
136 ui_create_tray_icon_when_idle (gpointer data)
138 GtkWidget *image;
140 - _tray_icon = scim_tray_icon_new ("SCIM Tray Icon");
141 - g_signal_connect (G_OBJECT (_tray_icon), "realize",
142 - G_CALLBACK (ui_tray_icon_realize_cb), NULL);
143 + _tray_icon = gtk_status_icon_new_from_file (SCIM_KEYBOARD_ICON_FILE);
144 + // g_signal_connect (G_OBJECT (_tray_icon), "realize",
145 + // G_CALLBACK (ui_tray_icon_realize_cb), NULL);
147 - _tray_icon_destroy_signal_id =
148 - g_signal_connect (G_OBJECT (_tray_icon), "destroy",
149 - G_CALLBACK (ui_tray_icon_destroy_cb),
150 - 0);
151 + // _tray_icon_destroy_signal_id =
152 + // g_signal_connect (G_OBJECT (_tray_icon), "destroy",
153 + // G_CALLBACK (ui_tray_icon_destroy_cb),
154 + // 0);
156 - image = ui_create_icon (SCIM_KEYBOARD_ICON_FILE,
157 - NULL,
158 - TRAY_ICON_SIZE,
159 - TRAY_ICON_SIZE,
160 - true);
161 + // image = ui_create_icon (SCIM_KEYBOARD_ICON_FILE,
162 + // NULL,
163 + // TRAY_ICON_SIZE,
164 + // TRAY_ICON_SIZE,
165 + // true);
167 - _tray_icon_factory_button = gtk_event_box_new ();
168 - g_signal_connect (G_OBJECT (_tray_icon_factory_button), "realize",
169 - G_CALLBACK (ui_tray_icon_realize_cb), NULL);
170 - gtk_container_add (GTK_CONTAINER (_tray_icon_factory_button), image);
171 - gtk_container_add (GTK_CONTAINER (_tray_icon), _tray_icon_factory_button);
172 - g_signal_connect (G_OBJECT (_tray_icon_factory_button), "button-release-event",
173 - G_CALLBACK (ui_factory_button_click_cb),
174 + // _tray_icon_factory_button = gtk_event_box_new ();
175 + // g_signal_connect (G_OBJECT (_tray_icon_factory_button), "realize",
176 + // G_CALLBACK (ui_tray_icon_realize_cb), NULL);
177 + // gtk_container_add (GTK_CONTAINER (_tray_icon_factory_button), image);
178 + // gtk_container_add (GTK_CONTAINER (_tray_icon), _tray_icon_factory_button);
181 + // g_signal_connect (G_OBJECT (_tray_icon_factory_button), "button-release-event",
182 + // G_CALLBACK (ui_factory_button_click_cb),
183 + // 0);
185 + g_signal_connect (G_OBJECT (_tray_icon), "popup-menu",
186 + G_CALLBACK (ui_tray_icon_popup_menu_cb),
187 + 0);
189 + g_signal_connect (G_OBJECT (_tray_icon), "activate",
190 + G_CALLBACK (ui_tray_icon_activate_cb),
193 - gtk_widget_show_all (GTK_WIDGET (_tray_icon));
194 + gtk_status_icon_set_visible (_tray_icon, TRUE);
196 return FALSE;
198 @@ -1686,6 +1703,19 @@
201 static void
202 +ui_tray_icon_popup_menu_cb (GtkStatusIcon *status_icon, guint button,
203 + guint activate_time, gpointer user_data)
205 + action_show_command_menu ();
208 +static void
209 +ui_tray_icon_activate_cb (GtkStatusIcon *status_icon, gpointer user_data)
211 + _panel_agent->request_factory_menu ();
214 +static void
215 ui_factory_menu_activate_cb (GtkMenuItem *item,
216 gpointer user_data)
218 @@ -2243,19 +2273,19 @@
221 #if ENABLE_TRAY_ICON
222 -static void
223 -ui_tray_icon_destroy_cb (GtkObject *object,
224 - gpointer user_data)
226 - SCIM_DEBUG_MAIN (1) << "Tray Icon destroyed!\n";
228 - gtk_widget_destroy (GTK_WIDGET (object));
230 - _tray_icon = 0;
231 - _tray_icon_factory_button = 0;
233 - g_idle_add (ui_create_tray_icon_when_idle, NULL);
235 +// static void
236 +// ui_tray_icon_destroy_cb (GtkObject *object,
237 +// gpointer user_data)
238 +// {
239 +// SCIM_DEBUG_MAIN (1) << "Tray Icon destroyed!\n";
240 +//
241 +// gtk_widget_destroy (GTK_WIDGET (object));
242 +//
243 +// _tray_icon = 0;
244 +// _tray_icon_factory_button = 0;
245 +//
246 +// g_idle_add (ui_create_tray_icon_when_idle, NULL);
247 +// }
248 #endif
250 static void
251 @@ -2685,18 +2715,21 @@
254 #if ENABLE_TRAY_ICON
255 - if (_tray_icon_factory_button) {
256 - GtkWidget *icon = gtk_bin_get_child (GTK_BIN (_tray_icon_factory_button));
257 + // if (_tray_icon_factory_button) {
258 + // GtkWidget *icon = gtk_bin_get_child (GTK_BIN (_tray_icon_factory_button));
260 - if (icon)
261 - gtk_container_remove (GTK_CONTAINER (_tray_icon_factory_button), icon);
262 + // if (icon)
263 + // gtk_container_remove (GTK_CONTAINER (_tray_icon_factory_button), icon);
265 - icon = ui_create_icon (info.icon, NULL, TRAY_ICON_SIZE, TRAY_ICON_SIZE, true);
266 + // icon = ui_create_icon (info.icon, NULL, TRAY_ICON_SIZE, TRAY_ICON_SIZE, true);
268 - gtk_container_add (GTK_CONTAINER (_tray_icon_factory_button), icon);
269 + // gtk_container_add (GTK_CONTAINER (_tray_icon_factory_button), icon);
271 - if (_tooltips)
272 - gtk_tooltips_set_tip (_tooltips, _tray_icon_factory_button, info.name.c_str (), NULL);
273 + // if (_tooltips)
274 + // gtk_tooltips_set_tip (_tooltips, _tray_icon_factory_button, info.name.c_str (), NULL);
275 + // }
276 + if (_tray_icon) {
277 + gtk_status_icon_set_from_file (_tray_icon, info.icon.c_str());
279 #endif