Merge lp:~attente/gtk/gtk2-no-menu-proxy into lp:~ubuntu-desktop/gtk/ubuntu

Proposed by William Hua
Status: Merged
Merge reported by: Sebastien Bacher
Merged at revision: not available
Proposed branch: lp:~attente/gtk/gtk2-no-menu-proxy
Merge into: lp:~ubuntu-desktop/gtk/ubuntu
Diff against target: 1602 lines (+0/-1566)
4 files modified
debian/patches/012_ubuntu-set-grab-add.patch (+0/-47)
debian/patches/043_ubuntu_menu_proxy.patch (+0/-1406)
debian/patches/072_indicator_menu_update.patch (+0/-110)
debian/patches/series (+0/-3)
To merge this branch: bzr merge lp:~attente/gtk/gtk2-no-menu-proxy
Reviewer Review Type Date Requested Status
Ubuntu Desktop Pending
Review via email: mp+151619@code.launchpad.net

Description of the change

Remove the menu proxy patch, set grab add patch, and indicator menu update patch.

We shouldn't need these any more since the menu proxy is replaced by unity-gtk-module, set grab add hasn't been used in a while, and support for gtk 2 indicators is gone.

To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks William, we finally got that merged in the packaging trunk, it's going to go to the ubuntu-desktop ppa for some testing before archive upload still though

Preview Diff

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

Subscribers

People subscribed via source and target branches

to all changes: