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
This commit is contained in:
Giovanni Campagna 2011-03-12 23:27:57 +01:00
parent 7230452e23
commit 057348763b

View File

@ -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;
}