diff options
author | Benjamin Otte <otte@redhat.com> | 2012-01-15 02:30:26 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2012-02-02 03:14:00 +0100 |
commit | a81ac3d5cd71fedef35bf861e4232f2dee3e0a21 (patch) | |
tree | 825ad9b10a10d779e164ce3596303d20075ab638 /gtk/gtkcssstyleproperty.c | |
parent | 9551f542bdc10e1bdcd7f7561126476c9a68dd87 (diff) | |
download | gtk+-a81ac3d5cd71fedef35bf861e4232f2dee3e0a21.tar.gz |
css: Add a check function for specified types
... and use it.
It seems kinda necessary for the refactoring I'm about to do...
Diffstat (limited to 'gtk/gtkcssstyleproperty.c')
-rw-r--r-- | gtk/gtkcssstyleproperty.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gtk/gtkcssstyleproperty.c b/gtk/gtkcssstyleproperty.c index 348ea0d163..ad713ec422 100644 --- a/gtk/gtkcssstyleproperty.c +++ b/gtk/gtkcssstyleproperty.c @@ -28,6 +28,7 @@ #include "gtkprivatetypebuiltins.h" #include "gtkstylepropertiesprivate.h" +#include <cairo-gobject.h> #include "gtkcssimagegradientprivate.h" #include "gtkcssimageprivate.h" @@ -441,6 +442,28 @@ _gtk_css_style_property_get_specified_type (GtkCssStyleProperty *property) return G_VALUE_TYPE (&property->initial_value); } +gboolean +_gtk_css_style_property_is_specified_type (GtkCssStyleProperty *property, + GType type) +{ + g_return_val_if_fail (GTK_IS_CSS_STYLE_PROPERTY (property), FALSE); + + /* If it's our specified type, of course it's valid */ + if (type == G_VALUE_TYPE (&property->initial_value)) + return TRUE; + + /* The special values 'inherit' and 'initial' are always valid */ + if (type == GTK_TYPE_CSS_SPECIAL_VALUE) + return TRUE; + + /* XXX: Someone needs to fix that legacy */ + if (G_VALUE_TYPE (&property->initial_value) == CAIRO_GOBJECT_TYPE_PATTERN && + type == GTK_TYPE_GRADIENT) + return TRUE; + + return FALSE; +} + /** * _gtk_css_style_property_compute_value: * @property: the property |