[gnome-shell] st-texture-cache: Don't implicitly return a fallback icon
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] st-texture-cache: Don't implicitly return a fallback icon
- Date: Sat, 17 Mar 2012 05:47:48 +0000 (UTC)
commit 0aad74a670b4d8d7f4e24348332047bf3e0db007
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Mar 8 14:23:51 2012 -0500
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
src/st/st-texture-cache.c | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/src/st/st-texture-cache.c b/src/st/st-texture-cache.c
index 20d23d8..ff1d857 100644
--- a/src/st/st-texture-cache.c
+++ b/src/st/st-texture-cache.c
@@ -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);
if (info == 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;
- }
+ return NULL;
gicon_string = g_icon_to_string (icon);
/* 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,
st_theme_node_get_icon_colors (theme_node));
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;
case ST_ICON_FULLCOLOR:
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);
g_object_unref (themed);
}
-
- return CLUTTER_ACTOR (texture);
+ return texture;
break;
default:
g_assert_not_reached ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]