GNOME Bugzilla – Bug 300982
fix handling of tooltips in gtkaction.c
Last modified: 2005-04-29 16:32:00 UTC
gtkaction.c has two prominent FIXMEs dealing with tooltips on tool-items. I think this can be easily fixed and will attach a small patch. What the patch does it to check if the proxy widget has already been added to a toolbar at the point the action is connected to it. It then sets the tooltip. At the moment, tooltips would only show up if gtk_action_connect_proxy() is called before gtk_toolbar_insert(). The patch is simple because gtk_action_sync_tooltip() already checks if the parent widget is a toolbar so it should be safe to call it here. The patch also changes a few lines in gtkuimanager.c where an object notification is done the hard way instead of simply using g_object_notify().
Created attachment 45363 [details] [review] patch against gtk-2-6
I have to correct myself; comment #1 is not entirely correct. At the moment, if one creates a toolitem manually, inserts it into a toolbar and connects it to an action, no tooltip will be set. With this patch, the behaviour is improved so that tooltips will be set if the action is connected after the item is inserted into the toolbar. There will still be no tooltips if the item is first connected to an action, then inserted. The workaround for this problem is to call g_object_notify (action, "tooltip") after inserting the item to the toolbar. This is what GtkUIManager is doing. Perhaps this should be documented somewhere.
This bug-report has a very simple patch attached to it and I tried my best to explain it. Any particular reason why there has been no comment yet? At least the small change to gtkuimanager.c should IMO be committed as soon as possible.
Looks fine to me. Can you commit it to both branches ?
2005-04-29 Matthias Clasen <mclasen@redhat.com> * gtk/gtkuimanager.c (update_node): Use g_object_notify() instead of triggering a ::notify by re-setting the property. (#300982, Sven Neumann) * gtk/gtkaction.c (connect_proxy): Use gtk_action_sync_tooltip().