diff options
author | Benjamin Otte <otte@redhat.com> | 2015-03-11 21:24:05 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2015-03-12 01:15:38 +0100 |
commit | 181e58e402aec9c546850d95194384329a9637e0 (patch) | |
tree | b8384fefe8db54fe34a26de838b33ae24ade1b7c | |
parent | 63f59dde3a2740057fb24115b58100af630aa453 (diff) | |
download | gtk+-181e58e402aec9c546850d95194384329a9637e0.tar.gz |
iconhelper: Move function from style context into only user
-rw-r--r-- | gtk/gtkiconhelper.c | 30 | ||||
-rw-r--r-- | gtk/gtkstylecontext.c | 36 | ||||
-rw-r--r-- | gtk/gtkstylecontextprivate.h | 1 |
3 files changed, 28 insertions, 39 deletions
diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c index c76534585c..415b55c7a3 100644 --- a/gtk/gtkiconhelper.c +++ b/gtk/gtkiconhelper.c @@ -23,6 +23,7 @@ #include <math.h> +#include "gtkcssenumvalueprivate.h" #include "gtkiconhelperprivate.h" #include "gtkstylecontextprivate.h" @@ -238,14 +239,39 @@ ensure_stated_icon_from_info (GtkIconHelper *self, static GtkIconLookupFlags get_icon_lookup_flags (GtkIconHelper *self, GtkStyleContext *context) { - GtkIconLookupFlags flags = GTK_ICON_LOOKUP_USE_BUILTIN; + GtkIconLookupFlags flags; + GtkCssIconStyle icon_style; + GtkStateFlags state; + + state = gtk_style_context_get_state (context); + flags = GTK_ICON_LOOKUP_USE_BUILTIN; if (self->priv->use_fallback) flags |= GTK_ICON_LOOKUP_GENERIC_FALLBACK; if (self->priv->pixel_size != -1 || self->priv->force_scale_pixbuf) flags |= GTK_ICON_LOOKUP_FORCE_SIZE; - flags |= _gtk_style_context_get_icon_lookup_flags (context); + icon_style = _gtk_css_icon_style_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_ICON_STYLE)); + + switch (icon_style) + { + case GTK_CSS_ICON_STYLE_REGULAR: + flags |= GTK_ICON_LOOKUP_FORCE_REGULAR; + break; + case GTK_CSS_ICON_STYLE_SYMBOLIC: + flags |= GTK_ICON_LOOKUP_FORCE_SYMBOLIC; + break; + case GTK_CSS_ICON_STYLE_REQUESTED: + break; + default: + g_assert_not_reached (); + return 0; + } + + if (state & GTK_STATE_FLAG_DIR_LTR) + flags |= GTK_ICON_LOOKUP_DIR_LTR; + else if (state & GTK_STATE_FLAG_DIR_RTL) + flags |= GTK_ICON_LOOKUP_DIR_RTL; return flags; } diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c index 481048651f..2504027a11 100644 --- a/gtk/gtkstylecontext.c +++ b/gtk/gtkstylecontext.c @@ -3842,42 +3842,6 @@ _gtk_style_context_get_icon_extents (GtkStyleContext *context, extents->height += border.top + border.bottom; } -GtkIconLookupFlags -_gtk_style_context_get_icon_lookup_flags (GtkStyleContext *context) -{ - GtkCssIconStyle icon_style; - GtkIconLookupFlags flags; - GtkStateFlags state; - - g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), 0); - - icon_style = _gtk_css_icon_style_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_ICON_STYLE)); - - switch (icon_style) - { - case GTK_CSS_ICON_STYLE_REGULAR: - flags = GTK_ICON_LOOKUP_FORCE_REGULAR; - break; - case GTK_CSS_ICON_STYLE_SYMBOLIC: - flags = GTK_ICON_LOOKUP_FORCE_SYMBOLIC; - break; - case GTK_CSS_ICON_STYLE_REQUESTED: - flags = 0; - break; - default: - g_assert_not_reached (); - return 0; - } - - state = gtk_style_context_get_state (context); - if (state & GTK_STATE_FLAG_DIR_LTR) - flags |= GTK_ICON_LOOKUP_DIR_LTR; - else if (state & GTK_STATE_FLAG_DIR_RTL) - flags |= GTK_ICON_LOOKUP_DIR_RTL; - - return flags; -} - static AtkAttributeSet * add_attribute (AtkAttributeSet *attributes, AtkTextAttribute attr, diff --git a/gtk/gtkstylecontextprivate.h b/gtk/gtkstylecontextprivate.h index 91e183c41e..a520bf73b2 100644 --- a/gtk/gtkstylecontextprivate.h +++ b/gtk/gtkstylecontextprivate.h @@ -66,7 +66,6 @@ void _gtk_style_context_get_icon_extents (GtkStyleContext gint y, gint width, gint height); -GtkIconLookupFlags _gtk_style_context_get_icon_lookup_flags (GtkStyleContext *context); /* Accessibility support */ AtkAttributeSet *_gtk_style_context_get_attributes (AtkAttributeSet *attributes, |