75d1f430713fb189f0790d826467f5c6219e6b6d
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 882c9bf..0a822ee 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -497,6 +497,19 @@ ephy_embed_base_init (gpointer g_class)
                                                                           "The embed's link message",
                                                                           NULL,
                                                                           G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+                g_object_interface_install_property (g_class,
+                                                     g_param_spec_object ("icon",
+                                                                          "Icon",
+                                                                          "The embed icon's",
+                                                                          GDK_TYPE_PIXBUF,
+                                                                          G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+
+                g_object_interface_install_property (g_class,
+                                                     g_param_spec_string ("icon-address",
+                                                                          "Icon address",
+                                                                          "The embed icon's address",
+                                                                          NULL,
+                                                                          (G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)));
 		initialized = TRUE;
 	}
 
@@ -1229,3 +1242,34 @@ ephy_embed_get_status_message (EphyEmbed *embed)
 	return iface->get_status_message (embed);
 }
 
+/**
+ * ephy_embed_get_icon:
+ * @embed: an #EphyEmbed
+ *
+ * Returns the embed's site icon as a #GdkPixbuf,
+ * or %NULL if it is not available.
+ *
+ * Return value: a the embed's site icon
+ **/
+GdkPixbuf *
+ephy_embed_get_icon (EphyEmbed *embed)
+{
+	EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
+	return iface->get_icon (embed);
+}
+
+/**
+ * ephy_embed_get_icon_address:
+ * @embed: an #EphyEmbed
+ *
+ * Returns a URL which points to @embed's site icon.
+ *
+ * Return value: the URL of @embed's site icon
+ **/
+const char *
+ephy_embed_get_icon_address (EphyEmbed *embed)
+{
+	EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
+	return iface->get_icon_address (embed);
+}
+
diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h
index 0dc9cfa..87d78f2 100644
--- a/embed/ephy-embed.h
+++ b/embed/ephy-embed.h
@@ -252,6 +252,8 @@ struct _EphyEmbedIface
 							 EphyEmbedAddressExpire expire);
 	const char *	   (* get_address)		(EphyEmbed *embed);
         const char *       (* get_status_message)       (EphyEmbed *embed);
+        GdkPixbuf *        (* get_icon)                 (EphyEmbed *embed);
+        const char *       (* get_icon_address)         (EphyEmbed *embed);
 };
 
 GType		  ephy_embed_net_state_get_type		(void);
@@ -368,6 +370,11 @@ const char *	 ephy_embed_get_address			(EphyEmbed *embed);
 /* Status messages */
 const char *       ephy_embed_get_status_message        (EphyEmbed *embed);
 
+/* Icon and Icon Address */
+
+GdkPixbuf *        ephy_embed_get_icon                  (EphyEmbed *embed);
+const char *       ephy_embed_get_icon_address          (EphyEmbed *embed);
+
 /* Encoding */
 char		 *ephy_embed_get_encoding		(EphyEmbed *embed);
 
diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp
index 6f8b5c6..4ac7626 100644
--- a/embed/mozilla/mozilla-embed.cpp
+++ b/embed/mozilla/mozilla-embed.cpp
@@ -45,6 +45,7 @@
 #include "ephy-debug.h"
 #include "ephy-embed-shell.h"
 #include "ephy-embed-single.h"
+#include "ephy-favicon-cache.h"
 #include "ephy-history.h"
 #include "ephy-string.h"
 #include "mozilla-embed-event.h"
