[gtk+/gtk-3-4] icontheme: search first in all themes if the requested icon is symbolic
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-4] icontheme: search first in all themes if the requested icon is symbolic
- Date: Wed, 2 May 2012 13:03:51 +0000 (UTC)
commit 3bc206c13e320a5c57ad00d034cb94cfc391ff50
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue Apr 24 21:47:33 2012 -0400
icontheme: search first in all themes if the requested icon is symbolic
Symbolic icons use a "-symbolic" suffix to distinguish themselves from
highcolor variants. Note that the dash character here has a different
meaning than the specificity level defined in the icon-naming-spec [1],
as it identifies a property of the icon itself.
Since they might be provided by a parent theme (e.g. the HighContrast theme
relies on the gnome icon theme for them), when we are looking up one we
should first escape the generic icon inheritance mechanism defined in the
icon-naming-spec [1], and privilege a symbolic icon, if it exists in a
parent theme, before applying the inheritance evaluation.
This fixes symbolic icons not working properly when used in the
HighContrast theme with the GTK_ICON_LOOKUP_GENERIC_FALLBACK flag set.
[1]
http://standards.freedesktop.org/icon-naming-spec/latest/ar01s03.html
https://bugzilla.gnome.org/show_bug.cgi?id=674806
gtk/gtkicontheme.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index 2b4d1d4..ec26bdd 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -1331,6 +1331,23 @@ choose_icon (GtkIconTheme *icon_theme,
ensure_valid_themes (icon_theme);
+ /* for symbolic icons, do a search in all registered themes first;
+ * a theme that inherits them from a parent theme might provide
+ * an alternative highcolor version, but still expect the symbolic icon
+ * to show up instead.
+ */
+ if (icon_names[0] &&
+ g_str_has_suffix (icon_names[0], "-symbolic"))
+ {
+ for (l = priv->themes; l; l = l->next)
+ {
+ IconTheme *theme = l->data;
+ icon_info = theme_lookup_icon (theme, icon_names[0], size, allow_svg, use_builtin);
+ if (icon_info)
+ goto out;
+ }
+ }
+
for (l = priv->themes; l; l = l->next)
{
IconTheme *theme = l->data;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]