diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ephy-tab.c | 37 | ||||
-rw-r--r-- | src/ephy-tab.h | 2 | ||||
-rw-r--r-- | src/ephy-window.c | 4 | ||||
-rwxr-xr-x | src/toolbar.c | 29 |
4 files changed, 64 insertions, 8 deletions
diff --git a/src/ephy-tab.c b/src/ephy-tab.c index 170ae3846..6430f025a 100644 --- a/src/ephy-tab.c +++ b/src/ephy-tab.c @@ -53,6 +53,7 @@ struct EphyTabPrivate TabLoadStatus load_status; char status_message[255]; char link_message[255]; + char favicon_url[255]; char *title; char *location; int load_percent; @@ -77,6 +78,10 @@ enum }; static void +ephy_tab_favicon_cb (EphyEmbed *embed, + const char *url, + EphyTab *tab); +static void ephy_tab_link_message_cb (EphyEmbed *embed, const char *message, EphyTab *tab); @@ -199,6 +204,7 @@ ephy_tab_init (EphyTab *tab) tab->priv->is_active = FALSE; *tab->priv->status_message = '\0'; *tab->priv->link_message = '\0'; + *tab->priv->favicon_url = '\0'; tab->priv->load_status = TAB_LOAD_NONE; tab->priv->load_percent = 0; tab->priv->title = NULL; @@ -260,6 +266,9 @@ ephy_tab_init (EphyTab *tab) g_signal_connect (embed, "ge_security_change", GTK_SIGNAL_FUNC (ephy_tab_security_change_cb), tab); + g_signal_connect (embed, "ge_favicon", + GTK_SIGNAL_FUNC (ephy_tab_favicon_cb), + tab); } /* Destructor */ @@ -424,6 +433,20 @@ ephy_tab_set_visibility (EphyTab *tab, /* Private callbacks for embed signals */ static void +ephy_tab_favicon_cb (EphyEmbed *embed, + const char *url, + EphyTab *tab) +{ + g_strlcpy (tab->priv->favicon_url, + url, 255); + + if (!tab->priv->is_active) return; + + ephy_window_update_control (tab->priv->window, + FaviconControl); +} + +static void ephy_tab_link_message_cb (EphyEmbed *embed, const char *message, EphyTab *tab) @@ -444,6 +467,7 @@ ephy_tab_location_cb (EphyEmbed *embed, EphyTab *tab) ephy_embed_get_location (embed, TRUE, &tab->priv->location); tab->priv->link_message[0] = '\0'; + tab->priv->favicon_url[0] = '\0'; if (tab->priv->is_active) { @@ -906,6 +930,19 @@ ephy_tab_get_location (EphyTab *tab) return tab->priv->location; } +const char * +ephy_tab_get_favicon_url (EphyTab *tab) +{ + if (tab->priv->favicon_url[0] == '\0') + { + return NULL; + } + else + { + return tab->priv->favicon_url; + } +} + void ephy_tab_set_location (EphyTab *tab, char *location) diff --git a/src/ephy-tab.h b/src/ephy-tab.h index 02e06746f..fe679f553 100644 --- a/src/ephy-tab.h +++ b/src/ephy-tab.h @@ -90,6 +90,8 @@ const char *ephy_tab_get_title (EphyTab *tab); const char *ephy_tab_get_location (EphyTab *tab); +const char *ephy_tab_get_favicon_url (EphyTab *tab); + void ephy_tab_set_location (EphyTab *tab, char *location); diff --git a/src/ephy-window.c b/src/ephy-window.c index dcba93e42..9f751ea8b 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -1086,12 +1086,12 @@ update_favicon_control (EphyWindow *window) cache = ephy_embed_shell_get_favicon_cache (EPHY_EMBED_SHELL (ephy_shell)); - location = ephy_tab_get_location (window->priv->active_tab); + location = ephy_tab_get_favicon_url (window->priv->active_tab); if (location) { GdkPixbuf *pixbuf; - pixbuf = ephy_favicon_cache_lookup_direct (cache, location); + pixbuf = ephy_favicon_cache_get (cache, location); gtk_window_set_icon (GTK_WINDOW (window), pixbuf); } diff --git a/src/toolbar.c b/src/toolbar.c index 24558e4a5..695f657da 100755 --- a/src/toolbar.c +++ b/src/toolbar.c @@ -29,7 +29,6 @@ #include "ephy-gui.h" #include "ephy-location-entry.h" #include "ephy-shell.h" -#include "ephy-embed-favicon.h" #include "ephy-dnd.h" #include "ephy-toolbar-bonobo-view.h" #include "ephy-toolbar-item-factory.h" @@ -255,8 +254,7 @@ toolbar_setup_favicon_ebox (Toolbar *t, GtkWidget *w) g_return_if_fail (w == p->favicon_ebox); - p->favicon = g_object_ref (ephy_embed_favicon_new - (ephy_window_get_active_embed (p->window))); + p->favicon = g_object_ref (gtk_image_new ()); gtk_container_add (GTK_CONTAINER (p->favicon_ebox), p->favicon); gtk_container_set_border_width (GTK_CONTAINER (p->favicon_ebox), 2); @@ -667,10 +665,29 @@ toolbar_set_location (Toolbar *t, void toolbar_update_favicon (Toolbar *t) { - if (t->priv->favicon) + GdkPixbuf *pixbuf = NULL; + EphyFaviconCache *cache; + EphyTab *tab; + const char *url; + + cache = ephy_embed_shell_get_favicon_cache (EPHY_EMBED_SHELL (ephy_shell)); + tab = ephy_window_get_active_tab (t->priv->window); + url = ephy_tab_get_favicon_url (tab); + + if (url) + { + pixbuf = ephy_favicon_cache_get (cache, url); + } + + if (pixbuf) + { + gtk_image_set_from_pixbuf (GTK_IMAGE (t->priv->favicon), pixbuf); + } + else { - ephy_embed_favicon_set_embed (EPHY_EMBED_FAVICON (t->priv->favicon), - ephy_window_get_active_embed (t->priv->window)); + gtk_image_set_from_stock (GTK_IMAGE (t->priv->favicon), + GTK_STOCK_JUMP_TO, + GTK_ICON_SIZE_MENU); } } |