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
=== modified file 'ChangeLog'
--- ChangeLog 2011-03-10 17:03:04 +0000
+++ ChangeLog 2011-03-16 19:16:36 +0000
@@ -1,5 +1,108 @@
1# Generated by Makefile. Do not edit.1# Generated by Makefile. Do not edit.
22
32011-03-16 Ted Gould <ted@gould.cx>
4
5 0.3.102
6
72011-03-16 Ted Gould <ted@gould.cx>
8
9 Add handling for children getting removed
10
112011-03-09 Ted Gould <ted@gould.cx>
12
13 Update to current trunk
14
152011-03-08 Ted Gould <ted@gould.cx>
16
17 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.
18
192011-03-08 Ted Gould <ted@gould.cx>
20
21 Disconnecting the child removed handlers
22
232011-03-08 Ted Gould <ted@gould.cx>
24
25 Removing the dbusmenu menuitem from the parent if it gets removed on the GTK side
26
272011-03-08 Ted Gould <ted@gould.cx>
28
29 Add a callback for child-removed as well
30
312011-03-16 Ted Gould <ted@gould.cx>
32
33 Adding defines for the event identifiers
34
352011-03-16 Ted Gould <ted@gould.cx>
36
37 Adding event defines to the documentation.
38
392011-03-16 Ted Gould <ted@gould.cx>
40
41 Adding opened and closed to the spec
42
432011-03-16 Ted Gould <ted@gould.cx>
44
45 Using the new defines
46
472011-03-16 Ted Gould <ted@gould.cx>
48
49 Adding defines for the event ids
50
512011-03-16 Ted Gould <ted@gould.cx>
52
53 Send open and close signals when menu visibility changes.
54
552011-03-16 Michael Terry <mike@mterry.name>
56
57 add opened and closed events
58
592011-03-16 Ted Gould <ted@gould.cx>
60
61 Empty images are images too
62
632011-03-16 Michael Terry <mike@mterry.name>
64
65 handle empty image types
66
672011-03-16 Ted Gould <ted@gould.cx>
68
69 Removing a noisy warning
70
712011-03-15 Ted Gould <ted@gould.cx>
72
73 Not everything is a menuitem
74
752011-03-16 Ted Gould <ted@gould.cx>
76
77 Adding needed dependencies to pkgconfig files
78
792011-03-15 Ted Gould <ted@gould.cx>
80
81 Adding needed requirements to pkgconfig files.
82
832011-03-14 Ted Gould <ted@gould.cx>
84
85 Handle NULL better in finding the label
86
872011-03-14 Michael Terry <mike@mterry.name>
88
89 be a little more cautious about pointers in sanitize_label_text
90
912011-03-14 Ted Gould <ted@gould.cx>
92
93 Lots of memory leak fixes
94
952011-03-14 Chris Coulson <chrisccoulson@ubuntu.com>
96
97 The g_variant_get_* family of calls which return a GVariant
98 actually return reference counted, non-floating variant. Ensure that we
99 always keep pointers to these so that we can properly unref them.
100
101 The same also applies to g_variant_iter_next_value.
102
103 Also fix a couple of other minor leaks along the way. This fixes
104 LP: #722972
105
32011-03-10 Ted Gould <ted@gould.cx>1062011-03-10 Ted Gould <ted@gould.cx>
4107
5 0.3.101108 0.3.101
6109
=== modified file 'configure'
--- configure 2011-03-10 17:05:16 +0000
+++ configure 2011-03-16 19:16:36 +0000
@@ -1,6 +1,6 @@
1#! /bin/sh1#! /bin/sh
2# Guess values for system-dependent variables and create Makefiles.2# Guess values for system-dependent variables and create Makefiles.
3# Generated by GNU Autoconf 2.67 for libdbusmenu 0.3.101.3# Generated by GNU Autoconf 2.67 for libdbusmenu 0.3.102.
4#4#
5# Report bugs to <ted@canonical.com>.5# Report bugs to <ted@canonical.com>.
6#6#
@@ -703,8 +703,8 @@
703# Identity of this package.703# Identity of this package.
704PACKAGE_NAME='libdbusmenu'704PACKAGE_NAME='libdbusmenu'
705PACKAGE_TARNAME='libdbusmenu'705PACKAGE_TARNAME='libdbusmenu'
706PACKAGE_VERSION='0.3.101'706PACKAGE_VERSION='0.3.102'
707PACKAGE_STRING='libdbusmenu 0.3.101'707PACKAGE_STRING='libdbusmenu 0.3.102'
708PACKAGE_BUGREPORT='ted@canonical.com'708PACKAGE_BUGREPORT='ted@canonical.com'
709PACKAGE_URL=''709PACKAGE_URL=''
710710
@@ -1541,7 +1541,7 @@
1541 # Omit some internal or obsolete options to make the list less imposing.1541 # Omit some internal or obsolete options to make the list less imposing.
1542 # This message is too long to be a string in the A/UX 3.1 sh.1542 # This message is too long to be a string in the A/UX 3.1 sh.
1543 cat <<_ACEOF1543 cat <<_ACEOF
1544\`configure' configures libdbusmenu 0.3.101 to adapt to many kinds of systems.1544\`configure' configures libdbusmenu 0.3.102 to adapt to many kinds of systems.
15451545
1546Usage: $0 [OPTION]... [VAR=VALUE]...1546Usage: $0 [OPTION]... [VAR=VALUE]...
15471547
@@ -1611,7 +1611,7 @@
16111611
1612if test -n "$ac_init_help"; then1612if test -n "$ac_init_help"; then
1613 case $ac_init_help in1613 case $ac_init_help in
1614 short | recursive ) echo "Configuration of libdbusmenu 0.3.101:";;1614 short | recursive ) echo "Configuration of libdbusmenu 0.3.102:";;
1615 esac1615 esac
1616 cat <<\_ACEOF1616 cat <<\_ACEOF
16171617
@@ -1751,7 +1751,7 @@
1751test -n "$ac_init_help" && exit $ac_status1751test -n "$ac_init_help" && exit $ac_status
1752if $ac_init_version; then1752if $ac_init_version; then
1753 cat <<\_ACEOF1753 cat <<\_ACEOF
1754libdbusmenu configure 0.3.1011754libdbusmenu configure 0.3.102
1755generated by GNU Autoconf 2.671755generated by GNU Autoconf 2.67
17561756
1757Copyright (C) 2010 Free Software Foundation, Inc.1757Copyright (C) 2010 Free Software Foundation, Inc.
@@ -2122,7 +2122,7 @@
2122This file contains any messages produced by compilers while2122This file contains any messages produced by compilers while
2123running configure, to aid debugging if configure makes a mistake.2123running configure, to aid debugging if configure makes a mistake.
21242124
2125It was created by libdbusmenu $as_me 0.3.101, which was2125It was created by libdbusmenu $as_me 0.3.102, which was
2126generated by GNU Autoconf 2.67. Invocation command line was2126generated by GNU Autoconf 2.67. Invocation command line was
21272127
2128 $ $0 $@2128 $ $0 $@
@@ -2943,7 +2943,7 @@
29432943
2944# Define the identity of the package.2944# Define the identity of the package.
2945 PACKAGE=libdbusmenu2945 PACKAGE=libdbusmenu
2946 VERSION=0.3.1012946 VERSION=0.3.102
29472947
29482948
2949# Some tools Automake needs.2949# Some tools Automake needs.
@@ -13294,7 +13294,7 @@
13294###########################13294###########################
1329513295
13296LIBDBUSMENU_CURRENT=313296LIBDBUSMENU_CURRENT=3
13297LIBDBUSMENU_REVISION=913297LIBDBUSMENU_REVISION=10
13298LIBDBUSMENU_AGE=013298LIBDBUSMENU_AGE=0
1329913299
1330013300
@@ -14616,7 +14616,7 @@
14616# report actual input values of CONFIG_FILES etc. instead of their14616# report actual input values of CONFIG_FILES etc. instead of their
14617# values after options handling.14617# values after options handling.
14618ac_log="14618ac_log="
14619This file was extended by libdbusmenu $as_me 0.3.101, which was14619This file was extended by libdbusmenu $as_me 0.3.102, which was
14620generated by GNU Autoconf 2.67. Invocation command line was14620generated by GNU Autoconf 2.67. Invocation command line was
1462114621
14622 CONFIG_FILES = $CONFIG_FILES14622 CONFIG_FILES = $CONFIG_FILES
@@ -14682,7 +14682,7 @@
14682cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=114682cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
14683ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"14683ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
14684ac_cs_version="\\14684ac_cs_version="\\
14685libdbusmenu config.status 0.3.10114685libdbusmenu config.status 0.3.102
14686configured by $0, generated by GNU Autoconf 2.67,14686configured by $0, generated by GNU Autoconf 2.67,
14687 with options \\"\$ac_cs_config\\"14687 with options \\"\$ac_cs_config\\"
1468814688
1468914689
=== modified file 'configure.ac'
--- configure.ac 2011-03-10 17:05:16 +0000
+++ configure.ac 2011-03-16 19:16:36 +0000
@@ -1,11 +1,11 @@
11
2AC_INIT(libdbusmenu, 0.3.101, ted@canonical.com)2AC_INIT(libdbusmenu, 0.3.102, ted@canonical.com)
3AC_COPYRIGHT([Copyright 2009,2010 Canonical])3AC_COPYRIGHT([Copyright 2009,2010 Canonical])
44
5AC_PREREQ(2.62)5AC_PREREQ(2.62)
66
7AM_CONFIG_HEADER(config.h)7AM_CONFIG_HEADER(config.h)
8AM_INIT_AUTOMAKE(libdbusmenu, 0.3.101, [-Wno-portability])8AM_INIT_AUTOMAKE(libdbusmenu, 0.3.102, [-Wno-portability])
99
10AM_MAINTAINER_MODE10AM_MAINTAINER_MODE
1111
@@ -134,7 +134,7 @@
134###########################134###########################
135135
136LIBDBUSMENU_CURRENT=3136LIBDBUSMENU_CURRENT=3
137LIBDBUSMENU_REVISION=9137LIBDBUSMENU_REVISION=10
138LIBDBUSMENU_AGE=0138LIBDBUSMENU_AGE=0
139139
140AC_SUBST(LIBDBUSMENU_CURRENT)140AC_SUBST(LIBDBUSMENU_CURRENT)
141141
=== modified file 'debian/changelog'
--- debian/changelog 2011-03-10 19:11:17 +0000
+++ debian/changelog 2011-03-16 19:16:36 +0000
@@ -1,3 +1,16 @@
1libdbusmenu (0.3.102-0ubuntu1~ppa1) natty; urgency=low
2
3 * New upstream release.
4 ∘ Remove child items when they're removed by GTK
5 ∘ Adding opened and closed events for menu visibility
6 ∘ Handle empty image types
7 ∘ Remove critical warning on parser menuitem check (LP: #733918)
8 ∘ Fix dependencies in pkgconfig files (LP: #733263)
9 ∘ Handle NULL labels (LP: #733688)
10 ∘ Fix memory leaks from variants (LP: #722972)
11
12 -- Ted Gould <ted@ubuntu.com> Wed, 16 Mar 2011 14:08:13 -0500
13
1libdbusmenu (0.3.101-0ubuntu1) natty; urgency=low14libdbusmenu (0.3.101-0ubuntu1) natty; urgency=low
215
3 * New upstream release.16 * New upstream release.
417
=== modified file 'docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt'
--- docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt 2011-03-03 18:27:37 +0000
+++ docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt 2011-03-16 19:16:36 +0000
@@ -70,6 +70,9 @@
70DBUSMENU_MENUITEM_SHORTCUT_CONTROL70DBUSMENU_MENUITEM_SHORTCUT_CONTROL
71DBUSMENU_MENUITEM_SHORTCUT_SHIFT71DBUSMENU_MENUITEM_SHORTCUT_SHIFT
72DBUSMENU_MENUITEM_SHORTCUT_SUPER72DBUSMENU_MENUITEM_SHORTCUT_SUPER
73DBUSMENU_MENUITEM_EVENT_ACTIVATED
74DBUSMENU_MENUITEM_EVENT_CLOSED
75DBUSMENU_MENUITEM_EVENT_OPENED
73DbusmenuMenuitem76DbusmenuMenuitem
74dbusmenu_menuitem_about_to_show_cb77dbusmenu_menuitem_about_to_show_cb
75dbusmenu_menuitem_buildvariant_slot_t78dbusmenu_menuitem_buildvariant_slot_t
7679
=== modified file 'docs/libdbusmenu-glib/reference/version.xml'
--- docs/libdbusmenu-glib/reference/version.xml 2011-03-10 17:05:16 +0000
+++ docs/libdbusmenu-glib/reference/version.xml 2011-03-16 19:16:36 +0000
@@ -1,1 +1,1 @@
10.3.10110.3.102
22
=== modified file 'docs/libdbusmenu-gtk/reference/version.xml'
--- docs/libdbusmenu-gtk/reference/version.xml 2011-03-10 17:05:16 +0000
+++ docs/libdbusmenu-gtk/reference/version.xml 2011-03-16 19:16:36 +0000
@@ -1,1 +1,1 @@
10.3.10110.3.102
22
=== modified file 'libdbusmenu-glib/client.c'
--- libdbusmenu-glib/client.c 2011-03-10 17:05:16 +0000
+++ libdbusmenu-glib/client.c 2011-03-16 19:16:36 +0000
@@ -598,20 +598,27 @@
598 }598 }
599599
600 /* Callback all the folks we can find */600 /* Callback all the folks we can find */
601 GVariantIter * iter = g_variant_iter_new(g_variant_get_child_value(params, 0));601 GVariant * child = g_variant_get_child_value(params, 0);
602 GVariant * child;602 GVariantIter * iter = g_variant_iter_new(child);
603 g_variant_unref(child);
603 while ((child = g_variant_iter_next_value(iter)) != NULL) {604 while ((child = g_variant_iter_next_value(iter)) != NULL) {
604 if (g_strcmp0(g_variant_get_type_string(child), "(ia{sv})") != 0) {605 if (g_strcmp0(g_variant_get_type_string(child), "(ia{sv})") != 0) {
605 g_warning("Properties return signature is not '(ia{sv})' it is '%s'", g_variant_get_type_string(child));606 g_warning("Properties return signature is not '(ia{sv})' it is '%s'", g_variant_get_type_string(child));
607 g_variant_unref(child);
606 continue;608 continue;
607 }609 }
608610
609 gint id = g_variant_get_int32(g_variant_get_child_value(child, 0));611 GVariant * idv = g_variant_get_child_value(child, 0);
612 gint id = g_variant_get_int32(idv);
613 g_variant_unref(idv);
614
610 GVariant * properties = g_variant_get_child_value(child, 1);615 GVariant * properties = g_variant_get_child_value(child, 1);
611616
612 properties_listener_t * listener = find_listener(listeners, 0, id);617 properties_listener_t * listener = find_listener(listeners, 0, id);
613 if (listener == NULL) {618 if (listener == NULL) {
614 g_warning("Unable to find listener for ID %d", id);619 g_warning("Unable to find listener for ID %d", id);
620 g_variant_unref(properties);
621 g_variant_unref(child);
615 continue;622 continue;
616 }623 }
617624
@@ -621,6 +628,8 @@
621 } else {628 } else {
622 g_warning("Odd, we've already replied to the listener on ID %d", id);629 g_warning("Odd, we've already replied to the listener on ID %d", id);
623 }630 }
631 g_variant_unref(properties);
632 g_variant_unref(child);
624 }633 }
625 g_variant_iter_free(iter);634 g_variant_iter_free(iter);
626 g_variant_unref(params);635 g_variant_unref(params);
@@ -676,7 +685,9 @@
676 GVariant * variant_ids = g_variant_builder_end(&builder);685 GVariant * variant_ids = g_variant_builder_end(&builder);
677686
678 /* Build up a prop list to pass */687 /* Build up a prop list to pass */
679 g_variant_builder_init(&builder, g_variant_type_new("as"));688 GVariantType * type = g_variant_type_new("as");
689 g_variant_builder_init(&builder, type);
690 g_variant_type_free(type);
680 /* TODO: need to use delayed property list here */691 /* TODO: need to use delayed property list here */
681 GVariant * variant_props = g_variant_builder_end(&builder);692 GVariant * variant_props = g_variant_builder_end(&builder);
682693
@@ -1050,12 +1061,13 @@
1050 /* Check the text direction if available */1061 /* Check the text direction if available */
1051 GVariant * textdir = g_dbus_proxy_get_cached_property(priv->menuproxy, "TextDirection");1062 GVariant * textdir = g_dbus_proxy_get_cached_property(priv->menuproxy, "TextDirection");
1052 if (textdir != NULL) {1063 if (textdir != NULL) {
1053 GVariant * str = textdir;1064 if (g_variant_is_of_type(textdir, G_VARIANT_TYPE_VARIANT)) {
1054 if (g_variant_is_of_type(str, G_VARIANT_TYPE_VARIANT)) {1065 GVariant * tmp = g_variant_get_variant(textdir);
1055 str = g_variant_get_variant(str);1066 g_variant_unref(textdir);
1067 textdir = tmp;
1056 }1068 }
10571069
1058 priv->text_direction = dbusmenu_text_direction_get_value_from_nick(g_variant_get_string(str, NULL));1070 priv->text_direction = dbusmenu_text_direction_get_value_from_nick(g_variant_get_string(textdir, NULL));
1059 g_object_notify(G_OBJECT(user_data), DBUSMENU_CLIENT_PROP_TEXT_DIRECTION);1071 g_object_notify(G_OBJECT(user_data), DBUSMENU_CLIENT_PROP_TEXT_DIRECTION);
10601072
1061 g_variant_unref(textdir);1073 g_variant_unref(textdir);
@@ -1063,13 +1075,14 @@
10631075
1064 /* Check the status if available */1076 /* Check the status if available */
1065 GVariant * status = g_dbus_proxy_get_cached_property(priv->menuproxy, "Status");1077 GVariant * status = g_dbus_proxy_get_cached_property(priv->menuproxy, "Status");
1066 if (textdir != NULL) {1078 if (status != NULL) {
1067 GVariant * str = status;1079 if (g_variant_is_of_type(status, G_VARIANT_TYPE_VARIANT)) {
1068 if (g_variant_is_of_type(str, G_VARIANT_TYPE_VARIANT)) {1080 GVariant * tmp = g_variant_get_variant(status);
1069 str = g_variant_get_variant(str);1081 g_variant_unref(status);
1082 status = tmp;
1070 }1083 }
10711084
1072 priv->status = dbusmenu_status_get_value_from_nick(g_variant_get_string(str, NULL));1085 priv->status = dbusmenu_status_get_value_from_nick(g_variant_get_string(status, NULL));
1073 g_object_notify(G_OBJECT(user_data), DBUSMENU_CLIENT_PROP_STATUS);1086 g_object_notify(G_OBJECT(user_data), DBUSMENU_CLIENT_PROP_STATUS);
10741087
1075 g_variant_unref(status);1088 g_variant_unref(status);
@@ -1142,20 +1155,22 @@
1142 g_variant_iter_init(&iters, properties);1155 g_variant_iter_init(&iters, properties);
1143 while (g_variant_iter_next(&iters, "{sv}", &key, &value)) {1156 while (g_variant_iter_next(&iters, "{sv}", &key, &value)) {
1144 if (g_strcmp0(key, "TextDirection") == 0) {1157 if (g_strcmp0(key, "TextDirection") == 0) {
1145 GVariant * str = value;1158 if (g_variant_is_of_type(value, G_VARIANT_TYPE_VARIANT)) {
1146 if (g_variant_is_of_type(str, G_VARIANT_TYPE_VARIANT)) {1159 GVariant * tmp = g_variant_get_variant(value);
1147 str = g_variant_get_variant(str);1160 g_variant_unref(value);
1161 value = tmp;
1148 }1162 }
11491163
1150 priv->text_direction = dbusmenu_text_direction_get_value_from_nick(g_variant_get_string(str, NULL));1164 priv->text_direction = dbusmenu_text_direction_get_value_from_nick(g_variant_get_string(value, NULL));
1151 }1165 }
1152 if (g_strcmp0(key, "Status") == 0) {1166 if (g_strcmp0(key, "Status") == 0) {
1153 GVariant * str = value;1167 if (g_variant_is_of_type(value, G_VARIANT_TYPE_VARIANT)) {
1154 if (g_variant_is_of_type(str, G_VARIANT_TYPE_VARIANT)) {1168 GVariant * tmp = g_variant_get_variant(value);
1155 str = g_variant_get_variant(str);1169 g_variant_unref(value);
1170 value = tmp;
1156 }1171 }
11571172
1158 priv->status = dbusmenu_status_get_value_from_nick(g_variant_get_string(str, NULL));1173 priv->status = dbusmenu_status_get_value_from_nick(g_variant_get_string(value, NULL));
1159 }1174 }
1160 if (g_strcmp0(key, "IconThemePath") == 0) {1175 if (g_strcmp0(key, "IconThemePath") == 0) {
1161 if (priv->icon_dirs != NULL) {1176 if (priv->icon_dirs != NULL) {
@@ -1224,11 +1239,14 @@
1224 /* Remove before adding just incase there is a duplicate, against the1239 /* Remove before adding just incase there is a duplicate, against the
1225 rules, but we can handle it so let's do it. */1240 rules, but we can handle it so let's do it. */
1226 GVariantIter ritems;1241 GVariantIter ritems;
1227 g_variant_iter_init(&ritems, g_variant_get_child_value(params, 1));1242 GVariant * ritemsv = g_variant_get_child_value(params, 1);
1243 g_variant_iter_init(&ritems, ritemsv);
12281244
1229 GVariant * ritem;1245 GVariant * ritem;
1230 while ((ritem = g_variant_iter_next_value(&ritems)) != NULL) {1246 while ((ritem = g_variant_iter_next_value(&ritems)) != NULL) {
1231 gint id = g_variant_get_int32(g_variant_get_child_value(ritem, 0));1247 GVariant * idv = g_variant_get_child_value(ritem, 0);
1248 gint id = g_variant_get_int32(idv);
1249 g_variant_unref(idv);
1232 DbusmenuMenuitem * menuitem = dbusmenu_menuitem_find_id(priv->root, id);1250 DbusmenuMenuitem * menuitem = dbusmenu_menuitem_find_id(priv->root, id);
12331251
1234 if (menuitem == NULL) {1252 if (menuitem == NULL) {
@@ -1236,7 +1254,8 @@
1236 }1254 }
12371255
1238 GVariantIter properties;1256 GVariantIter properties;
1239 g_variant_iter_init(&properties, g_variant_get_child_value(ritem, 1));1257 GVariant * propv = g_variant_get_child_value(ritem, 1);
1258 g_variant_iter_init(&properties, propv);
1240 gchar * property;1259 gchar * property;
12411260
1242 while (g_variant_iter_next(&properties, "s", &property)) {1261 while (g_variant_iter_next(&properties, "s", &property)) {
@@ -1245,16 +1264,23 @@
1245 g_free(property);1264 g_free(property);
1246 }1265 }
1247 g_variant_unref(ritem);1266 g_variant_unref(ritem);
1267 g_variant_unref(propv);
1248 }1268 }
1269 g_variant_unref(ritemsv);
12491270
1250 GVariantIter items;1271 GVariantIter items;
1251 g_variant_iter_init(&items, g_variant_get_child_value(params, 0));1272 GVariant * itemsv = g_variant_get_child_value(params, 0);
1273 g_variant_iter_init(&items, itemsv);
12521274
1253 GVariant * item;1275 GVariant * item;
1254 while ((item = g_variant_iter_next_value(&items)) != NULL) {1276 while ((item = g_variant_iter_next_value(&items)) != NULL) {
1255 gint id = g_variant_get_int32(g_variant_get_child_value(item, 0));1277 GVariant * idv = g_variant_get_child_value(item, 0);
1278 gint id = g_variant_get_int32(idv);
1279 g_variant_unref(idv);
1280
1256 GVariantIter properties;1281 GVariantIter properties;
1257 g_variant_iter_init(&properties, g_variant_get_child_value(item, 1));1282 GVariant * propv = g_variant_get_child_value(item, 1);
1283 g_variant_iter_init(&properties, propv);
1258 gchar * property;1284 gchar * property;
1259 GVariant * value;1285 GVariant * value;
12601286
@@ -1263,14 +1289,21 @@
1263 if (G_LIKELY(g_variant_is_of_type(value, G_VARIANT_TYPE_VARIANT))) {1289 if (G_LIKELY(g_variant_is_of_type(value, G_VARIANT_TYPE_VARIANT))) {
1264 /* Unboxing if needed */1290 /* Unboxing if needed */
1265 internalvalue = g_variant_get_variant(value);1291 internalvalue = g_variant_get_variant(value);
1292 g_variant_unref(value);
1266 }1293 }
1267 id_prop_update(proxy, id, property, internalvalue, client);1294 id_prop_update(proxy, id, property, internalvalue, client);
1295 g_variant_unref(internalvalue);
1268 }1296 }
1297 g_variant_unref(propv);
1298 g_variant_unref(item);
1269 }1299 }
1300 g_variant_unref(itemsv);
1270 } else if (g_strcmp0(signal, "ItemPropertyUpdated") == 0) {1301 } else if (g_strcmp0(signal, "ItemPropertyUpdated") == 0) {
1271 gint id; gchar * property; GVariant * value;1302 gint id; gchar * property; GVariant * value;
1272 g_variant_get(params, "(isv)", &id, &property, &value);1303 g_variant_get(params, "(isv)", &id, &property, &value);
1273 id_prop_update(proxy, id, property, value, client);1304 id_prop_update(proxy, id, property, value, client);
1305 g_free(property);
1306 g_variant_unref(value);
1274 } else if (g_strcmp0(signal, "ItemUpdated") == 0) {1307 } else if (g_strcmp0(signal, "ItemUpdated") == 0) {
1275 gint id;1308 gint id;
1276 g_variant_get(params, "(i)", &id);1309 g_variant_get(params, "(i)", &id);
@@ -1594,7 +1627,9 @@
1594 }1627 }
15951628
1596 /* First verify and figure out what we've got */1629 /* First verify and figure out what we've got */
1597 gint id = g_variant_get_int32(g_variant_get_child_value(layout, 0));1630 GVariant * idv = g_variant_get_child_value(layout, 0);
1631 gint id = g_variant_get_int32(idv);
1632 g_variant_unref(idv);
1598 if (id < 0) {1633 if (id < 0) {
1599 return NULL;1634 return NULL;
1600 }1635 }
@@ -1607,8 +1642,10 @@
16071642
1608 /* Some variables */1643 /* Some variables */
1609 GVariantIter children;1644 GVariantIter children;
1610 g_variant_iter_init(&children, g_variant_get_child_value(layout, 2));1645 GVariant * childrenv;
1611 GVariant * child;1646
1647 childrenv = g_variant_get_child_value(layout, 2);
1648 g_variant_iter_init(&children, childrenv);
16121649
1613 guint position = 0;1650 guint position = 0;
1614 GList * oldchildren = g_list_copy(dbusmenu_menuitem_get_children(item));1651 GList * oldchildren = g_list_copy(dbusmenu_menuitem_get_children(item));
@@ -1616,16 +1653,22 @@
16161653
1617 /* Go through all the XML Nodes and make sure that we have menuitems1654 /* Go through all the XML Nodes and make sure that we have menuitems
1618 to cover those XML nodes. */1655 to cover those XML nodes. */
1656 GVariant * child;
1619 while ((child = g_variant_iter_next_value(&children)) != NULL) {1657 while ((child = g_variant_iter_next_value(&children)) != NULL) {
1620 /* g_debug("Looking at child: %d", position); */1658 /* g_debug("Looking at child: %d", position); */
1621 if (g_variant_is_of_type(child, G_VARIANT_TYPE_VARIANT)) {1659 if (g_variant_is_of_type(child, G_VARIANT_TYPE_VARIANT)) {
1622 child = g_variant_get_variant(child);1660 GVariant * tmp = g_variant_get_variant(child);
1661 g_variant_unref(child);
1662 child = tmp;
1623 }1663 }
16241664
1625 gint childid = g_variant_get_int32(g_variant_get_child_value(child, 0));1665 GVariant * childidv = g_variant_get_child_value(child, 0);
1666 gint childid = g_variant_get_int32(childidv);
1667 g_variant_unref(childidv);
1626 if (childid < 0) {1668 if (childid < 0) {
1627 /* Don't increment the position when there isn't a valid1669 /* Don't increment the position when there isn't a valid
1628 node in the XML tree. It's probably a comment. */1670 node in the XML tree. It's probably a comment. */
1671 g_variant_unref(child);
1629 continue;1672 continue;
1630 }1673 }
1631 DbusmenuMenuitem * childmi = NULL;1674 DbusmenuMenuitem * childmi = NULL;
@@ -1665,10 +1708,12 @@
1665 GVariantIter iter;1708 GVariantIter iter;
1666 gchar * prop;1709 gchar * prop;
1667 GVariant * value;1710 GVariant * value;
1711 GVariant * child_props;
16681712
1669 /* Set the type first as it can manage the behavior of1713 /* Set the type first as it can manage the behavior of
1670 all other properties. */1714 all other properties. */
1671 g_variant_iter_init(&iter, g_variant_get_child_value(child, 1));1715 child_props = g_variant_get_child_value(child, 1);
1716 g_variant_iter_init(&iter, child_props);
1672 while (g_variant_iter_next(&iter, "{sv}", &prop, &value)) {1717 while (g_variant_iter_next(&iter, "{sv}", &prop, &value)) {
1673 if (g_strcmp0(prop, DBUSMENU_MENUITEM_PROP_TYPE) == 0) {1718 if (g_strcmp0(prop, DBUSMENU_MENUITEM_PROP_TYPE) == 0) {
1674 dbusmenu_menuitem_property_set_variant(childmi, prop, value);1719 dbusmenu_menuitem_property_set_variant(childmi, prop, value);
@@ -1678,15 +1723,17 @@
1678 }1723 }
16791724
1680 /* Now go through and do all the properties. */1725 /* Now go through and do all the properties. */
1681 g_variant_iter_init(&iter, g_variant_get_child_value(child, 1));1726 g_variant_iter_init(&iter, child_props);
1682 while (g_variant_iter_next(&iter, "{sv}", &prop, &value)) {1727 while (g_variant_iter_next(&iter, "{sv}", &prop, &value)) {
1683 dbusmenu_menuitem_property_set_variant(childmi, prop, value);1728 dbusmenu_menuitem_property_set_variant(childmi, prop, value);
1684 g_free(prop);1729 g_free(prop);
1685 g_variant_unref(value);1730 g_variant_unref(value);
1686 }1731 }
1732 g_variant_unref(child_props);
1687 }1733 }
16881734
1689 position++;1735 position++;
1736 g_variant_unref(child);
1690 }1737 }
16911738
1692 /* Remove any children that are no longer used by this version of1739 /* Remove any children that are no longer used by this version of
@@ -1709,19 +1756,24 @@
1709 }1756 }
17101757
1711 /* now it's time to recurse down the tree. */1758 /* now it's time to recurse down the tree. */
1712 g_variant_iter_init(&children, g_variant_get_child_value(layout, 2));1759 g_variant_iter_init(&children, childrenv);
17131760
1714 child = g_variant_iter_next_value(&children);1761 child = g_variant_iter_next_value(&children);
1715 GList * childmis = dbusmenu_menuitem_get_children(item);1762 GList * childmis = dbusmenu_menuitem_get_children(item);
1716 while (child != NULL && childmis != NULL) {1763 while (child != NULL && childmis != NULL) {
1717 if (g_variant_is_of_type(child, G_VARIANT_TYPE_VARIANT)) {1764 if (g_variant_is_of_type(child, G_VARIANT_TYPE_VARIANT)) {
1718 child = g_variant_get_variant(child);1765 GVariant * tmp = g_variant_get_variant(child);
1766 g_variant_unref(child);
1767 child = tmp;
1719 }1768 }
17201769
1721 gint xmlid = g_variant_get_int32(g_variant_get_child_value(child, 0));1770 GVariant * xmlidv = g_variant_get_child_value(child, 0);
1771 gint xmlid = g_variant_get_int32(xmlidv);
1772 g_variant_unref(xmlidv);
1722 /* If this isn't a valid menu item we need to move on1773 /* If this isn't a valid menu item we need to move on
1723 until we have one. This avoids things like comments. */1774 until we have one. This avoids things like comments. */
1724 if (xmlid < 0) {1775 if (xmlid < 0) {
1776 g_variant_unref(child);
1725 child = g_variant_iter_next_value(&children);1777 child = g_variant_iter_next_value(&children);
1726 continue;1778 continue;
1727 }1779 }
@@ -1733,10 +1785,13 @@
1733 1785
1734 parse_layout_xml(client, child, DBUSMENU_MENUITEM(childmis->data), item, proxy);1786 parse_layout_xml(client, child, DBUSMENU_MENUITEM(childmis->data), item, proxy);
17351787
1788 g_variant_unref(child);
1736 child = g_variant_iter_next_value(&children);1789 child = g_variant_iter_next_value(&children);
1737 childmis = g_list_next(childmis);1790 childmis = g_list_next(childmis);
1738 }1791 }
17391792
1793 g_variant_unref(childrenv);
1794
1740 if (child != NULL) {1795 if (child != NULL) {
1741 g_warning("Sync failed, now we've got extra layout nodes.");1796 g_warning("Sync failed, now we've got extra layout nodes.");
1742 }1797 }
@@ -1801,6 +1856,7 @@
18011856
1802 GError * error = NULL;1857 GError * error = NULL;
1803 GVariant * params = NULL;1858 GVariant * params = NULL;
1859 GVariant * layout = NULL;
18041860
1805 params = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, &error);1861 params = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, &error);
18061862
@@ -1810,8 +1866,11 @@
1810 goto out;1866 goto out;
1811 }1867 }
18121868
1813 guint rev = g_variant_get_uint32(g_variant_get_child_value(params, 0));1869 GVariant * revv = g_variant_get_child_value(params, 0);
1814 GVariant * layout = g_variant_get_child_value(params, 1);1870 guint rev = g_variant_get_uint32(revv);
1871 g_variant_unref(revv);
1872
1873 layout = g_variant_get_child_value(params, 1);
18151874
1816 guint parseable = parse_layout(client, layout);1875 guint parseable = parse_layout(client, layout);
18171876
@@ -1839,6 +1898,10 @@
1839 priv->layoutcall = NULL;1898 priv->layoutcall = NULL;
1840 }1899 }
18411900
1901 if (layout != NULL) {
1902 g_variant_unref(layout);
1903 }
1904
1842 if (params != NULL) {1905 if (params != NULL) {
1843 g_variant_unref(params);1906 g_variant_unref(params);
1844 }1907 }
18451908
=== modified file 'libdbusmenu-glib/dbus-menu.xml'
--- libdbusmenu-glib/dbus-menu.xml 2011-03-03 19:48:56 +0000
+++ libdbusmenu-glib/dbus-menu.xml 2011-03-16 19:16:36 +0000
@@ -294,6 +294,8 @@
294294
295 @li "clicked"295 @li "clicked"
296 @li "hovered"296 @li "hovered"
297 @li "opened"
298 @li "closed"
297299
298 Vendor specific events can be added by prefixing them with "x-<vendor>-"300 Vendor specific events can be added by prefixing them with "x-<vendor>-"
299 ]]></dox:d>301 ]]></dox:d>
300302
=== modified file 'libdbusmenu-glib/enum-types.c'
--- libdbusmenu-glib/enum-types.c 2011-02-24 21:06:19 +0000
+++ libdbusmenu-glib/enum-types.c 2011-03-16 19:16:36 +0000
@@ -30,7 +30,7 @@
3030
31#include "enum-types.h"31#include "enum-types.h"
3232
33#include "./types.h"33#include "types.h"
34/**34/**
35 dbusmenu_text_direction_get_type:35 dbusmenu_text_direction_get_type:
3636
3737
=== modified file 'libdbusmenu-glib/enum-types.h'
--- libdbusmenu-glib/enum-types.h 2011-02-24 21:06:19 +0000
+++ libdbusmenu-glib/enum-types.h 2011-03-16 19:16:36 +0000
@@ -36,10 +36,13 @@
36G_BEGIN_DECLS36G_BEGIN_DECLS
3737
38/* Enumerations from file: "./types.h" */38/* Enumerations from file: "./types.h" */
39#include "./types.h"39#include "types.h"
40
41
40GType dbusmenu_text_direction_get_type (void) G_GNUC_CONST;42GType dbusmenu_text_direction_get_type (void) G_GNUC_CONST;
41const gchar * dbusmenu_text_direction_get_nick (DbusmenuTextDirection value) G_GNUC_CONST;43const gchar * dbusmenu_text_direction_get_nick (DbusmenuTextDirection value) G_GNUC_CONST;
42DbusmenuTextDirection dbusmenu_text_direction_get_value_from_nick (const gchar * nick) G_GNUC_CONST;44DbusmenuTextDirection dbusmenu_text_direction_get_value_from_nick (const gchar * nick) G_GNUC_CONST;
45
43/**46/**
44 DBUSMENU_TYPE_TEXT_DIRECTION:47 DBUSMENU_TYPE_TEXT_DIRECTION:
4548
@@ -48,9 +51,11 @@
48*/51*/
49#define DBUSMENU_TYPE_TEXT_DIRECTION (dbusmenu_text_direction_get_type())52#define DBUSMENU_TYPE_TEXT_DIRECTION (dbusmenu_text_direction_get_type())
5053
54
51GType dbusmenu_status_get_type (void) G_GNUC_CONST;55GType dbusmenu_status_get_type (void) G_GNUC_CONST;
52const gchar * dbusmenu_status_get_nick (DbusmenuStatus value) G_GNUC_CONST;56const gchar * dbusmenu_status_get_nick (DbusmenuStatus value) G_GNUC_CONST;
53DbusmenuStatus dbusmenu_status_get_value_from_nick (const gchar * nick) G_GNUC_CONST;57DbusmenuStatus dbusmenu_status_get_value_from_nick (const gchar * nick) G_GNUC_CONST;
58
54/**59/**
55 DBUSMENU_TYPE_STATUS:60 DBUSMENU_TYPE_STATUS:
5661
5762
=== modified file 'libdbusmenu-glib/menuitem.c'
--- libdbusmenu-glib/menuitem.c 2011-03-07 19:56:53 +0000
+++ libdbusmenu-glib/menuitem.c 2011-03-16 19:16:36 +0000
@@ -430,7 +430,7 @@
430static void430static void
431handle_event (DbusmenuMenuitem * mi, const gchar * name, GVariant * value, guint timestamp)431handle_event (DbusmenuMenuitem * mi, const gchar * name, GVariant * value, guint timestamp)
432{432{
433 if (g_strcmp0(name, "clicked") == 0) {433 if (g_strcmp0(name, DBUSMENU_MENUITEM_EVENT_ACTIVATED) == 0) {
434 g_signal_emit(G_OBJECT(mi), signals[ITEM_ACTIVATED], 0, timestamp, TRUE);434 g_signal_emit(G_OBJECT(mi), signals[ITEM_ACTIVATED], 0, timestamp, TRUE);
435 }435 }
436436
437437
=== modified file 'libdbusmenu-glib/menuitem.h'
--- libdbusmenu-glib/menuitem.h 2011-02-24 16:52:10 +0000
+++ libdbusmenu-glib/menuitem.h 2011-03-16 19:16:36 +0000
@@ -267,6 +267,32 @@
267 */267 */
268#define DBUSMENU_MENUITEM_CHILD_DISPLAY_SUBMENU "submenu"268#define DBUSMENU_MENUITEM_CHILD_DISPLAY_SUBMENU "submenu"
269269
270/**
271 * DBUSMENU_MENUITEM_EVENT_ACTIVATED:
272 *
273 * String for the event identifier when a menu item is clicked
274 * on by the user.
275 */
276#define DBUSMENU_MENUITEM_EVENT_ACTIVATED "clicked"
277
278/**
279 * DBUSMENU_MENUITEM_EVENT_OPENED:
280 *
281 * String for the event identifier when a menu is opened and
282 * displayed to the user. Only valid for items that contain
283 * submenus.
284 */
285#define DBUSMENU_MENUITEM_EVENT_OPENED "opened"
286
287/**
288 * DBUSMENU_MENUITEM_EVENT_CLOSED:
289 *
290 * String for the event identifier when a menu is closed and
291 * displayed to the user. Only valid for items that contain
292 * submenus.
293 */
294#define DBUSMENU_MENUITEM_EVENT_CLOSED "closed"
295
270typedef struct _DbusmenuMenuitemPrivate DbusmenuMenuitemPrivate;296typedef struct _DbusmenuMenuitemPrivate DbusmenuMenuitemPrivate;
271297
272/**298/**
273299
=== modified file 'libdbusmenu-gtk/client.c'
--- libdbusmenu-gtk/client.c 2011-03-10 16:27:52 +0000
+++ libdbusmenu-gtk/client.c 2011-03-16 19:16:36 +0000
@@ -458,7 +458,7 @@
458{458{
459 if (gtk_menu_item_get_submenu(gmi) == NULL) {459 if (gtk_menu_item_get_submenu(gmi) == NULL) {
460 GVariant * variant = g_variant_new("i", 0);460 GVariant * variant = g_variant_new("i", 0);
461 dbusmenu_menuitem_handle_event(mi, "clicked", variant, gtk_get_current_event_time());461 dbusmenu_menuitem_handle_event(mi, DBUSMENU_MENUITEM_EVENT_ACTIVATED, variant, gtk_get_current_event_time());
462 } else {462 } else {
463 /* TODO: We need to stop the display of the submenu463 /* TODO: We need to stop the display of the submenu
464 until this callback returns. */464 until this callback returns. */
@@ -467,6 +467,15 @@
467 return TRUE;467 return TRUE;
468}468}
469469
470static void
471submenu_notify_visible_cb (GtkWidget * menu, GParamSpec * pspec, DbusmenuMenuitem * mi)
472{
473 if (gtk_widget_get_visible (menu))
474 dbusmenu_menuitem_handle_event(mi, DBUSMENU_MENUITEM_EVENT_OPENED, NULL, gtk_get_current_event_time());
475 else
476 dbusmenu_menuitem_handle_event(mi, DBUSMENU_MENUITEM_EVENT_CLOSED, NULL, gtk_get_current_event_time());
477}
478
470/* Process the visible property */479/* Process the visible property */
471static void480static void
472process_visible (DbusmenuMenuitem * mi, GtkMenuItem * gmi, GVariant * value)481process_visible (DbusmenuMenuitem * mi, GtkMenuItem * gmi, GVariant * value)
@@ -740,11 +749,12 @@
740749
741 GtkMenuItem * parent = dbusmenu_gtkclient_menuitem_get(gtkclient, mi);750 GtkMenuItem * parent = dbusmenu_gtkclient_menuitem_get(gtkclient, mi);
742 gtk_menu_item_set_submenu(parent, GTK_WIDGET(menu));751 gtk_menu_item_set_submenu(parent, GTK_WIDGET(menu));
752
753 g_signal_connect(menu, "notify::visible", G_CALLBACK(submenu_notify_visible_cb), mi);
743 } 754 }
744755
745 GtkMenuItem * childmi = dbusmenu_gtkclient_menuitem_get(gtkclient, child);756 GtkMenuItem * childmi = dbusmenu_gtkclient_menuitem_get(gtkclient, child);
746 gtk_menu_shell_insert(GTK_MENU_SHELL(menu), GTK_WIDGET(childmi), position);757 gtk_menu_shell_insert(GTK_MENU_SHELL(menu), GTK_WIDGET(childmi), position);
747 gtk_widget_show(GTK_WIDGET(menu));
748 758
749 return;759 return;
750}760}
751761
=== modified file 'libdbusmenu-gtk/dbusmenu-gtk-0.4.pc.in'
--- libdbusmenu-gtk/dbusmenu-gtk-0.4.pc.in 2010-12-08 15:27:48 +0000
+++ libdbusmenu-gtk/dbusmenu-gtk-0.4.pc.in 2011-03-16 19:16:36 +0000
@@ -5,7 +5,7 @@
5includedir=@includedir@5includedir=@includedir@
66
7Cflags: -I${includedir}/libdbusmenu-0.47Cflags: -I${includedir}/libdbusmenu-0.4
8Requires: dbusmenu-glib-0.48Requires: dbusmenu-glib-0.4 gdk-pixbuf-2.0 gtk+-2.0
9Libs: -L${libdir} -ldbusmenu-gtk9Libs: -L${libdir} -ldbusmenu-gtk
1010
11Name: libdbusmenu-gtk11Name: libdbusmenu-gtk
1212
=== modified file 'libdbusmenu-gtk/dbusmenu-gtk3-0.4.pc.in'
--- libdbusmenu-gtk/dbusmenu-gtk3-0.4.pc.in 2010-12-08 15:27:48 +0000
+++ libdbusmenu-gtk/dbusmenu-gtk3-0.4.pc.in 2011-03-16 19:16:36 +0000
@@ -5,7 +5,7 @@
5includedir=@includedir@5includedir=@includedir@
66
7Cflags: -I${includedir}/libdbusmenu-0.47Cflags: -I${includedir}/libdbusmenu-0.4
8Requires: dbusmenu-glib-0.48Requires: dbusmenu-glib-0.4 gdk-pixbuf-2.0 gtk+-3.0
9Libs: -L${libdir} -ldbusmenu-gtk39Libs: -L${libdir} -ldbusmenu-gtk3
1010
11Name: libdbusmenu-gtk311Name: libdbusmenu-gtk3
1212
=== modified file 'libdbusmenu-gtk/parser.c'
--- libdbusmenu-gtk/parser.c 2011-03-10 17:05:16 +0000
+++ libdbusmenu-gtk/parser.c 2011-03-16 19:16:36 +0000
@@ -69,6 +69,9 @@
69static void child_added_cb (GtkContainer * menu,69static void child_added_cb (GtkContainer * menu,
70 GtkWidget * widget,70 GtkWidget * widget,
71 gpointer data);71 gpointer data);
72static void child_removed_cb (GtkContainer * menu,
73 GtkWidget * widget,
74 gpointer data);
72static void theme_changed_cb (GtkIconTheme * theme,75static void theme_changed_cb (GtkIconTheme * theme,
73 gpointer data);76 gpointer data);
74static void item_activated (DbusmenuMenuitem * item,77static void item_activated (DbusmenuMenuitem * item,
@@ -98,15 +101,25 @@
98DbusmenuMenuitem *101DbusmenuMenuitem *
99dbusmenu_gtk_parse_menu_structure (GtkWidget * widget)102dbusmenu_gtk_parse_menu_structure (GtkWidget * widget)
100{103{
101 g_return_val_if_fail(GTK_IS_MENU_ITEM(widget) || GTK_IS_MENU_SHELL(widget), NULL);104 g_return_val_if_fail(GTK_IS_MENU_ITEM(widget) || GTK_IS_MENU_SHELL(widget), NULL);
102105
103 RecurseContext recurse = {0};106 DbusmenuMenuitem * returnval = NULL;
104107 gpointer data = g_object_get_data(G_OBJECT(widget), CACHED_MENUITEM);
105 recurse.toplevel = gtk_widget_get_toplevel(widget);108
106109 if (data == NULL) {
107 parse_menu_structure_helper(widget, &recurse);110 RecurseContext recurse = {0};
108111
109 return recurse.parent;112 recurse.toplevel = gtk_widget_get_toplevel(widget);
113
114 parse_menu_structure_helper(widget, &recurse);
115
116 returnval = recurse.parent;
117 } else {
118 returnval = DBUSMENU_MENUITEM(data);
119 g_object_ref(G_OBJECT(returnval));
120 }
121
122 return returnval;
110}123}
111124
112/**125/**
@@ -124,7 +137,9 @@
124DbusmenuMenuitem *137DbusmenuMenuitem *
125dbusmenu_gtk_parse_get_cached_item (GtkWidget * widget)138dbusmenu_gtk_parse_get_cached_item (GtkWidget * widget)
126{139{
127 g_return_val_if_fail(GTK_IS_MENU_ITEM(widget), NULL);140 if (!GTK_IS_MENU_ITEM(widget)) {
141 return NULL;
142 }
128 return DBUSMENU_MENUITEM(g_object_get_data(G_OBJECT(widget), CACHED_MENUITEM));143 return DBUSMENU_MENUITEM(g_object_get_data(G_OBJECT(widget), CACHED_MENUITEM));
129}144}
130145
@@ -160,6 +175,8 @@
160 if (pdata != NULL && pdata->shell != NULL) {175 if (pdata != NULL && pdata->shell != NULL) {
161 g_signal_handlers_disconnect_matched(pdata->shell, (GSignalMatchType)G_SIGNAL_MATCH_FUNC,176 g_signal_handlers_disconnect_matched(pdata->shell, (GSignalMatchType)G_SIGNAL_MATCH_FUNC,
162 0, 0, NULL, G_CALLBACK(child_added_cb), NULL);177 0, 0, NULL, G_CALLBACK(child_added_cb), NULL);
178 g_signal_handlers_disconnect_matched(pdata->shell, (GSignalMatchType)G_SIGNAL_MATCH_FUNC,
179 0, 0, NULL, G_CALLBACK(child_removed_cb), NULL);
163 g_object_remove_weak_pointer(G_OBJECT(pdata->shell), (gpointer*)&pdata->shell);180 g_object_remove_weak_pointer(G_OBJECT(pdata->shell), (gpointer*)&pdata->shell);
164 }181 }
165182
@@ -246,7 +263,6 @@
246static void263static void
247parse_menu_structure_helper (GtkWidget * widget, RecurseContext * recurse)264parse_menu_structure_helper (GtkWidget * widget, RecurseContext * recurse)
248{265{
249
250 /* If this is a shell, then let's handle the items in it. */266 /* If this is a shell, then let's handle the items in it. */
251 if (GTK_IS_MENU_SHELL (widget)) {267 if (GTK_IS_MENU_SHELL (widget)) {
252 /* Okay, this is a little janky and all.. but some applications update some268 /* Okay, this is a little janky and all.. but some applications update some
@@ -282,6 +298,10 @@
282 "child-added",298 "child-added",
283 G_CALLBACK (child_added_cb),299 G_CALLBACK (child_added_cb),
284 recurse->parent);300 recurse->parent);
301 g_signal_connect (G_OBJECT (widget),
302 "child-removed",
303 G_CALLBACK (child_removed_cb),
304 recurse->parent);
285 g_object_add_weak_pointer(G_OBJECT (widget), (gpointer*)&pdata->shell);305 g_object_add_weak_pointer(G_OBJECT (widget), (gpointer*)&pdata->shell);
286 }306 }
287307
@@ -371,14 +391,20 @@
371 which we don't. */391 which we don't. */
372 gchar * sanitized = NULL;392 gchar * sanitized = NULL;
373 GError * error = NULL;393 GError * error = NULL;
394
395 if (label == NULL) {
396 return NULL;
397 }
398
374 if (pango_parse_markup (label, -1, 0, NULL, &sanitized, NULL, &error)) {399 if (pango_parse_markup (label, -1, 0, NULL, &sanitized, NULL, &error)) {
375 return sanitized;400 return sanitized;
376 }401 }
377 else {402
403 if (error != NULL) {
378 g_warning ("Could not parse '%s': %s", label, error->message);404 g_warning ("Could not parse '%s': %s", label, error->message);
379 g_error_free (error);405 g_error_free (error);
380 return g_strdup (label);
381 }406 }
407 return g_strdup (label);
382}408}
383409
384static gchar *410static gchar *
@@ -533,6 +559,10 @@
533 "child-added",559 "child-added",
534 G_CALLBACK (child_added_cb),560 G_CALLBACK (child_added_cb),
535 mi);561 mi);
562 g_signal_connect (G_OBJECT (submenu),
563 "child-removed",
564 G_CALLBACK (child_removed_cb),
565 mi);
536 g_object_add_weak_pointer(G_OBJECT(submenu), (gpointer*)&pdata->shell);566 g_object_add_weak_pointer(G_OBJECT(submenu), (gpointer*)&pdata->shell);
537 }567 }
538568
@@ -625,6 +655,9 @@
625655
626 if (image != NULL && should_show_image (image)) {656 if (image != NULL && should_show_image (image)) {
627 switch (gtk_image_get_storage_type (image)) {657 switch (gtk_image_get_storage_type (image)) {
658 case GTK_IMAGE_EMPTY:
659 break;
660
628 case GTK_IMAGE_PIXBUF:661 case GTK_IMAGE_PIXBUF:
629 pixbuf = g_object_ref (gtk_image_get_pixbuf (image));662 pixbuf = g_object_ref (gtk_image_get_pixbuf (image));
630 break;663 break;
@@ -940,6 +973,28 @@
940 parse_menu_structure_helper(widget, &recurse);973 parse_menu_structure_helper(widget, &recurse);
941}974}
942975
976/* A child item was added to a menu we're watching. Let's try to integrate it. */
977static void
978child_removed_cb (GtkContainer *menu, GtkWidget *widget, gpointer data)
979{
980 gpointer pmi = g_object_get_data(G_OBJECT(widget), CACHED_MENUITEM);
981 if (pmi == NULL) {
982 return;
983 }
984
985 DbusmenuMenuitem * child = DBUSMENU_MENUITEM(pmi);
986
987 pmi = g_object_get_data(G_OBJECT(menu), CACHED_MENUITEM);
988 if (pmi == NULL) {
989 return;
990 }
991
992 DbusmenuMenuitem * parent = DBUSMENU_MENUITEM(pmi);
993
994 dbusmenu_menuitem_child_delete(parent, child);
995 return;
996}
997
943static void998static void
944theme_changed_cb (GtkIconTheme *theme, gpointer data)999theme_changed_cb (GtkIconTheme *theme, gpointer data)
945{1000{

Subscribers

People subscribed via source and target branches

to all changes: