diff options
author | Ted Gould <ted@gould.cx> | 2011-01-31 15:52:26 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-01-31 15:52:26 -0600 |
commit | 284b6b17cfc3b0be1f371c4787eec795c166c7ca (patch) | |
tree | b79c3891b3af838a4f36857ac61044e5e81bf138 /libdbusmenu-gtk/parser.c | |
parent | 6022220a0c208d0fea140ed3ed80e1806983f3b9 (diff) | |
parent | 6c339510a684ba9a8f01fc57188bb4953be0e30b (diff) | |
download | libdbusmenu-284b6b17cfc3b0be1f371c4787eec795c166c7ca.tar.gz libdbusmenu-284b6b17cfc3b0be1f371c4787eec795c166c7ca.tar.bz2 libdbusmenu-284b6b17cfc3b0be1f371c4787eec795c166c7ca.zip |
* New upstream release.
* Fix crashes on rapidly creating and destroying client
and menu objects (LP: #709754)
* Fix dynamically changed submenus to get the parsed
(LP: #696896)
* Fix bad signature on GetProperties with no hits
Diffstat (limited to 'libdbusmenu-gtk/parser.c')
-rw-r--r-- | libdbusmenu-gtk/parser.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c index 5d71585..7e5e7e1 100644 --- a/libdbusmenu-gtk/parser.c +++ b/libdbusmenu-gtk/parser.c @@ -649,6 +649,37 @@ widget_notify_cb (GtkWidget *widget, } } } + else if (pspec->name == g_intern_static_string ("submenu")) + { + /* The underlying submenu got swapped out. Let's see what it is now. */ + /* First, delete any children that may exist currently. */ + DbusmenuMenuitem * item = DBUSMENU_MENUITEM(g_object_get_data(G_OBJECT(widget), CACHED_MENUITEM)); + if (item != NULL) + { + GList * children = dbusmenu_menuitem_take_children (item); + GList * child = children; + while (child != NULL) { + g_object_unref (G_OBJECT(child->data)); + child = child->next; + } + g_list_free(children); + } + + /* Now parse new submenu. */ + RecurseContext recurse = {0}; + recurse.toplevel = gtk_widget_get_toplevel(widget); + recurse.parent = item; + + if (item != NULL) { + GtkWidget * menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget)); + parse_menu_structure_helper(menu, &recurse); + } else { + /* Note: it would be really odd that we wouldn't have a cached + item, but we should handle that appropriately. */ + parse_menu_structure_helper(widget, &recurse); + g_object_unref(G_OBJECT(recurse.parent)); + } + } } static gboolean |