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

Proposed by Ted Gould
Status: Merged
Merged at revision: 134
Proposed branch: lp:~dbusmenu-team/libdbusmenu/ubuntu
Merge into: lp:~ubuntu-desktop/libdbusmenu/ubuntu
Diff against target: 977 lines (+355/-75)
17 files modified
ChangeLog (+103/-0)
configure (+11/-11)
configure.ac (+3/-3)
debian/changelog (+13/-0)
docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt (+3/-0)
docs/libdbusmenu-glib/reference/version.xml (+1/-1)
docs/libdbusmenu-gtk/reference/version.xml (+1/-1)
libdbusmenu-glib/client.c (+102/-39)
libdbusmenu-glib/dbus-menu.xml (+2/-0)
libdbusmenu-glib/enum-types.c (+1/-1)
libdbusmenu-glib/enum-types.h (+6/-1)
libdbusmenu-glib/menuitem.c (+1/-1)
libdbusmenu-glib/menuitem.h (+26/-0)
libdbusmenu-gtk/client.c (+12/-2)
libdbusmenu-gtk/dbusmenu-gtk-0.4.pc.in (+1/-1)
libdbusmenu-gtk/dbusmenu-gtk3-0.4.pc.in (+1/-1)
libdbusmenu-gtk/parser.c (+68/-13)
To merge this branch: bzr merge lp:~dbusmenu-team/libdbusmenu/ubuntu
Reviewer Review Type Date Requested Status
Ken VanDine Pending
Review via email: mp+53684@code.launchpad.net
To post a comment you must log in.
lp:~dbusmenu-team/libdbusmenu/ubuntu updated
134. By Ken VanDine

releasing version 0.3.102-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-10 17:03:04 +0000
3+++ ChangeLog 2011-03-16 19:16:36 +0000
4@@ -1,5 +1,108 @@
5 # Generated by Makefile. Do not edit.
6
7+2011-03-16 Ted Gould <ted@gould.cx>
8+
9+ 0.3.102
10+
11+2011-03-16 Ted Gould <ted@gould.cx>
12+
13+ Add handling for children getting removed
14+
15+2011-03-09 Ted Gould <ted@gould.cx>
16+
17+ Update to current trunk
18+
19+2011-03-08 Ted Gould <ted@gould.cx>
20+
21+ If we call the parse function and we already have the menu item built for the passed in value let's just use that and not bother looking any further.
22+
23+2011-03-08 Ted Gould <ted@gould.cx>
24+
25+ Disconnecting the child removed handlers
26+
27+2011-03-08 Ted Gould <ted@gould.cx>
28+
29+ Removing the dbusmenu menuitem from the parent if it gets removed on the GTK side
30+
31+2011-03-08 Ted Gould <ted@gould.cx>
32+
33+ Add a callback for child-removed as well
34+
35+2011-03-16 Ted Gould <ted@gould.cx>
36+
37+ Adding defines for the event identifiers
38+
39+2011-03-16 Ted Gould <ted@gould.cx>
40+
41+ Adding event defines to the documentation.
42+
43+2011-03-16 Ted Gould <ted@gould.cx>
44+
45+ Adding opened and closed to the spec
46+
47+2011-03-16 Ted Gould <ted@gould.cx>
48+
49+ Using the new defines
50+
51+2011-03-16 Ted Gould <ted@gould.cx>
52+
53+ Adding defines for the event ids
54+
55+2011-03-16 Ted Gould <ted@gould.cx>
56+
57+ Send open and close signals when menu visibility changes.
58+
59+2011-03-16 Michael Terry <mike@mterry.name>
60+
61+ add opened and closed events
62+
63+2011-03-16 Ted Gould <ted@gould.cx>
64+
65+ Empty images are images too
66+
67+2011-03-16 Michael Terry <mike@mterry.name>
68+
69+ handle empty image types
70+
71+2011-03-16 Ted Gould <ted@gould.cx>
72+
73+ Removing a noisy warning
74+
75+2011-03-15 Ted Gould <ted@gould.cx>
76+
77+ Not everything is a menuitem
78+
79+2011-03-16 Ted Gould <ted@gould.cx>
80+
81+ Adding needed dependencies to pkgconfig files
82+
83+2011-03-15 Ted Gould <ted@gould.cx>
84+
85+ Adding needed requirements to pkgconfig files.
86+
87+2011-03-14 Ted Gould <ted@gould.cx>
88+
89+ Handle NULL better in finding the label
90+
91+2011-03-14 Michael Terry <mike@mterry.name>
92+
93+ be a little more cautious about pointers in sanitize_label_text
94+
95+2011-03-14 Ted Gould <ted@gould.cx>
96+
97+ Lots of memory leak fixes
98+
99+2011-03-14 Chris Coulson <chrisccoulson@ubuntu.com>
100+
101+ The g_variant_get_* family of calls which return a GVariant
102+ actually return reference counted, non-floating variant. Ensure that we
103+ always keep pointers to these so that we can properly unref them.
104+
105+ The same also applies to g_variant_iter_next_value.
106+
107+ Also fix a couple of other minor leaks along the way. This fixes
108+ LP: #722972
109+
110 2011-03-10 Ted Gould <ted@gould.cx>
111
112 0.3.101
113
114=== modified file 'configure'
115--- configure 2011-03-10 17:05:16 +0000
116+++ configure 2011-03-16 19:16:36 +0000
117@@ -1,6 +1,6 @@
118 #! /bin/sh
119 # Guess values for system-dependent variables and create Makefiles.
120-# Generated by GNU Autoconf 2.67 for libdbusmenu 0.3.101.
121+# Generated by GNU Autoconf 2.67 for libdbusmenu 0.3.102.
122 #
123 # Report bugs to <ted@canonical.com>.
124 #
125@@ -703,8 +703,8 @@
126 # Identity of this package.
127 PACKAGE_NAME='libdbusmenu'
128 PACKAGE_TARNAME='libdbusmenu'
129-PACKAGE_VERSION='0.3.101'
130-PACKAGE_STRING='libdbusmenu 0.3.101'
131+PACKAGE_VERSION='0.3.102'
132+PACKAGE_STRING='libdbusmenu 0.3.102'
133 PACKAGE_BUGREPORT='ted@canonical.com'
134 PACKAGE_URL=''
135
136@@ -1541,7 +1541,7 @@
137 # Omit some internal or obsolete options to make the list less imposing.
138 # This message is too long to be a string in the A/UX 3.1 sh.
139 cat <<_ACEOF
140-\`configure' configures libdbusmenu 0.3.101 to adapt to many kinds of systems.
141+\`configure' configures libdbusmenu 0.3.102 to adapt to many kinds of systems.
142
143 Usage: $0 [OPTION]... [VAR=VALUE]...
144
145@@ -1611,7 +1611,7 @@
146
147 if test -n "$ac_init_help"; then
148 case $ac_init_help in
149- short | recursive ) echo "Configuration of libdbusmenu 0.3.101:";;
150+ short | recursive ) echo "Configuration of libdbusmenu 0.3.102:";;
151 esac
152 cat <<\_ACEOF
153
154@@ -1751,7 +1751,7 @@
155 test -n "$ac_init_help" && exit $ac_status
156 if $ac_init_version; then
157 cat <<\_ACEOF
158-libdbusmenu configure 0.3.101
159+libdbusmenu configure 0.3.102
160 generated by GNU Autoconf 2.67
161
162 Copyright (C) 2010 Free Software Foundation, Inc.
163@@ -2122,7 +2122,7 @@
164 This file contains any messages produced by compilers while
165 running configure, to aid debugging if configure makes a mistake.
166
167-It was created by libdbusmenu $as_me 0.3.101, which was
168+It was created by libdbusmenu $as_me 0.3.102, which was
169 generated by GNU Autoconf 2.67. Invocation command line was
170
171 $ $0 $@
172@@ -2943,7 +2943,7 @@
173
174 # Define the identity of the package.
175 PACKAGE=libdbusmenu
176- VERSION=0.3.101
177+ VERSION=0.3.102
178
179
180 # Some tools Automake needs.
181@@ -13294,7 +13294,7 @@
182 ###########################
183
184 LIBDBUSMENU_CURRENT=3
185-LIBDBUSMENU_REVISION=9
186+LIBDBUSMENU_REVISION=10
187 LIBDBUSMENU_AGE=0
188
189
190@@ -14616,7 +14616,7 @@
191 # report actual input values of CONFIG_FILES etc. instead of their
192 # values after options handling.
193 ac_log="
194-This file was extended by libdbusmenu $as_me 0.3.101, which was
195+This file was extended by libdbusmenu $as_me 0.3.102, which was
196 generated by GNU Autoconf 2.67. Invocation command line was
197
198 CONFIG_FILES = $CONFIG_FILES
199@@ -14682,7 +14682,7 @@
200 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
201 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
202 ac_cs_version="\\
203-libdbusmenu config.status 0.3.101
204+libdbusmenu config.status 0.3.102
205 configured by $0, generated by GNU Autoconf 2.67,
206 with options \\"\$ac_cs_config\\"
207
208
209=== modified file 'configure.ac'
210--- configure.ac 2011-03-10 17:05:16 +0000
211+++ configure.ac 2011-03-16 19:16:36 +0000
212@@ -1,11 +1,11 @@
213
214-AC_INIT(libdbusmenu, 0.3.101, ted@canonical.com)
215+AC_INIT(libdbusmenu, 0.3.102, ted@canonical.com)
216 AC_COPYRIGHT([Copyright 2009,2010 Canonical])
217
218 AC_PREREQ(2.62)
219
220 AM_CONFIG_HEADER(config.h)
221-AM_INIT_AUTOMAKE(libdbusmenu, 0.3.101, [-Wno-portability])
222+AM_INIT_AUTOMAKE(libdbusmenu, 0.3.102, [-Wno-portability])
223
224 AM_MAINTAINER_MODE
225
226@@ -134,7 +134,7 @@
227 ###########################
228
229 LIBDBUSMENU_CURRENT=3
230-LIBDBUSMENU_REVISION=9
231+LIBDBUSMENU_REVISION=10
232 LIBDBUSMENU_AGE=0
233
234 AC_SUBST(LIBDBUSMENU_CURRENT)
235
236=== modified file 'debian/changelog'
237--- debian/changelog 2011-03-10 19:11:17 +0000
238+++ debian/changelog 2011-03-16 19:16:36 +0000
239@@ -1,3 +1,16 @@
240+libdbusmenu (0.3.102-0ubuntu1~ppa1) natty; urgency=low
241+
242+ * New upstream release.
243+ ∘ Remove child items when they're removed by GTK
244+ ∘ Adding opened and closed events for menu visibility
245+ ∘ Handle empty image types
246+ ∘ Remove critical warning on parser menuitem check (LP: #733918)
247+ ∘ Fix dependencies in pkgconfig files (LP: #733263)
248+ ∘ Handle NULL labels (LP: #733688)
249+ ∘ Fix memory leaks from variants (LP: #722972)
250+
251+ -- Ted Gould <ted@ubuntu.com> Wed, 16 Mar 2011 14:08:13 -0500
252+
253 libdbusmenu (0.3.101-0ubuntu1) natty; urgency=low
254
255 * New upstream release.
256
257=== modified file 'docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt'
258--- docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt 2011-03-03 18:27:37 +0000
259+++ docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt 2011-03-16 19:16:36 +0000
260@@ -70,6 +70,9 @@
261 DBUSMENU_MENUITEM_SHORTCUT_CONTROL
262 DBUSMENU_MENUITEM_SHORTCUT_SHIFT
263 DBUSMENU_MENUITEM_SHORTCUT_SUPER
264+DBUSMENU_MENUITEM_EVENT_ACTIVATED
265+DBUSMENU_MENUITEM_EVENT_CLOSED
266+DBUSMENU_MENUITEM_EVENT_OPENED
267 DbusmenuMenuitem
268 dbusmenu_menuitem_about_to_show_cb
269 dbusmenu_menuitem_buildvariant_slot_t
270
271=== modified file 'docs/libdbusmenu-glib/reference/version.xml'
272--- docs/libdbusmenu-glib/reference/version.xml 2011-03-10 17:05:16 +0000
273+++ docs/libdbusmenu-glib/reference/version.xml 2011-03-16 19:16:36 +0000
274@@ -1,1 +1,1 @@
275-0.3.101
276+0.3.102
277
278=== modified file 'docs/libdbusmenu-gtk/reference/version.xml'
279--- docs/libdbusmenu-gtk/reference/version.xml 2011-03-10 17:05:16 +0000
280+++ docs/libdbusmenu-gtk/reference/version.xml 2011-03-16 19:16:36 +0000
281@@ -1,1 +1,1 @@
282-0.3.101
283+0.3.102
284
285=== modified file 'libdbusmenu-glib/client.c'
286--- libdbusmenu-glib/client.c 2011-03-10 17:05:16 +0000
287+++ libdbusmenu-glib/client.c 2011-03-16 19:16:36 +0000
288@@ -598,20 +598,27 @@
289 }
290
291 /* Callback all the folks we can find */
292- GVariantIter * iter = g_variant_iter_new(g_variant_get_child_value(params, 0));
293- GVariant * child;
294+ GVariant * child = g_variant_get_child_value(params, 0);
295+ GVariantIter * iter = g_variant_iter_new(child);
296+ g_variant_unref(child);
297 while ((child = g_variant_iter_next_value(iter)) != NULL) {
298 if (g_strcmp0(g_variant_get_type_string(child), "(ia{sv})") != 0) {
299 g_warning("Properties return signature is not '(ia{sv})' it is '%s'", g_variant_get_type_string(child));
300+ g_variant_unref(child);
301 continue;
302 }
303
304- gint id = g_variant_get_int32(g_variant_get_child_value(child, 0));
305+ GVariant * idv = g_variant_get_child_value(child, 0);
306+ gint id = g_variant_get_int32(idv);
307+ g_variant_unref(idv);
308+
309 GVariant * properties = g_variant_get_child_value(child, 1);
310
311 properties_listener_t * listener = find_listener(listeners, 0, id);
312 if (listener == NULL) {
313 g_warning("Unable to find listener for ID %d", id);
314+ g_variant_unref(properties);
315+ g_variant_unref(child);
316 continue;
317 }
318
319@@ -621,6 +628,8 @@
320 } else {
321 g_warning("Odd, we've already replied to the listener on ID %d", id);
322 }
323+ g_variant_unref(properties);
324+ g_variant_unref(child);
325 }
326 g_variant_iter_free(iter);
327 g_variant_unref(params);
328@@ -676,7 +685,9 @@
329 GVariant * variant_ids = g_variant_builder_end(&builder);
330
331 /* Build up a prop list to pass */
332- g_variant_builder_init(&builder, g_variant_type_new("as"));
333+ GVariantType * type = g_variant_type_new("as");
334+ g_variant_builder_init(&builder, type);
335+ g_variant_type_free(type);
336 /* TODO: need to use delayed property list here */
337 GVariant * variant_props = g_variant_builder_end(&builder);
338
339@@ -1050,12 +1061,13 @@
340 /* Check the text direction if available */
341 GVariant * textdir = g_dbus_proxy_get_cached_property(priv->menuproxy, "TextDirection");
342 if (textdir != NULL) {
343- GVariant * str = textdir;
344- if (g_variant_is_of_type(str, G_VARIANT_TYPE_VARIANT)) {
345- str = g_variant_get_variant(str);
346+ if (g_variant_is_of_type(textdir, G_VARIANT_TYPE_VARIANT)) {
347+ GVariant * tmp = g_variant_get_variant(textdir);
348+ g_variant_unref(textdir);
349+ textdir = tmp;
350 }
351
352- priv->text_direction = dbusmenu_text_direction_get_value_from_nick(g_variant_get_string(str, NULL));
353+ priv->text_direction = dbusmenu_text_direction_get_value_from_nick(g_variant_get_string(textdir, NULL));
354 g_object_notify(G_OBJECT(user_data), DBUSMENU_CLIENT_PROP_TEXT_DIRECTION);
355
356 g_variant_unref(textdir);
357@@ -1063,13 +1075,14 @@
358
359 /* Check the status if available */
360 GVariant * status = g_dbus_proxy_get_cached_property(priv->menuproxy, "Status");
361- if (textdir != NULL) {
362- GVariant * str = status;
363- if (g_variant_is_of_type(str, G_VARIANT_TYPE_VARIANT)) {
364- str = g_variant_get_variant(str);
365+ if (status != NULL) {
366+ if (g_variant_is_of_type(status, G_VARIANT_TYPE_VARIANT)) {
367+ GVariant * tmp = g_variant_get_variant(status);
368+ g_variant_unref(status);
369+ status = tmp;
370 }
371
372- priv->status = dbusmenu_status_get_value_from_nick(g_variant_get_string(str, NULL));
373+ priv->status = dbusmenu_status_get_value_from_nick(g_variant_get_string(status, NULL));
374 g_object_notify(G_OBJECT(user_data), DBUSMENU_CLIENT_PROP_STATUS);
375
376 g_variant_unref(status);
377@@ -1142,20 +1155,22 @@
378 g_variant_iter_init(&iters, properties);
379 while (g_variant_iter_next(&iters, "{sv}", &key, &value)) {
380 if (g_strcmp0(key, "TextDirection") == 0) {
381- GVariant * str = value;
382- if (g_variant_is_of_type(str, G_VARIANT_TYPE_VARIANT)) {
383- str = g_variant_get_variant(str);
384+ if (g_variant_is_of_type(value, G_VARIANT_TYPE_VARIANT)) {
385+ GVariant * tmp = g_variant_get_variant(value);
386+ g_variant_unref(value);
387+ value = tmp;
388 }
389
390- priv->text_direction = dbusmenu_text_direction_get_value_from_nick(g_variant_get_string(str, NULL));
391+ priv->text_direction = dbusmenu_text_direction_get_value_from_nick(g_variant_get_string(value, NULL));
392 }
393 if (g_strcmp0(key, "Status") == 0) {
394- GVariant * str = value;
395- if (g_variant_is_of_type(str, G_VARIANT_TYPE_VARIANT)) {
396- str = g_variant_get_variant(str);
397+ if (g_variant_is_of_type(value, G_VARIANT_TYPE_VARIANT)) {
398+ GVariant * tmp = g_variant_get_variant(value);
399+ g_variant_unref(value);
400+ value = tmp;
401 }
402
403- priv->status = dbusmenu_status_get_value_from_nick(g_variant_get_string(str, NULL));
404+ priv->status = dbusmenu_status_get_value_from_nick(g_variant_get_string(value, NULL));
405 }
406 if (g_strcmp0(key, "IconThemePath") == 0) {
407 if (priv->icon_dirs != NULL) {
408@@ -1224,11 +1239,14 @@
409 /* Remove before adding just incase there is a duplicate, against the
410 rules, but we can handle it so let's do it. */
411 GVariantIter ritems;
412- g_variant_iter_init(&ritems, g_variant_get_child_value(params, 1));
413+ GVariant * ritemsv = g_variant_get_child_value(params, 1);
414+ g_variant_iter_init(&ritems, ritemsv);
415
416 GVariant * ritem;
417 while ((ritem = g_variant_iter_next_value(&ritems)) != NULL) {
418- gint id = g_variant_get_int32(g_variant_get_child_value(ritem, 0));
419+ GVariant * idv = g_variant_get_child_value(ritem, 0);
420+ gint id = g_variant_get_int32(idv);
421+ g_variant_unref(idv);
422 DbusmenuMenuitem * menuitem = dbusmenu_menuitem_find_id(priv->root, id);
423
424 if (menuitem == NULL) {
425@@ -1236,7 +1254,8 @@
426 }
427
428 GVariantIter properties;
429- g_variant_iter_init(&properties, g_variant_get_child_value(ritem, 1));
430+ GVariant * propv = g_variant_get_child_value(ritem, 1);
431+ g_variant_iter_init(&properties, propv);
432 gchar * property;
433
434 while (g_variant_iter_next(&properties, "s", &property)) {
435@@ -1245,16 +1264,23 @@
436 g_free(property);
437 }
438 g_variant_unref(ritem);
439+ g_variant_unref(propv);
440 }
441+ g_variant_unref(ritemsv);
442
443 GVariantIter items;
444- g_variant_iter_init(&items, g_variant_get_child_value(params, 0));
445+ GVariant * itemsv = g_variant_get_child_value(params, 0);
446+ g_variant_iter_init(&items, itemsv);
447
448 GVariant * item;
449 while ((item = g_variant_iter_next_value(&items)) != NULL) {
450- gint id = g_variant_get_int32(g_variant_get_child_value(item, 0));
451+ GVariant * idv = g_variant_get_child_value(item, 0);
452+ gint id = g_variant_get_int32(idv);
453+ g_variant_unref(idv);
454+
455 GVariantIter properties;
456- g_variant_iter_init(&properties, g_variant_get_child_value(item, 1));
457+ GVariant * propv = g_variant_get_child_value(item, 1);
458+ g_variant_iter_init(&properties, propv);
459 gchar * property;
460 GVariant * value;
461
462@@ -1263,14 +1289,21 @@
463 if (G_LIKELY(g_variant_is_of_type(value, G_VARIANT_TYPE_VARIANT))) {
464 /* Unboxing if needed */
465 internalvalue = g_variant_get_variant(value);
466+ g_variant_unref(value);
467 }
468 id_prop_update(proxy, id, property, internalvalue, client);
469+ g_variant_unref(internalvalue);
470 }
471+ g_variant_unref(propv);
472+ g_variant_unref(item);
473 }
474+ g_variant_unref(itemsv);
475 } else if (g_strcmp0(signal, "ItemPropertyUpdated") == 0) {
476 gint id; gchar * property; GVariant * value;
477 g_variant_get(params, "(isv)", &id, &property, &value);
478 id_prop_update(proxy, id, property, value, client);
479+ g_free(property);
480+ g_variant_unref(value);
481 } else if (g_strcmp0(signal, "ItemUpdated") == 0) {
482 gint id;
483 g_variant_get(params, "(i)", &id);
484@@ -1594,7 +1627,9 @@
485 }
486
487 /* First verify and figure out what we've got */
488- gint id = g_variant_get_int32(g_variant_get_child_value(layout, 0));
489+ GVariant * idv = g_variant_get_child_value(layout, 0);
490+ gint id = g_variant_get_int32(idv);
491+ g_variant_unref(idv);
492 if (id < 0) {
493 return NULL;
494 }
495@@ -1607,8 +1642,10 @@
496
497 /* Some variables */
498 GVariantIter children;
499- g_variant_iter_init(&children, g_variant_get_child_value(layout, 2));
500- GVariant * child;
501+ GVariant * childrenv;
502+
503+ childrenv = g_variant_get_child_value(layout, 2);
504+ g_variant_iter_init(&children, childrenv);
505
506 guint position = 0;
507 GList * oldchildren = g_list_copy(dbusmenu_menuitem_get_children(item));
508@@ -1616,16 +1653,22 @@
509
510 /* Go through all the XML Nodes and make sure that we have menuitems
511 to cover those XML nodes. */
512+ GVariant * child;
513 while ((child = g_variant_iter_next_value(&children)) != NULL) {
514 /* g_debug("Looking at child: %d", position); */
515 if (g_variant_is_of_type(child, G_VARIANT_TYPE_VARIANT)) {
516- child = g_variant_get_variant(child);
517+ GVariant * tmp = g_variant_get_variant(child);
518+ g_variant_unref(child);
519+ child = tmp;
520 }
521
522- gint childid = g_variant_get_int32(g_variant_get_child_value(child, 0));
523+ GVariant * childidv = g_variant_get_child_value(child, 0);
524+ gint childid = g_variant_get_int32(childidv);
525+ g_variant_unref(childidv);
526 if (childid < 0) {
527 /* Don't increment the position when there isn't a valid
528 node in the XML tree. It's probably a comment. */
529+ g_variant_unref(child);
530 continue;
531 }
532 DbusmenuMenuitem * childmi = NULL;
533@@ -1665,10 +1708,12 @@
534 GVariantIter iter;
535 gchar * prop;
536 GVariant * value;
537+ GVariant * child_props;
538
539 /* Set the type first as it can manage the behavior of
540 all other properties. */
541- g_variant_iter_init(&iter, g_variant_get_child_value(child, 1));
542+ child_props = g_variant_get_child_value(child, 1);
543+ g_variant_iter_init(&iter, child_props);
544 while (g_variant_iter_next(&iter, "{sv}", &prop, &value)) {
545 if (g_strcmp0(prop, DBUSMENU_MENUITEM_PROP_TYPE) == 0) {
546 dbusmenu_menuitem_property_set_variant(childmi, prop, value);
547@@ -1678,15 +1723,17 @@
548 }
549
550 /* Now go through and do all the properties. */
551- g_variant_iter_init(&iter, g_variant_get_child_value(child, 1));
552+ g_variant_iter_init(&iter, child_props);
553 while (g_variant_iter_next(&iter, "{sv}", &prop, &value)) {
554 dbusmenu_menuitem_property_set_variant(childmi, prop, value);
555 g_free(prop);
556 g_variant_unref(value);
557 }
558+ g_variant_unref(child_props);
559 }
560
561 position++;
562+ g_variant_unref(child);
563 }
564
565 /* Remove any children that are no longer used by this version of
566@@ -1709,19 +1756,24 @@
567 }
568
569 /* now it's time to recurse down the tree. */
570- g_variant_iter_init(&children, g_variant_get_child_value(layout, 2));
571+ g_variant_iter_init(&children, childrenv);
572
573 child = g_variant_iter_next_value(&children);
574 GList * childmis = dbusmenu_menuitem_get_children(item);
575 while (child != NULL && childmis != NULL) {
576 if (g_variant_is_of_type(child, G_VARIANT_TYPE_VARIANT)) {
577- child = g_variant_get_variant(child);
578+ GVariant * tmp = g_variant_get_variant(child);
579+ g_variant_unref(child);
580+ child = tmp;
581 }
582
583- gint xmlid = g_variant_get_int32(g_variant_get_child_value(child, 0));
584+ GVariant * xmlidv = g_variant_get_child_value(child, 0);
585+ gint xmlid = g_variant_get_int32(xmlidv);
586+ g_variant_unref(xmlidv);
587 /* If this isn't a valid menu item we need to move on
588 until we have one. This avoids things like comments. */
589 if (xmlid < 0) {
590+ g_variant_unref(child);
591 child = g_variant_iter_next_value(&children);
592 continue;
593 }
594@@ -1733,10 +1785,13 @@
595
596 parse_layout_xml(client, child, DBUSMENU_MENUITEM(childmis->data), item, proxy);
597
598+ g_variant_unref(child);
599 child = g_variant_iter_next_value(&children);
600 childmis = g_list_next(childmis);
601 }
602
603+ g_variant_unref(childrenv);
604+
605 if (child != NULL) {
606 g_warning("Sync failed, now we've got extra layout nodes.");
607 }
608@@ -1801,6 +1856,7 @@
609
610 GError * error = NULL;
611 GVariant * params = NULL;
612+ GVariant * layout = NULL;
613
614 params = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, &error);
615
616@@ -1810,8 +1866,11 @@
617 goto out;
618 }
619
620- guint rev = g_variant_get_uint32(g_variant_get_child_value(params, 0));
621- GVariant * layout = g_variant_get_child_value(params, 1);
622+ GVariant * revv = g_variant_get_child_value(params, 0);
623+ guint rev = g_variant_get_uint32(revv);
624+ g_variant_unref(revv);
625+
626+ layout = g_variant_get_child_value(params, 1);
627
628 guint parseable = parse_layout(client, layout);
629
630@@ -1839,6 +1898,10 @@
631 priv->layoutcall = NULL;
632 }
633
634+ if (layout != NULL) {
635+ g_variant_unref(layout);
636+ }
637+
638 if (params != NULL) {
639 g_variant_unref(params);
640 }
641
642=== modified file 'libdbusmenu-glib/dbus-menu.xml'
643--- libdbusmenu-glib/dbus-menu.xml 2011-03-03 19:48:56 +0000
644+++ libdbusmenu-glib/dbus-menu.xml 2011-03-16 19:16:36 +0000
645@@ -294,6 +294,8 @@
646
647 @li "clicked"
648 @li "hovered"
649+ @li "opened"
650+ @li "closed"
651
652 Vendor specific events can be added by prefixing them with "x-<vendor>-"
653 ]]></dox:d>
654
655=== modified file 'libdbusmenu-glib/enum-types.c'
656--- libdbusmenu-glib/enum-types.c 2011-02-24 21:06:19 +0000
657+++ libdbusmenu-glib/enum-types.c 2011-03-16 19:16:36 +0000
658@@ -30,7 +30,7 @@
659
660 #include "enum-types.h"
661
662-#include "./types.h"
663+#include "types.h"
664 /**
665 dbusmenu_text_direction_get_type:
666
667
668=== modified file 'libdbusmenu-glib/enum-types.h'
669--- libdbusmenu-glib/enum-types.h 2011-02-24 21:06:19 +0000
670+++ libdbusmenu-glib/enum-types.h 2011-03-16 19:16:36 +0000
671@@ -36,10 +36,13 @@
672 G_BEGIN_DECLS
673
674 /* Enumerations from file: "./types.h" */
675-#include "./types.h"
676+#include "types.h"
677+
678+
679 GType dbusmenu_text_direction_get_type (void) G_GNUC_CONST;
680 const gchar * dbusmenu_text_direction_get_nick (DbusmenuTextDirection value) G_GNUC_CONST;
681 DbusmenuTextDirection dbusmenu_text_direction_get_value_from_nick (const gchar * nick) G_GNUC_CONST;
682+
683 /**
684 DBUSMENU_TYPE_TEXT_DIRECTION:
685
686@@ -48,9 +51,11 @@
687 */
688 #define DBUSMENU_TYPE_TEXT_DIRECTION (dbusmenu_text_direction_get_type())
689
690+
691 GType dbusmenu_status_get_type (void) G_GNUC_CONST;
692 const gchar * dbusmenu_status_get_nick (DbusmenuStatus value) G_GNUC_CONST;
693 DbusmenuStatus dbusmenu_status_get_value_from_nick (const gchar * nick) G_GNUC_CONST;
694+
695 /**
696 DBUSMENU_TYPE_STATUS:
697
698
699=== modified file 'libdbusmenu-glib/menuitem.c'
700--- libdbusmenu-glib/menuitem.c 2011-03-07 19:56:53 +0000
701+++ libdbusmenu-glib/menuitem.c 2011-03-16 19:16:36 +0000
702@@ -430,7 +430,7 @@
703 static void
704 handle_event (DbusmenuMenuitem * mi, const gchar * name, GVariant * value, guint timestamp)
705 {
706- if (g_strcmp0(name, "clicked") == 0) {
707+ if (g_strcmp0(name, DBUSMENU_MENUITEM_EVENT_ACTIVATED) == 0) {
708 g_signal_emit(G_OBJECT(mi), signals[ITEM_ACTIVATED], 0, timestamp, TRUE);
709 }
710
711
712=== modified file 'libdbusmenu-glib/menuitem.h'
713--- libdbusmenu-glib/menuitem.h 2011-02-24 16:52:10 +0000
714+++ libdbusmenu-glib/menuitem.h 2011-03-16 19:16:36 +0000
715@@ -267,6 +267,32 @@
716 */
717 #define DBUSMENU_MENUITEM_CHILD_DISPLAY_SUBMENU "submenu"
718
719+/**
720+ * DBUSMENU_MENUITEM_EVENT_ACTIVATED:
721+ *
722+ * String for the event identifier when a menu item is clicked
723+ * on by the user.
724+ */
725+#define DBUSMENU_MENUITEM_EVENT_ACTIVATED "clicked"
726+
727+/**
728+ * DBUSMENU_MENUITEM_EVENT_OPENED:
729+ *
730+ * String for the event identifier when a menu is opened and
731+ * displayed to the user. Only valid for items that contain
732+ * submenus.
733+ */
734+#define DBUSMENU_MENUITEM_EVENT_OPENED "opened"
735+
736+/**
737+ * DBUSMENU_MENUITEM_EVENT_CLOSED:
738+ *
739+ * String for the event identifier when a menu is closed and
740+ * displayed to the user. Only valid for items that contain
741+ * submenus.
742+ */
743+#define DBUSMENU_MENUITEM_EVENT_CLOSED "closed"
744+
745 typedef struct _DbusmenuMenuitemPrivate DbusmenuMenuitemPrivate;
746
747 /**
748
749=== modified file 'libdbusmenu-gtk/client.c'
750--- libdbusmenu-gtk/client.c 2011-03-10 16:27:52 +0000
751+++ libdbusmenu-gtk/client.c 2011-03-16 19:16:36 +0000
752@@ -458,7 +458,7 @@
753 {
754 if (gtk_menu_item_get_submenu(gmi) == NULL) {
755 GVariant * variant = g_variant_new("i", 0);
756- dbusmenu_menuitem_handle_event(mi, "clicked", variant, gtk_get_current_event_time());
757+ dbusmenu_menuitem_handle_event(mi, DBUSMENU_MENUITEM_EVENT_ACTIVATED, variant, gtk_get_current_event_time());
758 } else {
759 /* TODO: We need to stop the display of the submenu
760 until this callback returns. */
761@@ -467,6 +467,15 @@
762 return TRUE;
763 }
764
765+static void
766+submenu_notify_visible_cb (GtkWidget * menu, GParamSpec * pspec, DbusmenuMenuitem * mi)
767+{
768+ if (gtk_widget_get_visible (menu))
769+ dbusmenu_menuitem_handle_event(mi, DBUSMENU_MENUITEM_EVENT_OPENED, NULL, gtk_get_current_event_time());
770+ else
771+ dbusmenu_menuitem_handle_event(mi, DBUSMENU_MENUITEM_EVENT_CLOSED, NULL, gtk_get_current_event_time());
772+}
773+
774 /* Process the visible property */
775 static void
776 process_visible (DbusmenuMenuitem * mi, GtkMenuItem * gmi, GVariant * value)
777@@ -740,11 +749,12 @@
778
779 GtkMenuItem * parent = dbusmenu_gtkclient_menuitem_get(gtkclient, mi);
780 gtk_menu_item_set_submenu(parent, GTK_WIDGET(menu));
781+
782+ g_signal_connect(menu, "notify::visible", G_CALLBACK(submenu_notify_visible_cb), mi);
783 }
784
785 GtkMenuItem * childmi = dbusmenu_gtkclient_menuitem_get(gtkclient, child);
786 gtk_menu_shell_insert(GTK_MENU_SHELL(menu), GTK_WIDGET(childmi), position);
787- gtk_widget_show(GTK_WIDGET(menu));
788
789 return;
790 }
791
792=== modified file 'libdbusmenu-gtk/dbusmenu-gtk-0.4.pc.in'
793--- libdbusmenu-gtk/dbusmenu-gtk-0.4.pc.in 2010-12-08 15:27:48 +0000
794+++ libdbusmenu-gtk/dbusmenu-gtk-0.4.pc.in 2011-03-16 19:16:36 +0000
795@@ -5,7 +5,7 @@
796 includedir=@includedir@
797
798 Cflags: -I${includedir}/libdbusmenu-0.4
799-Requires: dbusmenu-glib-0.4
800+Requires: dbusmenu-glib-0.4 gdk-pixbuf-2.0 gtk+-2.0
801 Libs: -L${libdir} -ldbusmenu-gtk
802
803 Name: libdbusmenu-gtk
804
805=== modified file 'libdbusmenu-gtk/dbusmenu-gtk3-0.4.pc.in'
806--- libdbusmenu-gtk/dbusmenu-gtk3-0.4.pc.in 2010-12-08 15:27:48 +0000
807+++ libdbusmenu-gtk/dbusmenu-gtk3-0.4.pc.in 2011-03-16 19:16:36 +0000
808@@ -5,7 +5,7 @@
809 includedir=@includedir@
810
811 Cflags: -I${includedir}/libdbusmenu-0.4
812-Requires: dbusmenu-glib-0.4
813+Requires: dbusmenu-glib-0.4 gdk-pixbuf-2.0 gtk+-3.0
814 Libs: -L${libdir} -ldbusmenu-gtk3
815
816 Name: libdbusmenu-gtk3
817
818=== modified file 'libdbusmenu-gtk/parser.c'
819--- libdbusmenu-gtk/parser.c 2011-03-10 17:05:16 +0000
820+++ libdbusmenu-gtk/parser.c 2011-03-16 19:16:36 +0000
821@@ -69,6 +69,9 @@
822 static void child_added_cb (GtkContainer * menu,
823 GtkWidget * widget,
824 gpointer data);
825+static void child_removed_cb (GtkContainer * menu,
826+ GtkWidget * widget,
827+ gpointer data);
828 static void theme_changed_cb (GtkIconTheme * theme,
829 gpointer data);
830 static void item_activated (DbusmenuMenuitem * item,
831@@ -98,15 +101,25 @@
832 DbusmenuMenuitem *
833 dbusmenu_gtk_parse_menu_structure (GtkWidget * widget)
834 {
835- g_return_val_if_fail(GTK_IS_MENU_ITEM(widget) || GTK_IS_MENU_SHELL(widget), NULL);
836-
837- RecurseContext recurse = {0};
838-
839- recurse.toplevel = gtk_widget_get_toplevel(widget);
840-
841- parse_menu_structure_helper(widget, &recurse);
842-
843- return recurse.parent;
844+ g_return_val_if_fail(GTK_IS_MENU_ITEM(widget) || GTK_IS_MENU_SHELL(widget), NULL);
845+
846+ DbusmenuMenuitem * returnval = NULL;
847+ gpointer data = g_object_get_data(G_OBJECT(widget), CACHED_MENUITEM);
848+
849+ if (data == NULL) {
850+ RecurseContext recurse = {0};
851+
852+ recurse.toplevel = gtk_widget_get_toplevel(widget);
853+
854+ parse_menu_structure_helper(widget, &recurse);
855+
856+ returnval = recurse.parent;
857+ } else {
858+ returnval = DBUSMENU_MENUITEM(data);
859+ g_object_ref(G_OBJECT(returnval));
860+ }
861+
862+ return returnval;
863 }
864
865 /**
866@@ -124,7 +137,9 @@
867 DbusmenuMenuitem *
868 dbusmenu_gtk_parse_get_cached_item (GtkWidget * widget)
869 {
870- g_return_val_if_fail(GTK_IS_MENU_ITEM(widget), NULL);
871+ if (!GTK_IS_MENU_ITEM(widget)) {
872+ return NULL;
873+ }
874 return DBUSMENU_MENUITEM(g_object_get_data(G_OBJECT(widget), CACHED_MENUITEM));
875 }
876
877@@ -160,6 +175,8 @@
878 if (pdata != NULL && pdata->shell != NULL) {
879 g_signal_handlers_disconnect_matched(pdata->shell, (GSignalMatchType)G_SIGNAL_MATCH_FUNC,
880 0, 0, NULL, G_CALLBACK(child_added_cb), NULL);
881+ g_signal_handlers_disconnect_matched(pdata->shell, (GSignalMatchType)G_SIGNAL_MATCH_FUNC,
882+ 0, 0, NULL, G_CALLBACK(child_removed_cb), NULL);
883 g_object_remove_weak_pointer(G_OBJECT(pdata->shell), (gpointer*)&pdata->shell);
884 }
885
886@@ -246,7 +263,6 @@
887 static void
888 parse_menu_structure_helper (GtkWidget * widget, RecurseContext * recurse)
889 {
890-
891 /* If this is a shell, then let's handle the items in it. */
892 if (GTK_IS_MENU_SHELL (widget)) {
893 /* Okay, this is a little janky and all.. but some applications update some
894@@ -282,6 +298,10 @@
895 "child-added",
896 G_CALLBACK (child_added_cb),
897 recurse->parent);
898+ g_signal_connect (G_OBJECT (widget),
899+ "child-removed",
900+ G_CALLBACK (child_removed_cb),
901+ recurse->parent);
902 g_object_add_weak_pointer(G_OBJECT (widget), (gpointer*)&pdata->shell);
903 }
904
905@@ -371,14 +391,20 @@
906 which we don't. */
907 gchar * sanitized = NULL;
908 GError * error = NULL;
909+
910+ if (label == NULL) {
911+ return NULL;
912+ }
913+
914 if (pango_parse_markup (label, -1, 0, NULL, &sanitized, NULL, &error)) {
915 return sanitized;
916 }
917- else {
918+
919+ if (error != NULL) {
920 g_warning ("Could not parse '%s': %s", label, error->message);
921 g_error_free (error);
922- return g_strdup (label);
923 }
924+ return g_strdup (label);
925 }
926
927 static gchar *
928@@ -533,6 +559,10 @@
929 "child-added",
930 G_CALLBACK (child_added_cb),
931 mi);
932+ g_signal_connect (G_OBJECT (submenu),
933+ "child-removed",
934+ G_CALLBACK (child_removed_cb),
935+ mi);
936 g_object_add_weak_pointer(G_OBJECT(submenu), (gpointer*)&pdata->shell);
937 }
938
939@@ -625,6 +655,9 @@
940
941 if (image != NULL && should_show_image (image)) {
942 switch (gtk_image_get_storage_type (image)) {
943+ case GTK_IMAGE_EMPTY:
944+ break;
945+
946 case GTK_IMAGE_PIXBUF:
947 pixbuf = g_object_ref (gtk_image_get_pixbuf (image));
948 break;
949@@ -940,6 +973,28 @@
950 parse_menu_structure_helper(widget, &recurse);
951 }
952
953+/* A child item was added to a menu we're watching. Let's try to integrate it. */
954+static void
955+child_removed_cb (GtkContainer *menu, GtkWidget *widget, gpointer data)
956+{
957+ gpointer pmi = g_object_get_data(G_OBJECT(widget), CACHED_MENUITEM);
958+ if (pmi == NULL) {
959+ return;
960+ }
961+
962+ DbusmenuMenuitem * child = DBUSMENU_MENUITEM(pmi);
963+
964+ pmi = g_object_get_data(G_OBJECT(menu), CACHED_MENUITEM);
965+ if (pmi == NULL) {
966+ return;
967+ }
968+
969+ DbusmenuMenuitem * parent = DBUSMENU_MENUITEM(pmi);
970+
971+ dbusmenu_menuitem_child_delete(parent, child);
972+ return;
973+}
974+
975 static void
976 theme_changed_cb (GtkIconTheme *theme, gpointer data)
977 {

Subscribers

People subscribed via source and target branches

to all changes: