Merge lp:~mterry/libdbusmenu/submenus into lp:libdbusmenu/0.5
Proposed by
Michael Terry
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 201 | ||||
Proposed branch: | lp:~mterry/libdbusmenu/submenus | ||||
Merge into: | lp:libdbusmenu/0.5 | ||||
Diff against target: |
31 lines (+21/-0) 1 file modified
libdbusmenu-gtk/parser.c (+21/-0) |
||||
To merge this branch: | bzr merge lp:~mterry/libdbusmenu/submenus | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
DBus Menu Team | Pending | ||
Review via email: mp+47855@code.launchpad.net |
Description of the change
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.)
To post a comment you must log in.
This should use dbusmenu_ menuitem_ take_children and then run
g_object_unref() on them. Since child_delete() is going to free the
memory for the GList structure currently pointed to by children, next
isn't necessarily there (in all practical cases it is). Other solution
is that you could keep next on the stack, but I think take_children() is
probably cleaner.
On Fri, 2011-01-28 at 19:40 +0000, Michael Terry wrote: /bugs.launchpad .net/bugs/ 696896 /code.launchpad .net/~mterry/ dbusmenu/ submenus/ +merge/ 47855 gtk/parser. c' gtk/parser. c 2011-01-27 19:54:18 +0000 gtk/parser. c 2011-01-28 19:40:14 +0000 static_ string ("submenu")) MENUITEM( g_object_ get_data( G_OBJECT( widget) , CACHED_MENUITEM)); menuitem_ get_children (item); menuitem_ child_delete (item, DBUSMENU_ MENUITEM( children- >data)) ; item_get_ submenu (GTK_MENU_ITEM (widget)); get_toplevel( widget) ; structure_ helper( menu, &recurse);
> 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:/
>
> For more details, see:
> https:/
>
> 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.)
> differences between files attachment (review-diff.txt)
> === modified file 'libdbusmenu-
> --- libdbusmenu-
> +++ libdbusmenu-
> @@ -649,6 +649,27 @@
> }
> }
> }
> + else if (pspec->name == g_intern_
> + {
> + /* The underlying submenu got swapped out. Let's see what it is now. */
> + /* First, delete any children that may exist currently. */
> + DbusmenuMenuitem * item = DBUSMENU_
> + if (item != NULL)
> + {
> + GList * children = dbusmenu_
> + while (children != NULL) {
> + dbusmenu_
> + children = children->next;
> + }
> + }
> +
> + /* Now parse new submenu. */
> + GtkWidget * menu = gtk_menu_
> + RecurseContext recurse = {0};
> + recurse.toplevel = gtk_widget_
> + recurse.parent = item;
> + parse_menu_
> + }
> }
>
> static gboolean
>