After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 458283 - wrong tooltip on menutoolbutton
wrong tooltip on menutoolbutton
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkToolbar
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks: 341400
 
 
Reported: 2007-07-19 12:24 UTC by Christian Persch
Modified: 2011-02-04 16:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
testcase (1019 bytes, text/plain)
2007-07-19 12:24 UTC, Christian Persch
  Details
transfer possible tooltip to new box (659 bytes, patch)
2007-08-07 10:54 UTC, Kristian Rietveld
reviewed Details | Review

Description Christian Persch 2007-07-19 12:24:02 UTC
Steps to repro:
0)
item = gtk_menu_tool_button_new_from_stock (GTK_STOCK_GO_BACK);
gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM (item), "Go back");
gtk_menu_tool_button_set_arrow_tooltip_text (GTK_MENU_TOOL_BUTTON (item), "Back history");
gtk_widget_set_tooltip_text (GTK_WIDGET (item), "Widget tooltip");

1) Move mouse to the drop-down arrow
2) Move mouse to the back icon
3) Move mouse directly and very quickly to the drop-down arrow
4) Move mouse slowly back to the back icon so that the button is just highlighted but the mouse pointer still at the extreme border of it (i.e. moving it one pixel to the right un-highlights the back icon button)

Results:
1) No tooltip shows up on the drop-down arrow.
2) Tooltip shows up, but it's the one from gtk_widget_set_tooltip_text not the one from gtk_tool_item_set_tooltip_text
3) Tooltip shows up on the drop-down arrow!
4) No tooltip shows up
Comment 1 Christian Persch 2007-07-19 12:24:44 UTC
Created attachment 91976 [details]
testcase
Comment 2 Kristian Rietveld 2007-07-19 17:26:12 UTC
Try setting the tooltip after inserting the item into the toolbar.

The problem here really is that gtk_tool_item_set_tooltIp() is setting the tooltip on its child.  However, during toolbar reconfiguration (which happens when you insert this tool item), a new box is created, and the old one is replaced, and hence the tooltip is lost.  Maybe this was one of the reasons for the ::set-tooltip signal?  Since the ::set-tooltip handler here is setting the tooltip on the button (which is packed into the hbox), instead of on the hbox ...

As a solution here we  could move over the tooltip properties from one hbox to the other ...

Any opinions here?
Comment 3 Christian Persch 2007-07-19 18:13:56 UTC
IMHO the tooltip should be transferred, yes. We can't expect the programmer to know that the tool item internas are going to be reconstructed in ways that make it lose the tooltip. And not being able to set the tooltip until the item is in a toolbar (and having to re-set it after a toolbar style change) was one of the major flaws of the old API; I'd rather not introduce it into the new API.
Comment 4 Kristian Rietveld 2007-08-07 10:54:31 UTC
Created attachment 93199 [details] [review]
transfer possible tooltip to new box

This patch transfers a tooltip to the new box (if needed).  I don't think this is the most elegant solution.

As I argued before, this feels like the reason why set-tooltip was introduced as a virtual function.  We really want to have this tooltip on the button here, but gtk_toolitem_set_tooltip() sets it on toolitem->child, which is an hbox in this case.  There seems to be a real need to be able to set the toolitem tooltip on something else than toolitem->child.

I don't think the problem of not being able to set a tooltip on a toolbar toolitem will ever return, since that required the GtkToolbar to be alive and provide a GtkTooltips structure, AFAIK.  And right now, the tooltip is just a property on the object.
Comment 5 Matthias Clasen 2007-09-09 19:58:17 UTC
Does this also need to handle complex tooltips with query-tooltip ? 
Comment 6 Christian Persch 2007-09-09 21:19:52 UTC
I don't think we need to support query-tooltip for menutoolbutton (and anyway if one connected to it, one would presumably connect to it on the menutoolbutton itself not its child, I think).
Comment 7 Kristian Rietveld 2007-09-10 12:45:23 UTC
And for GtkToolItem we only have helper functions for tooltip_text and tooltip_markup to replace gtk_toolitem_set_tooltip() as well.
Comment 8 Kristian Rietveld 2007-09-10 12:49:20 UTC
Committed in r18785.