Fallback to using a generic when requested image isn't found

Use a type specific generic image when the requested icon
can't be loaded instead of using an empty texture.

https://bugzilla.gnome.org/show_bug.cgi?id=644668
This commit is contained in:
William Jon McCann
2011-03-16 22:27:04 -04:00
parent 36ce460a39
commit dd99ed73a9
3 changed files with 61 additions and 18 deletions

View File

@@ -141,14 +141,26 @@ shell_app_create_faded_icon_cpu (StTextureCache *cache,
app = data->app;
size = data->size;
icon = shell_app_info_get_icon (app->info);
if (icon == NULL)
return COGL_INVALID_HANDLE;
info = NULL;
icon = shell_app_info_get_icon (app->info);
if (icon != NULL)
{
info = gtk_icon_theme_lookup_by_gicon (gtk_icon_theme_get_default (),
icon, (int) (size + 0.5),
GTK_ICON_LOOKUP_FORCE_SIZE);
g_object_unref (icon);
}
if (info == NULL)
{
icon = g_themed_icon_new ("application-x-executable");
info = gtk_icon_theme_lookup_by_gicon (gtk_icon_theme_get_default (),
icon, (int) (size + 0.5),
GTK_ICON_LOOKUP_FORCE_SIZE);
g_object_unref (icon);
}
info = gtk_icon_theme_lookup_by_gicon (gtk_icon_theme_get_default (),
icon, (int) (size + 0.5),
GTK_ICON_LOOKUP_FORCE_SIZE);
g_object_unref (icon);
if (info == NULL)
return COGL_INVALID_HANDLE;