diff options
author | Peter Harvey <peter.a.harvey@gmail.com> | 2006-02-24 22:57:04 +0800 |
---|---|---|
committer | Peter Anthony Harvey <paharvey@src.gnome.org> | 2006-02-24 22:57:04 +0800 |
commit | e665f081cad919a243d5367c13ef039f8662bce5 (patch) | |
tree | 7325451d666878ddeccfdd6e3baeb678a2c6ea4c | |
parent | b9492e9f705fe2a09fa2690d4b403d9604d1a226 (diff) | |
download | gsoc2013-epiphany-e665f081cad919a243d5367c13ef039f8662bce5.tar.gz gsoc2013-epiphany-e665f081cad919a243d5367c13ef039f8662bce5.tar.zst gsoc2013-epiphany-e665f081cad919a243d5367c13ef039f8662bce5.zip |
src/bookmarks/ephy-bookmark-action.c
2006-02-24 Peter Harvey <peter.a.harvey@gmail.com>
* src/bookmarks/ephy-bookmark-action.c
Set the tooltip for bookmarks on the toolbar, using a
'title\nlocation' format. Bug #332113.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmark-action.c | 48 |
2 files changed, 56 insertions, 1 deletions
@@ -2,9 +2,16 @@ * src/bookmarks/ephy-bookmark-action.c + Set the tooltip for bookmarks on the toolbar, using a + 'title\nlocation' format. Bug #332113. + +2006-02-24 Peter Harvey <peter.a.harvey@gmail.com> + + * src/bookmarks/ephy-bookmark-action.c + Update the bookmark icon if the toolbar is reconfigured (happens when the theme changes). Everything else should - be already handled by the class handler. + be already handled by the class handler. Bug #148940. 2006-02-24 Peter Harvey <peter.a.harvey@gmail.com> diff --git a/src/bookmarks/ephy-bookmark-action.c b/src/bookmarks/ephy-bookmark-action.c index 142a1dfa7..b3fea1fdb 100644 --- a/src/bookmarks/ephy-bookmark-action.c +++ b/src/bookmarks/ephy-bookmark-action.c @@ -415,6 +415,51 @@ toolbar_reconfigured_cb (GtkToolItem *toolitem, ephy_bookmark_action_sync_icon (action, NULL, GTK_WIDGET (toolitem)); } + +static gboolean +set_tooltip_cb (GtkToolItem *toolitem, + GtkTooltips *tooltips, + gchar *tip_text, + gchar *tip_private, + GtkAction *action) +{ + EphyBookmarks *bookmarks; + EphyNode *node; + GtkWidget *button; + + const char *title, *location; + char *tooltip; + + node = ephy_bookmark_action_get_bookmark (EPHY_BOOKMARK_ACTION (action)); + bookmarks = ephy_shell_get_bookmarks (ephy_shell_get_default ()); + title = ephy_node_get_property_string (node, EPHY_NODE_BMK_PROP_TITLE); + location = ephy_node_get_property_string (node, EPHY_NODE_BMK_PROP_LOCATION); + tooltip = NULL; + + if (strstr (location, "%s") != NULL) + { + GnomeVFSURI *uri = gnome_vfs_uri_new (location); + if (uri != NULL) + { + tooltip = g_strconcat + (title, "\n", gnome_vfs_uri_get_scheme (uri), + "://", gnome_vfs_uri_get_host_name (uri), NULL); + gnome_vfs_uri_unref (uri); + } + } + if (tooltip == NULL) + { + tooltip = g_strconcat (title, "\n", location, NULL); + } + + button = g_object_get_data (G_OBJECT (toolitem), "button"); + gtk_tooltips_set_tip (tooltips, button, tooltip, NULL); + g_free (tooltip); + + return TRUE; +} + + static void connect_proxy (GtkAction *action, GtkWidget *proxy) @@ -438,8 +483,11 @@ connect_proxy (GtkAction *action, ephy_bookmark_action_sync_label (action, NULL, proxy); g_signal_connect_object (action, "notify::label", G_CALLBACK (ephy_bookmark_action_sync_label), proxy, 0); + g_signal_connect (proxy, "toolbar-reconfigured", G_CALLBACK (toolbar_reconfigured_cb), action); + g_signal_connect (proxy, "set-tooltip", + G_CALLBACK (set_tooltip_cb), action); button = GTK_WIDGET (g_object_get_data (G_OBJECT (proxy), "button")); g_signal_connect (button, "clicked", G_CALLBACK (activate_cb), action); |