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 154464 - gtk_tooltips_set_tip doesn't work on ToolItems
gtk_tooltips_set_tip doesn't work on ToolItems
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Documentation
2.4.x
Other Linux
: Normal normal
: Small fix
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2004-10-04 14:22 UTC by John Spray
Modified: 2012-08-26 10:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Brief Demonstration (782 bytes, text/plain)
2004-10-04 14:23 UTC, John Spray
Details

Description John Spray 2004-10-04 14:22:06 UTC
For a ToolButton, gtk_tool_item_set_tooltip works, gtk_tooltips_set_tip doesn't
work.  The documentation implies that both should work the same.  Test case follows.
Comment 1 John Spray 2004-10-04 14:23:20 UTC
Created attachment 32210 [details]
Brief Demonstration

Comment out gtk_tool_item_set_tooltip or gtk_tooltips_set_tip to see that one
works and the other does not.
Comment 2 Matthias Clasen 2004-10-04 14:33:50 UTC
I don't read the documentation as implying that gtk_tooltips_set_tip) would work
on toolitems. It will work if you call it on the child of the tool item, which is
what gtk_tool_item_set_tooltip() does. Please reopen if you have a proposal for
clarifying the docs.
Comment 3 John Spray 2004-10-04 14:51:52 UTC
tooltips_set_tip takes a GtkWidget argument.  Toolitem inherits from GtkWidget.
 If we're going to have certain GtkWidgets excluded, that should definitely be
noted.  Since I don't actually know which GtkWidgets work with
gtk_tooltips_set_tip, I can't make this modification myself.

void gtk_tooltips_set_tip (GtkTooltips *tooltips,
                           GtkWidget *widget,
                           const gchar *tip_text,
                           const gchar *tip_private);

GObject
 +----GtkObject
       +----GtkWidget
             +----GtkContainer
                   +----GtkBin
                         +----GtkToolItem
Comment 4 Chris Vine 2004-10-04 22:41:50 UTC
Matthias,

If you look at the test case, you will see that gtk_tooltips_set_tip() does NOT,
as you suggest, work with "the child of the tool item", if by that you mean
something which derives from GtkToolItem.  It does not work with tool buttons,
which was the point of the bug report.
Comment 5 Matthias Clasen 2004-10-05 02:31:02 UTC
the child of the tool item is GTK_BIN(tool_item)->child
Comment 6 Chris Vine 2004-10-05 09:36:02 UTC
So, where 'button' is a pointer to a GtkButton object, this works:

  gtk_tooltips_set_tip(tips, GTK_WIDGET(button), "tooltips_set_tip",
                       "tooltips_set_tip");

Where 'button' is a pointer to a GtkToolButton object it does not.

However, where 'button' is a pointer to a GtkToolButton object, this works:

  gtk_tooltips_set_tip(tips, GTK_WIDGET(GTK_BIN(button)->child),
                       "tooltips_set_tip", "tooltips_set_tip");

As it happens, both GtkButton and GtkToolItem derive directly from GtkBin.  If
this is intended behaviour, it seems to me that the original poster is correct,
and this un-OO like behaviour should be documented for gtk_tooltips_set_tip().

However, it would be better for gtk_tooltips_set_tip() to work with any object
deriving from GtkWidget, since that is the argument it takes.  This would
presumably mean gtk_tooltips_set_tip() specialising itself when passed something
derived from GtkToolItem.  Is there anything else deriving from GtkWidget which
does not work with gtk_tooltips_set_tip()?  If correcting the documentation (or
correcting the implementation of gtk_tooltips_set_tip()) it would be best to be
complete.
Comment 7 David Corrales 2007-02-05 23:00:12 UTC
I have to add that this very strange behavior puzzled me until I found this post. It's not clear according to the docs (or argument types) as to why you have to use a different function in order to set the tooltips for this special kind of button.
I considered this a bug, not really a design "feature", since there's not logical argument of why you would handle this case in a different way.
Comment 8 Tadej Borovšak 2012-08-26 09:22:34 UTC
This bug should probably be marked as notabug, since GtkToolTips API docs clearly state (for more than a decade) that widgets with no GdkWindow cannot have tooltip set.

Commit that added that piece of information to API docs: http://git.gnome.org/browse/gtk+/commit/docs/reference/gtk/tmpl/gtktooltips.sgml?h=gtk-2-24&id=e809560d6af9a3ba7410a7123d090cf65a110183
Comment 9 Emmanuele Bassi (:ebassi) 2012-08-26 10:04:34 UTC
this bug should be marked as obsolete, since GtkTooltips has been deprecated for years in gtk2, and we have new API to set tooltips on widgets. GtkTooltips is also not available in gtk3.