summaryrefslogtreecommitdiffstats
path: root/src/tab.c
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-09-27 16:44:28 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-09-27 16:44:28 (EDT)
commitf0e284453a6bd27c77611c8f0a433d33c586fe43 (patch)
tree6c95e7e19376d2c20f9cefa5faa214baca0de26e /src/tab.c
parent6b92277f3003b71c0bc58290a9ce83424f5edc57 (diff)
downloadmarquee-f0e284453a6bd27c77611c8f0a433d33c586fe43.zip
marquee-f0e284453a6bd27c77611c8f0a433d33c586fe43.tar.gz
marquee-f0e284453a6bd27c77611c8f0a433d33c586fe43.tar.bz2
MqTab: Fall back to stock icon on favicon error
Diffstat (limited to 'src/tab.c')
-rw-r--r--src/tab.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/tab.c b/src/tab.c
index 04ff082..6f3a539 100644
--- a/src/tab.c
+++ b/src/tab.c
@@ -30,7 +30,12 @@
static void
update_tab_image(MqTab *tab, GdkPixbuf *favicon)
{
- gtk_image_set_from_pixbuf(GTK_IMAGE(tab->tab_image), favicon);
+ if (favicon) {
+ gtk_image_set_from_pixbuf(GTK_IMAGE(tab->tab_image), favicon);
+ } else {
+ gtk_image_set_from_icon_name(GTK_IMAGE(tab->tab_image),
+ "text-x-generic", GTK_ICON_SIZE_BUTTON);
+ }
}
static void
@@ -289,6 +294,7 @@ favicon_cb(WebKitWebView __attribute__((unused)) *web_view,
GdkPixbuf *scaled_pixbuf;
surface = webkit_web_view_get_favicon(tab->web_view);
+ scaled_pixbuf = NULL;
if (surface) {
pixbuf = gdk_pixbuf_get_from_surface(surface, 0, 0,
cairo_image_surface_get_width(surface),
@@ -297,11 +303,10 @@ favicon_cb(WebKitWebView __attribute__((unused)) *web_view,
scaled_pixbuf = gdk_pixbuf_scale_simple(pixbuf, 16, 16,
GDK_INTERP_BILINEAR);
g_object_unref(pixbuf);
- if (scaled_pixbuf) {
- update_tab_image(tab, scaled_pixbuf);
- }
}
}
+
+ update_tab_image(tab, scaled_pixbuf);
}
static void