summaryrefslogtreecommitdiff
path: root/gtk/gtkcsscustomproperty.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2012-04-07 07:40:36 +0200
committerBenjamin Otte <otte@redhat.com>2012-04-17 08:59:20 +0200
commit40283e7c2793c7b46e51df520ae17d312a389618 (patch)
tree4c52decc658ec488dfc46a0ed7de70106b8b1c65 /gtk/gtkcsscustomproperty.c
parent883c871be649cb51e1ff5f907a07fd7dfa1cbaf9 (diff)
downloadgtk+-40283e7c2793c7b46e51df520ae17d312a389618.tar.gz
cssvalue: Split out old value handling to new typed value
... and Make this new value be a real GValue, as we don't need to save performance for these anymore (it's just used for custom properties). And I'd rather have code work for all values then be optimized for no reason.
Diffstat (limited to 'gtk/gtkcsscustomproperty.c')
-rw-r--r--gtk/gtkcsscustomproperty.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/gtk/gtkcsscustomproperty.c b/gtk/gtkcsscustomproperty.c
index 0f20c1fc7f..8f50d8a5e2 100644
--- a/gtk/gtkcsscustomproperty.c
+++ b/gtk/gtkcsscustomproperty.c
@@ -24,6 +24,7 @@
#include <string.h>
#include "gtkcssstylefuncsprivate.h"
+#include "gtkcsstypedvalueprivate.h"
#include "gtkstylepropertiesprivate.h"
#include "gtkthemingengine.h"
@@ -46,7 +47,6 @@ gtk_css_custom_property_parse_value (GtkStyleProperty *property,
{
GtkCssCustomProperty *custom = GTK_CSS_CUSTOM_PROPERTY (property);
GValue value = G_VALUE_INIT;
- GtkCssValue *result;
gboolean success;
if (custom->property_parse_func)
@@ -78,10 +78,7 @@ gtk_css_custom_property_parse_value (GtkStyleProperty *property,
return NULL;
}
- result = _gtk_css_value_new_from_gvalue (&value);
- g_value_unset (&value);
-
- return result;
+ return _gtk_css_typed_value_new_take (&value);
}
static void
@@ -91,14 +88,15 @@ gtk_css_custom_property_query (GtkStyleProperty *property,
gpointer query_data)
{
GtkCssStyleProperty *style = GTK_CSS_STYLE_PROPERTY (property);
+ GtkCssCustomProperty *custom = GTK_CSS_CUSTOM_PROPERTY (property);
GtkCssValue *css_value;
css_value = (* query_func) (_gtk_css_style_property_get_id (style), query_data);
if (css_value == NULL)
- css_value =_gtk_css_style_property_get_initial_value (style);
+ css_value = _gtk_css_style_property_get_initial_value (style);
- _gtk_css_value_init_gvalue (css_value, value);
- g_assert (GTK_CSS_CUSTOM_PROPERTY (property)->pspec->value_type == G_VALUE_TYPE (value));
+ g_value_init (value, custom->pspec->value_type);
+ g_value_copy (_gtk_css_typed_value_get (css_value), value);
}
static void
@@ -107,7 +105,7 @@ gtk_css_custom_property_assign (GtkStyleProperty *property,
GtkStateFlags state,
const GValue *value)
{
- GtkCssValue *css_value = _gtk_css_value_new_from_gvalue (value);
+ GtkCssValue *css_value = _gtk_css_typed_value_new (value);
_gtk_style_properties_set_property_by_property (props,
GTK_CSS_STYLE_PROPERTY (property),
state,
@@ -174,7 +172,7 @@ gtk_css_custom_property_create_initial_value (GParamSpec *pspec)
else
g_param_value_set_default (pspec, &value);
- result = _gtk_css_value_new_from_gvalue (&value);
+ result = _gtk_css_typed_value_new (&value);
g_value_unset (&value);
return result;