Commit c8e57d63 authored by Benjamin Otte's avatar Benjamin Otte

cssstyelproperty: Rempove specified-type and computed-type props

This removes the necessity to keep a GType associated with style
properties and code can now make use of GtkCssValue completely.
parent 75a5f043
......@@ -216,7 +216,6 @@ gtk_theming_engine_register_property (const gchar *name_space,
node = g_object_new (GTK_TYPE_CSS_CUSTOM_PROPERTY,
"initial-value", initial,
"name", name,
"computed-type", pspec->value_type,
"value-type", pspec->value_type,
NULL);
node->pspec = pspec;
......@@ -259,7 +258,6 @@ gtk_style_properties_register_property (GtkStylePropertyParser parse_func,
node = g_object_new (GTK_TYPE_CSS_CUSTOM_PROPERTY,
"initial-value", initial,
"name", pspec->name,
"computed-type", pspec->value_type,
"value-type", pspec->value_type,
NULL);
node->pspec = pspec;
......
......@@ -42,8 +42,6 @@
enum {
PROP_0,
PROP_ID,
PROP_SPECIFIED_TYPE,
PROP_COMPUTED_TYPE,
PROP_INHERIT,
PROP_INITIAL
};
......@@ -79,10 +77,6 @@ gtk_css_style_property_set_property (GObject *object,
property->initial_value = g_value_dup_boxed (value);
g_assert (property->initial_value != NULL);
break;
case PROP_COMPUTED_TYPE:
property->computed_type = g_value_get_gtype (value);
g_assert (property->computed_type != G_TYPE_NONE);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -99,12 +93,6 @@ gtk_css_style_property_get_property (GObject *object,
switch (prop_id)
{
case PROP_SPECIFIED_TYPE:
g_value_set_gtype (value, G_VALUE_TYPE (&property->initial_value));
break;
case PROP_COMPUTED_TYPE:
g_value_set_gtype (value, property->computed_type);
break;
case PROP_ID:
g_value_set_boolean (value, property->id);
break;
......@@ -233,20 +221,6 @@ _gtk_css_style_property_class_init (GtkCssStylePropertyClass *klass)
P_("The numeric id for quick access"),
0, G_MAXUINT, 0,
G_PARAM_READABLE));
g_object_class_install_property (object_class,
PROP_SPECIFIED_TYPE,
g_param_spec_gtype ("specified-type",
P_("Specified type"),
P_("The type of values after parsing"),
G_TYPE_NONE,
G_PARAM_READABLE));
g_object_class_install_property (object_class,
PROP_COMPUTED_TYPE,
g_param_spec_gtype ("computed-type",
P_("Computed type"),
P_("The type of values after style lookup"),
G_TYPE_NONE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class,
PROP_INHERIT,
g_param_spec_boolean ("inherit",
......@@ -415,45 +389,6 @@ _gtk_css_style_property_get_initial_value (GtkCssStyleProperty *property)
return property->initial_value;
}
/**
* _gtk_css_style_property_get_computed_type:
* @property: the property to query
*
* Gets the #GType used for values for this property after a CSS lookup has
* happened. _gtk_css_style_property_compute_value() will convert values to
* this type.
*
* Returns: the #GType used for computed values.
**/
GType
_gtk_css_style_property_get_computed_type (GtkCssStyleProperty *property)
{
g_return_val_if_fail (GTK_IS_CSS_STYLE_PROPERTY (property), G_TYPE_NONE);
return property->computed_type;
}
/**
* _gtk_css_style_property_get_specified_type:
* @property: the property to query
*
* Gets the #GType used for values for this property after CSS parsing if
* the value is not a special keyword. _gtk_css_style_property_compute_value()
* will convert values of this type to the computed type.
*
* The initial value returned by _gtk_css_style_property_get_initial_value()
* will be of this type.
*
* Returns: the #GType used for specified values.
**/
GType
_gtk_css_style_property_get_specified_type (GtkCssStyleProperty *property)
{
g_return_val_if_fail (GTK_IS_CSS_STYLE_PROPERTY (property), G_TYPE_NONE);
return _gtk_css_value_get_content_type (property->initial_value);
}
/**
* _gtk_css_style_property_compute_value:
* @property: the property
......
This diff is collapsed.
......@@ -50,7 +50,6 @@ struct _GtkCssStyleProperty
{
GtkStyleProperty parent;
GType computed_type;
GtkCssValue *initial_value;
guint id;
guint inherit :1;
......@@ -79,8 +78,6 @@ gboolean _gtk_css_style_property_is_inherit (GtkCssStyleProp
guint _gtk_css_style_property_get_id (GtkCssStyleProperty *property);
GtkCssValue * _gtk_css_style_property_get_initial_value
(GtkCssStyleProperty *property);
GType _gtk_css_style_property_get_computed_type (GtkCssStyleProperty *property);
GType _gtk_css_style_property_get_specified_type (GtkCssStyleProperty *property);
GtkCssValue * _gtk_css_style_property_compute_value (GtkCssStyleProperty *property,
GtkStyleContext *context,
......
......@@ -441,8 +441,6 @@ _gtk_style_properties_set_property_by_property (GtkStyleProperties *props,
PropertyData *prop;
ValueData *val;
g_return_if_fail (_gtk_css_value_holds (value, _gtk_css_style_property_get_computed_type (style_prop)));
priv = props->priv;
prop = g_hash_table_lookup (priv->properties, style_prop);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment