[gtk+/wip/css: 4/37] css: Create SymbolicColor fallback properties for colors



commit 31441a18e44577e2c89194ed5abbc1cdeda6f81c
Author: Benjamin Otte <otte redhat com>
Date:   Sat Jan 14 04:18:29 2012 +0100

    css: Create SymbolicColor fallback properties for colors

 gtk/gtkcsscustomproperty.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkcsscustomproperty.c b/gtk/gtkcsscustomproperty.c
index 266544b..fcb8a0f 100644
--- a/gtk/gtkcsscustomproperty.c
+++ b/gtk/gtkcsscustomproperty.c
@@ -77,21 +77,32 @@ _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 void
 gtk_css_custom_property_create_initial_value (GParamSpec *pspec,
                                               GValue     *value)
 {
-  g_value_init (value, pspec->value_type);
+  g_value_init (value, gtk_css_custom_property_get_specified_type (pspec));
 
   if (pspec->value_type == GTK_TYPE_THEMING_ENGINE)
     g_value_set_object (value, gtk_theming_engine_load (NULL));
   else if (pspec->value_type == PANGO_TYPE_FONT_DESCRIPTION)
     g_value_take_boxed (value, pango_font_description_from_string ("Sans 10"));
-  else if (pspec->value_type == GDK_TYPE_RGBA)
+  else if (pspec->value_type == GDK_TYPE_RGBA ||
+           pspec->value_type == GDK_TYPE_COLOR)
     {
       GdkRGBA color;
       gdk_rgba_parse (&color, "pink");
-      g_value_set_boxed (value, &color);
+      g_value_take_boxed (value, gtk_symbolic_color_new_literal (&color));
     }
   else if (pspec->value_type == GTK_TYPE_BORDER)
     {



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