From f0e284453a6bd27c77611c8f0a433d33c586fe43 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Wed, 27 Sep 2017 16:44:28 -0400 Subject: MqTab: Fall back to stock icon on favicon error --- (limited to 'src/tab.c') 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 -- cgit v0.9.1