GNOME Bugzilla – Bug 455482
remove old tooltips work-around from uimanager
Last modified: 2007-07-10 18:01:32 UTC
GtkUIManager/GtkAction has some work-around for the old tooltip code not being able to set tooltips on toolitems not in a toolbar; this is obsolete with the new tooltips code.
Created attachment 91533 [details] [review] fix
The first chunk looks right to me. >Index: gtk/gtkaction.c >=================================================================== >--- gtk/gtkaction.c (révision 18431) >+++ gtk/gtkaction.c (copie de travail) >@@ -1451,13 +1444,8 @@ static void > gtk_action_sync_tooltip (GtkAction *action, > GtkWidget *proxy) > { >- GtkWidget *parent; >- >- parent = gtk_widget_get_parent (proxy); >- >- if (GTK_IS_TOOL_ITEM (proxy) && GTK_IS_TOOLBAR (parent)) >- gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM (proxy), >- action->private_data->tooltip); >+ gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM (proxy), >+ action->private_data->tooltip); I don't see why this has to be changed. Doesn't this code currently guard against tooltips being set on menu items, and in general all items except toolbar items?
(In reply to comment #2) > >- if (GTK_IS_TOOL_ITEM (proxy) && GTK_IS_TOOLBAR (parent)) > >- gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM (proxy), > >- action->private_data->tooltip); > >+ gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM (proxy), > >+ action->private_data->tooltip); > > > I don't see why this has to be changed. Doesn't this code currently guard > against tooltips being set on menu items, and in general all items except > toolbar items? The problematic part was the |GTK_IS_TOOLBAR (parent)| check. But you're right that the patch applied the tooltip incorrectly to !tool-item objects; attached updated patch corrects this by protecting the another caller of gtk_action_sync_tooltip with GTK_IS_TOOL_ITEM (proxy); the one other caller is already calling it only in this condition.
Created attachment 91543 [details] [review] updated patch: don't use gtk_tool_item_set_tooltip_text on non-toolitems
Looks good to me. Thanks for cleaning that up.
* gtk/gtkaction.c: (gtk_action_sync_tooltip), (gtk_action_set_tooltip): * gtk/gtkuimanager.c: (update_node): Remove work-around for the old tooltips code, and just set the action tooltip immediately on the proxy widget. Bug #455482.