Michael Terry has proposed merging lp:~mterry/dbusmenu/submenus into 
lp:dbusmenu.

Requested reviews:
  DBus Menu Team (dbusmenu-team)
Related bugs:
  #696896 Empathy's Edit->Contact menu item should have a submenu
  https://bugs.launchpad.net/bugs/696896

For more details, see:
https://code.launchpad.net/~mterry/dbusmenu/submenus/+merge/47855

Watch GtkMenu items for submenus.  When they appear, parse them.  Fixes issues 
with dynamic menus in applications like empathy.

This seems to have been made much easier with the new parser code, thanks!  (I 
had looked into this briefly before, but the parsing would have been much more 
complicated before.)
-- 
https://code.launchpad.net/~mterry/dbusmenu/submenus/+merge/47855
Your team ayatana-commits is subscribed to branch lp:dbusmenu.
=== modified file 'libdbusmenu-gtk/parser.c'
--- libdbusmenu-gtk/parser.c	2011-01-27 19:54:18 +0000
+++ libdbusmenu-gtk/parser.c	2011-01-28 19:40:14 +0000
@@ -649,6 +649,27 @@
             }
         }
     }
+  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_get_children (item);
+          while (children != NULL) {
+            dbusmenu_menuitem_child_delete (item, DBUSMENU_MENUITEM(children->data));
+            children = children->next;
+          }
+        }
+
+      /* Now parse new submenu. */
+      GtkWidget * menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget));
+      RecurseContext recurse = {0};
+      recurse.toplevel = gtk_widget_get_toplevel(widget);
+      recurse.parent = item;
+      parse_menu_structure_helper(menu, &recurse);
+    }
 }
 
 static gboolean

_______________________________________________
Mailing list: https://launchpad.net/~ayatana-commits
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~ayatana-commits
More help   : https://help.launchpad.net/ListHelp

Reply via email to