[gtk+/wip/css: 4/36] css: Create SymbolicColor fallback properties for colors
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/css: 4/36] css: Create SymbolicColor fallback properties for colors
- Date: Wed, 18 Jan 2012 09:38:51 +0000 (UTC)
commit f4cd5c6eb16fe80e7a724655cec8670cd48a68de
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]