[gnome-shell] StTextureCache: never return fullcolor icons for ST_ICON_SYMBOLIC
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] StTextureCache: never return fullcolor icons for ST_ICON_SYMBOLIC
- Date: Tue, 8 Mar 2011 14:38:11 +0000 (UTC)
commit 026fc531bab507658b54f296b14f71f5d1723780
Author: Dan Winship <danw gnome org>
Date: Mon Mar 7 12:47:07 2011 -0500
StTextureCache: never return fullcolor icons for ST_ICON_SYMBOLIC
g_themed_icon_new_with_default_fallbacks() does not do what we want
with symbolic icons; if the user's icon theme is not "gnome", then it
will end up preferring a non-symbolic icon from the higher-level theme
over a symbolic icon from gnome-icon-theme-symbolic.
If the shell requests a symbolic icon, and there is only a
non-symbolic icon available, that should be considered a programmer
error, just like requesting a non-existent icon name. So change the
code to only look up "-symbolic" names when drawing an
ST_ICON_SYMBOLIC icon.
https://bugzilla.gnome.org/show_bug.cgi?id=644142
src/st/st-texture-cache.c | 38 ++++++++++++++++++++++++++++++++++----
1 files changed, 34 insertions(+), 4 deletions(-)
---
diff --git a/src/st/st-texture-cache.c b/src/st/st-texture-cache.c
index 52ce02e..405cc17 100644
--- a/src/st/st-texture-cache.c
+++ b/src/st/st-texture-cache.c
@@ -1391,6 +1391,36 @@ st_texture_cache_load_sliced_image (StTextureCache *cache,
* icon you are loading, use %ST_ICON_FULLCOLOR.
*/
+/* generates names like g_themed_icon_new_with_default_fallbacks(),
+ * but *only* symbolic names
+ */
+static char **
+symbolic_names_for_icon (const char *name)
+{
+ char **parts, **names;
+ int i;
+
+ parts = g_strsplit (name, "-", -1);
+ names = g_new (char *, g_strv_length (parts) + 1);
+ for (i = 0; parts[i]; i++)
+ {
+ if (i == 0)
+ {
+ names[i] = g_strdup_printf ("%s-symbolic", parts[i]);
+ }
+ else
+ {
+ names[i] = g_strdup_printf ("%.*s-%s-symbolic",
+ (int) (strlen (names[i - 1]) - strlen ("-symbolic")),
+ names[i - 1], parts[i]);
+ }
+ }
+ names[i] = NULL;
+
+ g_strfreev (parts);
+ return names;
+}
+
/**
* st_texture_cache_load_icon_name:
* @cache: The texture cache instance
@@ -1414,7 +1444,7 @@ st_texture_cache_load_icon_name (StTextureCache *cache,
{
ClutterActor *texture;
GIcon *themed;
- char *symbolic;
+ char **names;
g_return_val_if_fail (!(icon_type == ST_ICON_SYMBOLIC && theme_node == NULL), NULL);
@@ -1429,9 +1459,9 @@ st_texture_cache_load_icon_name (StTextureCache *cache,
return CLUTTER_ACTOR (texture);
break;
case ST_ICON_SYMBOLIC:
- symbolic = g_strconcat (name, "-symbolic", NULL);
- themed = g_themed_icon_new_with_default_fallbacks ((const gchar*)symbolic);
- g_free (symbolic);
+ names = symbolic_names_for_icon (name);
+ themed = g_themed_icon_new_from_names (names, -1);
+ g_strfreev (names);
texture = load_gicon_with_colors (cache, themed, size,
st_theme_node_get_icon_colors (theme_node));
g_object_unref (themed);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]