icon theme: Also never fail in gtk_icon_theme_lookup_by_gicon()

Similar to regular lookups, if the icon is some unknown type we return
a missing-image.
This commit is contained in:
Alexander Larsson 2020-02-06 10:17:13 +01:00
parent 6865744034
commit 8788c76bd9

View File

@ -3541,9 +3541,8 @@ gtk_icon_paintable_new_for_pixbuf (GtkIconTheme *icon_theme,
* #GtkIcon. The icon can then be rendered by using it as a #GdkPaintable,
* or you can get information such as the filename and size.
*
* Returns: (nullable) (transfer full): a #GtkIconPaintable containing
* information about the icon, or %NULL if the icon wasnt
* found. Unref with g_object_unref()
* Returns: (transfer full): a #GtkIconPaintable containing
* information about the icon. Unref with g_object_unref()
*/
GtkIconPaintable *
gtk_icon_theme_lookup_by_gicon (GtkIconTheme *self,
@ -3583,6 +3582,13 @@ gtk_icon_theme_lookup_by_gicon (GtkIconTheme *self,
names = (const gchar **) g_themed_icon_get_names (G_THEMED_ICON (gicon));
icon = gtk_icon_theme_lookup_icon (self, names[0], &names[1], size, scale, direction, flags);
}
else
{
g_debug ("Unhandled GIcon type %s", g_type_name_from_instance (gicon));
icon = icon_paintable_new (size, scale);
icon->filename = g_strdup (IMAGE_MISSING_RESOURCE_PATH);
icon->is_resource = TRUE;
}
return icon;
}