st-theme-node: Add support for -st-icon-style property

GTK+ added support for a -gtk-icon-style property in themes to
enforce a particular icon style. Do the same for shell themes
with an -st-icon-style property, with the same set of possible
values as the GTK+ variant:
  'requested' - use symbolic or fullcolor icon depending on the
                icon name (default)
  'regular'   - enforce fullcolor icons
  'symbolic'  - enforce symbolic icons

https://bugzilla.gnome.org/show_bug.cgi?id=740447
This commit is contained in:
Florian Müllner
2014-11-29 14:53:36 +00:00
parent deddac8748
commit 2940ef07e9
3 changed files with 64 additions and 5 deletions

View File

@ -2392,6 +2392,48 @@ st_theme_node_get_transition_duration (StThemeNode *node)
return st_slow_down_factor * node->transition_duration;
}
StIconStyle
st_theme_node_get_icon_style (StThemeNode *node)
{
int i;
ensure_properties (node);
for (i = node->n_properties - 1; i >= 0; i--)
{
CRDeclaration *decl = node->properties[i];
if (strcmp (decl->property->stryng->str, "-st-icon-style") == 0)
{
CRTerm *term;
for (term = decl->value; term; term = term->next)
{
if (term->type != TERM_IDENT)
goto next_decl;
if (strcmp (term->content.str->stryng->str, "requested") == 0)
return ST_ICON_STYLE_REQUESTED;
else if (strcmp (term->content.str->stryng->str, "regular") == 0)
return ST_ICON_STYLE_REGULAR;
else if (strcmp (term->content.str->stryng->str, "symbolic") == 0)
return ST_ICON_STYLE_SYMBOLIC;
else
g_warning ("Unknown -st-icon-style \"%s\"",
term->content.str->stryng->str);
}
}
next_decl:
;
}
if (node->parent_node)
return st_theme_node_get_icon_style (node->parent_node);
return ST_ICON_STYLE_REQUESTED;
}
StTextDecoration
st_theme_node_get_text_decoration (StThemeNode *node)
{