diff options
author | Matthias Clasen <mclasen@redhat.com> | 2013-10-15 21:19:17 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2013-10-15 21:19:17 -0400 |
commit | 6d5cbf16d6ee3a63c419f3bad7ac65e3e9fc29e8 (patch) | |
tree | 34d325f0f174bf1ef3b1b14b5ed15a75250d9350 /gtk/gtkicontheme.c | |
parent | 14414d5946212996a8aac3dd49798a0d589b9e11 (diff) | |
download | gtk+-6d5cbf16d6ee3a63c419f3bad7ac65e3e9fc29e8.tar.gz |
Fall back to non-symbolic icons
When doing fallback for symbolic icons, we first shorten
the name at dashes while preserving the -symbolic suffix.
But after exhausting that, we should also try stripping
the suffix.
https://bugzilla.gnome.org/show_bug.cgi?id=708163
Diffstat (limited to 'gtk/gtkicontheme.c')
-rw-r--r-- | gtk/gtkicontheme.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c index bf5a224e56..a2cbf62958 100644 --- a/gtk/gtkicontheme.c +++ b/gtk/gtkicontheme.c @@ -904,7 +904,7 @@ gtk_icon_theme_finalize (GObject *object) * the right name is found directly in one of the elements of * @path, then that image will be used for the icon name. * (This is legacy feature, and new icons should be put - * into the default icon theme, which is called DEFAULT_THEME_NAME, + * into the default icon theme, which is called hicolor, * rather than directly on the icon path.) * * Since: 2.4 @@ -1897,12 +1897,15 @@ gtk_icon_theme_lookup_icon_for_scale (GtkIconTheme *icon_theme, if (is_symbolic) { - names = g_new (gchar *, dashes + 2); + names = g_new (gchar *, 2 * dashes + 3); for (i = 0; nonsymbolic_names[i] != NULL; i++) - names[i] = g_strconcat (nonsymbolic_names[i], "-symbolic", NULL); + { + names[i] = g_strconcat (nonsymbolic_names[i], "-symbolic", NULL); + names[dashes + 1 + i] = nonsymbolic_names[i]; + } - names[i] = NULL; - g_strfreev (nonsymbolic_names); + names[dashes + 1 + i] = NULL; + g_free (nonsymbolic_names); } else { @@ -1910,13 +1913,13 @@ gtk_icon_theme_lookup_icon_for_scale (GtkIconTheme *icon_theme, } info = choose_icon (icon_theme, (const gchar **) names, size, scale, flags); - + g_strfreev (names); } - else + else { const gchar *names[2]; - + names[0] = icon_name; names[1] = NULL; |