[gtk+] stylecontext: Remove state from _peek_style_property()



commit 4a6957f50df96d9493c4a3058c5631a8894eea66
Author: Benjamin Otte <otte redhat com>
Date:   Tue Jun 10 20:18:37 2014 +0200

    stylecontext: Remove state from _peek_style_property()
    
    It evaluates to "current state" in all cases, so no need to special case
    it.

 gtk/deprecated/gtkstyle.c    |    4 ++--
 gtk/gtkstylecontext.c        |   21 ++++-----------------
 gtk/gtkstylecontextprivate.h |    1 -
 gtk/gtkwidget.c              |    8 ++------
 4 files changed, 8 insertions(+), 26 deletions(-)
---
diff --git a/gtk/deprecated/gtkstyle.c b/gtk/deprecated/gtkstyle.c
index 55ad766..d610a34 100644
--- a/gtk/deprecated/gtkstyle.c
+++ b/gtk/deprecated/gtkstyle.c
@@ -1153,7 +1153,7 @@ gtk_style_get_style_property (GtkStyle     *style,
   priv = GTK_STYLE_GET_PRIVATE (style);
   peek_value = _gtk_style_context_peek_style_property (priv->context,
                                                        widget_type,
-                                                       0, pspec);
+                                                       pspec);
 
   if (G_VALUE_TYPE (value) == G_PARAM_SPEC_VALUE_TYPE (pspec))
     g_value_copy (peek_value, value);
@@ -1214,7 +1214,7 @@ gtk_style_get_valist (GtkStyle    *style,
         }
 
       peek_value = _gtk_style_context_peek_style_property (priv->context, widget_type,
-                                                           0, pspec);
+                                                           pspec);
       G_VALUE_LCOPY (peek_value, var_args, 0, &error);
       if (error)
         {
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 53e7fa9..2f9b348 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -244,7 +244,6 @@ struct PropertyValue
 {
   GType       widget_type;
   GParamSpec *pspec;
-  GtkStateFlags state;
   GValue      value;
 };
 
@@ -2182,9 +2181,6 @@ style_property_values_cmp (gconstpointer bsearch_node1,
   if (val1->pspec != val2->pspec)
     return val1->pspec < val2->pspec ? -1 : 1;
 
-  if (val1->state != val2->state)
-    return val1->state < val2->state ? -1 : 1;
-
   return 0;
 }
 
@@ -2200,7 +2196,6 @@ _gtk_style_context_peek_property (GtkStyleContext *context,
 const GValue *
 _gtk_style_context_peek_style_property (GtkStyleContext *context,
                                         GType            widget_type,
-                                        GtkStateFlags    state,
                                         GParamSpec      *pspec)
 {
   GtkStyleContextPrivate *priv;
@@ -2210,10 +2205,9 @@ _gtk_style_context_peek_style_property (GtkStyleContext *context,
 
   priv = context->priv;
 
-  data = style_data_lookup_for_state (context, state);
+  data = style_data_lookup (context);
 
   key.widget_type = widget_type;
-  key.state = state;
   key.pspec = pspec;
 
   /* need value cache array */
@@ -2246,7 +2240,7 @@ _gtk_style_context_peek_style_property (GtkStyleContext *context,
 
       if (gtk_style_provider_get_style_property (GTK_STYLE_PROVIDER (priv->cascade),
                                                  widget_path,
-                                                 state, pspec, &pcache->value))
+                                                 0, pspec, &pcache->value))
         {
           G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
 
@@ -2322,7 +2316,6 @@ gtk_style_context_get_style_property (GtkStyleContext *context,
 {
   GtkStyleContextPrivate *priv;
   GtkWidgetClass *widget_class;
-  GtkStateFlags state;
   GParamSpec *pspec;
   const GValue *peek_value;
   GType widget_type;
@@ -2366,9 +2359,7 @@ gtk_style_context_get_style_property (GtkStyleContext *context,
       return;
     }
 
-  state = gtk_style_context_get_state (context);
-  peek_value = _gtk_style_context_peek_style_property (context, widget_type,
-                                                       state, pspec);
+  peek_value = _gtk_style_context_peek_style_property (context, widget_type, pspec);
 
   if (G_VALUE_TYPE (value) == G_VALUE_TYPE (peek_value))
     g_value_copy (peek_value, value);
@@ -2397,7 +2388,6 @@ gtk_style_context_get_style_valist (GtkStyleContext *context,
 {
   GtkStyleContextPrivate *priv;
   const gchar *prop_name;
-  GtkStateFlags state;
   GType widget_type;
 
   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
@@ -2425,8 +2415,6 @@ gtk_style_context_get_style_valist (GtkStyleContext *context,
         }
     }
 
-  state = gtk_style_context_get_state (context);
-
   while (prop_name)
     {
       GtkWidgetClass *widget_class;
@@ -2447,8 +2435,7 @@ gtk_style_context_get_style_valist (GtkStyleContext *context,
           break;
         }
 
-      peek_value = _gtk_style_context_peek_style_property (context, widget_type,
-                                                           state, pspec);
+      peek_value = _gtk_style_context_peek_style_property (context, widget_type, pspec);
 
       G_VALUE_LCOPY (peek_value, args, 0, &error);
 
diff --git a/gtk/gtkstylecontextprivate.h b/gtk/gtkstylecontextprivate.h
index 1fbe269..5c1b240 100644
--- a/gtk/gtkstylecontextprivate.h
+++ b/gtk/gtkstylecontextprivate.h
@@ -36,7 +36,6 @@ GtkCssValue   * _gtk_style_context_peek_property             (GtkStyleContext *c
                                                               guint            property_id);
 const GValue * _gtk_style_context_peek_style_property        (GtkStyleContext *context,
                                                               GType            widget_type,
-                                                              GtkStateFlags    state,
                                                               GParamSpec      *pspec);
 void           _gtk_style_context_validate                   (GtkStyleContext *context,
                                                               gint64           timestamp,
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 58b89ff..16f7e43 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -13018,14 +13018,12 @@ gtk_widget_style_get_property (GtkWidget   *widget,
     {
       GtkStyleContext *context;
       const GValue *peek_value;
-      GtkStateFlags state;
 
       context = gtk_widget_get_style_context (widget);
-      state = gtk_widget_get_state_flags (widget);
 
       peek_value = _gtk_style_context_peek_style_property (context,
                                                            G_OBJECT_TYPE (widget),
-                                                           state, pspec);
+                                                           pspec);
 
       /* auto-conversion of the caller's value type
        */
@@ -13059,14 +13057,12 @@ gtk_widget_style_get_valist (GtkWidget   *widget,
                             va_list      var_args)
 {
   GtkStyleContext *context;
-  GtkStateFlags state;
   const gchar *name;
 
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
   g_object_ref (widget);
   context = gtk_widget_get_style_context (widget);
-  state = gtk_widget_get_state_flags (widget);
 
   name = first_property_name;
   while (name)
@@ -13091,7 +13087,7 @@ gtk_widget_style_get_valist (GtkWidget   *widget,
 
       peek_value = _gtk_style_context_peek_style_property (context,
                                                            G_OBJECT_TYPE (widget),
-                                                           state, pspec);
+                                                           pspec);
 
       G_VALUE_LCOPY (peek_value, var_args, 0, &error);
       if (error)


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