Merge lp:~dbusmenu-team/libdbusmenu/ubuntu into lp:~ubuntu-desktop/libdbusmenu/ubuntu

Proposed by Ted Gould
Status: Merged
Merged at revision: 138
Proposed branch: lp:~dbusmenu-team/libdbusmenu/ubuntu
Merge into: lp:~ubuntu-desktop/libdbusmenu/ubuntu
Diff against target: 536 lines (+196/-38)
14 files modified
ChangeLog (+72/-0)
configure (+11/-11)
configure.ac (+3/-3)
debian/changelog (+14/-0)
docs/libdbusmenu-glib/reference/html/ch01.html (+1/-1)
docs/libdbusmenu-glib/reference/version.xml (+1/-1)
docs/libdbusmenu-gtk/reference/html/ch01.html (+1/-1)
docs/libdbusmenu-gtk/reference/version.xml (+1/-1)
libdbusmenu-glib/client.c (+11/-3)
libdbusmenu-glib/menuitem.c (+1/-1)
libdbusmenu-gtk/Makefile.am (+0/-2)
libdbusmenu-gtk/Makefile.in (+0/-2)
libdbusmenu-gtk/client.c (+42/-12)
libdbusmenu-gtk/parser.c (+38/-0)
To merge this branch: bzr merge lp:~dbusmenu-team/libdbusmenu/ubuntu
Reviewer Review Type Date Requested Status
Ken VanDine Pending
Review via email: mp+56789@code.launchpad.net

Description of the change

0.4.2

To post a comment you must log in.
lp:~dbusmenu-team/libdbusmenu/ubuntu updated
138. By Ken VanDine

releasing version 0.4.2-0ubuntu1

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2011-03-31 18:48:12 +0000
3+++ ChangeLog 2011-04-07 15:38:25 +0000
4@@ -1,5 +1,77 @@
5 # Generated by Makefile. Do not edit.
6
7+2011-04-07 Ted Gould <ted@gould.cx>
8+
9+ 0.4.2
10+
11+2011-04-07 Ted Gould <ted@gould.cx>
12+
13+ Build menus based on teh child-display property
14+
15+2011-04-05 Ted Gould <ted@gould.cx>
16+
17+ Make check to send about-to-show look for properties as well.
18+
19+2011-04-05 Ted Gould <ted@gould.cx>
20+
21+ Attching a bug number
22+
23+2011-04-05 Ted Gould <ted@gould.cx>
24+
25+ Making the debug message better
26+
27+2011-04-05 Ted Gould <ted@gould.cx>
28+
29+ We don't need the parent, cut-and-paste confusion here.
30+
31+2011-04-05 Ted Gould <ted@gould.cx>
32+
33+ Handle the case of the variant being NULL
34+
35+2011-04-05 Ted Gould <ted@gould.cx>
36+
37+ Now that we're using the child-display variable more, let's grab it in the first pass.
38+
39+2011-04-05 Ted Gould <ted@gould.cx>
40+
41+ Then menu should get created when processing the property, so let's warn and exit here if it's not available
42+
43+2011-04-05 Ted Gould <ted@gould.cx>
44+
45+ Passing in the client so that I can get the menuitem in all cases
46+
47+2011-04-05 Ted Gould <ted@gould.cx>
48+
49+ Setting up the shell to handle the children display prop
50+
51+2011-04-05 Ted Gould <ted@gould.cx>
52+
53+ Add a handler for the open/close events and pass them up to GTK
54+
55+2011-04-05 Michael Terry <mike@mterry.name>
56+
57+ respond to opened and closed events for the benefit of any watching application
58+
59+2011-04-05 Ted Gould <ted@gould.cx>
60+
61+ Keep refs to the client and makes sure to disconnect all handlers.
62+
63+2011-04-05 Michael Terry <mike@mterry.name>
64+
65+ fix typo
66+
67+2011-04-05 Michael Terry <mike@mterry.name>
68+
69+ be a little more careful with asynchronous callbacks
70+
71+2011-04-05 Ted Gould <ted@gould.cx>
72+
73+ Don't duplicate flags
74+
75+2011-04-04 Ted Gould <ted@gould.cx>
76+
77+ Don't need SCANNERFLAGS and INTROSPECTION_SCANNER_ARGS both so they dup'd the parameters.
78+
79 2011-03-31 Ted Gould <ted@gould.cx>
80
81 0.4.1
82
83=== modified file 'configure'
84--- configure 2011-03-31 18:50:13 +0000
85+++ configure 2011-04-07 15:38:25 +0000
86@@ -1,6 +1,6 @@
87 #! /bin/sh
88 # Guess values for system-dependent variables and create Makefiles.
89-# Generated by GNU Autoconf 2.67 for libdbusmenu 0.4.1.
90+# Generated by GNU Autoconf 2.67 for libdbusmenu 0.4.2.
91 #
92 # Report bugs to <ted@canonical.com>.
93 #
94@@ -703,8 +703,8 @@
95 # Identity of this package.
96 PACKAGE_NAME='libdbusmenu'
97 PACKAGE_TARNAME='libdbusmenu'
98-PACKAGE_VERSION='0.4.1'
99-PACKAGE_STRING='libdbusmenu 0.4.1'
100+PACKAGE_VERSION='0.4.2'
101+PACKAGE_STRING='libdbusmenu 0.4.2'
102 PACKAGE_BUGREPORT='ted@canonical.com'
103 PACKAGE_URL=''
104
105@@ -1541,7 +1541,7 @@
106 # Omit some internal or obsolete options to make the list less imposing.
107 # This message is too long to be a string in the A/UX 3.1 sh.
108 cat <<_ACEOF
109-\`configure' configures libdbusmenu 0.4.1 to adapt to many kinds of systems.
110+\`configure' configures libdbusmenu 0.4.2 to adapt to many kinds of systems.
111
112 Usage: $0 [OPTION]... [VAR=VALUE]...
113
114@@ -1611,7 +1611,7 @@
115
116 if test -n "$ac_init_help"; then
117 case $ac_init_help in
118- short | recursive ) echo "Configuration of libdbusmenu 0.4.1:";;
119+ short | recursive ) echo "Configuration of libdbusmenu 0.4.2:";;
120 esac
121 cat <<\_ACEOF
122
123@@ -1751,7 +1751,7 @@
124 test -n "$ac_init_help" && exit $ac_status
125 if $ac_init_version; then
126 cat <<\_ACEOF
127-libdbusmenu configure 0.4.1
128+libdbusmenu configure 0.4.2
129 generated by GNU Autoconf 2.67
130
131 Copyright (C) 2010 Free Software Foundation, Inc.
132@@ -2122,7 +2122,7 @@
133 This file contains any messages produced by compilers while
134 running configure, to aid debugging if configure makes a mistake.
135
136-It was created by libdbusmenu $as_me 0.4.1, which was
137+It was created by libdbusmenu $as_me 0.4.2, which was
138 generated by GNU Autoconf 2.67. Invocation command line was
139
140 $ $0 $@
141@@ -2943,7 +2943,7 @@
142
143 # Define the identity of the package.
144 PACKAGE=libdbusmenu
145- VERSION=0.4.1
146+ VERSION=0.4.2
147
148
149 # Some tools Automake needs.
150@@ -13294,7 +13294,7 @@
151 ###########################
152
153 LIBDBUSMENU_CURRENT=3
154-LIBDBUSMENU_REVISION=12
155+LIBDBUSMENU_REVISION=13
156 LIBDBUSMENU_AGE=0
157
158
159@@ -14616,7 +14616,7 @@
160 # report actual input values of CONFIG_FILES etc. instead of their
161 # values after options handling.
162 ac_log="
163-This file was extended by libdbusmenu $as_me 0.4.1, which was
164+This file was extended by libdbusmenu $as_me 0.4.2, which was
165 generated by GNU Autoconf 2.67. Invocation command line was
166
167 CONFIG_FILES = $CONFIG_FILES
168@@ -14682,7 +14682,7 @@
169 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
170 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
171 ac_cs_version="\\
172-libdbusmenu config.status 0.4.1
173+libdbusmenu config.status 0.4.2
174 configured by $0, generated by GNU Autoconf 2.67,
175 with options \\"\$ac_cs_config\\"
176
177
178=== modified file 'configure.ac'
179--- configure.ac 2011-03-31 18:50:13 +0000
180+++ configure.ac 2011-04-07 15:38:25 +0000
181@@ -1,11 +1,11 @@
182
183-AC_INIT(libdbusmenu, 0.4.1, ted@canonical.com)
184+AC_INIT(libdbusmenu, 0.4.2, ted@canonical.com)
185 AC_COPYRIGHT([Copyright 2009,2010 Canonical])
186
187 AC_PREREQ(2.62)
188
189 AM_CONFIG_HEADER(config.h)
190-AM_INIT_AUTOMAKE(libdbusmenu, 0.4.1, [-Wno-portability])
191+AM_INIT_AUTOMAKE(libdbusmenu, 0.4.2, [-Wno-portability])
192
193 AM_MAINTAINER_MODE
194
195@@ -134,7 +134,7 @@
196 ###########################
197
198 LIBDBUSMENU_CURRENT=3
199-LIBDBUSMENU_REVISION=12
200+LIBDBUSMENU_REVISION=13
201 LIBDBUSMENU_AGE=0
202
203 AC_SUBST(LIBDBUSMENU_CURRENT)
204
205=== modified file 'debian/changelog'
206--- debian/changelog 2011-03-31 19:33:18 +0000
207+++ debian/changelog 2011-04-07 15:38:25 +0000
208@@ -1,3 +1,17 @@
209+libdbusmenu (0.4.2-0ubuntu1~ppa1) natty; urgency=low
210+
211+ * New upstream release.
212+ ∘ Fix GIR scan to not include duplicate namespaces (LP: #750575)
213+ ∘ Keep refs to the client and makes sure to disconnect all handlers.
214+ (LP: #749609)
215+ ∘ Add GTK side handlers for the open/close events to ensure GTK apps
216+ can use those events still (LP: #750588)
217+ ∘ Create submenus for menuitems that don't have children but still
218+ have told us they need them with the child-display property.
219+ (LP: #619811)
220+
221+ -- Ted Gould <ted@ubuntu.com> Thu, 07 Apr 2011 10:32:51 -0500
222+
223 libdbusmenu (0.4.1-0ubuntu1) natty; urgency=low
224
225 * New upstream release.
226
227=== modified file 'docs/libdbusmenu-glib/reference/html/ch01.html'
228--- docs/libdbusmenu-glib/reference/html/ch01.html 2011-03-31 18:48:12 +0000
229+++ docs/libdbusmenu-glib/reference/html/ch01.html 2011-04-07 15:38:25 +0000
230@@ -21,7 +21,7 @@
231 </tr></table>
232 <div class="chapter">
233 <div class="titlepage"><div><div><h2 class="title">
234-<a name="id471000"></a>API</h2></div></div></div>
235+<a name="id552681"></a>API</h2></div></div></div>
236 <div class="toc"><dl>
237 <dt>
238 <span class="refentrytitle"><a href="libdbusmenu-glib-DbusmenuServer.html">DbusmenuServer</a></span><span class="refpurpose"> — The server signals changed and
239
240=== modified file 'docs/libdbusmenu-glib/reference/version.xml'
241--- docs/libdbusmenu-glib/reference/version.xml 2011-03-31 18:50:13 +0000
242+++ docs/libdbusmenu-glib/reference/version.xml 2011-04-07 15:38:25 +0000
243@@ -1,1 +1,1 @@
244-0.4.1
245+0.4.2
246
247=== modified file 'docs/libdbusmenu-gtk/reference/html/ch01.html'
248--- docs/libdbusmenu-gtk/reference/html/ch01.html 2011-03-31 18:48:12 +0000
249+++ docs/libdbusmenu-gtk/reference/html/ch01.html 2011-04-07 15:38:25 +0000
250@@ -21,7 +21,7 @@
251 </tr></table>
252 <div class="chapter">
253 <div class="titlepage"><div><div><h2 class="title">
254-<a name="id520868"></a>API</h2></div></div></div>
255+<a name="id463422"></a>API</h2></div></div></div>
256 <div class="toc"><dl>
257 <dt>
258 <span class="refentrytitle"><a href="libdbusmenu-gtk-DbusmenuGtkMenu.html">DbusmenuGtkMenu</a></span><span class="refpurpose"> — A GTK Menu Object that syncronizes over DBus</span>
259
260=== modified file 'docs/libdbusmenu-gtk/reference/version.xml'
261--- docs/libdbusmenu-gtk/reference/version.xml 2011-03-31 18:50:13 +0000
262+++ docs/libdbusmenu-gtk/reference/version.xml 2011-04-07 15:38:25 +0000
263@@ -1,1 +1,1 @@
264-0.4.1
265+0.4.2
266
267=== modified file 'libdbusmenu-glib/client.c'
268--- libdbusmenu-glib/client.c 2011-03-31 18:47:46 +0000
269+++ libdbusmenu-glib/client.c 2011-04-07 15:38:25 +0000
270@@ -331,6 +331,8 @@
271 return;
272 }
273
274+#define LAYOUT_PROPS_COUNT 5
275+
276 static void
277 dbusmenu_client_init (DbusmenuClient *self)
278 {
279@@ -351,13 +353,14 @@
280
281 priv->layoutcall = NULL;
282
283- gchar * layout_props[5];
284+ gchar * layout_props[LAYOUT_PROPS_COUNT + 1];
285 layout_props[0] = DBUSMENU_MENUITEM_PROP_TYPE;
286 layout_props[1] = DBUSMENU_MENUITEM_PROP_LABEL;
287 layout_props[2] = DBUSMENU_MENUITEM_PROP_VISIBLE;
288 layout_props[3] = DBUSMENU_MENUITEM_PROP_ENABLED;
289- layout_props[4] = NULL;
290- priv->layout_props = g_variant_new_strv((const gchar * const *)layout_props, 4);
291+ layout_props[4] = DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY;
292+ layout_props[LAYOUT_PROPS_COUNT] = NULL;
293+ priv->layout_props = g_variant_new_strv((const gchar * const *)layout_props, LAYOUT_PROPS_COUNT);
294 g_variant_ref_sink(priv->layout_props);
295
296 priv->current_revision = 0;
297@@ -441,6 +444,9 @@
298 priv->menuproxy_cancel = NULL;
299 }
300 if (priv->menuproxy != NULL) {
301+ g_signal_handlers_disconnect_matched(priv->menuproxy,
302+ G_SIGNAL_MATCH_DATA,
303+ 0, 0, NULL, NULL, object);
304 g_object_unref(G_OBJECT(priv->menuproxy));
305 priv->menuproxy = NULL;
306 }
307@@ -1494,6 +1500,7 @@
308 g_variant_unref(edata->variant);
309 g_free(edata->event);
310 g_object_unref(edata->menuitem);
311+ g_object_unref(edata->client);
312 g_free(edata);
313
314 if (G_UNLIKELY(error != NULL)) {
315@@ -1528,6 +1535,7 @@
316
317 event_data_t * edata = g_new0(event_data_t, 1);
318 edata->client = client;
319+ g_object_ref(client);
320 edata->menuitem = mi;
321 g_object_ref(edata->menuitem);
322 edata->event = g_strdup(name);
323
324=== modified file 'libdbusmenu-glib/menuitem.c'
325--- libdbusmenu-glib/menuitem.c 2011-03-16 19:02:13 +0000
326+++ libdbusmenu-glib/menuitem.c 2011-04-07 15:38:25 +0000
327@@ -446,7 +446,7 @@
328 {
329 g_return_if_fail(DBUSMENU_IS_MENUITEM(mi));
330
331- if (dbusmenu_menuitem_get_children(mi) == NULL) {
332+ if (dbusmenu_menuitem_get_children(mi) == NULL && g_strcmp0(DBUSMENU_MENUITEM_CHILD_DISPLAY_SUBMENU, dbusmenu_menuitem_property_get(mi, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY)) != 0) {
333 g_warning("About to Show called on an item wihtout submenus. We're ignoring it.");
334 } else {
335 gboolean dummy;
336
337=== modified file 'libdbusmenu-gtk/Makefile.am'
338--- libdbusmenu-gtk/Makefile.am 2011-02-24 18:40:30 +0000
339+++ libdbusmenu-gtk/Makefile.am 2011-04-07 15:38:25 +0000
340@@ -103,7 +103,6 @@
341 DbusmenuGtk_0_4_gir_LIBS = libdbusmenu-gtk$(VER).la
342 DbusmenuGtk_0_4_gir_FILES = $(addprefix $(srcdir)/, $(introspection_sources))
343 DbusmenuGtk_0_4_gir_NAMESPACE = DbusmenuGtk$(VER)
344-DbusmenuGtk_0_4_gir_SCANNERFLAGS = $(INTROSPECTION_SCANNER_ARGS)
345 DbusmenuGtk_0_4_gir_EXPORT_PACKAGES = dbusmenu-gtk$(VER)-0.4
346
347 # We duplicate these for the same reason as libdbusmenu_gtk3includedir above
348@@ -112,7 +111,6 @@
349 DbusmenuGtk3_0_4_gir_LIBS = $(DbusmenuGtk_0_4_gir_LIBS)
350 DbusmenuGtk3_0_4_gir_FILES = $(DbusmenuGtk_0_4_gir_FILES)
351 DbusmenuGtk3_0_4_gir_NAMESPACE = $(DbusmenuGtk_0_4_gir_NAMESPACE)
352-DbusmenuGtk3_0_4_gir_SCANNERFLAGS = $(DbusmenuGtk_0_4_gir_SCANNERFLAGS)
353 DbusmenuGtk3_0_4_gir_EXPORT_PACKAGES = $(DbusmenuGtk_0_4_gir_EXPORT_PACKAGES)
354
355 INTROSPECTION_GIRS += DbusmenuGtk$(VER)-0.4.gir
356
357=== modified file 'libdbusmenu-gtk/Makefile.in'
358--- libdbusmenu-gtk/Makefile.in 2011-03-10 17:05:16 +0000
359+++ libdbusmenu-gtk/Makefile.in 2011-04-07 15:38:25 +0000
360@@ -401,7 +401,6 @@
361 @HAVE_INTROSPECTION_TRUE@DbusmenuGtk_0_4_gir_LIBS = libdbusmenu-gtk$(VER).la
362 @HAVE_INTROSPECTION_TRUE@DbusmenuGtk_0_4_gir_FILES = $(addprefix $(srcdir)/, $(introspection_sources))
363 @HAVE_INTROSPECTION_TRUE@DbusmenuGtk_0_4_gir_NAMESPACE = DbusmenuGtk$(VER)
364-@HAVE_INTROSPECTION_TRUE@DbusmenuGtk_0_4_gir_SCANNERFLAGS = $(INTROSPECTION_SCANNER_ARGS)
365 @HAVE_INTROSPECTION_TRUE@DbusmenuGtk_0_4_gir_EXPORT_PACKAGES = dbusmenu-gtk$(VER)-0.4
366
367 # We duplicate these for the same reason as libdbusmenu_gtk3includedir above
368@@ -410,7 +409,6 @@
369 @HAVE_INTROSPECTION_TRUE@DbusmenuGtk3_0_4_gir_LIBS = $(DbusmenuGtk_0_4_gir_LIBS)
370 @HAVE_INTROSPECTION_TRUE@DbusmenuGtk3_0_4_gir_FILES = $(DbusmenuGtk_0_4_gir_FILES)
371 @HAVE_INTROSPECTION_TRUE@DbusmenuGtk3_0_4_gir_NAMESPACE = $(DbusmenuGtk_0_4_gir_NAMESPACE)
372-@HAVE_INTROSPECTION_TRUE@DbusmenuGtk3_0_4_gir_SCANNERFLAGS = $(DbusmenuGtk_0_4_gir_SCANNERFLAGS)
373 @HAVE_INTROSPECTION_TRUE@DbusmenuGtk3_0_4_gir_EXPORT_PACKAGES = $(DbusmenuGtk_0_4_gir_EXPORT_PACKAGES)
374 @HAVE_INTROSPECTION_TRUE@girdir = $(datadir)/gir-1.0
375 @HAVE_INTROSPECTION_TRUE@gir_DATA = $(INTROSPECTION_GIRS)
376
377=== modified file 'libdbusmenu-gtk/client.c'
378--- libdbusmenu-gtk/client.c 2011-03-16 15:27:00 +0000
379+++ libdbusmenu-gtk/client.c 2011-04-07 15:38:25 +0000
380@@ -551,11 +551,43 @@
381 return;
382 }
383
384+/* Submenu processing */
385+static void
386+process_submenu (DbusmenuMenuitem * mi, GtkMenuItem * gmi, GVariant * variant, DbusmenuGtkClient * gtkclient)
387+{
388+ const gchar * submenu = NULL;
389+ if (variant != NULL) {
390+ submenu = g_variant_get_string(variant, NULL);
391+ }
392+
393+ if (g_strcmp0(submenu, DBUSMENU_MENUITEM_CHILD_DISPLAY_SUBMENU) != 0) {
394+ /* This is the only case we're really supporting right now,
395+ so if it's not this, we want to clean up. */
396+ /* We're just going to warn for now. */
397+ gpointer pmenu = g_object_get_data(G_OBJECT(mi), data_menu);
398+ if (pmenu != NULL) {
399+ g_warning("The child-display variable is set to '%s' but there's a menu, odd?", submenu);
400+ }
401+ } else {
402+ /* We need to build a menu for these guys to live in. */
403+ GtkMenu * menu = GTK_MENU(gtk_menu_new());
404+ g_object_set_data(G_OBJECT(mi), data_menu, menu);
405+
406+ gtk_menu_item_set_submenu(gmi, GTK_WIDGET(menu));
407+
408+ g_signal_connect(menu, "notify::visible", G_CALLBACK(submenu_notify_visible_cb), mi);
409+ }
410+
411+ return;
412+}
413+
414 /* Whenever we have a property change on a DbusmenuMenuitem
415 we need to be responsive to that. */
416 static void
417-menu_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, GVariant * variant, GtkMenuItem * gmi)
418+menu_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, GVariant * variant, DbusmenuGtkClient * gtkclient)
419 {
420+ GtkMenuItem * gmi = dbusmenu_gtkclient_menuitem_get(gtkclient, mi);
421+
422 if (!g_strcmp0(prop, DBUSMENU_MENUITEM_PROP_LABEL)) {
423 gtk_menu_item_set_label(gmi, variant == NULL ? NULL : g_variant_get_string(variant, NULL));
424 } else if (!g_strcmp0(prop, DBUSMENU_MENUITEM_PROP_VISIBLE)) {
425@@ -566,6 +598,8 @@
426 process_toggle_type(mi, gmi, variant);
427 } else if (!g_strcmp0(prop, DBUSMENU_MENUITEM_PROP_TOGGLE_STATE)) {
428 process_toggle_state(mi, gmi, variant);
429+ } else if (!g_strcmp0(prop, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY)) {
430+ process_submenu(mi, gmi, variant, gtkclient);
431 }
432
433 return;
434@@ -704,7 +738,7 @@
435 #endif
436
437 /* DbusmenuMenuitem signals */
438- g_signal_connect(G_OBJECT(item), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(menu_prop_change_cb), gmi);
439+ g_signal_connect(G_OBJECT(item), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(menu_prop_change_cb), client);
440 g_signal_connect(G_OBJECT(item), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(menu_shortcut_change_cb), client);
441 g_signal_connect(G_OBJECT(item), DBUSMENU_MENUITEM_SIGNAL_CHILD_REMOVED, G_CALLBACK(delete_child), client);
442 g_signal_connect(G_OBJECT(item), DBUSMENU_MENUITEM_SIGNAL_CHILD_MOVED, G_CALLBACK(move_child), client);
443@@ -720,6 +754,7 @@
444 process_sensitive(item, gmi, dbusmenu_menuitem_property_get_variant(item, DBUSMENU_MENUITEM_PROP_ENABLED));
445 process_toggle_type(item, gmi, dbusmenu_menuitem_property_get_variant(item, DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE));
446 process_toggle_state(item, gmi, dbusmenu_menuitem_property_get_variant(item, DBUSMENU_MENUITEM_PROP_TOGGLE_STATE));
447+ process_submenu(item, gmi, dbusmenu_menuitem_property_get_variant(item, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY), client);
448 refresh_shortcut(client, item);
449
450 /* Oh, we're a child, let's deal with that */
451@@ -741,17 +776,12 @@
452 if (g_strcmp0(dbusmenu_menuitem_property_get(mi, DBUSMENU_MENUITEM_PROP_TYPE), DBUSMENU_CLIENT_TYPES_SEPARATOR) == 0) { return; }
453
454 gpointer ann_menu = g_object_get_data(G_OBJECT(mi), data_menu);
455+ if (ann_menu == NULL) {
456+ g_warning("Children but no menu, someone's been naughty with their '" DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY "' property: '%s'", dbusmenu_menuitem_property_get(mi, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY));
457+ return;
458+ }
459+
460 GtkMenu * menu = GTK_MENU(ann_menu);
461- if (menu == NULL) {
462- /* Oh, we don't have a submenu, build one! */
463- menu = GTK_MENU(gtk_menu_new());
464- g_object_set_data(G_OBJECT(mi), data_menu, menu);
465-
466- GtkMenuItem * parent = dbusmenu_gtkclient_menuitem_get(gtkclient, mi);
467- gtk_menu_item_set_submenu(parent, GTK_WIDGET(menu));
468-
469- g_signal_connect(menu, "notify::visible", G_CALLBACK(submenu_notify_visible_cb), mi);
470- }
471
472 GtkMenuItem * childmi = dbusmenu_gtkclient_menuitem_get(gtkclient, child);
473 gtk_menu_shell_insert(GTK_MENU_SHELL(menu), GTK_WIDGET(childmi), position);
474
475=== modified file 'libdbusmenu-gtk/parser.c'
476--- libdbusmenu-gtk/parser.c 2011-03-31 18:50:13 +0000
477+++ libdbusmenu-gtk/parser.c 2011-04-07 15:38:25 +0000
478@@ -79,6 +79,11 @@
479 gpointer user_data);
480 static gboolean item_about_to_show (DbusmenuMenuitem * item,
481 gpointer user_data);
482+static gboolean item_handle_event (DbusmenuMenuitem * item,
483+ const gchar * name,
484+ GVariant * variant,
485+ guint timestamp,
486+ GtkWidget * widget);
487 static void widget_notify_cb (GtkWidget * widget,
488 GParamSpec * pspec,
489 gpointer data);
490@@ -580,6 +585,11 @@
491 DBUSMENU_MENUITEM_SIGNAL_ABOUT_TO_SHOW,
492 G_CALLBACK (item_about_to_show),
493 widget);
494+
495+ g_signal_connect (G_OBJECT (mi),
496+ DBUSMENU_MENUITEM_SIGNAL_EVENT,
497+ G_CALLBACK (item_handle_event),
498+ widget);
499 }
500
501 dbusmenu_menuitem_property_set_bool (mi,
502@@ -924,6 +934,34 @@
503 return TRUE;
504 }
505
506+static gboolean
507+item_handle_event (DbusmenuMenuitem *item, const gchar *name,
508+ GVariant *variant, guint timestamp, GtkWidget *widget)
509+{
510+ if (g_strcmp0 (name, DBUSMENU_MENUITEM_EVENT_OPENED) == 0)
511+ {
512+ GtkWidget *submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget));
513+ if (submenu != NULL)
514+ {
515+ // Show the submenu so the app can notice and futz with the menus as
516+ // desired (empathy and geany do this)
517+ gtk_widget_show (submenu);
518+ }
519+ }
520+ else if (g_strcmp0 (name, DBUSMENU_MENUITEM_EVENT_CLOSED) == 0)
521+ {
522+ GtkWidget *submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget));
523+ if (submenu != NULL)
524+ {
525+ // Hide the submenu so the app can notice and futz with the menus as
526+ // desired (empathy and geany do this)
527+ gtk_widget_hide (submenu);
528+ }
529+ }
530+
531+ return FALSE; // just pass through on everything
532+}
533+
534 static void
535 widget_notify_cb (GtkWidget *widget,
536 GParamSpec *pspec,

Subscribers

People subscribed via source and target branches

to all changes: