diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2003-12-20 06:58:40 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2003-12-20 06:58:40 +0800 |
commit | bb654d80e463104c05d9fa92c7ab5a8cbdf30384 (patch) | |
tree | 48b507cdd7000400d56a5b27db18ac7917e0776e /src | |
parent | b8823a91a4c7e5a3b3b3e27be07b7cc9f8006b4e (diff) | |
download | gsoc2013-epiphany-bb654d80e463104c05d9fa92c7ab5a8cbdf30384.tar gsoc2013-epiphany-bb654d80e463104c05d9fa92c7ab5a8cbdf30384.tar.gz gsoc2013-epiphany-bb654d80e463104c05d9fa92c7ab5a8cbdf30384.tar.bz2 gsoc2013-epiphany-bb654d80e463104c05d9fa92c7ab5a8cbdf30384.tar.lz gsoc2013-epiphany-bb654d80e463104c05d9fa92c7ab5a8cbdf30384.tar.xz gsoc2013-epiphany-bb654d80e463104c05d9fa92c7ab5a8cbdf30384.tar.zst gsoc2013-epiphany-bb654d80e463104c05d9fa92c7ab5a8cbdf30384.zip |
Use favicons in the back/forward menus.
2003-12-19 Christian Persch <chpe@cvs.gnome.org>
* src/ephy-navigation-action.c: (ephy_navigation_action_get_type),
(new_history_menu_item), (setup_back_or_forward_menu),
(setup_up_menu):
Use favicons in the back/forward menus.
Diffstat (limited to 'src')
-rw-r--r-- | src/ephy-navigation-action.c | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/src/ephy-navigation-action.c b/src/ephy-navigation-action.c index ef5c393f7..0cf42896e 100644 --- a/src/ephy-navigation-action.c +++ b/src/ephy-navigation-action.c @@ -22,6 +22,9 @@ #include "ephy-arrow-toolbutton.h" #include "ephy-window.h" #include "ephy-string.h" +#include "ephy-favicon-cache.h" +#include "ephy-history.h" +#include "ephy-embed-shell.h" #include "ephy-debug.h" #include <gtk/gtkimage.h> @@ -52,7 +55,7 @@ ephy_navigation_action_get_type (void) { static GType type = 0; - if (!type) + if (type == 0) { static const GTypeInfo type_info = { @@ -71,26 +74,49 @@ ephy_navigation_action_get_type (void) "EphyNavigationAction", &type_info, 0); } + return type; } #define MAX_LENGTH 60 static GtkWidget * -new_history_menu_item (char *origtext, - GdkPixbuf *icon) +new_history_menu_item (const char *origtext, + const char *address) { GtkWidget *item, *image; + GdkPixbuf *icon = NULL; char *short_text; + if (address != NULL) + { + EphyFaviconCache *cache; + EphyHistory *history; + const char *icon_address; + + history = EPHY_HISTORY + (ephy_embed_shell_get_global_history (embed_shell)); + icon_address = ephy_history_get_icon (history, address); + + cache = EPHY_FAVICON_CACHE + (ephy_embed_shell_get_favicon_cache (embed_shell)); + icon = ephy_favicon_cache_get (cache, icon_address); + } + short_text = ephy_string_shorten (origtext, MAX_LENGTH); item = gtk_image_menu_item_new_with_label (short_text); g_free (short_text); image = gtk_image_new_from_pixbuf (icon); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); + gtk_widget_show (image); gtk_widget_show (item); + if (icon != NULL) + { + g_object_unref (icon); + } + return item; } @@ -164,7 +190,7 @@ setup_back_or_forward_menu (EphyWindow *window, GtkMenuShell *ms, EphyNavigation char *title, *url; GtkWidget *item; ephy_embed_shistory_get_nth (embed, start, FALSE, &url, &title); - item = new_history_menu_item (title ? title : url, NULL); + item = new_history_menu_item (title ? title : url, url); gtk_menu_shell_append (ms, item); g_object_set_data (G_OBJECT (item), "go_nth", GINT_TO_POINTER (start)); g_signal_connect (item, "activate", @@ -203,7 +229,7 @@ setup_up_menu (EphyWindow *window, GtkMenuShell *ms) char *url = li->data; GtkWidget *item; - item = new_history_menu_item (url, NULL); + item = new_history_menu_item (url, url); gtk_menu_shell_append (ms, item); g_object_set_data (G_OBJECT(item), "go_nth", GINT_TO_POINTER (count)); g_signal_connect (item, "activate", |