diff options
author | Benjamin Otte <otte@redhat.com> | 2012-03-26 07:08:24 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2012-04-17 08:59:11 +0200 |
commit | 5ac9ba714ae480b8abfa918448ec07e5bf330da0 (patch) | |
tree | 1d250787adc88618406398d5f5f7d24df3cb51d8 /gtk/gtkcssstyleproperty.c | |
parent | 58e4fdf911377c303858d0eebbd2594505dd3a21 (diff) | |
download | gtk+-5ac9ba714ae480b8abfa918448ec07e5bf330da0.tar.gz |
styleproperty: Make _gtk_style_property_query() take a GValue
... and don't make it return a GtkCssValue. We want to use this for
compat with the old GValue APIs after all...
Diffstat (limited to 'gtk/gtkcssstyleproperty.c')
-rw-r--r-- | gtk/gtkcssstyleproperty.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/gtk/gtkcssstyleproperty.c b/gtk/gtkcssstyleproperty.c index e783aa02c2..4e14cd4a09 100644 --- a/gtk/gtkcssstyleproperty.c +++ b/gtk/gtkcssstyleproperty.c @@ -132,8 +132,9 @@ _gtk_css_style_property_assign (GtkStyleProperty *property, _gtk_css_value_unref (css_value); } -static GtkCssValue * +static void _gtk_css_style_property_query (GtkStyleProperty *property, + GValue *value, GtkStyleQueryFunc query_func, gpointer query_data) { @@ -150,11 +151,11 @@ _gtk_css_style_property_query (GtkStyleProperty *property, cairo_surface_t *surface; cairo_matrix_t matrix; - if (image == NULL) - return _gtk_css_value_new_from_pattern (NULL); - else if (GTK_IS_CSS_IMAGE_GRADIENT (image)) - return _gtk_css_value_new_from_pattern (GTK_CSS_IMAGE_GRADIENT (image)->pattern); - else + g_value_init (value, CAIRO_GOBJECT_TYPE_PATTERN); + + if (GTK_IS_CSS_IMAGE_GRADIENT (image)) + g_value_set_boxed (value, GTK_CSS_IMAGE_GRADIENT (image)->pattern); + else if (image != NULL) { double width, height; @@ -165,19 +166,24 @@ _gtk_css_style_property_query (GtkStyleProperty *property, cairo_matrix_init_scale (&matrix, width, height); cairo_pattern_set_matrix (pattern, &matrix); cairo_surface_destroy (surface); - return _gtk_css_value_new_take_pattern (pattern); + g_value_take_boxed (value, pattern); } } else if (_gtk_css_value_holds (css_value, GTK_TYPE_CSS_NUMBER)) { - int v = round (_gtk_css_number_get (_gtk_css_value_get_number (css_value), 100)); - return _gtk_css_value_new_from_int (v); + g_value_init (value, G_TYPE_INT); + g_value_set_int (value, round (_gtk_css_number_get (_gtk_css_value_get_number (css_value), 100))); } else - return _gtk_css_value_ref (css_value); + { + _gtk_css_value_init_gvalue (css_value, value); + } } else - return _gtk_css_value_ref (_gtk_css_style_property_get_initial_value (GTK_CSS_STYLE_PROPERTY (property))); + { + _gtk_css_value_init_gvalue (_gtk_css_style_property_get_initial_value (GTK_CSS_STYLE_PROPERTY (property)), + value); + } } static gboolean |