summaryrefslogtreecommitdiff
path: root/gtk/gtk_scaffolding.c
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@netsurf-browser.org>2011-01-07 14:13:40 +0000
committerDaniel Silverstone <dsilvers@netsurf-browser.org>2011-01-07 14:13:40 +0000
commit1ca13118a8c09753d3a5f4a65725eb485c1b2440 (patch)
treee105417e4845828339beafd06af0d0870e1ac043 /gtk/gtk_scaffolding.c
parent0bfafb51a6361041e1f4f2733ce406f8664ceab9 (diff)
downloadnetsurf-1ca13118a8c09753d3a5f4a65725eb485c1b2440.tar.gz
netsurf-1ca13118a8c09753d3a5f4a65725eb485c1b2440.tar.bz2
Ensure that if we're given no icon (or can't generate one) we default to the system-default favicon
svn path=/trunk/netsurf/; revision=11246
Diffstat (limited to 'gtk/gtk_scaffolding.c')
-rw-r--r--gtk/gtk_scaffolding.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/gtk/gtk_scaffolding.c b/gtk/gtk_scaffolding.c
index 46287222b..676b60769 100644
--- a/gtk/gtk_scaffolding.c
+++ b/gtk/gtk_scaffolding.c
@@ -1839,28 +1839,27 @@ void gui_window_set_icon(struct gui_window *_g, hlcache_handle *icon)
{
struct gtk_scaffolding *g = nsgtk_get_scaffold(_g);
struct bitmap *icon_bitmap;
- GtkImage *iconImage;
+ GtkImage *iconImage = NULL;
- if (icon == NULL)
- return;
if (g->top_level != _g)
return;
#ifdef WITH_BMP
- if (content_get_type(icon) == CONTENT_ICO)
+ if (icon != NULL && content_get_type(icon) == CONTENT_ICO)
nsico_set_bitmap_from_size(icon, 16, 16);
#endif
- icon_bitmap = content_get_bitmap(icon);
- if (icon_bitmap == NULL)
- return;
-
- GdkPixbuf *pb = gtk_bitmap_get_primary(icon_bitmap);
- if (pb != NULL && gdk_pixbuf_get_width(pb) > 0 &&
+ icon_bitmap = (icon != NULL) ? content_get_bitmap(icon) : NULL;
+
+ if (icon_bitmap != NULL) {
+ GdkPixbuf *pb = gtk_bitmap_get_primary(icon_bitmap);
+ if (pb != NULL && gdk_pixbuf_get_width(pb) > 0 &&
gdk_pixbuf_get_height(pb) > 0) {
- pb = gdk_pixbuf_scale_simple(pb, 16, 16, GDK_INTERP_HYPER);
- iconImage = GTK_IMAGE(gtk_image_new_from_pixbuf(pb));
- } else {
+ pb = gdk_pixbuf_scale_simple(pb, 16, 16, GDK_INTERP_HYPER);
+ iconImage = GTK_IMAGE(gtk_image_new_from_pixbuf(pb));
+ }
+ }
+ if (iconImage == NULL) {
/** \todo Does pb need cleaning up? */
char imagepath[strlen(res_dir_location) +
SLEN("favicon.png") + 1];