@@ -96,6 +97,14 @@ static void mozilla_embed_set_title             (MozillaEmbed *embed,
 static void mozilla_embed_set_loading_title     (MozillaEmbed *embed,
                                                  const char *title,
                                                  gboolean is_address);
+static void mozilla_embed_icon_cache_changed_cb (EphyFaviconCache *cache,
+                                                 const char *address,
+                                                 MozillaEmbed *embed);
+static void mozilla_embed_set_icon_address      (MozillaEmbed *embed,
+                                                 const char *address);
+static void mozilla_embed_favicon_cb            (EphyEmbed *embed,
+                                                 const char *address,
+                                                 MozillaEmbed *membed);
 static void impl_set_typed_address		(EphyEmbed *embed,
 						 const char *address,
 						 EphyEmbedAddressExpire expire);
@@ -143,6 +152,8 @@ struct MozillaEmbedPrivate
 	int total_requests;
 	char *status_message;
 	char *link_message;
+	char *icon_address;
+	GdkPixbuf *icon;
 
 	/* File watch */
 	GnomeVFSMonitorHandle *monitor;
@@ -157,6 +168,8 @@ enum
 	PROP_0,
 	PROP_ADDRESS,
 	PROP_DOCUMENT_TYPE,
+        PROP_ICON,
+        PROP_ICON_ADDRESS,
         PROP_LINK_MESSAGE,
 	PROP_LOAD_PROGRESS,
 	PROP_LOAD_STATUS,
@@ -275,12 +288,12 @@ mozilla_embed_get_property (GObject *object,
 	case PROP_DOCUMENT_TYPE:
 		g_value_set_enum (value, priv->document_type);
 		break;
-	case PROP_SECURITY:
-		g_value_set_enum (value, priv->security_level);
-		break;
-	case PROP_ZOOM:
-		g_value_set_float (value, priv->zoom);
-		break;
+        case PROP_ICON:
+               g_value_set_object (value, priv->icon);
+               break;
+        case PROP_ICON_ADDRESS:
+               g_value_set_string (value, priv->icon_address);
+               break;
         case PROP_LINK_MESSAGE:
                 g_value_set_string (value, priv->link_message);
                 break;
@@ -293,6 +306,9 @@ mozilla_embed_get_property (GObject *object,
 	case PROP_NAVIGATION:
 		g_value_set_flags (value, priv->nav_flags);
 		break;
+	case PROP_SECURITY:
+		g_value_set_enum (value, priv->security_level);
+		break;
         case PROP_STATUS_MESSAGE:
                 g_value_set_string (value, priv->status_message);
                 break;
@@ -302,6 +318,9 @@ mozilla_embed_get_property (GObject *object,
 	case PROP_TYPED_ADDRESS:
 		g_value_set_string (value, priv->typed_address);
 		break;
+	case PROP_ZOOM:
+		g_value_set_float (value, priv->zoom);
+		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 		break;
@@ -317,12 +336,16 @@ mozilla_embed_set_property (GObject *object,
 {
 	switch (prop_id)
 	{
+        case PROP_ICON_ADDRESS:
+                mozilla_embed_set_icon_address (MOZILLA_EMBED (object), g_value_get_string (value));
+                break;
 	case PROP_TYPED_ADDRESS:
 		impl_set_typed_address (EPHY_EMBED (object), g_value_get_string (value),
 					EPHY_EMBED_ADDRESS_EXPIRE_NOW);
 		break;
         case PROP_ADDRESS:
 	case PROP_DOCUMENT_TYPE:
+        case PROP_ICON:
 	case PROP_LOAD_PROGRESS:
 	case PROP_LOAD_STATUS:
         case PROP_LINK_MESSAGE:
@@ -375,6 +398,7 @@ mozilla_embed_class_init (MozillaEmbedClass *klass)
 static void
 mozilla_embed_init (MozillaEmbed *embed)
 {
+	EphyFaviconCache *cache;
 	MozillaEmbedPrivate *priv = embed->priv;
 	priv = MOZILLA_EMBED_GET_PRIVATE (embed);
 	priv->browser = new EphyBrowser ();
@@ -412,6 +436,15 @@ mozilla_embed_init (MozillaEmbed *embed)
 	g_signal_connect_object (embed, "link_message",
 				 G_CALLBACK (mozilla_embed_link_message_cb),
 				 embed, (GConnectFlags)0);
+	g_signal_connect_object (embed, "ge_favicon",
+				 G_CALLBACK (mozilla_embed_favicon_cb),
+				 embed, (GConnectFlags)0);
+
+	cache = EPHY_FAVICON_CACHE
+		(ephy_embed_shell_get_favicon_cache (embed_shell));
+	g_signal_connect_object (G_OBJECT (cache), "changed",
+				 G_CALLBACK (mozilla_embed_icon_cache_changed_cb),
+				 embed,  (GConnectFlags)0);
 
 	priv->document_type = EPHY_EMBED_DOCUMENT_HTML;
 	priv->security_level = EPHY_EMBED_STATE_IS_UNKNOWN;
@@ -427,6 +460,8 @@ mozilla_embed_init (MozillaEmbed *embed)
 	priv->is_blank = TRUE;
 	priv->total_requests = 0;
 	priv->cur_requests = 0;
+	priv->icon_address = NULL;
+	priv->icon = NULL;
 }
 
 gpointer
@@ -461,6 +496,14 @@ mozilla_embed_finalize (GObject *object)
 		embed->priv->browser = nsnull;
 	}
 
+	if (embed->priv->icon != NULL)
+	{
+		g_object_unref (embed->priv->icon);
+		embed->priv->icon = NULL;
+	}
+
+	g_free (embed->priv->icon_address);
+
 	g_free (embed->priv->address);
 	g_free (embed->priv->typed_address);
 	g_free (embed->priv->title);
@@ -1427,9 +1470,7 @@ mozilla_embed_location_changed_cb (GtkMozEmbed *embed,
 	}
 
 	mozilla_embed_set_link_message (membed, NULL);
-#if 0
-	mozilla_embed_set_icon_address (embed, NULL);
-#endif
+	mozilla_embed_set_icon_address (membed, NULL);
 	mozilla_embed_update_navigation_flags (membed);
 
 	g_object_notify (object, "title");
@@ -1441,9 +1482,89 @@ static void
 mozilla_embed_link_message_cb       (EphyEmbed *embed,
                                      MozillaEmbed *membed)
 {
-  char *link_message = gtk_moz_embed_get_link_message (GTK_MOZ_EMBED (membed));
-  mozilla_embed_set_link_message (membed, link_message);
-  g_free (link_message);
+        char *link_message = gtk_moz_embed_get_link_message (GTK_MOZ_EMBED (membed));
+        mozilla_embed_set_link_message (membed, link_message);
+        g_free (link_message);
+}
+
+static void
+mozilla_embed_load_icon (MozillaEmbed *embed)
+{
+	MozillaEmbedPrivate *priv = embed->priv;
+	EphyEmbedShell *shell;
+	EphyFaviconCache *cache;
+
+	if (priv->icon_address == NULL || priv->icon != NULL) return;
+
+	shell = ephy_embed_shell_get_default ();
+	cache = EPHY_FAVICON_CACHE (ephy_embed_shell_get_favicon_cache (shell));
+
+	/* ephy_favicon_cache_get returns a reference already */
+	priv->icon = ephy_favicon_cache_get (cache, priv->icon_address);
+
+	g_object_notify (G_OBJECT (embed), "icon");
+}
+
+static void
+mozilla_embed_icon_cache_changed_cb (EphyFaviconCache *cache,
+                                     const char *address,
+                                     MozillaEmbed *embed)
+{
+	MozillaEmbedPrivate *priv = embed->priv;
+
+	g_return_if_fail (address != NULL);
+
+	/* is this for us? */
+	if (priv->icon_address != NULL &&
+	    strcmp (priv->icon_address, address) == 0)
+	{
+		mozilla_embed_load_icon (embed);
+	}
+}
+
+static void
+mozilla_embed_set_icon_address (MozillaEmbed *embed,
+                                const char *address)
+{
+	GObject *object = G_OBJECT (embed);
+	MozillaEmbedPrivate *priv = embed->priv;
+        /*	EphyBookmarks *eb;*/
+	EphyHistory *history;
+
+	g_free (priv->icon_address);
+	priv->icon_address = g_strdup (address);
+
+	if (priv->icon != NULL)
+	{
+		g_object_unref (priv->icon);
+		priv->icon = NULL;
+
+		g_object_notify (object, "icon");
+	}
+
+	if (priv->icon_address)
+	{
+		history = EPHY_HISTORY
+			(ephy_embed_shell_get_global_history (embed_shell));
+		ephy_history_set_icon (history, priv->address,
+				       priv->icon_address);
+                /* FIXME: we need to put this somewhere inside src?/
+		eb = ephy_shell_get_bookmarks (ephy_shell);
+		ephy_bookmarks_set_icon (eb, priv->address,
+                priv->icon_address);*/
+
+		mozilla_embed_load_icon (embed);
+	}
+
+	g_object_notify (object, "icon-address");
+}
+
+static void
+mozilla_embed_favicon_cb (EphyEmbed *embed,
+                          const char *address,
+                          MozillaEmbed *membed)
+{
+  	mozilla_embed_set_icon_address (membed, address);
 }
 
 static gboolean
diff --git a/src/ephy-tab.c b/src/ephy-tab.c
index 57e4137..60056cd 100644
--- a/src/ephy-tab.c
+++ b/src/ephy-tab.c
@@ -78,8 +78,6 @@ struct _EphyTabPrivate
 {
 	guint id;
 
-	char *icon_address;
-	GdkPixbuf *icon;
 	int width;
 	int height;
 	GSList *hidden_popups;
@@ -180,10 +178,6 @@ ephy_tab_set_property (GObject *object,
 		case PROP_POPUPS_ALLOWED:
 			ephy_tab_set_popups_allowed (tab, g_value_get_boolean (value));
 			break;
-		case PROP_ICON_ADDRESS:
-			ephy_tab_set_icon_address (tab, g_value_get_string (value));
-			break;
-		case PROP_ICON:
 		case PROP_HIDDEN_POPUP_COUNT:
 			/* read only */
 			break;
@@ -197,16 +191,9 @@ ephy_tab_get_property (GObject *object,
 		       GParamSpec *pspec)
 {
 	EphyTab *tab = EPHY_TAB (object);
-	EphyTabPrivate *priv = tab->priv;
 
 	switch (prop_id)
 	{
-		case PROP_ICON:
-			g_value_set_object (value, priv->icon);
-			break;
-		case PROP_ICON_ADDRESS:
-			g_value_set_string (value, priv->icon_address);
-			break;
 		case PROP_HIDDEN_POPUP_COUNT:
 			g_value_set_int (value, popup_blocker_n_hidden (tab));
 			break;
@@ -307,22 +294,6 @@ ephy_tab_class_init (EphyTabClass *class)
 	widget_class->grab_focus = ephy_tab_grab_focus;
 
 	g_object_class_install_property (object_class,
-					 PROP_ICON,
-					 g_param_spec_object ("icon",
-							      "Icon",
-							      "The tab icon's",
-							      GDK_TYPE_PIXBUF,
-							      G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
-
-	g_object_class_install_property (object_class,
-					 PROP_ICON_ADDRESS,
-					 g_param_spec_string ("icon-address",
-							      "Icon address",
-							      "The tab icon's address",
-							      NULL,
-							      (G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)));
-
-	g_object_class_install_property (object_class,
 					 PROP_HIDDEN_POPUP_COUNT,
 					 g_param_spec_int ("hidden-popup-count",
 							   "Number of Blocked Popups",
@@ -655,13 +626,6 @@ ephy_tab_finalize (GObject *object)
 	EphyTabPrivate *priv = tab->priv;
 	guint id = priv->id;
 
-	if (priv->icon != NULL)
-	{
-		g_object_unref (priv->icon);
-		priv->icon = NULL;
-	}
-
-	g_free (priv->icon_address);
 	popups_manager_reset (tab);
 
 	G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -835,124 +799,8 @@ ephy_tab_set_size (EphyTab *tab,
 	}
 }
 
-static void
-ephy_tab_load_icon (EphyTab *tab)
-{
-	EphyTabPrivate *priv = tab->priv;
-	EphyEmbedShell *shell;
-	EphyFaviconCache *cache;
-
-	if (priv->icon_address == NULL || priv->icon != NULL) return;
-
-	shell = ephy_embed_shell_get_default ();
-	cache = EPHY_FAVICON_CACHE (ephy_embed_shell_get_favicon_cache (shell));
-
-	/* ephy_favicon_cache_get returns a reference already */
-	priv->icon = ephy_favicon_cache_get (cache, priv->icon_address);
-
-	g_object_notify (G_OBJECT (tab), "icon");
-}
-
-static void
-ephy_tab_icon_cache_changed_cb (EphyFaviconCache *cache,
-				const char *address,
-				EphyTab *tab)
-{
-	EphyTabPrivate *priv = tab->priv;
-
-	g_return_if_fail (address != NULL);
-
-	/* is this for us? */
-	if (priv->icon_address != NULL &&
-	    strcmp (priv->icon_address, address) == 0)
-	{
-		ephy_tab_load_icon (tab);
-	}
-}
-
-void
-ephy_tab_set_icon_address (EphyTab *tab,
-			   const char *address)
-{
-	GObject *object = G_OBJECT (tab);
-	EphyTabPrivate *priv = tab->priv;
-	EphyBookmarks *eb;
-	EphyHistory *history;
-
-	g_free (priv->icon_address);
-	priv->icon_address = g_strdup (address);
-
-	if (priv->icon != NULL)
-	{
-		g_object_unref (priv->icon);
-		priv->icon = NULL;
-
-		g_object_notify (object, "icon");
-	}
-
-	if (priv->icon_address)
-	{
-		eb = ephy_shell_get_bookmarks (ephy_shell);
-		history = EPHY_HISTORY
-			(ephy_embed_shell_get_global_history (embed_shell));
-		ephy_bookmarks_set_icon (eb, priv->address,
-				         priv->icon_address);
-		ephy_history_set_icon (history, priv->address,
-				       priv->icon_address);
-
-		ephy_tab_load_icon (tab);
-	}
-
-	g_object_notify (object, "icon-address");
-}
-
-/**
- * ephy_tab_get_icon:
- * @tab: an #EphyTab
- *
- * Returns the tab's site icon as a #GdkPixbuf,
- * or %NULL if it is not available.
- *
- * Return value: a the tab's site icon
- **/
-GdkPixbuf *
-ephy_tab_get_icon (EphyTab *tab)
-{
-	EphyTabPrivate *priv;
-
-	g_return_val_if_fail (EPHY_IS_TAB (tab), NULL);
-
-	priv = tab->priv;
-
-	return priv->icon;
-}
-
-/**
- * ephy_tab_get_icon_address:
- * @tab: an #EphyTab
- *
- * Returns a URL which points to @tab's site icon.
- *
- * Return value: the URL of @tab's site icon
- **/
-const char *
-ephy_tab_get_icon_address (EphyTab *tab)
-{
-	g_return_val_if_fail (EPHY_IS_TAB (tab), NULL);
-
-	return tab->priv->icon_address;
-}
-
 /* Private callbacks for embed signals */
 
-static void
-ephy_tab_favicon_cb (EphyEmbed *embed,
-		     const char *address,
-		     EphyTab *tab)
-{
-	ephy_tab_set_icon_address (tab, address);
-}
-
 static gboolean
 ephy_tab_open_uri_cb (EphyEmbed *embed,
 		      const char *uri,
@@ -1180,7 +1028,6 @@ ephy_tab_init (EphyTab *tab)
 {
 	EphyTabPrivate *priv;
 	GObject *embed;
-	EphyFaviconCache *cache;
 	guint id;
 
 	LOG ("EphyTab initialising %p", tab);
@@ -1218,8 +1065,6 @@ ephy_tab_init (EphyTab *tab)
 
 	tab->priv->width = -1;
 	tab->priv->height = -1;
-	priv->icon_address = NULL;
-	priv->icon = NULL;
 
 	embed = ephy_embed_factory_new_object (EPHY_TYPE_EMBED);
 	g_assert (embed != NULL);
@@ -1239,18 +1084,9 @@ ephy_tab_init (EphyTab *tab)
 	g_signal_connect_object (embed, "ge_dom_mouse_click",
 				 G_CALLBACK (ephy_tab_dom_mouse_click_cb),
 				 tab, 0);
-	g_signal_connect_object (embed, "ge_favicon",
-				 G_CALLBACK (ephy_tab_favicon_cb),
-				 tab, 0);
 	g_signal_connect_object (embed, "ge_content_change",
 				 G_CALLBACK (ephy_tab_content_change_cb),
 				 tab, 0);
-
-	cache = EPHY_FAVICON_CACHE
-		(ephy_embed_shell_get_favicon_cache (EPHY_EMBED_SHELL (ephy_shell)));
-	g_signal_connect_object (G_OBJECT (cache), "changed",
-				 G_CALLBACK (ephy_tab_icon_cache_changed_cb),
-				 tab,  0);
 }
 
 /**
