Comment 7 for bug 1011733

Revision history for this message
Charles Kerr (charlesk) wrote :

This is happening because of the way DBusMenu implements its menuitems.

GtkMenuItem is a GtkBin, and gtk's menuitem.c adds a single child, a GtkAccelLabel (which is a private Gtk class). DBusMenu wants the single child to be a container, so it reparents that GtkAccelLabel into an hbox and sets the hbox as the single child. (see genericmenuitem.c's set_label()).

Unfortunately, this breaks Gtk's gtkmenuitem.c's gtk_menu_item_sync_action_properties() function, which only updates the GtkAccelLabel's properties if the GtkAccelLabel is still the direct child of the menuitem.

It looks like there's some precedent in gtkmenuitem.c to look harder for the Accel Label if the menuitem'c child is a container. This is what's done in gtk_menu_item_accel_width_foreach() as a part of determining the menuitem's preferred width for gtk_menu_item_get_preferred_width().

Maybe a similar patch would be accepted upstream for gtk_menu_item_sync_action_properties(). I haven't tested such a patch, but I think it would resolve this bug.