[gtk+/wip/css: 35/167] styleproperty: Add _gtk_style_property_query()



commit f2cef92a7a8b8a7049605e9a503fb2035c3b116f
Author: Benjamin Otte <otte redhat com>
Date:   Sat Dec 31 01:14:47 2011 +0100

    styleproperty: Add _gtk_style_property_query()
    
    This way, we only need to export one function, not 3.

 gtk/gtkstyleproperties.c      |   12 +-----------
 gtk/gtkstyleproperty.c        |   32 +++++++++++++++++++++++++++++---
 gtk/gtkstylepropertyprivate.h |   22 ++++++----------------
 3 files changed, 36 insertions(+), 30 deletions(-)
---
diff --git a/gtk/gtkstyleproperties.c b/gtk/gtkstyleproperties.c
index 08ed39b..48dc88b 100644
--- a/gtk/gtkstyleproperties.c
+++ b/gtk/gtkstyleproperties.c
@@ -744,7 +744,6 @@ _gtk_style_properties_get_property (GtkStyleProperties *props,
 				    GValue             *value)
 {
   const GtkStyleProperty *node;
-  const GValue *val;
 
   g_return_val_if_fail (GTK_IS_STYLE_PROPERTIES (props), FALSE);
   g_return_val_if_fail (property != NULL, FALSE);
@@ -757,16 +756,7 @@ _gtk_style_properties_get_property (GtkStyleProperties *props,
       return FALSE;
     }
 
-  val = _gtk_style_properties_peek_property (props, node, state);
-  g_value_init (value, node->pspec->value_type);
-
-  if (val)
-    _gtk_style_property_resolve (node, props, state, context, (GValue *) val, value);
-  else if (_gtk_style_property_is_shorthand (node))
-    _gtk_style_property_pack (node, props, state, context, value);
-  else
-    _gtk_style_property_default_value (node, props, state, value);
-
+  _gtk_style_property_query (node, props, state, context, value);
   return TRUE;
 }
 
diff --git a/gtk/gtkstyleproperty.c b/gtk/gtkstyleproperty.c
index d139b9d..fb1ca24 100644
--- a/gtk/gtkstyleproperty.c
+++ b/gtk/gtkstyleproperty.c
@@ -33,6 +33,7 @@
 #include "gtkcssparserprivate.h"
 #include "gtkcsstypesprivate.h"
 #include "gtkprivatetypebuiltins.h"
+#include "gtkstylepropertiesprivate.h"
 
 /* the actual parsers we have */
 #include "gtkanimationdescription.h"
@@ -2440,7 +2441,7 @@ _gtk_style_property_print_value (const GtkStyleProperty *property,
   func (value, string);
 }
 
-void
+static void
 _gtk_style_property_default_value (const GtkStyleProperty *property,
                                    GtkStyleProperties     *properties,
                                    GtkStateFlags           state,
@@ -2565,7 +2566,7 @@ resolve_shadow (GtkStyleProperties *props,
   return TRUE;
 }
 
-void
+static void
 _gtk_style_property_resolve (const GtkStyleProperty *property,
                              GtkStyleProperties     *props,
                              GtkStateFlags           state,
@@ -2668,7 +2669,7 @@ _gtk_style_property_unpack (const GtkStyleProperty *property,
   return property->unpack_func (value, n_params);
 }
 
-void
+static void
 _gtk_style_property_pack (const GtkStyleProperty *property,
                           GtkStyleProperties     *props,
                           GtkStateFlags           state,
@@ -2683,6 +2684,31 @@ _gtk_style_property_pack (const GtkStyleProperty *property,
   property->pack_func (value, props, state, context);
 }
 
+void
+_gtk_style_property_query (const GtkStyleProperty  *property,
+                           GtkStyleProperties      *props,
+                           GtkStateFlags            state,
+			   GtkStylePropertyContext *context,
+                           GValue                  *value)
+{
+  const GValue *val;
+
+  g_return_if_fail (property != NULL);
+  g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
+  g_return_if_fail (context != NULL);
+  g_return_if_fail (value != NULL);
+
+  val = _gtk_style_properties_peek_property (props, property, state);
+  g_value_init (value, property->pspec->value_type);
+
+  if (val)
+    _gtk_style_property_resolve (property, props, state, context, (GValue *) val, value);
+  else if (_gtk_style_property_is_shorthand (property))
+    _gtk_style_property_pack (property, props, state, context, value);
+  else
+    _gtk_style_property_default_value (property, props, state, value);
+}
+
 #define rgba_init(rgba, r, g, b, a) G_STMT_START{ \
   (rgba)->red = (r); \
   (rgba)->green = (g); \
diff --git a/gtk/gtkstylepropertyprivate.h b/gtk/gtkstylepropertyprivate.h
index e34c208..4f5902a 100644
--- a/gtk/gtkstylepropertyprivate.h
+++ b/gtk/gtkstylepropertyprivate.h
@@ -78,29 +78,13 @@ void                     _gtk_style_property_register      (GParamSpec
 gboolean                 _gtk_style_property_is_inherit    (const GtkStyleProperty *property);
 guint                    _gtk_style_property_get_id        (const GtkStyleProperty *property);
 
-void                     _gtk_style_property_default_value (const GtkStyleProperty *property,
-                                                            GtkStyleProperties     *properties,
-                                                            GtkStateFlags           state,
-                                                            GValue                 *value);
 const GValue *           _gtk_style_property_get_initial_value
                                                            (const GtkStyleProperty *property);
 
-void                     _gtk_style_property_resolve       (const GtkStyleProperty *property,
-                                                            GtkStyleProperties     *properties,
-                                                            GtkStateFlags           state,
-							    GtkStylePropertyContext *context,
-                                                            GValue                 *orig_value,
-                                                            GValue                 *out_value);
-
 gboolean                 _gtk_style_property_is_shorthand  (const GtkStyleProperty *property);
 GParameter *             _gtk_style_property_unpack        (const GtkStyleProperty *property,
                                                             const GValue           *value,
                                                             guint                  *n_params);
-void                     _gtk_style_property_pack          (const GtkStyleProperty *property,
-                                                            GtkStyleProperties     *props,
-                                                            GtkStateFlags           state,
-							    GtkStylePropertyContext *context,
-                                                            GValue                 *value);
 
 gboolean                 _gtk_style_property_parse_value   (const GtkStyleProperty *property,
                                                             GValue                 *value,
@@ -110,6 +94,12 @@ void                     _gtk_style_property_print_value   (const GtkStyleProper
                                                             const GValue           *value,
                                                             GString                *string);
 
+void                     _gtk_style_property_query         (const GtkStyleProperty *property,
+                                                            GtkStyleProperties     *props,
+                                                            GtkStateFlags           state,
+							    GtkStylePropertyContext *context,
+                                                            GValue                 *value);
+
 G_END_DECLS
 
 #endif /* __GTK_CSS_STYLEPROPERTY_PRIVATE_H__ */



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