[gtk+] csscustomproperty: Redo RGBA/Color parsing
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] csscustomproperty: Redo RGBA/Color parsing
- Date: Mon, 9 Apr 2012 01:10:29 +0000 (UTC)
commit 43c56d70ea247b3317c386e22407ad20769d2762
Author: Benjamin Otte <otte redhat com>
Date: Mon Apr 9 03:05:12 2012 +0200
csscustomproperty: Redo RGBA/Color parsing
This fixes custom parse functions returning RGBA values where we
expected symbolic colors.
gtk/gtkcsscustomproperty.c | 23 +++++++++--------------
gtk/gtkcssstyleproperty.c | 4 ++++
2 files changed, 13 insertions(+), 14 deletions(-)
---
diff --git a/gtk/gtkcsscustomproperty.c b/gtk/gtkcsscustomproperty.c
index 179705b..bce695d 100644
--- a/gtk/gtkcsscustomproperty.c
+++ b/gtk/gtkcsscustomproperty.c
@@ -81,33 +81,28 @@ _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)
{
GValue value = G_VALUE_INIT;
- g_value_init (&value, gtk_css_custom_property_get_specified_type (pspec));
+ g_value_init (&value, pspec->value_type);
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 ||
- pspec->value_type == GDK_TYPE_COLOR)
+ else if (pspec->value_type == GDK_TYPE_RGBA)
{
GdkRGBA color;
gdk_rgba_parse (&color, "pink");
- g_value_take_boxed (&value, gtk_symbolic_color_new_literal (&color));
+ g_value_take_boxed (&value, &color);
+ }
+ else if (pspec->value_type == GDK_TYPE_COLOR)
+ {
+ GdkColor color;
+ gdk_color_parse ("pink", &color);
+ g_value_take_boxed (&value, &color);
}
else if (pspec->value_type == GTK_TYPE_BORDER)
{
diff --git a/gtk/gtkcssstyleproperty.c b/gtk/gtkcssstyleproperty.c
index cbbe606..c9d4e56 100644
--- a/gtk/gtkcssstyleproperty.c
+++ b/gtk/gtkcssstyleproperty.c
@@ -464,6 +464,10 @@ _gtk_css_style_property_is_specified_type (GtkCssStyleProperty *property,
return TRUE;
/* XXX: Someone needs to fix that legacy */
+ if ((_gtk_css_value_holds (property->initial_value, GDK_TYPE_RGBA) ||
+ _gtk_css_value_holds (property->initial_value, GDK_TYPE_COLOR)) &&
+ type == GTK_TYPE_GRADIENT)
+ return TRUE;
if (_gtk_css_value_holds (property->initial_value, CAIRO_GOBJECT_TYPE_PATTERN) &&
type == GTK_TYPE_GRADIENT)
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]