diff options
author | Cosimo Cecchi <cosimoc@svn.gnome.org> | 2007-09-10 06:43:58 +0800 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@src.gnome.org> | 2007-09-10 06:43:58 +0800 |
commit | 8344bc78c1bfc2e200c4525f07c4e50ba77f279d (patch) | |
tree | 5bd2b6e69472798bca91ebe89e4b40f3dc41ddb1 /src | |
parent | 7a9491270389f22445a70f56aadf25d140960836 (diff) | |
download | gsoc2013-epiphany-8344bc78c1bfc2e200c4525f07c4e50ba77f279d.tar gsoc2013-epiphany-8344bc78c1bfc2e200c4525f07c4e50ba77f279d.tar.gz gsoc2013-epiphany-8344bc78c1bfc2e200c4525f07c4e50ba77f279d.tar.bz2 gsoc2013-epiphany-8344bc78c1bfc2e200c4525f07c4e50ba77f279d.tar.lz gsoc2013-epiphany-8344bc78c1bfc2e200c4525f07c4e50ba77f279d.tar.xz gsoc2013-epiphany-8344bc78c1bfc2e200c4525f07c4e50ba77f279d.tar.zst gsoc2013-epiphany-8344bc78c1bfc2e200c4525f07c4e50ba77f279d.zip |
Makes tooltips for Back and Forward buttons display the titles of relative
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.
svn path=/trunk/; revision=7364
Diffstat (limited to 'src')
-rw-r--r-- | src/ephy-toolbar.c | 20 | ||||
-rw-r--r-- | src/ephy-toolbar.h | 4 | ||||
-rw-r--r-- | src/ephy-window.c | 30 |
3 files changed, 54 insertions, 0 deletions
diff --git a/src/ephy-toolbar.c b/src/ephy-toolbar.c index 48d4dc832..beb5f9070 100644 --- a/src/ephy-toolbar.c +++ b/src/ephy-toolbar.c @@ -457,6 +457,26 @@ ephy_toolbar_set_navigation_actions (EphyToolbar *toolbar, } void +ephy_toolbar_set_navigation_tooltips (EphyToolbar *toolbar, + const char *back_title, + const char *forward_title) +{ + EphyToolbarPrivate *priv = toolbar->priv; + GValue value = { 0 }; + + g_value_init (&value, G_TYPE_STRING); + + g_value_set_static_string (&value, back_title); + g_object_set_property (G_OBJECT (priv->actions[BACK_ACTION]), + "tooltip", &value); + + g_value_set_static_string (&value, forward_title); + g_object_set_property (G_OBJECT (priv->actions[FORWARD_ACTION]), + "tooltip", &value); + g_value_unset (&value); +} + +void ephy_toolbar_set_security_state (EphyToolbar *toolbar, gboolean is_secure, gboolean show_lock, diff --git a/src/ephy-toolbar.h b/src/ephy-toolbar.h index 1da72f953..3ed7aa377 100644 --- a/src/ephy-toolbar.h +++ b/src/ephy-toolbar.h @@ -86,6 +86,10 @@ void ephy_toolbar_set_navigation_actions (EphyToolbar *toolbar, gboolean forward, gboolean up); +void ephy_toolbar_set_navigation_tooltips (EphyToolbar *toolbar, + const char *back_title, + const char *forward_title); + void ephy_toolbar_set_security_state (EphyToolbar *toolbar, gboolean is_secure, gboolean show_lock, diff --git a/src/ephy-window.c b/src/ephy-window.c index 6865c6909..dc9366d20 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -1474,6 +1474,10 @@ sync_tab_navigation (EphyTab *tab, { EphyTabNavigationFlags flags; gboolean up = FALSE, back = FALSE, forward = FALSE; + EphyEmbed *embed; + char *back_url = NULL, *forward_url = NULL; + char *back_title = NULL, *forward_title = NULL; + gint position; if (window->priv->closing) return; @@ -1494,6 +1498,32 @@ sync_tab_navigation (EphyTab *tab, ephy_toolbar_set_navigation_actions (window->priv->toolbar, back, forward, up); + + embed = ephy_tab_get_embed (tab); + if (embed == NULL) return; + + position = ephy_embed_shistory_get_pos (embed); + + if (position > 0) + { + ephy_embed_shistory_get_nth (embed, -1, TRUE, + &back_url, &back_title); + } + + if (position < ephy_embed_shistory_n_items (embed) - 1) + { + ephy_embed_shistory_get_nth (embed, 1, TRUE, + &forward_url, &forward_title); + } + + ephy_toolbar_set_navigation_tooltips (window->priv->toolbar, + back_title, + forward_title); + + g_free (back_title); + g_free (back_url); + g_free (forward_title); + g_free (forward_url); } static void |