st-texture-cache: Don't implicitly return a fallback icon
In the case that we don't have an icon corresponding to the gicon, it's more than likely that the code calling load_gicon will know more about what it wants as a fallback than the texture-cache itself. In fact - we had a whole lot of dead code that would try to fall back, but never did because we always returned a valid actor. This was causing certain applications with invalid icons to not get the fallback icon because an icon couldn't be found. Fix up the one place where we don't have an explicit fallback icon codepath, and then stop doing what we were doing. https://bugzilla.gnome.org/show_bug.cgi?id=671656
This commit is contained in:
parent
985f28bbea
commit
0aad74a670
@ -921,12 +921,7 @@ load_gicon_with_colors (StTextureCache *cache,
|
|||||||
|
|
||||||
info = gtk_icon_theme_lookup_by_gicon (theme, icon, size, GTK_ICON_LOOKUP_USE_BUILTIN);
|
info = gtk_icon_theme_lookup_by_gicon (theme, icon, size, GTK_ICON_LOOKUP_USE_BUILTIN);
|
||||||
if (info == NULL)
|
if (info == NULL)
|
||||||
{
|
return NULL;
|
||||||
/* gah, the icon doesn't exist. Return a blank texture that will never load */
|
|
||||||
texture = CLUTTER_ACTOR (create_default_texture (cache));
|
|
||||||
clutter_actor_set_size (texture, size, size);
|
|
||||||
return texture;
|
|
||||||
}
|
|
||||||
|
|
||||||
gicon_string = g_icon_to_string (icon);
|
gicon_string = g_icon_to_string (icon);
|
||||||
/* A return value of NULL indicates that the icon can not be serialized,
|
/* A return value of NULL indicates that the icon can not be serialized,
|
||||||
@ -1233,8 +1228,16 @@ st_texture_cache_load_icon_name (StTextureCache *cache,
|
|||||||
texture = load_gicon_with_colors (cache, themed, size,
|
texture = load_gicon_with_colors (cache, themed, size,
|
||||||
st_theme_node_get_icon_colors (theme_node));
|
st_theme_node_get_icon_colors (theme_node));
|
||||||
g_object_unref (themed);
|
g_object_unref (themed);
|
||||||
|
if (texture == NULL)
|
||||||
|
{
|
||||||
|
/* We don't have an equivalent of image-missing
|
||||||
|
* for the symbolic icon theme, so just create a blank
|
||||||
|
* actor. */
|
||||||
|
texture = clutter_actor_new ();
|
||||||
|
clutter_actor_set_size (texture, size, size);
|
||||||
|
}
|
||||||
|
|
||||||
return CLUTTER_ACTOR (texture);
|
return texture;
|
||||||
break;
|
break;
|
||||||
case ST_ICON_FULLCOLOR:
|
case ST_ICON_FULLCOLOR:
|
||||||
themed = g_themed_icon_new_with_default_fallbacks (name);
|
themed = g_themed_icon_new_with_default_fallbacks (name);
|
||||||
@ -1246,8 +1249,7 @@ st_texture_cache_load_icon_name (StTextureCache *cache,
|
|||||||
texture = load_gicon_with_colors (cache, themed, size, NULL);
|
texture = load_gicon_with_colors (cache, themed, size, NULL);
|
||||||
g_object_unref (themed);
|
g_object_unref (themed);
|
||||||
}
|
}
|
||||||
|
return texture;
|
||||||
return CLUTTER_ACTOR (texture);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
|
Loading…
Reference in New Issue
Block a user