[Xfce4-commits] <midori:master> Use WebKitFaviconDatabase as of WebKit 1.8.0
Christian Dywan
noreply at xfce.org
Sun May 13 02:24:01 CEST 2012
Updating branch refs/heads/master
to 94c6fca20f40e21910ef42b9eaeb62859deca994 (commit)
from cb40b36c0e007edfccdcf1c2c6e64b86060c8006 (commit)
commit 94c6fca20f40e21910ef42b9eaeb62859deca994
Author: Christian Dywan <christian at twotoasts.de>
Date: Sun May 13 01:33:23 2012 +0200
Use WebKitFaviconDatabase as of WebKit 1.8.0
Fixes: https://bugs.launchpad.net/midori/+bug/902456
katze/katze-item.c | 8 ++++++++
midori/main.c | 10 ++++++++++
midori/midori-view.c | 14 +++++++++++++-
3 files changed, 31 insertions(+), 1 deletions(-)
diff --git a/katze/katze-item.c b/katze/katze-item.c
index 7df2ea0..36446b7 100644
--- a/katze/katze-item.c
+++ b/katze/katze-item.c
@@ -15,6 +15,8 @@
#include <glib/gi18n.h>
+#include <webkit/webkit.h>
+
/**
* SECTION:katze-item
* @short_description: A useful item
@@ -442,6 +444,12 @@ katze_item_get_image (KatzeItem* item)
if (KATZE_ITEM_IS_FOLDER (item))
image = gtk_image_new_from_stock (GTK_STOCK_DIRECTORY, GTK_ICON_SIZE_MENU);
+ #if WEBKIT_CHECK_VERSION (1, 8, 0)
+ /* FIXME: Don't hard-code icon size */
+ else if ((pixbuf = webkit_favicon_database_try_get_favicon_pixbuf (
+ webkit_get_favicon_database (), item->uri, 16, 16)))
+ image = gtk_image_new_from_pixbuf (pixbuf);
+ #endif
else if ((pixbuf = g_object_get_data (G_OBJECT (item), "pixbuf")))
image = gtk_image_new_from_pixbuf (pixbuf);
else if ((icon = katze_item_get_icon (item)) && !strchr (icon, '/'))
diff --git a/midori/main.c b/midori/main.c
index 588bac3..cb4e1c4 100644
--- a/midori/main.c
+++ b/midori/main.c
@@ -981,6 +981,13 @@ midori_load_soup_session (gpointer settings)
G_CALLBACK (soup_session_settings_notify_first_party_cb), session);
#endif
+ #if WEBKIT_CHECK_VERSION (1, 8, 0)
+ gchar* cache = g_build_filename (g_get_user_data_dir (),
+ "webkit", "icondatabase", NULL);
+ webkit_favicon_database_set_path (webkit_get_favicon_database (), cache);
+ g_free (cache);
+ #endif
+
g_signal_connect (session, "request-queued",
G_CALLBACK (midori_soup_session_settings_accept_language_cb), settings);
@@ -1794,6 +1801,9 @@ midori_clear_page_icons_cb (void)
"webkit", "icondatabase", NULL);
sokoke_remove_path (cache, TRUE);
g_free (cache);
+ #if WEBKIT_CHECK_VERSION (1, 8, 0)
+ webkit_favicon_database_clear (webkit_get_favicon_database ());
+ #endif
}
static void
diff --git a/midori/midori-view.c b/midori/midori-view.c
index 00863f4..1ca8011 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -802,6 +802,7 @@ free_parts:
g_strfreev (parts);
}
+#if !WEBKIT_CHECK_VERSION (1, 8, 0)
static gboolean
katze_net_icon_status_cb (KatzeNetRequest* request,
MidoriView* view)
@@ -869,15 +870,25 @@ katze_net_icon_transfer_cb (KatzeNetRequest* request,
pixbuf_scaled = gdk_pixbuf_scale_simple (pixbuf, icon_width, icon_height, GDK_INTERP_BILINEAR);
midori_view_apply_icon (view, pixbuf_scaled, view->icon_uri);
}
+#endif
static void
_midori_web_view_load_icon (MidoriView* view)
{
GdkPixbuf* pixbuf = NULL;
gint icon_width, icon_height;
- GdkPixbuf* pixbuf_scaled;
GtkSettings* settings;
+ #if WEBKIT_CHECK_VERSION (1, 8, 0)
+ settings = gtk_widget_get_settings (view->web_view);
+ gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU,
+ &icon_width, &icon_height);
+ if ((pixbuf = webkit_web_view_try_get_favicon_pixbuf (
+ WEBKIT_WEB_VIEW (view->web_view), 16, 16)))
+ midori_view_apply_icon (view, pixbuf, view->icon_uri);
+ #else
+ GdkPixbuf* pixbuf_scaled;
+
if (!midori_uri_is_http (view->icon_uri))
katze_assign (view->icon_uri, NULL);
@@ -932,6 +943,7 @@ _midori_web_view_load_icon (MidoriView* view)
pixbuf = pixbuf_scaled;
midori_view_apply_icon (view, pixbuf, view->icon_uri);
}
+ #endif
}
static void
More information about the Xfce4-commits
mailing list