From 057348763b674c075f803122856c58ff338f67ff Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Sat, 12 Mar 2011 23:27:57 +0100 Subject: [PATCH] StTextureCache: generate icon names in the right order GThemedIcon expects the first name to be the most specific, and will thus prefer it to later ones. We thus need to order the names from the longer to the shorter. https://bugzilla.gnome.org/show_bug.cgi?id=621707 --- src/st/st-texture-cache.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/st/st-texture-cache.c b/src/st/st-texture-cache.c index 405cc177a..198ddf273 100644 --- a/src/st/st-texture-cache.c +++ b/src/st/st-texture-cache.c @@ -1398,10 +1398,11 @@ static char ** symbolic_names_for_icon (const char *name) { char **parts, **names; - int i; + int i, numnames; parts = g_strsplit (name, "-", -1); - names = g_new (char *, g_strv_length (parts) + 1); + numnames = g_strv_length (parts); + names = g_new (char *, numnames + 1); for (i = 0; parts[i]; i++) { if (i == 0) @@ -1418,6 +1419,15 @@ symbolic_names_for_icon (const char *name) names[i] = NULL; g_strfreev (parts); + + /* need to reverse here, because longest (most specific) + name has to come first */ + for (i = 0; i < (numnames / 2); i++) { + char *tmp = names[i]; + names[i] = names[numnames - i - 1]; + names[numnames - i - 1] = tmp; + } + return names; }