diff options
author | Benjamin Otte <otte@redhat.com> | 2011-12-31 01:14:47 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2012-01-09 18:37:51 +0100 |
commit | 3e24b5dbbec0161aa28dc32aac52d6c9e8f9a980 (patch) | |
tree | 1d4a681d784fe80c7353c3b8bb61d3e2f3a7ed9d /gtk/gtkstyleproperty.c | |
parent | 2573e72f496fe252c452ca9bdff03b70c6926d2a (diff) | |
download | gtk+-3e24b5dbbec0161aa28dc32aac52d6c9e8f9a980.tar.gz |
styleproperty: Add _gtk_style_property_query()
This way, we only need to export one function, not 3.
Diffstat (limited to 'gtk/gtkstyleproperty.c')
-rw-r--r-- | gtk/gtkstyleproperty.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/gtk/gtkstyleproperty.c b/gtk/gtkstyleproperty.c index d139b9da85..fb1ca2496c 100644 --- a/gtk/gtkstyleproperty.c +++ b/gtk/gtkstyleproperty.c @@ -33,6 +33,7 @@ #include "gtkcssparserprivate.h" #include "gtkcsstypesprivate.h" #include "gtkprivatetypebuiltins.h" +#include "gtkstylepropertiesprivate.h" /* the actual parsers we have */ #include "gtkanimationdescription.h" @@ -2440,7 +2441,7 @@ _gtk_style_property_print_value (const GtkStyleProperty *property, func (value, string); } -void +static void _gtk_style_property_default_value (const GtkStyleProperty *property, GtkStyleProperties *properties, GtkStateFlags state, @@ -2565,7 +2566,7 @@ resolve_shadow (GtkStyleProperties *props, return TRUE; } -void +static void _gtk_style_property_resolve (const GtkStyleProperty *property, GtkStyleProperties *props, GtkStateFlags state, @@ -2668,7 +2669,7 @@ _gtk_style_property_unpack (const GtkStyleProperty *property, return property->unpack_func (value, n_params); } -void +static void _gtk_style_property_pack (const GtkStyleProperty *property, GtkStyleProperties *props, GtkStateFlags state, @@ -2683,6 +2684,31 @@ _gtk_style_property_pack (const GtkStyleProperty *property, property->pack_func (value, props, state, context); } +void +_gtk_style_property_query (const GtkStyleProperty *property, + GtkStyleProperties *props, + GtkStateFlags state, + GtkStylePropertyContext *context, + GValue *value) +{ + const GValue *val; + + g_return_if_fail (property != NULL); + g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props)); + g_return_if_fail (context != NULL); + g_return_if_fail (value != NULL); + + val = _gtk_style_properties_peek_property (props, property, state); + g_value_init (value, property->pspec->value_type); + + if (val) + _gtk_style_property_resolve (property, props, state, context, (GValue *) val, value); + else if (_gtk_style_property_is_shorthand (property)) + _gtk_style_property_pack (property, props, state, context, value); + else + _gtk_style_property_default_value (property, props, state, value); +} + #define rgba_init(rgba, r, g, b, a) G_STMT_START{ \ (rgba)->red = (r); \ (rgba)->green = (g); \ |