silence console warnings when fallback icons can't be found

This commit is contained in:
Jordan Lee 2012-12-27 17:49:52 +00:00
parent 144d3b952c
commit ff3a6df7a6
1 changed files with 25 additions and 22 deletions

View File

@ -156,8 +156,8 @@ register_my_icons (void)
{
int i;
const int n = G_N_ELEMENTS (my_fallback_icons);
GtkIconFactory * factory = gtk_icon_factory_new ();
GtkIconTheme * theme = gtk_icon_theme_get_default ();
GtkIconFactory * factory = gtk_icon_factory_new ();
gtk_icon_factory_add_default (factory);
@ -167,16 +167,18 @@ register_my_icons (void)
if (!gtk_icon_theme_has_icon (theme, name))
{
int width;
GdkPixbuf * p;
p = gdk_pixbuf_new_from_inline (-1, my_fallback_icons[i].raw, FALSE, NULL);
if (p != NULL)
{
int width;
GtkIconSet * icon_set;
p =
gdk_pixbuf_new_from_inline (-1, my_fallback_icons[i].raw,
FALSE,
NULL);
width = gdk_pixbuf_get_width (p);
icon_set = gtk_icon_set_new_from_pixbuf (p);
gtk_icon_theme_add_builtin_icon (name, width, p);
gtk_icon_factory_add (factory, name, icon_set);
@ -184,6 +186,7 @@ register_my_icons (void)
gtk_icon_set_unref (icon_set);
}
}
}
g_object_unref (G_OBJECT (factory));
}