diff options
-rw-r--r-- | src/idobasicmenuitem.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/idobasicmenuitem.c b/src/idobasicmenuitem.c index da17211..6185d23 100644 --- a/src/idobasicmenuitem.c +++ b/src/idobasicmenuitem.c @@ -245,29 +245,35 @@ ido_basic_menu_item_set_icon (IdoBasicMenuItem * self, GIcon * icon) if (p->icon != icon) { g_clear_object (&p->icon); + gtk_image_clear (GTK_IMAGE(p->image)); if (icon == NULL) { - gtk_image_clear (GTK_IMAGE(p->image)); gtk_widget_set_visible (p->image, FALSE); } else { GtkIconInfo *info; const gchar *filename; - GdkPixbuf *pixbuf; p->icon = g_object_ref (icon); info = gtk_icon_theme_lookup_by_gicon (gtk_icon_theme_get_default (), p->icon, 16, 0); filename = gtk_icon_info_get_filename (info); - pixbuf = gdk_pixbuf_new_from_file_at_scale (filename, -1, 16, TRUE, NULL); - gtk_image_set_from_pixbuf (GTK_IMAGE(p->image), pixbuf); - gtk_widget_set_visible (p->image, TRUE); + if (filename) + { + GdkPixbuf *pixbuf; + + pixbuf = gdk_pixbuf_new_from_file_at_scale (filename, -1, 16, TRUE, NULL); + gtk_image_set_from_pixbuf (GTK_IMAGE(p->image), pixbuf); + + g_object_unref (pixbuf); + } + + gtk_widget_set_visible (p->image, filename != NULL); g_object_unref (info); - g_object_unref (pixbuf); } } } |