aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-08-01 02:27:06 +0800
committerChristian Persch <chpe@src.gnome.org>2005-08-01 02:27:06 +0800
commit1aa3163b9c63dbf16e98f65ba1bba7a28d1ef194 (patch)
treef055e27836ac38c29a00183fdc54cc90a55c8e1b
parent61d59c31fc965d667f51777e102189d81b3833ee (diff)
downloadgsoc2013-epiphany-1aa3163b9c63dbf16e98f65ba1bba7a28d1ef194.tar
gsoc2013-epiphany-1aa3163b9c63dbf16e98f65ba1bba7a28d1ef194.tar.gz
gsoc2013-epiphany-1aa3163b9c63dbf16e98f65ba1bba7a28d1ef194.tar.bz2
gsoc2013-epiphany-1aa3163b9c63dbf16e98f65ba1bba7a28d1ef194.tar.lz
gsoc2013-epiphany-1aa3163b9c63dbf16e98f65ba1bba7a28d1ef194.tar.xz
gsoc2013-epiphany-1aa3163b9c63dbf16e98f65ba1bba7a28d1ef194.tar.zst
gsoc2013-epiphany-1aa3163b9c63dbf16e98f65ba1bba7a28d1ef194.zip
Fallback to favicon.ico. Fixes bug #116678.
2005-07-31 Christian Persch <chpe@cvs.gnome.org> * src/ephy-tab.c: (ephy_tab_set_icon_address), (ephy_tab_set_fallback_icon_address), (ensure_page_info), (ephy_tab_net_state_cb): Fallback to favicon.ico. Fixes bug #116678.
-rw-r--r--ChangeLog8
-rw-r--r--src/ephy-tab.c54
2 files changed, 50 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 98f93ed7e..34e8f1564 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-07-31 Christian Persch <chpe@cvs.gnome.org>
+
+ * src/ephy-tab.c: (ephy_tab_set_icon_address),
+ (ephy_tab_set_fallback_icon_address), (ensure_page_info),
+ (ephy_tab_net_state_cb):
+
+ Fallback to favicon.ico. Fixes bug #116678.
+
2005-07-30 Christian Persch <chpe@cvs.gnome.org>
* lib/ephy-debug.c: (trap_handler):
diff --git a/src/ephy-tab.c b/src/ephy-tab.c
index e22b51e90..739ba5215 100644
--- a/src/ephy-tab.c
+++ b/src/ephy-tab.c
@@ -1164,32 +1164,61 @@ ephy_tab_icon_cache_changed_cb (EphyFaviconCache *cache,
}
static void
-ephy_tab_set_icon_address (EphyTab *tab, const char *address)
+ephy_tab_set_icon_address (EphyTab *tab,
+ const char *address)
{
+ EphyTabPrivate *priv = tab->priv;
EphyBookmarks *eb;
EphyHistory *history;
- g_return_if_fail (EPHY_IS_TAB (tab));
-
- g_free (tab->priv->icon_address);
-
- tab->priv->icon_address = g_strdup (address);
+ g_free (priv->icon_address);
+ priv->icon_address = g_strdup (address);
- if (tab->priv->icon_address)
+ 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, tab->priv->address,
- tab->priv->icon_address);
- ephy_history_set_icon (history, tab->priv->address,
- tab->priv->icon_address);
+ ephy_bookmarks_set_icon (eb, priv->address,
+ priv->icon_address);
+ ephy_history_set_icon (history, priv->address,
+ priv->icon_address);
}
g_object_notify (G_OBJECT (tab), "icon");
}
static void
+ephy_tab_set_fallback_icon_address (EphyTab *tab)
+{
+ EphyTabPrivate *priv = tab->priv;
+ GnomeVFSURI *uri;
+ char *icon_address;
+
+ /* If the site didn't specify a site icon, we fall back to
+ * favicon.ico, see bug #116678.
+ */
+
+ if (priv->icon_address != NULL ||
+ priv->address == NULL ||
+ !(g_str_has_prefix (priv->address, "http://") ||
+ g_str_has_prefix (priv->address, "https://"))) return;
+
+ uri = gnome_vfs_uri_new (priv->address);
+ if (uri == NULL) return;
+
+ /* FIXME: support host:port ? */
+ icon_address = g_strconcat (gnome_vfs_uri_get_scheme (uri), "://",
+ gnome_vfs_uri_get_host_name (uri),
+ "/favicon.ico", NULL);
+
+ ephy_tab_set_icon_address (tab, icon_address);
+
+ g_free (icon_address);
+ gnome_vfs_uri_unref (uri);
+}
+
+static void
ephy_tab_file_monitor_cancel (EphyTab *tab)
{
EphyTabPrivate *priv = tab->priv;
@@ -1620,7 +1649,7 @@ ensure_page_info (EphyTab *tab, EphyEmbed *embed, const char *address)
if (priv->address == NULL || priv->address[0] != '\0')
{
- ephy_tab_set_address (tab, address ? g_strdup (address) : NULL);
+ ephy_tab_set_address (tab, g_strdup (address));
}
/* FIXME huh?? */
@@ -1670,6 +1699,7 @@ ephy_tab_net_state_cb (EphyEmbed *embed,
ephy_tab_set_load_percent (tab, 100);
ephy_tab_set_load_status (tab, FALSE);
ephy_tab_update_navigation_flags (tab, embed);
+ ephy_tab_set_fallback_icon_address (tab);
g_free (priv->loading_title);
priv->loading_title = NULL;