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 341400 - Tooltips for Back and Forward buttons should be titles of the relevant pages
Tooltips for Back and Forward buttons should be titles of the relevant pages
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: Controls
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: Epiphany Maintainers
Marco Pesenti Gritti
Depends on: 347637 458283
Blocks:
 
 
Reported: 2006-05-11 11:57 UTC by Matthew Paul Thomas (mpt)
Modified: 2007-09-09 22:49 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
Add back/forward titles to navigation tooltips (2.40 KB, patch)
2007-09-09 06:02 UTC, Cyril Brulebois
needs-work Details | Review
Updated navigation tooltips patch (2.55 KB, patch)
2007-09-09 21:21 UTC, Cyril Brulebois
committed Details | Review

Description Matthew Paul Thomas (mpt) 2006-05-11 11:57:45 UTC
Epiphany 2.14.1, Ubuntu Dapper

The tooltip for the Back button should be "Back to “Title of previous page, ellipsized in the middle if necessary”". Similarly, the tooltip for the Forward button should be "Forward to “Title of next page, ellipsized in the middle if necessary”".

See also bug 169397.
Comment 1 Christian Persch 2007-03-12 12:25:22 UTC
Moving to 2.20 target due to feature and UI freeze for 2.18.
Comment 2 Christian Persch 2007-08-27 20:43:02 UTC
Moving Severity:enhancement bugs off of 2.20 target.
Comment 3 Cyril Brulebois 2007-09-07 05:21:24 UTC
I'm interested in implementing this, be it in an extension (as discussed in another bugreport) or in Epiphany itself, at least if I'm given a go. :)
Comment 4 Christian Persch 2007-09-08 20:47:01 UTC
Setting the tooltip itself should work now with the new gtk tooltips system; just use gtk_tool_item_set_tooltip_text(). You can get the title from ephy_embed_shistory_get_nth().

(However middle ellipsisation isn't possible with the gtk tooltips framework.)
Comment 5 Cyril Brulebois 2007-09-09 02:18:26 UTC
Alright. Now I'm wondering, after having had a look at src/ephy-tab.c, whether the appropriate would be in “ephy_tab_update_navigation_flags()”, since it seems to be called from several places, and that's where I would tend to put such tooltip text update code.
Comment 6 Cyril Brulebois 2007-09-09 05:24:36 UTC
I discovered “sync_tab_navigation()” in src/ephy-window.c some minutes later, but I'm still patching. I'll keep you posted in less than some hours, I hope. :)
Comment 7 Cyril Brulebois 2007-09-09 06:01:57 UTC
Some comments on the following patch:
 - I played a bit with “array-tooltip” before “tooltip”, that's why this patch
   isn't using “gtk_tool_item_set_tooltip_text()”; AFAIUI, that allows the
   tooltip text to be also displayed in the statusbar, that's why I'm not sure
   it is needed that I rewrite it to use the function you mentioned, but of
   course, I may be totally wrong;
 - that's the first time I play with g_value*, I'm not sure I did it the right
   way;
 - I was first tempted to also pass a “up_title” paramter (see the
   “ephy_toolbar_set_navigation_actions()” prototype, but I can't see how we
   could get its *title* (the URL could be computed, though), that's why I
   dropped it.

As always, comments and slapping welcome. :)
Comment 8 Cyril Brulebois 2007-09-09 06:02:43 UTC
Created attachment 95201 [details] [review]
Add back/forward titles to navigation tooltips
Comment 9 Christian Persch 2007-09-09 12:58:28 UTC
Thanks for the patch!

+	g_value_set_string (&value, back_title);
+	g_object_set_property (G_OBJECT (priv->actions[BACK_ACTION]),
+			       "tooltip", &value);
+
+	g_value_set_string (&value, forward_title);

You can use g_value_set_static_string to save string copies.

+	g_value_set_string (&value, forward_title);
+	g_object_set_property (G_OBJECT (priv->actions[FORWARD_ACTION]),
+			       "tooltip", &value);
+}

You need g_value_unset (&value) afterwards here to clean up.

+	if (ephy_embed_shistory_get_pos (embed) > 0)
+	{
+		ephy_embed_shistory_get_nth (embed, -1, TRUE,
+					     &back_url, &back_title);
+	}
+
+	if (ephy_embed_shistory_get_pos (embed) < ephy_embed_shistory_n_items (embed) - 1)
+	{

Just store the _get_pos result in a local variable instead of calling it twice. And use "... else if (...)" here.

+	ephy_toolbar_set_navigation_tooltips (window->priv->toolbar,
+					      back_title,
+					      forward_title);

You need to free back/forward_title and _url.

Actually maybe the implementation of ephy_embed_shistory_get_nth should be changed to allow passing NULL if you're not interested in the URL, so we make fewer string copies here.
Comment 10 Christian Persch 2007-09-09 13:24:11 UTC
(Note that due to bug 458283 the tooltips might not work correctly right now; but that shouldn't stop a patch from being committed to epiphany.)
Comment 11 Cyril Brulebois 2007-09-09 21:21:16 UTC
Created attachment 95229 [details] [review]
Updated navigation tooltips patch

 - g_value_set_static_string: Done, thanks.
 - g_value_unset: Done, thanks.
 - position: Done, I wasn't sure just calling it twice would imply
   the need of caching this value, but OK, I'm learning. :)
 - if/else if: discussed on IRC, not done.
 - g_free: usually I try adding them, and see whether they are needed
   (SEGV otherwise). Maybe you would accept a documentation patch, so
   that it is specified that they are malloc()'d / have to be freed?
 - I agree that its accepting NULL for parameters I don't care about
   is what I expected in the first place.
Comment 12 Christian Persch 2007-09-09 21:29:01 UTC
Let's do a follow-up patch in a new bug for the NULL parameters then.

Thanks for the patch! oktc, trunk only.
Comment 13 Cosimo Cecchi 2007-09-09 22:49:27 UTC
Committed the patch. Closing this bug as FIXED, as for comment #10.

2007-09-10  Cosimo Cecchi  <cosimoc@svn.gnome.org>

        * src/ephy-toolbar.c: (ephy_toolbar_set_navigation_tooltips):
        * src/ephy-toolbar.h:
        * src/ephy-window.c: (sync_tab_navigation):

        Makes tooltips for Back and Forward buttons display the titles of
        relative pages. Fixes bug #341400. Patch by Cyril Brulebois.