about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJosh Rickmar <jrick@devio.us>2012-06-29 12:38:03 -0400
committerJosh Rickmar <jrick@devio.us>2012-06-29 12:38:03 -0400
commit801a297af920433507479ee0b666678d480013e9 (patch)
tree2010474963f699323cf3115717245ac98e051635
parent821c70e34bba189c45922276e0854653b46a842d (diff)
downloadxombrero-801a297af920433507479ee0b666678d480013e9.tar.gz
Prevent the use a depreciated function (as of webkit 1.8), and only
attempt to get the webview's pixbuf if the page is valid (has a
non-null uri).  This prevents glib warnings when attempting to load
the webview's favicon.
* * *
Remove unnecessary braces.
-rw-r--r--xombrero.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/xombrero.c b/xombrero.c
index b2c7cad..98c1b23 100644
--- a/xombrero.c
+++ b/xombrero.c
@@ -3993,9 +3993,21 @@ notify_icon_loaded_cb(WebKitWebView *wv, gchar *uri, struct tab *t)
 
 #if WEBKIT_CHECK_VERSION(1, 4, 0)
 	/* take icon from WebKitIconDatabase */
-	GdkPixbuf		*pb;
+	GdkPixbuf		*pb = NULL;
 
-	pb = webkit_web_view_get_icon_pixbuf(wv);
+/* webkit_web_view_get_icon_pixbuf is depreciated in 1.8 */
+#if WEBKIT_CHECK_VERSION(1, 8, 0)
+	/*
+	 * If the page was not loaded (for example, via ssl_strict_certs), do
+	 * not attempt to get the webview's pixbuf.  This prevents a CRITICAL
+	 * glib warning.
+	 */
+	if (wv && webkit_web_view_get_uri(wv))
+		pb = webkit_web_view_try_get_favicon_pixbuf(wv, 0, 0);
+#else
+	if (wv && webkit_web_view_get_uri(wv))
+		pb = webkit_web_view_get_icon_pixbuf(wv);
+#endif
 	if (pb) {
 		xt_icon_from_pixbuf(t, pb);
 		g_object_unref(pb);