~ubuntu-branches/ubuntu/wily/scim/wily-proposed

« back to all changes in this revision

Viewing changes to debian/patches/53_scim-1.4.7-trayicon.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Rolf Leggewie
  • Date: 2010-08-11 18:28:44 UTC
  • mfrom: (3.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20100811182844-rnn95k63cwehtm75
Tags: 1.4.9-5
* debian/copyright: add my copyright
* debian/control: update to standard 3.9.1, no further changes necessary

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
7
 
 
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"
14
 
 
15
 
 #if ENABLE_TRAY_ICON
16
 
-  #include "scimtrayicon.h"
17
 
+//  #include "scimtrayicon.h"
18
 
 #endif
19
 
 
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);
29
 
+
30
 
+static void       ui_tray_icon_activate_cb             (GtkStatusIcon  *status_icon,
31
 
+                                                        gpointer        user_data);
32
 
 #endif
33
 
 
34
 
 // Client Property Callback
35
 
@@ -399,9 +406,9 @@
36
 
 static PangoFontDescription *_default_font_desc        = 0;
37
 
 
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
46
 
 
47
 
 static gboolean           _input_window_draging        = FALSE;
48
 
@@ -647,9 +654,9 @@
49
 
 
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);
58
 
     }
59
 
     _tray_icon = 0;
60
 
 #endif
61
 
@@ -1312,9 +1319,9 @@
62
 
         }
63
 
 
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
72
 
 
73
 
         if (_help_dialog) {
74
 
@@ -1337,65 +1344,75 @@
75
 
 #endif
76
 
 
77
 
 #if ENABLE_TRAY_ICON
78
 
-static gboolean
79
 
-ui_tray_icon_expose_event_cb (GtkWidget *widget, GdkEventExpose *event)
80
 
-{
81
 
-    gdk_window_clear_area (widget->window, event->area.x, event->area.y,
82
 
-                           event->area.width, event->area.height);
83
 
-    return FALSE;
84
 
-}
85
 
-
86
 
-static void
87
 
-ui_tray_icon_style_set_cb (GtkWidget *widget, GtkStyle *previous_style)
88
 
-{
89
 
-    gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
90
 
-}
91
 
-
92
 
-static void
93
 
-ui_tray_icon_realize_cb (GtkWidget *widget)
94
 
-{
95
 
-    if (GTK_WIDGET_NO_WINDOW (widget) || GTK_WIDGET_APP_PAINTABLE (widget))
96
 
-        return;
97
 
-
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);
105
 
-}
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
 
+// }
134
 
 
135
 
 static gboolean
136
 
 ui_create_tray_icon_when_idle (gpointer data)
137
 
 {
138
 
     GtkWidget *image;
139
 
 
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);
146
 
 
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);
155
 
 
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);
166
 
 
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);
179
 
+
180
 
+    
181
 
+    // g_signal_connect (G_OBJECT (_tray_icon_factory_button), "button-release-event",
182
 
+    //                   G_CALLBACK (ui_factory_button_click_cb),
183
 
+    //                   0);
184
 
+    
185
 
+    g_signal_connect (G_OBJECT (_tray_icon), "popup-menu",
186
 
+                      G_CALLBACK (ui_tray_icon_popup_menu_cb),
187
 
+                      0);
188
 
+    
189
 
+    g_signal_connect (G_OBJECT (_tray_icon), "activate",
190
 
+                      G_CALLBACK (ui_tray_icon_activate_cb),
191
 
                       0);
192
 
 
193
 
-    gtk_widget_show_all (GTK_WIDGET (_tray_icon));
194
 
+    gtk_status_icon_set_visible (_tray_icon, TRUE);
195
 
 
196
 
     return FALSE;
197
 
 }
198
 
@@ -1686,6 +1703,19 @@
199
 
 }
200
 
 
201
 
 static void
202
 
+ui_tray_icon_popup_menu_cb (GtkStatusIcon *status_icon, guint button, 
203
 
+    guint activate_time, gpointer user_data)
204
 
+{
205
 
+    action_show_command_menu ();
206
 
+}
207
 
+
208
 
+static void
209
 
+ui_tray_icon_activate_cb (GtkStatusIcon *status_icon, gpointer user_data)
210
 
+{
211
 
+    _panel_agent->request_factory_menu ();
212
 
+}
213
 
+
214
 
+static void
215
 
 ui_factory_menu_activate_cb (GtkMenuItem *item,
216
 
                              gpointer     user_data)
217
 
 {
218
 
@@ -2243,19 +2273,19 @@
219
 
 }
220
 
 
221
 
 #if ENABLE_TRAY_ICON
222
 
-static void
223
 
-ui_tray_icon_destroy_cb (GtkObject      *object,
224
 
-                         gpointer        user_data)
225
 
-{
226
 
-    SCIM_DEBUG_MAIN (1) << "Tray Icon destroyed!\n";
227
 
-
228
 
-    gtk_widget_destroy (GTK_WIDGET (object));
229
 
-
230
 
-    _tray_icon = 0;
231
 
-    _tray_icon_factory_button = 0;
232
 
-
233
 
-    g_idle_add (ui_create_tray_icon_when_idle, NULL);
234
 
-}
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
249
 
 
250
 
 static void
251
 
@@ -2685,18 +2715,21 @@
252
 
     }
253
 
 
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));
259
 
 
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);
264
 
 
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);
267
 
 
268
 
-        gtk_container_add (GTK_CONTAINER (_tray_icon_factory_button), icon);
269
 
+    //     gtk_container_add (GTK_CONTAINER (_tray_icon_factory_button), icon);
270
 
 
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());
278
 
     }
279
 
 #endif