[gtk+] iconhelper: Move function from style context into only user



commit 181e58e402aec9c546850d95194384329a9637e0
Author: Benjamin Otte <otte redhat com>
Date:   Wed Mar 11 21:24:05 2015 +0100

    iconhelper: Move function from style context into only user

 gtk/gtkiconhelper.c          |   30 ++++++++++++++++++++++++++++--
 gtk/gtkstylecontext.c        |   36 ------------------------------------
 gtk/gtkstylecontextprivate.h |    1 -
 3 files changed, 28 insertions(+), 39 deletions(-)
---
diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c
index c765345..415b55c 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 4810486..2504027 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 91e183c..a520bf7 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,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]