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 347637 - Tooltips on toolbar broken
Tooltips on toolbar broken
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Class: UIManager / Actions
2.10.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
: 387686 (view as bug list)
Depends on:
Blocks: 341400
 
 
Reported: 2006-07-15 23:41 UTC by Reinout van Schouwen
Modified: 2011-02-04 16:10 UTC
See Also:
GNOME target: ---
GNOME version: 2.15/2.16



Description Reinout van Schouwen 2006-07-15 23:41:10 UTC
The tooltips on the toolbar are broken with GTK 2.10.

Maybe a GTK bug, filing here now so we don't forget about it.
Comment 1 Christian Persch 2006-07-16 11:36:46 UTC
Definitely a gtk+ problem, since I cannot reproduce this on epiphany 2.14 using gtk+ 2.8 but can when using same version with gtk 2.10. Re-assigning.

This could have broken with either bug 300982 or bug 312173...

Also I noticed that gtk_action_sync_tooltip is wrong: is takes the tooltip text from its private data instead of getting the property (which can be overridden in a derived class!)

  if (GTK_IS_TOOL_ITEM (proxy) && GTK_IS_TOOLBAR (parent))
    gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (proxy),
                               GTK_TOOLBAR (parent)->tooltips,
                               action->private_data->tooltip,
                               NULL);
Comment 2 Matthias Clasen 2006-07-17 15:05:08 UTC
I don't see whats wrong with using private data there. If a derived class
overrides the property, it better store it to the same place.
Comment 3 Crispin Flowerday (not receiving bugmail) 2006-07-17 15:13:43 UTC
How can a derived class store the tooltip in the same place ? It doesn't have access to the GtkAction's private_data (or am I missing something ?)
Comment 4 Christian Persch 2006-07-17 16:29:26 UTC
(
Epiphany's bookmarks action overrides the "tooltip" property, in order to save memory (the tooltip is the location) and we really don't want to store the same potentially long string a 2nd time as tooltip.
The problem that the tooltips don't work anymore is unrelated to this (since it also concerns normal toolitems), it was just something I noticed when I looked at potential sources of the problem.
)
Comment 5 Matthias Clasen 2006-07-17 18:00:34 UTC
Crispin, you can "chain up the setter" by calling
g_object_set (object, "BaseClass::propname", value, NULL)

Christian, can you give a testcase of nonworking tooltips on toolitems ?
It seems to work fine with testactions and testmerge

Comment 6 Christian Persch 2006-07-17 19:14:55 UTC
Chaining up will store the string in extra memory, which I don't want to do...
(it's rarely used [only on tooltips on toolbar, and on statusbar on demand])

I don't have a testcase yet, but Epiphany creates a toolitem from an action, inserts into the toolbar and then calls notify on ::tooltip to get the tooltip to actually appear; while in testmerge the UI manager handles the entire toolbar... 
Comment 7 Matthias Clasen 2006-08-17 05:32:15 UTC
As a workaround for your notify problem, you can simply replace 

g_object_notify (action, "tooltip")

by

g_object_get (action, "tooltip", &tooltip, NULL);
g_object_set (action, "tooltip", tooltip, NULL);
g_free (tooltip);
 
For your duplicate tooltip storage problem, have you verified
that it actually works to make gtk_action_sync_tooltip use
g_object_get (action, "tooltip", &tooltip, NULL) instead
of action->private_data->tooltip ? I'm not 100% sure if overriding
the property plays nicely with g_object_get.

I'm willing to do that change if you confirm that it works.
Comment 8 Bastiaan 2006-11-18 18:05:50 UTC
Hi,

To make tooltips work on the toolbar, I had to specify the (supposedly) private tooltips of the GtkToolbar. So:


/* code start */

GtkToolbar *my_toolbar = gtk_toolbar_new();
gtk_toolbar_set_tooltips( my_toolbar, TRUE );

/* ... */

GtkToolItem *item = gtk_tool_button_new_from_stock( GTK_STOC_HELP );
gtk_tool_item_set_tooltip( item, my_toolbar->tooltips, "Tip", "Private" );

/* code end */


If GtkToolbar should really have only private members, then there should be a gtk_toolbar_get_tooltips(), so you can do

gtk_tool_item_set_tooltip( item, gtk_toolbar_get_tooltips( my_menubar ), "Tip", "Private" );

The current API is a bit chaotic, compared to the deprecated API. Previously, tooltips were enabled/disabled and set using gtk_toolbar methods. Now they are set with a gtk_tool_item method, in combination with data (or a future method) from gtk_toolbar. That is a bit much flipping back-and-forth in the documentation and it may take a while before a user figures out how to make tooltips on tool items work.

Actually, specifying the GtkToolTips at all seems a lot of unnecessary typing, as it rarely seems useful to have several groups of tooltips for a menubar, or even all menubars in an application. If gtk_tool_item_set_tooltip() is called after gtk_toolbar_insert, it could figure out the tooltips group by itself. Alternatively, gtk_toolbar_insert() could take tooltips much like the deprecated functions do, or there could be a variant like gtk_toolbar_insert_with_tooltip().

Another alternative is to have all toolbar items in an application share the same tooltips group, so it need not be specified.

Or am I supposed to define a GtkTooltips of my own and use that instead of the one in GtkToolbar? If that is the case, then gtk_toolbar_set_tooltips() should have been deprecated.

Anyway, I am confused by the current API and unsure how one is supposed to code in an undeprecated way.


Best regards,
Bastiaan Veelo.
(using 2.10.6)
Comment 9 Reinout van Schouwen 2006-12-20 23:42:57 UTC
*** Bug 387686 has been marked as a duplicate of this bug. ***
Comment 10 Kristian Rietveld 2007-07-09 19:31:40 UTC
(FYI: Note that the toolbar will use the new tooltips API from 2.11.6 and higher).
Comment 11 Christian Persch 2007-07-10 13:47:36 UTC
I changed the epiphany toolbar implementation to use the new tooltips API, which fixes this problem. I think the cause was the work-around that bug 455482 will remove, so I'm closing this bug.