ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #02925
[Branch ~dbusmenu-team/dbusmenu/trunk] Rev 201: Handling changing submenus by watching for the notify event
Merge authors:
Michael Terry (mterry)
Ted Gould (ted)
Related merge proposals:
https://code.launchpad.net/~mterry/dbusmenu/submenus/+merge/47855
proposed by: Michael Terry (mterry)
------------------------------------------------------------
revno: 201 [merge]
committer: Ted Gould <ted@xxxxxxxx>
branch nick: trunk
timestamp: Mon 2011-01-31 12:13:31 -0600
message:
Handling changing submenus by watching for the notify event
modified:
libdbusmenu-gtk/parser.c
--
lp:dbusmenu
https://code.launchpad.net/~dbusmenu-team/dbusmenu/trunk
Your team ayatana-commits is subscribed to branch lp:dbusmenu.
To unsubscribe from this branch go to https://code.launchpad.net/~dbusmenu-team/dbusmenu/trunk/+edit-subscription
=== modified file 'libdbusmenu-gtk/parser.c'
--- libdbusmenu-gtk/parser.c 2011-01-27 19:54:18 +0000
+++ libdbusmenu-gtk/parser.c 2011-01-31 18:08:57 +0000
@@ -649,6 +649,37 @@
}
}
}
+ 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