~ubuntu-branches/ubuntu/natty/gtk+2.0/natty

174 by Ken VanDine
* debian/patches/043_ubuntu_menu_proxy.patch
1
## Description: add some description
2
## Origin/Author: add some origin or author
3
## Bug: bug URL
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
4
Index: gtk+2.0-2.23.90/gtk/Makefile.am
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
5
===================================================================
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
6
--- gtk+2.0-2.23.90.orig/gtk/Makefile.am	2011-01-21 09:23:55.728241188 -0500
7
+++ gtk+2.0-2.23.90/gtk/Makefile.am	2011-01-21 09:23:58.638179868 -0500
199 by Robert Ancell
New upstream release
8
@@ -249,6 +249,8 @@
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
9
 	gtkmenu.h		\
10
 	gtkmenubar.h		\
11
 	gtkmenuitem.h		\
12
+	ubuntumenuproxy.h	\
13
+	ubuntumenuproxymodule.h	\
14
 	gtkmenushell.h		\
15
 	gtkmenutoolbutton.h	\
16
 	gtkmessagedialog.h	\
199 by Robert Ancell
New upstream release
17
@@ -519,6 +521,8 @@
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
18
 	gtkmenu.c		\
19
 	gtkmenubar.c		\
20
 	gtkmenuitem.c		\
21
+	ubuntumenuproxy.c	\
22
+	ubuntumenuproxymodule.c	\
23
 	gtkmenushell.c		\
24
 	gtkmenutoolbutton.c	\
25
 	gtkmessagedialog.c	\
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
26
Index: gtk+2.0-2.23.90/gtk/gtk.h
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
27
===================================================================
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
28
--- gtk+2.0-2.23.90.orig/gtk/gtk.h	2011-01-06 12:15:12.000000000 -0500
29
+++ gtk+2.0-2.23.90/gtk/gtk.h	2011-01-21 09:23:58.638179868 -0500
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
30
@@ -65,6 +65,8 @@
31
 #include <gtk/gtkcellview.h>
32
 #include <gtk/gtkcheckbutton.h>
33
 #include <gtk/gtkcheckmenuitem.h>
34
+#include <gtk/ubuntumenuproxy.h>
35
+#include <gtk/ubuntumenuproxymodule.h>
36
 #include <gtk/gtkclipboard.h>
37
 #include <gtk/gtkcolorbutton.h>
38
 #include <gtk/gtkcolorsel.h>
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
39
Index: gtk+2.0-2.23.90/gtk/gtk.symbols
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
40
===================================================================
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
41
--- gtk+2.0-2.23.90.orig/gtk/gtk.symbols	2011-01-21 09:23:56.498221932 -0500
42
+++ gtk+2.0-2.23.90/gtk/gtk.symbols	2011-01-21 09:23:58.638179868 -0500
199 by Robert Ancell
New upstream release
43
@@ -2606,6 +2606,21 @@
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
44
 #endif
45
 #endif
46
 
47
+#if IN_HEADER(__UBUNTU_MENU_PROXY_H__)
48
+#if IN_FILE(__UBUNTU_MENU_PROXY_C__)
49
+ubuntu_menu_proxy_get_type G_GNUC_CONST
50
+ubuntu_menu_proxy_get
51
+ubuntu_menu_proxy_insert
52
+#endif
53
+#endif
54
+
55
+#if IN_HEADER(__UBUNTU_MENU_PROXY_MODULE_H__)
56
+#if IN_FILE(__UBUNTU_MENU_PROXY_MODULE_C__)
57
+ubuntu_menu_proxy_module_get_type
58
+ubuntu_menu_proxy_module_get
59
+#endif
60
+#endif
61
+
62
 #if IN_HEADER(__GTK_MENU_SHELL_H__)
63
 #if IN_FILE(__GTK_MENU_SHELL_C__)
64
 gtk_menu_shell_activate_item
199 by Robert Ancell
New upstream release
65
@@ -2620,6 +2635,7 @@
180 by Sebastien Bacher, Sense Egbert Hofstede
* debian/patches/043_ubuntu_menu_proxy.patch:
66
 gtk_menu_shell_select_item
67
 gtk_menu_shell_set_take_focus
68
 gtk_menu_shell_get_take_focus
69
+ubuntu_gtk_menu_shell_activate_mnemonic
70
 #endif
71
 #endif
72
 
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
73
Index: gtk+2.0-2.23.90/gtk/gtkmenubar.c
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
74
===================================================================
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
75
--- gtk+2.0-2.23.90.orig/gtk/gtkmenubar.c	2011-01-06 12:15:13.000000000 -0500
76
+++ gtk+2.0-2.23.90/gtk/gtkmenubar.c	2011-01-21 09:23:58.638179868 -0500
77
@@ -107,7 +107,7 @@
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
78
   widget_class->size_allocate = gtk_menu_bar_size_allocate;
79
   widget_class->expose_event = gtk_menu_bar_expose;
80
   widget_class->hierarchy_changed = gtk_menu_bar_hierarchy_changed;
81
-  
82
+
83
   menu_shell_class->submenu_placement = GTK_TOP_BOTTOM;
84
   menu_shell_class->get_popup_delay = gtk_menu_bar_get_popup_delay;
85
   menu_shell_class->move_current = gtk_menu_bar_move_current;
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
86
@@ -218,8 +218,37 @@
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
87
 }
88
 
89
 static void
174 by Ken VanDine
* debian/patches/043_ubuntu_menu_proxy.patch
90
+local_notify (GtkWidget  *widget,
91
+              GParamSpec *pspec,
92
+              gpointer    user_data)
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
93
+{
174 by Ken VanDine
* debian/patches/043_ubuntu_menu_proxy.patch
94
+  gboolean local;
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
95
+
96
+  g_object_get (widget,
174 by Ken VanDine
* debian/patches/043_ubuntu_menu_proxy.patch
97
+                "ubuntu-local", &local,
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
98
+                NULL);
99
+
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
100
+  gtk_widget_queue_resize (widget);
101
+
102
+  /*
174 by Ken VanDine
* debian/patches/043_ubuntu_menu_proxy.patch
103
+  if (local)
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
104
+    {
174 by Ken VanDine
* debian/patches/043_ubuntu_menu_proxy.patch
105
+      gtk_widget_show (widget);
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
106
+    }
107
+  else
108
+    {
174 by Ken VanDine
* debian/patches/043_ubuntu_menu_proxy.patch
109
+      gtk_widget_hide (widget);
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
110
+    }
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
111
+  */
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
112
+}
113
+
114
+static void
174 by Ken VanDine
* debian/patches/043_ubuntu_menu_proxy.patch
115
 gtk_menu_bar_init (GtkMenuBar *object)
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
116
 {
174 by Ken VanDine
* debian/patches/043_ubuntu_menu_proxy.patch
117
+  g_signal_connect (object,
118
+                    "notify::ubuntu-local",
119
+                    G_CALLBACK (local_notify),
120
+                    NULL);
121
 }
122
 
123
 GtkWidget*
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
124
@@ -284,13 +313,27 @@
125
   gint nchildren;
126
   GtkRequisition child_requisition;
127
   gint ipadding;
128
+  gboolean local = FALSE;
129
 
130
   g_return_if_fail (GTK_IS_MENU_BAR (widget));
131
   g_return_if_fail (requisition != NULL);
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
132
 
133
   requisition->width = 0;
134
   requisition->height = 0;
135
-  
136
+
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
137
+  g_object_get (widget,
138
+                "ubuntu-local",
139
+                &local,
140
+                NULL);
141
+
142
+  if (!local)
143
+    {
144
+      requisition->width = 0;
145
+      requisition->height = 0;
146
+
147
+      return;
148
+    }
149
+
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
150
   if (gtk_widget_get_visible (widget))
151
     {
152
       menu_bar = GTK_MENU_BAR (widget);
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
153
@@ -626,8 +669,15 @@
205 by Michael Terry
* debian/patches/043_ubuntu_menu_proxy.patch:
154
 	      GtkMenuShell *menu_shell = GTK_MENU_SHELL (menubars->data);
155
 
156
               _gtk_menu_shell_set_keyboard_mode (menu_shell, TRUE);
157
-	      _gtk_menu_shell_activate (menu_shell);
158
-	      gtk_menu_shell_select_first (menu_shell, FALSE);
159
+              if (ubuntu_gtk_menu_shell_activate_first (GTK_MENU_SHELL (menu_shell), FALSE))
160
+		{
161
+		  //g_print ("send activate to remote!\n");
162
+		}
163
+	      else
164
+		{
165
+		  _gtk_menu_shell_activate (menu_shell);
166
+		  gtk_menu_shell_select_first (menu_shell, FALSE);
167
+		}
168
 	      
169
 	      g_list_free (menubars);
170
 	      
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
171
Index: gtk+2.0-2.23.90/gtk/gtkmenushell.c
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
172
===================================================================
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
173
--- gtk+2.0-2.23.90.orig/gtk/gtkmenushell.c	2011-01-06 12:15:13.000000000 -0500
174
+++ gtk+2.0-2.23.90/gtk/gtkmenushell.c	2011-01-21 09:23:58.638179868 -0500
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
175
@@ -37,6 +37,7 @@
176
 #include "gtkmenubar.h"
177
 #include "gtkmenuitem.h"
178
 #include "gtkmenushell.h"
179
+#include "ubuntumenuproxy.h"
180
 #include "gtkmnemonichash.h"
181
 #include "gtktearoffmenuitem.h"
182
 #include "gtkwindow.h"
183
@@ -64,7 +65,8 @@
184
 
185
 enum {
186
   PROP_0,
187
-  PROP_TAKE_FOCUS
188
+  PROP_TAKE_FOCUS,
189
+  PROP_LOCAL
190
 };
191
 
192
 /* Terminology:
174 by Ken VanDine
* debian/patches/043_ubuntu_menu_proxy.patch
193
@@ -135,6 +137,9 @@
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
194
   GtkMnemonicHash *mnemonic_hash;
195
   GtkKeyHash *key_hash;
196
 
197
+  UbuntuMenuProxy *proxy;
174 by Ken VanDine
* debian/patches/043_ubuntu_menu_proxy.patch
198
+  gboolean         local;
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
199
+
200
   guint take_focus : 1;
201
   guint activated_submenu : 1;
202
   /* This flag is a crutch to keep mnemonics in the same menu
174 by Ken VanDine
* debian/patches/043_ubuntu_menu_proxy.patch
203
@@ -381,6 +386,14 @@
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
204
 							 TRUE,
205
 							 GTK_PARAM_READWRITE));
206
 
207
+  g_object_class_install_property (object_class,
208
+                                   PROP_LOCAL,
209
+                                   g_param_spec_boolean ("ubuntu-local",
210
+                                                         P_("Local menu"),
211
+                                                         P_("Determines whether the menu is local"),
180 by Sebastien Bacher, Sense Egbert Hofstede
* debian/patches/043_ubuntu_menu_proxy.patch:
212
+                                                         FALSE,
174 by Ken VanDine
* debian/patches/043_ubuntu_menu_proxy.patch
213
+                                                         GTK_PARAM_READWRITE));
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
214
+
215
   g_type_class_add_private (object_class, sizeof (GtkMenuShellPrivate));
216
 }
217
 
174 by Ken VanDine
* debian/patches/043_ubuntu_menu_proxy.patch
218
@@ -391,6 +404,22 @@
219
 }
220
 
221
 static void
222
+show_local_notify (UbuntuMenuProxy *proxy,
223
+                   GParamSpec      *pspec,
224
+                   GtkMenuShell    *shell)
225
+{
226
+  gboolean local;
227
+
228
+  g_object_get (proxy,
229
+                "show-local", &local,
230
+                NULL);
231
+
232
+  g_object_set (shell,
233
+                "ubuntu-local", local,
234
+                NULL);
235
+}
236
+
237
+static void
238
 gtk_menu_shell_init (GtkMenuShell *menu_shell)
239
 {
240
   GtkMenuShellPrivate *priv = GTK_MENU_SHELL_GET_PRIVATE (menu_shell);
179 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
241
@@ -408,6 +437,13 @@
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
242
   priv->key_hash = NULL;
243
   priv->take_focus = TRUE;
244
   priv->activated_submenu = FALSE;
245
+  priv->proxy = ubuntu_menu_proxy_get ();
180 by Sebastien Bacher, Sense Egbert Hofstede
* debian/patches/043_ubuntu_menu_proxy.patch:
246
+  priv->local = FALSE;
174 by Ken VanDine
* debian/patches/043_ubuntu_menu_proxy.patch
247
+
179 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
248
+  if (priv->proxy != NULL)
249
+    g_signal_connect (priv->proxy, "notify::show-local",
250
+                      G_CALLBACK (show_local_notify),
251
+                      menu_shell);
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
252
 }
253
 
254
 static void
180 by Sebastien Bacher, Sense Egbert Hofstede
* debian/patches/043_ubuntu_menu_proxy.patch:
255
@@ -417,12 +453,16 @@
174 by Ken VanDine
* debian/patches/043_ubuntu_menu_proxy.patch
256
                              GParamSpec   *pspec)
257
 {
258
   GtkMenuShell *menu_shell = GTK_MENU_SHELL (object);
259
+  GtkMenuShellPrivate *priv = GTK_MENU_SHELL_GET_PRIVATE (object);
260
 
261
   switch (prop_id)
262
     {
263
     case PROP_TAKE_FOCUS:
264
       gtk_menu_shell_set_take_focus (menu_shell, g_value_get_boolean (value));
265
       break;
266
+    case PROP_LOCAL:
267
+      priv->local = g_value_get_boolean (value);
268
+      break;
269
     default:
270
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
271
       break;
180 by Sebastien Bacher, Sense Egbert Hofstede
* debian/patches/043_ubuntu_menu_proxy.patch:
272
@@ -436,12 +476,23 @@
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
273
                              GParamSpec  *pspec)
274
 {
275
   GtkMenuShell *menu_shell = GTK_MENU_SHELL (object);
276
+  GtkMenuShellPrivate *priv = GTK_MENU_SHELL_GET_PRIVATE (menu_shell);
277
+  gboolean local;
278
 
279
   switch (prop_id)
280
     {
281
     case PROP_TAKE_FOCUS:
282
       g_value_set_boolean (value, gtk_menu_shell_get_take_focus (menu_shell));
283
       break;
284
+    case PROP_LOCAL:
285
+      if (priv->proxy == NULL) {
286
+        local = TRUE;
287
+      } else {
174 by Ken VanDine
* debian/patches/043_ubuntu_menu_proxy.patch
288
+        local = priv->local;
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
289
+      }
290
+
291
+      g_value_set_boolean (value, local);
292
+      break;
293
     default:
294
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
295
       break;
182 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
296
@@ -454,6 +505,13 @@
297
   GtkMenuShell *menu_shell = GTK_MENU_SHELL (object);
298
   GtkMenuShellPrivate *priv = GTK_MENU_SHELL_GET_PRIVATE (menu_shell);
299
 
300
+  if (priv->proxy != NULL)
301
+    {
302
+      g_signal_handlers_disconnect_by_func (priv->proxy,
303
+                                            show_local_notify,
304
+                                            menu_shell);
305
+    }
306
+
307
   if (priv->mnemonic_hash)
308
     _gtk_mnemonic_hash_free (priv->mnemonic_hash);
309
   if (priv->key_hash)
310
@@ -483,14 +541,24 @@
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
311
 		       gint          position)
312
 {
313
   GtkMenuShellClass *class;
314
+  GtkMenuShellPrivate *priv;
315
 
316
   g_return_if_fail (GTK_IS_MENU_SHELL (menu_shell));
317
   g_return_if_fail (GTK_IS_MENU_ITEM (child));
318
 
319
   class = GTK_MENU_SHELL_GET_CLASS (menu_shell);
320
 
321
+  priv = GTK_MENU_SHELL_GET_PRIVATE (menu_shell);
322
+
172 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
323
   if (class->insert)
324
     class->insert (menu_shell, child, position);
325
+
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
326
+  /* insert to proxy */
327
+  if (priv->proxy != NULL)
328
+    ubuntu_menu_proxy_insert (priv->proxy,
182 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
329
+                              GTK_WIDGET (menu_shell),
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
330
+                              child,
331
+                              position);
332
 }
172 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
333
 
334
 static void
205 by Michael Terry
* debian/patches/043_ubuntu_menu_proxy.patch:
335
@@ -1815,5 +1883,52 @@
180 by Sebastien Bacher, Sense Egbert Hofstede
* debian/patches/043_ubuntu_menu_proxy.patch:
336
     }
337
 }
338
 
339
+gboolean
340
+ubuntu_gtk_menu_shell_activate_mnemonic (GtkMenuShell *shell, GtkWidget *item)
341
+{
342
+  GtkMenuShellPrivate *priv;
343
+
344
+  g_return_val_if_fail (GTK_IS_MENU_SHELL (shell), FALSE);
345
+
346
+  priv = GTK_MENU_SHELL_GET_PRIVATE (shell);
347
+
183 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
348
+  if (priv->proxy && !ubuntu_menu_proxy_show_local (priv->proxy))
180 by Sebastien Bacher, Sense Egbert Hofstede
* debian/patches/043_ubuntu_menu_proxy.patch:
349
+    {
350
+      ubuntu_menu_proxy_activate_menu (priv->proxy,
351
+                                       item);
352
+
353
+      return TRUE;
354
+    }
355
+
356
+  return FALSE;
357
+}
358
+
205 by Michael Terry
* debian/patches/043_ubuntu_menu_proxy.patch:
359
+gboolean
360
+ubuntu_gtk_menu_shell_activate_first (GtkMenuShell *menu_shell,
361
+			              gboolean      search_sensitive)
362
+{
363
+  GtkWidget *to_select = NULL;
364
+  GList *tmp_list;
365
+
366
+  tmp_list = menu_shell->children;
367
+  while (tmp_list)
368
+    {
369
+      GtkWidget *child = tmp_list->data;
370
+      
371
+      if ((!search_sensitive && gtk_widget_get_visible (child)) ||
372
+	  _gtk_menu_item_is_selectable (child))
373
+	{
374
+	  to_select = child;
375
+	  if (!GTK_IS_TEAROFF_MENU_ITEM (child))
376
+	    break;
377
+	}
378
+      
379
+      tmp_list = tmp_list->next;
380
+    }
381
+
382
+  return to_select &&
383
+         ubuntu_gtk_menu_shell_activate_mnemonic(menu_shell, to_select);
384
+}
385
+
180 by Sebastien Bacher, Sense Egbert Hofstede
* debian/patches/043_ubuntu_menu_proxy.patch:
386
 #define __GTK_MENU_SHELL_C__
387
 #include "gtkaliasdef.c"
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
388
Index: gtk+2.0-2.23.90/gtk/tests/Makefile.am
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
389
===================================================================
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
390
--- gtk+2.0-2.23.90.orig/gtk/tests/Makefile.am	2011-01-06 12:15:15.000000000 -0500
391
+++ gtk+2.0-2.23.90/gtk/tests/Makefile.am	2011-01-21 09:23:58.638179868 -0500
182 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
392
@@ -45,6 +45,10 @@
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
393
 recentmanager_SOURCES 		 = recentmanager.c
394
 recentmanager_LDADD   		 = $(progs_ldadd)
395
 
396
+TEST_PROGS                      += menuproxy
397
+menuproxy_SOURCES                = menuproxy.c
398
+menuproxy_LDADD                  = $(progs_ldadd)
399
+
400
 TEST_PROGS			+= floating
401
 floating_SOURCES		 = floating.c
402
 floating_LDADD			 = $(progs_ldadd)
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
403
Index: gtk+2.0-2.23.90/gtk/tests/menuproxy.c
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
404
===================================================================
405
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
406
+++ gtk+2.0-2.23.90/gtk/tests/menuproxy.c	2011-01-21 09:23:58.648179671 -0500
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
407
@@ -0,0 +1,278 @@
408
+/*
409
+ * Copyright (C) 2009 Canonical, Ltd.
410
+ *
411
+ * This library is free software; you can redistribute it and/or
412
+ * modify it under the terms of the GNU Lesser General Public
413
+ * License as published by the Free Software Foundation; either
414
+ * version 2 of the License, or (at your option) any later version.
415
+ *
416
+ * This library is distributed in the hope that it will be useful,
417
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
418
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
419
+ * Lesser General Public License for more details.
420
+ *
421
+ * You should have received a copy of the GNU Lesser General Public
422
+ * License along with this library; if not, write to the
423
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
424
+ * Boston, MA 02111-1307, USA.
425
+ *
426
+ * Authors: Cody Russell <bratsche@gnome.org>
427
+ */
428
+
429
+#undef GTK_DISABLE_DEPRECATED
430
+#include "../gtk/gtk.h"
431
+
432
+typedef struct _TestProxy      TestProxy;
433
+typedef struct _TestProxyClass TestProxyClass;
434
+
435
+//static GType           test_proxy_type_id      = 0;
436
+//static TestProxyClass *test_proxy_parent_class = NULL;
437
+
438
+#define TEST_TYPE_PROXY     (test_proxy_type_id)
439
+#define TEST_PROXY(o)       (G_TYPE_CHECK_INSTANCE_CAST ((o), TEST_TYPE_PROXY, TestProxy))
440
+#define TEST_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), TEST_TYPE_PROXY, TestProxyClass))
441
+#define TEST_IS_PROXY(o)    (G_TYPE_CHECK_INSTANCE_TYPE ((o), TEST_TYPE_PROXY))
442
+
443
+struct _TestProxy
444
+{
445
+  UbuntuMenuProxy parent_object;
446
+};
447
+
448
+struct _TestProxyClass
449
+{
450
+  UbuntuMenuProxyClass parent_class;
451
+};
452
+
453
+static void test_proxy_insert         (UbuntuMenuProxy *proxy,
454
+                                       GtkWidget    *child,
455
+                                       guint         position);
456
+
457
+G_DEFINE_DYNAMIC_TYPE(TestProxy, test_proxy, UBUNTU_TYPE_MENU_PROXY)
458
+
459
+static void
460
+test_proxy_init (TestProxy *proxy)
461
+{
462
+}
463
+
464
+static void
465
+test_proxy_class_init (TestProxyClass *class)
466
+{
467
+  UbuntuMenuProxyClass *proxy_class = UBUNTU_MENU_PROXY_CLASS (class);
468
+
469
+  test_proxy_parent_class = g_type_class_peek_parent (class);
470
+
471
+  proxy_class->insert = test_proxy_insert;
472
+}
473
+
474
+static void
475
+test_proxy_class_finalize (TestProxyClass *class)
476
+{
477
+}
478
+
479
+static void
480
+test_proxy_insert (UbuntuMenuProxy *proxy,
481
+                   GtkWidget    *child,
482
+                   guint         position)
483
+{
484
+}
485
+
486
+/* ---------------------------------------------------- */
487
+
488
+#define TEST_TYPE_MODULE         (test_module_get_type ())
489
+#define TEST_MODULE(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), TEST_TYPE_MODULE, TestModule))
490
+#define TEST_MODULE_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), TEST_TYPE_MODULE, TestModuleClass))
491
+#define TEST_IS_MODULE(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), TEST_TYPE_MODULE))
492
+#define TEST_IS_MODULE_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), TEST_TYPE_MODULE))
493
+#define TEST_MODULE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TEST_TYPE_MODULE, TestModuleClass))
494
+
495
+
496
+typedef struct _TestModule      TestModule;
497
+typedef struct _TestModuleClass TestModuleClass;
498
+
499
+struct _TestModule
500
+{
501
+  GTypeModule  parent_instance;
502
+};
503
+
504
+struct _TestModuleClass
505
+{
506
+  GTypeModuleClass  parent_class;
507
+};
508
+
509
+static gboolean
510
+test_module_load (GTypeModule *module)
511
+{
512
+  g_print ("registering type...\n");
513
+  g_print ("     type_id = %d\n", test_proxy_type_id);
514
+
515
+  test_proxy_register_type (G_TYPE_MODULE (module));
516
+
517
+  //test_proxy_get_type (G_TYPE_MODULE (module));
518
+
519
+  g_print ("     type_id = %d\n", test_proxy_type_id);
520
+
521
+  return TRUE;
522
+}
523
+
524
+static void
525
+test_module_unload (GTypeModule *module)
526
+{
527
+}
528
+
529
+static void
530
+test_module_class_init (TestModuleClass *class)
531
+{
532
+  GTypeModuleClass *type_module_class = G_TYPE_MODULE_CLASS (class);
533
+
534
+  type_module_class->load = test_module_load;
535
+  type_module_class->unload = test_module_unload;
536
+}
537
+
538
+static void
539
+test_module_init (TestModule *module)
540
+{
541
+}
542
+
543
+G_DEFINE_TYPE (TestModule, test_module, G_TYPE_TYPE_MODULE);
544
+
545
+TestModule *
546
+test_module_new (void)
547
+{
548
+  TestModule *module = g_object_new (TEST_TYPE_MODULE,
549
+                                     NULL);
550
+
551
+  g_print ("test_module_new(): %p\n", module);
552
+
553
+  return module;
554
+}
555
+
556
+
557
+/* ---------------------------------------------------- */
558
+
559
+static void
560
+non_null_proxy_test (void)
561
+{
562
+  UbuntuMenuProxyModule *module;
563
+
564
+  /* prevent the module loader from finding a proxy module */
565
+  g_unsetenv ("UBUNTU_MENUPROXY");
566
+
567
+  module = ubuntu_menu_proxy_module_get ();
568
+  test_proxy_register_type (G_TYPE_MODULE (module));
569
+  //test_proxy_get_type (G_TYPE_MODULE (module));
570
+
571
+  GtkWidget *widget = g_object_new (GTK_TYPE_MENU_BAR, NULL);
572
+  g_object_ref_sink (widget);
573
+
574
+  g_assert (GTK_IS_MENU_BAR (widget));
575
+  //g_assert (GTK_MENU_SHELL (widget)->proxy != NULL);
576
+
577
+  g_object_unref (widget);
578
+}
579
+
580
+static void
581
+null_proxy_test (void)
582
+{
583
+  GtkWidget *widget = g_object_new (GTK_TYPE_MENU_BAR, NULL);
584
+  g_object_ref_sink (widget);
585
+
586
+  g_assert (GTK_IS_MENU_BAR (widget));
587
+
588
+  //g_assert (GTK_MENU_SHELL (widget)->proxy == NULL);
589
+
590
+  g_object_unref (widget);
591
+}
592
+
593
+static gboolean inserted_called = FALSE;
594
+
595
+static void
596
+inserted_cb (UbuntuMenuProxy *proxy,
597
+             GtkWidget    *child,
598
+             guint         position,
599
+             gpointer      data)
600
+{
601
+  g_return_if_fail (UBUNTU_IS_MENU_PROXY (proxy));
602
+  g_return_if_fail (GTK_IS_WIDGET (child));
603
+  inserted_called = TRUE;
604
+}
605
+
606
+static void
607
+menubar_signals_proxy_test (void)
608
+{
609
+  GtkWidget *widget   = NULL;
610
+  GtkWidget *menuitem = NULL;
611
+  UbuntuMenuProxy *proxy;
612
+
613
+  //ubuntu_menu_proxy_register_type (test_proxy_get_type ());
614
+
615
+  widget = g_object_new (GTK_TYPE_MENU_BAR, NULL);
616
+  g_object_ref_sink (widget);
617
+
618
+  g_assert (GTK_IS_MENU_BAR (widget));
619
+  //g_assert (GTK_MENU_SHELL (widget)->proxy != NULL);
620
+
621
+  /*
622
+  proxy = GTK_MENU_SHELL (widget)->proxy;
623
+
624
+  g_signal_connect (proxy,
625
+                    "inserted", G_CALLBACK (inserted_cb),
626
+                    NULL);
627
+  */
628
+
629
+  // insert menuitem
630
+  menuitem = gtk_menu_item_new_with_label ("Test Item");
631
+  gtk_menu_shell_append (GTK_MENU_SHELL (widget),
632
+                         menuitem);
633
+
634
+  g_assert (inserted_called == TRUE);
635
+
636
+  g_object_unref (widget);
637
+}
638
+
639
+static void
640
+proxy_type_exists_test (void)
641
+{
642
+#if 0
643
+  UbuntuMenuProxyModule *module;
644
+
645
+  g_unsetenv ("GTK_MENUPROXY");
646
+
647
+  module = ubuntu_menu_proxy_module_get ();
648
+  test_proxy_get_type (G_TYPE_MODULE (module));
649
+#endif
650
+
651
+  g_assert (ubuntu_menu_proxy_get_type () != 0);
652
+}
653
+
654
+static void
655
+can_instantiate_test (void)
656
+{
657
+  TestModule *module = test_module_new ();
658
+
659
+  g_type_module_use (G_TYPE_MODULE (module));
660
+
661
+  UbuntuMenuProxy *proxy = ubuntu_menu_proxy_get ();
662
+
663
+  g_assert (proxy != NULL);
664
+
665
+  g_object_ref_sink (proxy);
666
+
667
+  g_assert (TEST_IS_PROXY (proxy));
668
+  g_assert (UBUNTU_IS_MENU_PROXY (proxy));
669
+
670
+  g_object_unref (proxy);
671
+}
672
+
673
+int
674
+main (int argc, char *argv[])
675
+{
676
+  gtk_test_init (&argc, &argv);
677
+
678
+  g_test_add_func ("/proxy/null-proxy", null_proxy_test);
679
+  g_test_add_func ("/proxy/type-exists", proxy_type_exists_test);
680
+  g_test_add_func ("/proxy/can-instantiate", can_instantiate_test);
681
+  g_test_add_func ("/proxy/non-null-proxy", non_null_proxy_test);
682
+  g_test_add_func ("/proxy/menubar-signals-proxy", menubar_signals_proxy_test);
683
+
684
+  return g_test_run();
685
+}
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
686
Index: gtk+2.0-2.23.90/gtk/ubuntumenuproxy.c
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
687
===================================================================
688
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
689
+++ gtk+2.0-2.23.90/gtk/ubuntumenuproxy.c	2011-01-21 09:23:58.648179671 -0500
180 by Sebastien Bacher, Sense Egbert Hofstede
* debian/patches/043_ubuntu_menu_proxy.patch:
690
@@ -0,0 +1,249 @@
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
691
+/*
692
+ * Copyright (C) 2010 Canonical, Ltd.
693
+ *
694
+ * This library is free software; you can redistribute it and/or
695
+ * modify it under the terms of the GNU Lesser General Public
696
+ * License as published by the Free Software Foundation; either
697
+ * version 2 of the License, or (at your option) any later version.
698
+ *
699
+ * This library is distributed in the hope that it will be useful,
700
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
701
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
702
+ * Lesser General Public License for more details.
703
+ *
704
+ * You should have received a copy of the GNU Lesser General Public
705
+ * License along with this library; if not, write to the
706
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
707
+ * Boston, MA 02111-1307, USA.
708
+ *
709
+ * Authors: Cody Russell <bratsche@gnome.org>
710
+ */
711
+
712
+#include "config.h"
713
+#include "gtkintl.h"
714
+#include "gtkmarshalers.h"
715
+#include "ubuntumenuproxy.h"
716
+#include "ubuntumenuproxymodule.h"
717
+#include "gtkmodules.h"
174 by Ken VanDine
* debian/patches/043_ubuntu_menu_proxy.patch
718
+#include "gtkprivate.h"
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
719
+#include "gtkalias.h"
720
+
721
+enum {
174 by Ken VanDine
* debian/patches/043_ubuntu_menu_proxy.patch
722
+  PROP_0,
723
+  PROP_SHOW_LOCAL
724
+};
725
+
726
+enum {
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
727
+  INSERTED,
174 by Ken VanDine
* debian/patches/043_ubuntu_menu_proxy.patch
728
+  LOCAL_NOTIFY,
180 by Sebastien Bacher, Sense Egbert Hofstede
* debian/patches/043_ubuntu_menu_proxy.patch:
729
+  ACTIVATE_MENU,
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
730
+  LAST_SIGNAL
731
+};
732
+
174 by Ken VanDine
* debian/patches/043_ubuntu_menu_proxy.patch
733
+#define UBUNTU_MENU_PROXY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UBUNTU_TYPE_MENU_PROXY, UbuntuMenuProxyPrivate))
734
+
735
+typedef struct _UbuntuMenuProxyPrivate UbuntuMenuProxyPrivate;
736
+
737
+struct _UbuntuMenuProxyPrivate
738
+{
739
+  gboolean show_local;
740
+};
741
+
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
742
+static guint               menu_proxy_signals[LAST_SIGNAL] = { 0 };
743
+static GObjectClass       *parent_class = NULL;
174 by Ken VanDine
* debian/patches/043_ubuntu_menu_proxy.patch
744
+static UbuntuMenuProxy    *proxy_singleton = NULL;
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
745
+
746
+static void     ubuntu_menu_proxy_real_insert     (UbuntuMenuProxy *proxy,
747
+                                                   GtkWidget    *parent,
748
+                                                   GtkWidget    *child,
749
+                                                   guint         position);
750
+static gboolean ubuntu_menu_proxy_real_show_local (UbuntuMenuProxy *proxy);
751
+
752
+
753
+
754
+/* --------------------------------------------------------- */
755
+
756
+G_DEFINE_TYPE (UbuntuMenuProxy, ubuntu_menu_proxy, G_TYPE_OBJECT)
757
+
758
+static GObject *
759
+ubuntu_menu_proxy_constructor (GType                  type,
760
+                               guint                  n_params,
761
+                               GObjectConstructParam *params)
762
+{
763
+  GObject *object;
764
+
765
+  if (proxy_singleton != NULL)
766
+    {
767
+      object = g_object_ref (proxy_singleton);
768
+    }
769
+  else
770
+    {
771
+      object = G_OBJECT_CLASS (ubuntu_menu_proxy_parent_class)->constructor (type,
772
+                                                                             n_params,
773
+                                                                             params);
774
+
775
+      proxy_singleton = UBUNTU_MENU_PROXY (object);
776
+      g_object_add_weak_pointer (object, (gpointer) &proxy_singleton);
777
+    }
778
+
779
+  return object;
780
+}
781
+
782
+static void
783
+ubuntu_menu_proxy_init (UbuntuMenuProxy *proxy)
784
+{
785
+}
786
+
787
+static void
174 by Ken VanDine
* debian/patches/043_ubuntu_menu_proxy.patch
788
+ubuntu_menu_proxy_get_property (GObject    *object,
789
+                                guint       prop_id,
790
+                                GValue     *value,
791
+                                GParamSpec *pspec)
792
+{
793
+  UbuntuMenuProxyPrivate *priv = UBUNTU_MENU_PROXY_GET_PRIVATE (object);
794
+
795
+  switch (prop_id)
796
+    {
797
+    case PROP_SHOW_LOCAL:
798
+      g_value_set_boolean (value, priv->show_local);
799
+      break;
800
+
801
+    default:
802
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
803
+      break;
804
+    }
805
+}
806
+
807
+static void
808
+ubuntu_menu_proxy_set_property (GObject      *object,
809
+                                guint         prop_id,
810
+                                const GValue *value,
811
+                                GParamSpec   *pspec)
812
+{
813
+  UbuntuMenuProxyPrivate *priv = UBUNTU_MENU_PROXY_GET_PRIVATE (object);
814
+
815
+  switch (prop_id)
816
+    {
817
+    case PROP_SHOW_LOCAL:
818
+      priv->show_local = g_value_get_boolean (value);
819
+      g_signal_emit (object, menu_proxy_signals[LOCAL_NOTIFY], 0, priv->show_local);
820
+      break;
821
+
822
+    default:
823
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
824
+      break;
825
+    }
826
+}
827
+
828
+static void
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
829
+ubuntu_menu_proxy_class_init (UbuntuMenuProxyClass *class)
830
+{
831
+  GObjectClass *object_class = G_OBJECT_CLASS (class);
832
+
833
+  parent_class = g_type_class_peek_parent (class);
834
+
174 by Ken VanDine
* debian/patches/043_ubuntu_menu_proxy.patch
835
+  object_class->get_property = ubuntu_menu_proxy_get_property;
836
+  object_class->set_property = ubuntu_menu_proxy_set_property;
837
+
838
+  g_object_class_install_property (object_class,
839
+                                   PROP_SHOW_LOCAL,
840
+                                   g_param_spec_boolean ("show-local",
841
+                                                         P_("Show the local menu"),
842
+                                                         P_("Whether the menu is displayed locally"),
180 by Sebastien Bacher, Sense Egbert Hofstede
* debian/patches/043_ubuntu_menu_proxy.patch:
843
+                                                         FALSE,
174 by Ken VanDine
* debian/patches/043_ubuntu_menu_proxy.patch
844
+                                                         GTK_PARAM_READWRITE));
845
+
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
846
+  menu_proxy_signals[INSERTED] =
847
+    g_signal_new (I_("inserted"),
848
+                  G_TYPE_FROM_CLASS (class),
849
+                  G_SIGNAL_RUN_LAST,
850
+                  G_STRUCT_OFFSET (UbuntuMenuProxyClass, inserted),
851
+                  NULL, NULL,
852
+                  _gtk_marshal_VOID__OBJECT_UINT,
853
+                  G_TYPE_NONE, 2,
854
+                  GTK_TYPE_WIDGET, G_TYPE_UINT);
855
+
174 by Ken VanDine
* debian/patches/043_ubuntu_menu_proxy.patch
856
+  menu_proxy_signals[LOCAL_NOTIFY] =
857
+    g_signal_new (I_("local-notify"),
858
+                  G_TYPE_FROM_CLASS (class),
859
+                  G_SIGNAL_RUN_LAST,
860
+                  NULL,
861
+                  NULL, NULL,
862
+                  _gtk_marshal_VOID__BOOLEAN,
863
+                  G_TYPE_NONE, 1,
864
+                  G_TYPE_BOOLEAN);
865
+
180 by Sebastien Bacher, Sense Egbert Hofstede
* debian/patches/043_ubuntu_menu_proxy.patch:
866
+  menu_proxy_signals[ACTIVATE_MENU] =
867
+    g_signal_new (I_("activate-menu"),
868
+                  G_TYPE_FROM_CLASS (class),
869
+                  G_SIGNAL_RUN_LAST,
870
+                  NULL,
871
+                  NULL, NULL,
872
+                  _gtk_marshal_VOID__OBJECT,
873
+                  G_TYPE_NONE, 1,
874
+                  G_TYPE_OBJECT);
875
+
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
876
+  class->insert = ubuntu_menu_proxy_real_insert;
877
+  class->show_local = ubuntu_menu_proxy_real_show_local;
878
+
879
+  object_class->constructor = ubuntu_menu_proxy_constructor;
174 by Ken VanDine
* debian/patches/043_ubuntu_menu_proxy.patch
880
+
881
+  g_type_class_add_private (object_class, sizeof (UbuntuMenuProxyPrivate));
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
882
+}
883
+
884
+UbuntuMenuProxy *
885
+ubuntu_menu_proxy_get (void)
886
+{
887
+  if (!proxy_singleton)
888
+    {
889
+      ubuntu_menu_proxy_module_get ();
890
+    }
891
+
892
+  return proxy_singleton;
893
+}
894
+
895
+static void
896
+ubuntu_menu_proxy_real_insert (UbuntuMenuProxy *proxy,
897
+                               GtkWidget    *parent,
898
+                               GtkWidget    *child,
899
+                               guint         position)
900
+{
901
+}
902
+
903
+static gboolean
904
+ubuntu_menu_proxy_real_show_local (UbuntuMenuProxy *proxy)
905
+{
906
+  return TRUE;
907
+}
908
+
909
+void
910
+ubuntu_menu_proxy_insert (UbuntuMenuProxy *proxy,
911
+                          GtkWidget    *parent,
912
+                          GtkWidget    *child,
913
+                          guint         position)
914
+{
915
+  g_return_if_fail (UBUNTU_IS_MENU_PROXY (proxy));
916
+
917
+  UBUNTU_MENU_PROXY_GET_CLASS (proxy)->insert (proxy,
918
+                                               parent,
919
+                                               child,
920
+                                               position);
921
+}
922
+
923
+gboolean
924
+ubuntu_menu_proxy_show_local (UbuntuMenuProxy *proxy)
925
+{
926
+  g_return_val_if_fail (UBUNTU_IS_MENU_PROXY (proxy), TRUE);
927
+
928
+  return UBUNTU_MENU_PROXY_GET_CLASS (proxy)->show_local (proxy);
929
+}
930
+
180 by Sebastien Bacher, Sense Egbert Hofstede
* debian/patches/043_ubuntu_menu_proxy.patch:
931
+void
932
+ubuntu_menu_proxy_activate_menu (UbuntuMenuProxy *proxy,
933
+                                 GtkWidget       *widget)
934
+{
935
+  g_signal_emit (proxy, menu_proxy_signals[ACTIVATE_MENU], 0, widget);
936
+}
937
+
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
938
+#define __UBUNTU_MENU_PROXY_C__
939
+#include "gtkaliasdef.c"
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
940
Index: gtk+2.0-2.23.90/gtk/ubuntumenuproxy.h
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
941
===================================================================
942
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
943
+++ gtk+2.0-2.23.90/gtk/ubuntumenuproxy.h	2011-01-21 09:23:58.648179671 -0500
180 by Sebastien Bacher, Sense Egbert Hofstede
* debian/patches/043_ubuntu_menu_proxy.patch:
944
@@ -0,0 +1,74 @@
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
945
+/*
946
+ * Copyright (C) 2010 Canonical, Ltd.
947
+ *
948
+ * This library is free software; you can redistribute it and/or
949
+ * modify it under the terms of the GNU Lesser General Public
950
+ * License as published by the Free Software Foundation; either
951
+ * version 2 of the License, or (at your option) any later version.
952
+ *
953
+ * This library is distributed in the hope that it will be useful,
954
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
955
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
956
+ * Lesser General Public License for more details.
957
+ *
958
+ * You should have received a copy of the GNU Lesser General Public
959
+ * License along with this library; if not, write to the
960
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
961
+ * Boston, MA 02111-1307, USA.
962
+ *
963
+ * Authors: Cody Russell <bratsche@gnome.org>
964
+ */
965
+
966
+#if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
967
+#error "Only <gtk/gtk.h> can be included directly."
968
+#endif
969
+
970
+#ifndef __UBUNTU_MENU_PROXY_H__
971
+#define __UBUNTU_MENU_PROXY_H__
972
+
973
+#include <gtk/gtkwidget.h>
974
+#include <gtk/gtktypeutils.h>
975
+
976
+G_BEGIN_DECLS
977
+
978
+#define UBUNTU_TYPE_MENU_PROXY           (ubuntu_menu_proxy_get_type ())
979
+#define UBUNTU_MENU_PROXY(o)             (G_TYPE_CHECK_INSTANCE_CAST ((o), UBUNTU_TYPE_MENU_PROXY, UbuntuMenuProxy))
980
+#define UBUNTU_MENU_PROXY_CLASS(k)       (G_TYPE_CHECK_CLASS_CAST ((k), UBUNTU_TYPE_MENU_PROXY, UbuntuMenuProxyClass))
981
+#define UBUNTU_IS_MENU_PROXY(o)          (G_TYPE_CHECK_INSTANCE_TYPE ((o), UBUNTU_TYPE_MENU_PROXY))
982
+#define UBUNTU_IS_MENU_PROXY_CLASS(k)    (G_TYPE_CHECK_CLASS_TYPE ((k), UBUNTU_TYPE_MENU_PROXY))
983
+#define UBUNTU_MENU_PROXY_GET_CLASS(o)   (G_TYPE_INSTANCE_GET_CLASS ((o), UBUNTU_TYPE_MENU_PROXY, UbuntuMenuProxyClass))
984
+
985
+
986
+typedef struct _UbuntuMenuProxy      UbuntuMenuProxy;
987
+typedef struct _UbuntuMenuProxyClass UbuntuMenuProxyClass;
988
+
989
+struct _UbuntuMenuProxy
990
+{
991
+  GObject parent_object;
992
+};
993
+
994
+struct _UbuntuMenuProxyClass
995
+{
996
+  GObjectClass parent_class;
997
+
998
+  /* vtable */
999
+  void     (* insert)     (UbuntuMenuProxy *proxy, GtkWidget *parent, GtkWidget *child, guint position);
1000
+  gboolean (* show_local) (UbuntuMenuProxy *proxy);
1001
+
1002
+  /* signals */
1003
+  void (* inserted)  (UbuntuMenuProxy *proxy, GtkWidget *child);
1004
+};
1005
+
1006
+GType              ubuntu_menu_proxy_get_type      (void) G_GNUC_CONST;
1007
+UbuntuMenuProxy*   ubuntu_menu_proxy_get           (void);
1008
+void               ubuntu_menu_proxy_insert        (UbuntuMenuProxy *proxy,
1009
+                                                    GtkWidget       *parent,
1010
+                                                    GtkWidget       *child,
1011
+                                                    guint            position);
1012
+gboolean           ubuntu_menu_proxy_show_local    (UbuntuMenuProxy *proxy);
180 by Sebastien Bacher, Sense Egbert Hofstede
* debian/patches/043_ubuntu_menu_proxy.patch:
1013
+void               ubuntu_menu_proxy_activate_menu (UbuntuMenuProxy *proxy,
1014
+                                                    GtkWidget       *widget);
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
1015
+
1016
+G_END_DECLS
1017
+
1018
+#endif /* __UBUNTU_MENU_PROXY_H__ */
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
1019
Index: gtk+2.0-2.23.90/gtk/ubuntumenuproxymodule.c
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
1020
===================================================================
1021
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
1022
+++ gtk+2.0-2.23.90/gtk/ubuntumenuproxymodule.c	2011-01-21 09:24:12.467904054 -0500
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
1023
@@ -0,0 +1,212 @@
1024
+/*
1025
+ * Copyright (C) 2010 Canonical, Ltd.
1026
+ *
1027
+ * This library is free software; you can redistribute it and/or
1028
+ * modify it under the terms of the GNU Lesser General Public
1029
+ * License as published by the Free Software Foundation; either
1030
+ * version 2 of the License, or (at your option) any later version.
1031
+ *
1032
+ * This library is distributed in the hope that it will be useful,
1033
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1034
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1035
+ * Lesser General Public License for more details.
1036
+ *
1037
+ * You should have received a copy of the GNU Lesser General Public
1038
+ * License along with this library; if not, write to the
1039
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
1040
+ * Boston, MA 02111-1307, USA.
1041
+ *
1042
+ * Authors: Cody Russell <bratsche@gnome.org>
1043
+ */
1044
+
1045
+#include "config.h"
1046
+#include "gtkintl.h"
1047
+#include "ubuntumenuproxy.h"
1048
+#include "ubuntumenuproxymodule.h"
1049
+#include "gtkmodules.h"
1050
+#include "gtkalias.h"
1051
+
1052
+enum {
1053
+  PROP_0,
1054
+  PROP_MODULENAME
1055
+};
1056
+
1057
+static GObject  *ubuntu_menu_proxy_module_constructor   (GType                  type,
1058
+                                                         guint                  n_params,
1059
+                                                         GObjectConstructParam *params);
1060
+static void      ubuntu_menu_proxy_module_finalize      (GObject               *object);
1061
+static gboolean  ubuntu_menu_proxy_module_real_load     (GTypeModule           *gmodule);
1062
+static void      ubuntu_menu_proxy_module_real_unload   (GTypeModule           *gmodule);
1063
+
1064
+
1065
+G_DEFINE_TYPE (UbuntuMenuProxyModule, ubuntu_menu_proxy_module, G_TYPE_TYPE_MODULE);
1066
+
1067
+static UbuntuMenuProxyModule *proxy_module_singleton = NULL;
1068
+
1069
+static void
1070
+ubuntu_menu_proxy_module_class_init (UbuntuMenuProxyModuleClass *class)
1071
+{
1072
+  GObjectClass     *object_class      = G_OBJECT_CLASS (class);
1073
+  GTypeModuleClass *type_module_class = G_TYPE_MODULE_CLASS (class);
1074
+
1075
+  object_class->finalize     = ubuntu_menu_proxy_module_finalize;
1076
+
1077
+  type_module_class->load    = ubuntu_menu_proxy_module_real_load;
1078
+  type_module_class->unload  = ubuntu_menu_proxy_module_real_unload;
1079
+}
1080
+
1081
+static void
1082
+ubuntu_menu_proxy_module_init (UbuntuMenuProxyModule *module)
1083
+{
1084
+  module->name     = g_strdup (g_getenv ("UBUNTU_MENUPROXY"));
1085
+  module->library  = NULL;
1086
+  module->load     = NULL;
1087
+  module->unload   = NULL;
1088
+}
1089
+
1090
+static void
1091
+ubuntu_menu_proxy_module_finalize (GObject *object)
1092
+{
1093
+  UbuntuMenuProxyModule *module = UBUNTU_MENU_PROXY_MODULE (object);
1094
+
1095
+  if (module->name != NULL)
1096
+    {
1097
+      g_free (module->name);
1098
+    }
1099
+
1100
+  G_OBJECT_CLASS (ubuntu_menu_proxy_module_parent_class)->finalize (object);
1101
+}
1102
+
1103
+static gboolean
1104
+ubuntu_menu_proxy_module_real_load (GTypeModule *gmodule)
1105
+{
1106
+  UbuntuMenuProxyModule *module = UBUNTU_MENU_PROXY_MODULE (gmodule);
1107
+  gchar *path;
1108
+
1109
+  if (proxy_module_singleton != NULL)
1110
+    return TRUE;
1111
+
1112
+  if (!module->name)
1113
+    {
1114
+      g_warning ("Module path not set");
1115
+      return FALSE;
1116
+    }
1117
+
1118
+  path = _gtk_find_module (module->name, "menuproxies");
1119
+
1120
+  module->library = g_module_open (path, 0);
1121
+
1122
+  if (!module->library)
1123
+    {
1124
+      g_printerr ("%s\n", g_module_error ());
1125
+      return FALSE;
1126
+    }
1127
+
1128
+  /* Make sure that the loaded library contains the required methods */
1129
+  if (!g_module_symbol (module->library,
1130
+                        "menu_proxy_module_load",
1131
+                        (gpointer *) &module->load) ||
1132
+      !g_module_symbol (module->library,
1133
+                        "menu_proxy_module_unload",
1134
+                        (gpointer *) &module->unload))
1135
+    {
1136
+      g_printerr ("%s\n", g_module_error ());
1137
+      g_module_close (module->library);
1138
+
1139
+      return FALSE;
1140
+    }
1141
+
1142
+  /* Initialize the loaded module */
1143
+  module->load (module);
1144
+
1145
+  return TRUE;
1146
+}
1147
+
1148
+static void
1149
+ubuntu_menu_proxy_module_real_unload (GTypeModule *gmodule)
1150
+{
1151
+  UbuntuMenuProxyModule *module = UBUNTU_MENU_PROXY_MODULE (gmodule);
1152
+
1153
+  module->unload (module);
1154
+
1155
+  g_module_close (module->library);
1156
+  module->library = NULL;
1157
+
1158
+  module->load   = NULL;
1159
+  module->unload = NULL;
1160
+}
1161
+
1162
+static gboolean
1163
+is_valid_module_name (const gchar *name)
1164
+{
1165
+#if !defined(G_OS_WIN32) && !defined(G_WITH_CYGWIN)
1166
+  return g_str_has_prefix (name, "lib") && g_str_has_suffix (name, ".so");
1167
+#else
1168
+  return g_str_has_suffix (name, ".dll");
1169
+#endif
1170
+}
1171
+
1172
+static void
1173
+setup_instance (UbuntuMenuProxyModule *module)
1174
+{
1175
+  GType *proxy_types;
1176
+  guint  n_proxies;
1177
+
1178
+  proxy_types = g_type_children (UBUNTU_TYPE_MENU_PROXY,
1179
+                                 &n_proxies);
1180
+
1181
+  if (n_proxies > 1)
1182
+    {
1183
+      g_warning ("There are %d child types of UbuntuMenuProxy, should be 0 or 1.\n",
1184
+                 n_proxies);
1185
+    }
1186
+  else if (n_proxies == 1)
1187
+    {
1188
+      g_object_new (proxy_types[0], NULL);
1189
+    }
1190
+}
1191
+
1192
+UbuntuMenuProxyModule *
1193
+ubuntu_menu_proxy_module_get (void)
1194
+{
1195
+  if (!proxy_module_singleton)
1196
+    {
1197
+      UbuntuMenuProxyModule *module = NULL;
1198
+      const gchar *module_name;
1199
+
1200
+      module_name = g_getenv ("UBUNTU_MENUPROXY");
1201
+
1202
+      if (module_name != NULL)
1203
+        {
1204
+          if (is_valid_module_name (module_name))
1205
+            {
1206
+              gchar *path = _gtk_find_module (module_name, "menuproxies");
1207
+
1208
+              module = g_object_new (UBUNTU_TYPE_MENU_PROXY_MODULE,
1209
+                                     NULL);
1210
+
1211
+              if (!g_type_module_use (G_TYPE_MODULE (module)))
1212
+                {
1213
+                  g_warning ("Failed to load type module: %s\n", path);
1214
+
1215
+                  g_object_unref (module);
1216
+                  g_free (path);
1217
+
1218
+                  return NULL;
1219
+                }
1220
+
1221
+              setup_instance (module);
1222
+
1223
+              g_free (path);
1224
+              g_type_module_unuse (G_TYPE_MODULE (module));
1225
+            }
1226
+
1227
+          proxy_module_singleton = module;
1228
+        }
1229
+    }
1230
+
1231
+  return proxy_module_singleton;
1232
+}
1233
+
1234
+#define __UBUNTU_MENU_PROXY_MODULE_C__
1235
+#include "gtkaliasdef.c"
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
1236
Index: gtk+2.0-2.23.90/gtk/ubuntumenuproxymodule.h
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
1237
===================================================================
1238
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
1239
+++ gtk+2.0-2.23.90/gtk/ubuntumenuproxymodule.h	2011-01-21 09:23:58.648179671 -0500
167 by Sebastien Bacher, Ken VanDine
* debian/libgtk2.0-0.symbols:
1240
@@ -0,0 +1,69 @@
1241
+/*
1242
+ * Copyright (C) 2010 Canonical, Ltd.
1243
+ *
1244
+ * This library is free software; you can redistribute it and/or
1245
+ * modify it under the terms of the GNU Lesser General Public
1246
+ * License as published by the Free Software Foundation; either
1247
+ * version 2 of the License, or (at your option) any later version.
1248
+ *
1249
+ * This library is distributed in the hope that it will be useful,
1250
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1251
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1252
+ * Lesser General Public License for more details.
1253
+ *
1254
+ * You should have received a copy of the GNU Lesser General Public
1255
+ * License along with this library; if not, write to the
1256
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
1257
+ * Boston, MA 02111-1307, USA.
1258
+ *
1259
+ * Authors: Cody Russell <bratsche@gnome.org>
1260
+ */
1261
+
1262
+#if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
1263
+#error "Only <gtk/gtk.h> can be included directly."
1264
+#endif
1265
+
1266
+#ifndef __UBUNTU_MENU_PROXY_MODULE_H__
1267
+#define __UBUNTU_MENU_PROXY_MODULE_H__
1268
+
1269
+#include <glib-object.h>
1270
+#include <gmodule.h>
1271
+
1272
+G_BEGIN_DECLS
1273
+
1274
+#define UBUNTU_TYPE_MENU_PROXY_MODULE         (ubuntu_menu_proxy_module_get_type ())
1275
+#define UBUNTU_MENU_PROXY_MODULE(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), UBUNTU_TYPE_MENU_PROXY_MODULE, UbuntuMenuProxyModule))
1276
+#define UBUNTU_MENU_PROXY_MODULE_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), UBUNTU_TYPE_MENU_PROXY_MODULE, UbuntuMenuProxyModuleClass))
1277
+#define UBUNTU_IS_MENU_MODULE_PROXY(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), UBUNTU_TYPE_MENU_PROXY_MODULE))
1278
+#define UBUNTU_IS_MENU_PROXY_MODULE_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), UBUNTU_TYPE_MENU_PROXY_MODULE))
1279
+#define UBUNTU_MENU_PROXY_MODULE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), UBUNTU_TYPE_MENU_PROXY_MODULE, UbuntuMenuProxyModuleClass))
1280
+
1281
+typedef struct _UbuntuMenuProxyModule        UbuntuMenuProxyModule;
1282
+typedef struct _UbuntuMenuProxyModuleClass   UbuntuMenuProxyModuleClass;
1283
+typedef struct _UbuntuMenuProxyModulePrivate UbuntuMenuProxyModulePrivate;
1284
+
1285
+struct _UbuntuMenuProxyModule
1286
+{
1287
+  GTypeModule parent_instance;
1288
+
1289
+  UbuntuMenuProxyModulePrivate *priv;
1290
+
1291
+  GModule *library;
1292
+  gchar   *name;
1293
+
1294
+  void        (* load)     (UbuntuMenuProxyModule *module);
1295
+  void        (* unload)   (UbuntuMenuProxyModule *module);
1296
+};
1297
+
1298
+struct _UbuntuMenuProxyModuleClass
1299
+{
1300
+  GTypeModuleClass parent_class;
1301
+};
1302
+
1303
+GType                  ubuntu_menu_proxy_module_get_type (void) G_GNUC_CONST;
1304
+
1305
+UbuntuMenuProxyModule *ubuntu_menu_proxy_module_get      (void);
1306
+
1307
+G_END_DECLS
1308
+
1309
+#endif /* __UBUNTU_MENU_PROXY_MODULE_H__ */
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
1310
Index: gtk+2.0-2.23.90/gtk/gtkwindow.c
171 by Sebastien Bacher
debian/patches/043_ubuntu_menu_proxy.patch: updated version by Cody Russell
1311
===================================================================
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
1312
--- gtk+2.0-2.23.90.orig/gtk/gtkwindow.c	2011-01-21 09:23:52.318364336 -0500
1313
+++ gtk+2.0-2.23.90/gtk/gtkwindow.c	2011-01-21 09:23:58.648179671 -0500
171 by Sebastien Bacher
debian/patches/043_ubuntu_menu_proxy.patch: updated version by Cody Russell
1314
@@ -94,7 +94,8 @@
1315
   PROP_GRAVITY,
1316
   PROP_TRANSIENT_FOR,
1317
   PROP_OPACITY,
1318
-  
1319
+  PROP_NO_PROXY,
1320
+
1321
   /* Readonly properties */
1322
   PROP_IS_ACTIVE,
1323
   PROP_HAS_TOPLEVEL_FOCUS,
1324
@@ -195,6 +196,8 @@
1325
 
1326
   gdouble opacity;
1327
 
1328
+  gboolean no_proxy;
1329
+
1330
   gchar *startup_id;
1331
 };
1332
 
1333
@@ -502,6 +505,14 @@
1334
 							NULL,
1335
 							GTK_PARAM_READWRITE));
1336
 
1337
+  g_object_class_install_property (object_class,
1338
+                                   PROP_NO_PROXY,
1339
+                                   g_param_spec_boolean ("ubuntu-no-proxy",
1340
+                                                         P_("Disable menu proxies for this window"),
1341
+                                                         P_("Disable menu proxies for this window"),
1342
+                                                         FALSE,
1343
+                                                         GTK_PARAM_READWRITE));
1344
+
1345
   /**
1346
    * GtkWindow:startup-id:
1347
    *
182 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
1348
@@ -1084,6 +1095,9 @@
171 by Sebastien Bacher
debian/patches/043_ubuntu_menu_proxy.patch: updated version by Cody Russell
1349
     case PROP_MNEMONICS_VISIBLE:
1350
       gtk_window_set_mnemonics_visible (window, g_value_get_boolean (value));
1351
       break;
1352
+    case PROP_NO_PROXY:
1353
+      priv->no_proxy = g_value_get_boolean (value);
1354
+      break;
1355
     default:
1356
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
1357
       break;
182 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
1358
@@ -1202,6 +1216,9 @@
171 by Sebastien Bacher
debian/patches/043_ubuntu_menu_proxy.patch: updated version by Cody Russell
1359
     case PROP_MNEMONICS_VISIBLE:
1360
       g_value_set_boolean (value, priv->mnemonics_visible);
1361
       break;
1362
+    case PROP_NO_PROXY:
1363
+      g_value_set_boolean (value, priv->no_proxy);
1364
+      break;
1365
     default:
1366
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
1367
       break;
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
1368
Index: gtk+2.0-2.23.90/gtk/gtkmenuitem.c
180 by Sebastien Bacher, Sense Egbert Hofstede
* debian/patches/043_ubuntu_menu_proxy.patch:
1369
===================================================================
208 by Sebastien Bacher
* debian/patches/043_ubuntu_menu_proxy.patch:
1370
--- gtk+2.0-2.23.90.orig/gtk/gtkmenuitem.c	2011-01-21 09:23:52.278365796 -0500
1371
+++ gtk+2.0-2.23.90/gtk/gtkmenuitem.c	2011-01-21 09:23:58.648179671 -0500
180 by Sebastien Bacher, Sense Egbert Hofstede
* debian/patches/043_ubuntu_menu_proxy.patch:
1372
@@ -1395,7 +1395,17 @@
1373
 				  widget);
1374
     }
1375
   else
1376
-    g_signal_emit (widget, menu_item_signals[ACTIVATE_ITEM], 0);
1377
+    {
1378
+      if (GTK_IS_MENU_BAR (widget->parent) &&
1379
+          ubuntu_gtk_menu_shell_activate_mnemonic (GTK_MENU_SHELL (widget->parent), widget))
1380
+        {
1381
+          //g_print ("send activate to remote!\n");
1382
+        }
1383
+      else
1384
+        {
1385
+          g_signal_emit (widget, menu_item_signals[ACTIVATE_ITEM], 0);
1386
+        }
1387
+    }
1388
   
1389
   return TRUE;
1390
 }