[gtk+/wip/cssvalue: 53/141] customproperty: Don't rely on querying style property



commit 0aae4edbae52b44883d92eb640c048f8573c9f7b
Author: Benjamin Otte <otte redhat com>
Date:   Tue Mar 27 05:00:35 2012 +0200

    customproperty: Don't rely on querying style property
    
    This way, we can remove type madness from GtkCssStyleProperty later.

 gtk/gtkcsscustomproperty.c |   23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkcsscustomproperty.c b/gtk/gtkcsscustomproperty.c
index 7bd6df0..7f21781 100644
--- a/gtk/gtkcsscustomproperty.c
+++ b/gtk/gtkcsscustomproperty.c
@@ -28,6 +28,16 @@
 
 G_DEFINE_TYPE (GtkCssCustomProperty, _gtk_css_custom_property, GTK_TYPE_CSS_STYLE_PROPERTY)
 
+static GType
+gtk_css_custom_property_get_specified_type (GParamSpec *pspec)
+{
+  if (pspec->value_type == GDK_TYPE_RGBA ||
+      pspec->value_type == GDK_TYPE_COLOR)
+    return GTK_TYPE_SYMBOLIC_COLOR;
+  else
+    return pspec->value_type;
+}
+
 static GtkCssValue *
 gtk_css_custom_property_parse_value (GtkStyleProperty *property,
                                      GtkCssParser     *parser,
@@ -56,8 +66,7 @@ gtk_css_custom_property_parse_value (GtkStyleProperty *property,
     }
   else
     {
-      GtkCssStyleProperty *style = GTK_CSS_STYLE_PROPERTY (property);
-      g_value_init (&value, _gtk_css_style_property_get_specified_type (style));
+      g_value_init (&value, gtk_css_custom_property_get_specified_type (custom->pspec));
 
       success = _gtk_css_style_parse_value (&value, parser, base);
     }
@@ -88,16 +97,6 @@ _gtk_css_custom_property_init (GtkCssCustomProperty *custom_property)
 {
 }
 
-static GType
-gtk_css_custom_property_get_specified_type (GParamSpec *pspec)
-{
-  if (pspec->value_type == GDK_TYPE_RGBA ||
-      pspec->value_type == GDK_TYPE_COLOR)
-    return GTK_TYPE_SYMBOLIC_COLOR;
-  else
-    return pspec->value_type;
-}
-
 static GtkCssValue *
 gtk_css_custom_property_create_initial_value (GParamSpec *pspec)
 {



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