From dd83f9ca86d31c78d37239b6f5f55cf68e65d590 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 7 Oct 2016 04:31:37 +0200 Subject: [PATCH] API: Remove API to set CSS properties from GValues This API was only used in GtkModifierStyle and GtkStyleProperties and they are both on their way out. CSS properties must now be set using strings via the regular parser API. --- docs/reference/gtk/gtk4-sections.txt | 3 - gtk/deprecated/Makefile.inc | 1 - gtk/deprecated/gtkstyleproperties.c | 158 --------------- gtk/deprecated/gtkstyleproperties.h | 14 -- gtk/deprecated/gtkstylepropertiesprivate.h | 34 ---- gtk/gtkcsscustomproperty.c | 16 -- gtk/gtkcssshorthandproperty.c | 12 -- gtk/gtkcssshorthandpropertyimpl.c | 179 ----------------- gtk/gtkcssshorthandpropertyprivate.h | 5 - gtk/gtkcssstyleproperty.c | 21 -- gtk/gtkcssstylepropertyimpl.c | 216 --------------------- gtk/gtkcssstylepropertyprivate.h | 3 - gtk/gtkstyleproperty.c | 36 +--- gtk/gtkstylepropertyprivate.h | 8 - 14 files changed, 2 insertions(+), 704 deletions(-) delete mode 100644 gtk/deprecated/gtkstylepropertiesprivate.h diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt index a6aedd3a52..41e459034e 100644 --- a/docs/reference/gtk/gtk4-sections.txt +++ b/docs/reference/gtk/gtk4-sections.txt @@ -5659,9 +5659,6 @@ gtk_style_properties_merge gtk_style_properties_new GtkStylePropertyParser gtk_style_properties_register_property -gtk_style_properties_set -gtk_style_properties_set_property -gtk_style_properties_set_valist gtk_style_properties_unset_property GTK_TYPE_STYLE_PROPERTIES diff --git a/gtk/deprecated/Makefile.inc b/gtk/deprecated/Makefile.inc index 75d7ac6f86..8136ef1b1d 100644 --- a/gtk/deprecated/Makefile.inc +++ b/gtk/deprecated/Makefile.inc @@ -15,7 +15,6 @@ deprecated_h_sources = \ deprecated_private_h_sources = \ deprecated/gtkgradientprivate.h \ - deprecated/gtkstylepropertiesprivate.h \ deprecated/gtksymboliccolorprivate.h deprecated_c_sources = \ diff --git a/gtk/deprecated/gtkstyleproperties.c b/gtk/deprecated/gtkstyleproperties.c index 36f49a80d1..ac8ff373b4 100644 --- a/gtk/deprecated/gtkstyleproperties.c +++ b/gtk/deprecated/gtkstyleproperties.c @@ -17,8 +17,6 @@ #include "config.h" -#include "gtkstylepropertiesprivate.h" - #include #include #include @@ -428,162 +426,6 @@ gtk_style_properties_lookup_color (GtkStyleProperties *props, return g_hash_table_lookup (priv->color_map, name); } -void -_gtk_style_properties_set_property_by_property (GtkStyleProperties *props, - GtkCssStyleProperty *style_prop, - GtkStateFlags state, - GtkCssValue *value) -{ - GtkStylePropertiesPrivate *priv; - PropertyData *prop; - ValueData *val; - - priv = props->priv; - prop = g_hash_table_lookup (priv->properties, style_prop); - - if (!prop) - { - prop = property_data_new (); - g_hash_table_insert (priv->properties, (gpointer) style_prop, prop); - } - - val = property_data_get_value (prop, state); - - _gtk_css_value_unref (val->value); - val->value = _gtk_css_value_ref (value); - - _gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (props)); -} - -/** - * gtk_style_properties_set_property: - * @props: a #GtkStyleProperties - * @property: styling property to set - * @state: state to set the value for - * @value: new value for the property - * - * Sets a styling property in @props. - * - * Since: 3.0 - * - * Deprecated: 3.16: #GtkStyleProperties are deprecated. - **/ -void -gtk_style_properties_set_property (GtkStyleProperties *props, - const gchar *property, - GtkStateFlags state, - const GValue *value) -{ - GtkStyleProperty *node; - - g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props)); - g_return_if_fail (property != NULL); - g_return_if_fail (value != NULL); - - node = _gtk_style_property_lookup (property); - - if (!node) - { - g_warning ("Style property \"%s\" is not registered", property); - return; - } - if (_gtk_style_property_get_value_type (node) == G_TYPE_NONE) - { - g_warning ("Style property \"%s\" is not settable", property); - return; - } - - _gtk_style_property_assign (node, props, state, value); -} - -/** - * gtk_style_properties_set_valist: - * @props: a #GtkStyleProperties - * @state: state to set the values for - * @args: va_list of property name/value pairs, followed by %NULL - * - * Sets several style properties on @props. - * - * Since: 3.0 - * - * Deprecated: 3.16: #GtkStyleProperties are deprecated. - **/ -void -gtk_style_properties_set_valist (GtkStyleProperties *props, - GtkStateFlags state, - va_list args) -{ - const gchar *property_name; - - g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props)); - - property_name = va_arg (args, const gchar *); - - while (property_name) - { - GtkStyleProperty *node; - gchar *error = NULL; - GType val_type; - GValue val = G_VALUE_INIT; - - node = _gtk_style_property_lookup (property_name); - - if (!node) - { - g_warning ("Style property \"%s\" is not registered", property_name); - break; - } - - val_type = _gtk_style_property_get_value_type (node); - if (val_type == G_TYPE_NONE) - { - g_warning ("Style property \"%s\" is not settable", property_name); - break; - } - - G_VALUE_COLLECT_INIT (&val, _gtk_style_property_get_value_type (node), - args, 0, &error); - if (error) - { - g_warning ("Could not set style property \"%s\": %s", property_name, error); - g_value_unset (&val); - g_free (error); - break; - } - - _gtk_style_property_assign (node, props, state, &val); - g_value_unset (&val); - - property_name = va_arg (args, const gchar *); - } -} - -/** - * gtk_style_properties_set: - * @props: a #GtkStyleProperties - * @state: state to set the values for - * @...: property name/value pairs, followed by %NULL - * - * Sets several style properties on @props. - * - * Since: 3.0 - * - * Deprecated: 3.16: #GtkStyleProperties are deprecated. - **/ -void -gtk_style_properties_set (GtkStyleProperties *props, - GtkStateFlags state, - ...) -{ - va_list args; - - g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props)); - - va_start (args, state); - gtk_style_properties_set_valist (props, state, args); - va_end (args); -} - typedef struct { GtkStyleProperties *props; GtkStateFlags state; diff --git a/gtk/deprecated/gtkstyleproperties.h b/gtk/deprecated/gtkstyleproperties.h index c59c7af783..a8dd38e45f 100644 --- a/gtk/deprecated/gtkstyleproperties.h +++ b/gtk/deprecated/gtkstyleproperties.h @@ -88,20 +88,6 @@ GDK_DEPRECATED_IN_3_8 GtkSymbolicColor * gtk_style_properties_lookup_color (GtkStyleProperties *props, const gchar *name); -GDK_DEPRECATED_IN_3_16 -void gtk_style_properties_set_property (GtkStyleProperties *props, - const gchar *property, - GtkStateFlags state, - const GValue *value); -GDK_DEPRECATED_IN_3_16 -void gtk_style_properties_set_valist (GtkStyleProperties *props, - GtkStateFlags state, - va_list args); -GDK_DEPRECATED_IN_3_16 -void gtk_style_properties_set (GtkStyleProperties *props, - GtkStateFlags state, - ...) G_GNUC_NULL_TERMINATED; - GDK_DEPRECATED_IN_3_16 gboolean gtk_style_properties_get_property (GtkStyleProperties *props, const gchar *property, diff --git a/gtk/deprecated/gtkstylepropertiesprivate.h b/gtk/deprecated/gtkstylepropertiesprivate.h deleted file mode 100644 index 77268d9cce..0000000000 --- a/gtk/deprecated/gtkstylepropertiesprivate.h +++ /dev/null @@ -1,34 +0,0 @@ -/* GTK - The GIMP Toolkit - * Copyright (C) 2010 Carlos Garnacho - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#ifndef __GTK_STYLE_PROPERTIES_PRIVATE_H__ -#define __GTK_STYLE_PROPERTIES_PRIVATE_H__ - -#include "gtkstyleproperties.h" -#include "gtkcssstylepropertyprivate.h" -#include "gtkstylecontextprivate.h" - -G_BEGIN_DECLS - -void _gtk_style_properties_set_property_by_property (GtkStyleProperties *props, - GtkCssStyleProperty *property, - GtkStateFlags state, - GtkCssValue *value); - -G_END_DECLS - -#endif /* __GTK_STYLE_PROPERTIES_PRIVATE_H__ */ diff --git a/gtk/gtkcsscustomproperty.c b/gtk/gtkcsscustomproperty.c index 3d5c74db15..ff3e35a082 100644 --- a/gtk/gtkcsscustomproperty.c +++ b/gtk/gtkcsscustomproperty.c @@ -25,7 +25,6 @@ #include "gtkcssstylefuncsprivate.h" #include "gtkcsstypedvalueprivate.h" -#include "deprecated/gtkstylepropertiesprivate.h" #include "deprecated/gtksymboliccolor.h" @@ -59,20 +58,6 @@ gtk_css_custom_property_query (GtkStyleProperty *property, g_value_copy (_gtk_css_typed_value_get (css_value), value); } -static void -gtk_css_custom_property_assign (GtkStyleProperty *property, - GtkStyleProperties *props, - GtkStateFlags state, - const 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, - css_value); - _gtk_css_value_unref (css_value); -} - static void _gtk_css_custom_property_class_init (GtkCssCustomPropertyClass *klass) { @@ -80,7 +65,6 @@ _gtk_css_custom_property_class_init (GtkCssCustomPropertyClass *klass) property_class->parse_value = gtk_css_custom_property_parse_value; property_class->query = gtk_css_custom_property_query; - property_class->assign = gtk_css_custom_property_assign; } static void diff --git a/gtk/gtkcssshorthandproperty.c b/gtk/gtkcssshorthandproperty.c index 5e05761bbd..71c08bd34b 100644 --- a/gtk/gtkcssshorthandproperty.c +++ b/gtk/gtkcssshorthandproperty.c @@ -63,17 +63,6 @@ gtk_css_shorthand_property_set_property (GObject *object, } } -static void -_gtk_css_shorthand_property_assign (GtkStyleProperty *property, - GtkStyleProperties *props, - GtkStateFlags state, - const GValue *value) -{ - GtkCssShorthandProperty *shorthand = GTK_CSS_SHORTHAND_PROPERTY (property); - - shorthand->assign (shorthand, props, state, value); -} - static void _gtk_css_shorthand_property_query (GtkStyleProperty *property, GValue *value, @@ -172,7 +161,6 @@ _gtk_css_shorthand_property_class_init (GtkCssShorthandPropertyClass *klass) G_TYPE_STRV, G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); - property_class->assign = _gtk_css_shorthand_property_assign; property_class->query = _gtk_css_shorthand_property_query; property_class->parse_value = gtk_css_shorthand_property_parse_value; } diff --git a/gtk/gtkcssshorthandpropertyimpl.c b/gtk/gtkcssshorthandpropertyimpl.c index 3931363f07..d16e23f982 100644 --- a/gtk/gtkcssshorthandpropertyimpl.c +++ b/gtk/gtkcssshorthandpropertyimpl.c @@ -39,7 +39,6 @@ #include "gtkcssstringvalueprivate.h" #include "gtkcssstylefuncsprivate.h" #include "gtkcssvalueprivate.h" -#include "deprecated/gtkstylepropertiesprivate.h" #include "gtktypebuiltins.h" /* this is in case round() is not provided by the compiler, @@ -935,29 +934,6 @@ parse_all (GtkCssShorthandProperty *shorthand, /*** PACKING ***/ -static void -unpack_border (GtkCssShorthandProperty *shorthand, - GtkStyleProperties *props, - GtkStateFlags state, - const GValue *value) -{ - GValue v = G_VALUE_INIT; - GtkBorder *border = g_value_get_boxed (value); - - g_value_init (&v, G_TYPE_INT); - - g_value_set_int (&v, border->top); - _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, 0)), props, state, &v); - g_value_set_int (&v, border->right); - _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, 1)), props, state, &v); - g_value_set_int (&v, border->bottom); - _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, 2)), props, state, &v); - g_value_set_int (&v, border->left); - _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, 3)), props, state, &v); - - g_value_unset (&v); -} - static void pack_border (GtkCssShorthandProperty *shorthand, GValue *value, @@ -992,27 +968,6 @@ pack_border (GtkCssShorthandProperty *shorthand, g_value_set_boxed (value, &border); } -static void -unpack_border_radius (GtkCssShorthandProperty *shorthand, - GtkStyleProperties *props, - GtkStateFlags state, - const GValue *value) -{ - GtkCssValue *css_value; - guint i; - - css_value = _gtk_css_corner_value_new (_gtk_css_number_value_new (g_value_get_int (value), GTK_CSS_PX), - _gtk_css_number_value_new (g_value_get_int (value), GTK_CSS_PX)); - - for (i = 0; i < 4; i++) - _gtk_style_properties_set_property_by_property (props, - _gtk_css_shorthand_property_get_subproperty (shorthand, i), - state, - css_value); - - _gtk_css_value_unref (css_value); -} - static void pack_border_radius (GtkCssShorthandProperty *shorthand, GValue *value, @@ -1032,100 +987,6 @@ pack_border_radius (GtkCssShorthandProperty *shorthand, g_value_set_int (value, i); } -static void -unpack_font_description (GtkCssShorthandProperty *shorthand, - GtkStyleProperties *props, - GtkStateFlags state, - const GValue *value) -{ - GtkStyleProperty *prop; - PangoFontDescription *description; - PangoFontMask mask; - GValue v = G_VALUE_INIT; - - /* For backwards compat, we only unpack values that are indeed set. - * For strict CSS conformance we need to unpack all of them. - * Note that we do set all of them in the parse function, so it - * will not have effects when parsing CSS files. It will though - * for custom style providers. - */ - - description = g_value_get_boxed (value); - - if (description) - mask = pango_font_description_get_set_fields (description); - else - mask = 0; - - if (mask & PANGO_FONT_MASK_FAMILY) - { - GPtrArray *strv = g_ptr_array_new (); - - g_ptr_array_add (strv, g_strdup (pango_font_description_get_family (description))); - g_ptr_array_add (strv, NULL); - g_value_init (&v, G_TYPE_STRV); - g_value_take_boxed (&v, g_ptr_array_free (strv, FALSE)); - - prop = _gtk_style_property_lookup ("font-family"); - _gtk_style_property_assign (prop, props, state, &v); - g_value_unset (&v); - } - - if (mask & PANGO_FONT_MASK_STYLE) - { - g_value_init (&v, PANGO_TYPE_STYLE); - g_value_set_enum (&v, pango_font_description_get_style (description)); - - prop = _gtk_style_property_lookup ("font-style"); - _gtk_style_property_assign (prop, props, state, &v); - g_value_unset (&v); - } - - if (mask & PANGO_FONT_MASK_VARIANT) - { - g_value_init (&v, PANGO_TYPE_VARIANT); - g_value_set_enum (&v, pango_font_description_get_variant (description)); - - prop = _gtk_style_property_lookup ("font-variant"); - _gtk_style_property_assign (prop, props, state, &v); - g_value_unset (&v); - } - - if (mask & PANGO_FONT_MASK_WEIGHT) - { - g_value_init (&v, PANGO_TYPE_WEIGHT); - g_value_set_enum (&v, pango_font_description_get_weight (description)); - - prop = _gtk_style_property_lookup ("font-weight"); - _gtk_style_property_assign (prop, props, state, &v); - g_value_unset (&v); - } - - if (mask & PANGO_FONT_MASK_STRETCH) - { - g_value_init (&v, PANGO_TYPE_STRETCH); - g_value_set_enum (&v, pango_font_description_get_stretch (description)); - - prop = _gtk_style_property_lookup ("font-stretch"); - _gtk_style_property_assign (prop, props, state, &v); - g_value_unset (&v); - } - - if (mask & PANGO_FONT_MASK_SIZE) - { - double size; - - g_value_init (&v, G_TYPE_DOUBLE); - size = pango_font_description_get_size (description) / PANGO_SCALE; - if (!pango_font_description_get_size_is_absolute (description)) - size = size * 96.0 / 72.0; - g_value_set_double (&v, size); - prop = _gtk_style_property_lookup ("font-size"); - _gtk_style_property_assign (prop, props, state, &v); - g_value_unset (&v); - } -} - static void pack_font_description (GtkCssShorthandProperty *shorthand, GValue *value, @@ -1171,24 +1032,6 @@ pack_font_description (GtkCssShorthandProperty *shorthand, g_value_take_boxed (value, description); } -static void -unpack_to_everything (GtkCssShorthandProperty *shorthand, - GtkStyleProperties *props, - GtkStateFlags state, - const GValue *value) -{ - GtkCssStyleProperty *prop; - guint i, n; - - n = _gtk_css_shorthand_property_get_n_subproperties (shorthand); - - for (i = 0; i < n; i++) - { - prop = _gtk_css_shorthand_property_get_subproperty (shorthand, i); - _gtk_style_property_assign (GTK_STYLE_PROPERTY (prop), props, state, value); - } -} - static void pack_first_element (GtkCssShorthandProperty *shorthand, GValue *value, @@ -1214,7 +1057,6 @@ _gtk_css_shorthand_property_register (const char *name, GType value_type, const char **subproperties, GtkCssShorthandPropertyParseFunc parse_func, - GtkCssShorthandPropertyAssignFunc assign_func, GtkCssShorthandPropertyQueryFunc query_func) { GtkCssShorthandProperty *node; @@ -1226,7 +1068,6 @@ _gtk_css_shorthand_property_register (const char *name, NULL); node->parse = parse_func; - node->assign = assign_func; node->query = query_func; } @@ -1286,116 +1127,97 @@ _gtk_css_shorthand_property_init_properties (void) PANGO_TYPE_FONT_DESCRIPTION, font_subproperties, parse_font, - unpack_font_description, pack_font_description); _gtk_css_shorthand_property_register ("margin", GTK_TYPE_BORDER, margin_subproperties, parse_margin, - unpack_border, pack_border); _gtk_css_shorthand_property_register ("padding", GTK_TYPE_BORDER, padding_subproperties, parse_padding, - unpack_border, pack_border); _gtk_css_shorthand_property_register ("border-width", GTK_TYPE_BORDER, border_width_subproperties, parse_border_width, - unpack_border, pack_border); _gtk_css_shorthand_property_register ("border-radius", G_TYPE_INT, border_radius_subproperties, parse_border_radius, - unpack_border_radius, pack_border_radius); _gtk_css_shorthand_property_register ("border-color", GDK_TYPE_RGBA, border_color_subproperties, parse_border_color, - unpack_to_everything, pack_first_element); _gtk_css_shorthand_property_register ("border-style", GTK_TYPE_BORDER_STYLE, border_style_subproperties, parse_border_style, - unpack_to_everything, pack_first_element); _gtk_css_shorthand_property_register ("border-image", G_TYPE_NONE, border_image_subproperties, parse_border_image, - NULL, NULL); _gtk_css_shorthand_property_register ("border-top", G_TYPE_NONE, border_top_subproperties, parse_border_side, - NULL, NULL); _gtk_css_shorthand_property_register ("border-right", G_TYPE_NONE, border_right_subproperties, parse_border_side, - NULL, NULL); _gtk_css_shorthand_property_register ("border-bottom", G_TYPE_NONE, border_bottom_subproperties, parse_border_side, - NULL, NULL); _gtk_css_shorthand_property_register ("border-left", G_TYPE_NONE, border_left_subproperties, parse_border_side, - NULL, NULL); _gtk_css_shorthand_property_register ("border", G_TYPE_NONE, border_subproperties, parse_border, - NULL, NULL); _gtk_css_shorthand_property_register ("-gtk-outline-radius", G_TYPE_INT, outline_radius_subproperties, parse_border_radius, - unpack_border_radius, pack_border_radius); _gtk_style_property_add_alias ("-gtk-outline-radius", "outline-radius"); _gtk_css_shorthand_property_register ("outline", G_TYPE_NONE, outline_subproperties, parse_border_side, - NULL, NULL); _gtk_css_shorthand_property_register ("background", G_TYPE_NONE, background_subproperties, parse_background, - NULL, NULL); _gtk_css_shorthand_property_register ("transition", G_TYPE_NONE, transition_subproperties, parse_transition, - NULL, NULL); _gtk_css_shorthand_property_register ("animation", G_TYPE_NONE, animation_subproperties, parse_animation, - NULL, NULL); _gtk_css_shorthand_property_register ("text-decoration", G_TYPE_NONE, text_decoration_subproperties, parse_text_decoration, - NULL, NULL); all_subproperties = get_all_subproperties (); @@ -1403,7 +1225,6 @@ _gtk_css_shorthand_property_init_properties (void) G_TYPE_NONE, all_subproperties, parse_all, - NULL, NULL); g_free (all_subproperties); } diff --git a/gtk/gtkcssshorthandpropertyprivate.h b/gtk/gtkcssshorthandpropertyprivate.h index d548370314..07e21e9bbd 100644 --- a/gtk/gtkcssshorthandpropertyprivate.h +++ b/gtk/gtkcssshorthandpropertyprivate.h @@ -41,10 +41,6 @@ typedef struct _GtkCssShorthandPropertyClass GtkCssShorthandPropertyClass; typedef gboolean (* GtkCssShorthandPropertyParseFunc) (GtkCssShorthandProperty *shorthand, GtkCssValue **values, GtkCssParser *parser); -typedef void (* GtkCssShorthandPropertyAssignFunc) (GtkCssShorthandProperty *shorthand, - GtkStyleProperties *props, - GtkStateFlags state, - const GValue *value); typedef void (* GtkCssShorthandPropertyQueryFunc) (GtkCssShorthandProperty *shorthand, GValue *value, GtkStyleQueryFunc query_func, @@ -57,7 +53,6 @@ struct _GtkCssShorthandProperty GPtrArray *subproperties; GtkCssShorthandPropertyParseFunc parse; - GtkCssShorthandPropertyAssignFunc assign; GtkCssShorthandPropertyQueryFunc query; }; diff --git a/gtk/gtkcssstyleproperty.c b/gtk/gtkcssstyleproperty.c index e4d3f8f5dc..ef087198e6 100644 --- a/gtk/gtkcssstyleproperty.c +++ b/gtk/gtkcssstyleproperty.c @@ -29,7 +29,6 @@ #include "gtkcssunsetvalueprivate.h" #include "gtkintl.h" #include "gtkprivatetypebuiltins.h" -#include "deprecated/gtkstylepropertiesprivate.h" #include "gtkprivate.h" /* this is in case round() is not provided by the compiler, @@ -122,25 +121,6 @@ gtk_css_style_property_get_property (GObject *object, } } -static void -_gtk_css_style_property_assign (GtkStyleProperty *property, - GtkStyleProperties *props, - GtkStateFlags state, - const GValue *value) -{ - GtkCssStyleProperty *style; - GtkCssValue *css_value; - - style = GTK_CSS_STYLE_PROPERTY (property); - css_value = style->assign_value (style, value); - - _gtk_style_properties_set_property_by_property (props, - style, - state, - css_value); - _gtk_css_value_unref (css_value); -} - static void _gtk_css_style_property_query (GtkStyleProperty *property, GValue *value, @@ -239,7 +219,6 @@ _gtk_css_style_property_class_init (GtkCssStylePropertyClass *klass) GTK_TYPE_CSS_VALUE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); - property_class->assign = _gtk_css_style_property_assign; property_class->query = _gtk_css_style_property_query; property_class->parse_value = gtk_css_style_property_parse_value; diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c index 319092383a..0282b506e3 100644 --- a/gtk/gtkcssstylepropertyimpl.c +++ b/gtk/gtkcssstylepropertyimpl.c @@ -76,7 +76,6 @@ gtk_css_style_property_register (const char * name, GtkCssAffects affects, GtkCssStylePropertyParseFunc parse_value, GtkCssStylePropertyQueryFunc query_value, - GtkCssStylePropertyAssignFunc assign_value, GtkCssValue * initial_value) { GtkCssStyleProperty *node; @@ -84,7 +83,6 @@ gtk_css_style_property_register (const char * name, g_assert (initial_value != NULL); g_assert (parse_value != NULL); g_assert (value_type == G_TYPE_NONE || query_value != NULL); - g_assert (assign_value == NULL || query_value != NULL); node = g_object_new (GTK_TYPE_CSS_STYLE_PROPERTY, "value-type", value_type, @@ -97,7 +95,6 @@ gtk_css_style_property_register (const char * name, node->parse_value = parse_value; node->query_value = query_value; - node->assign_value = assign_value; _gtk_css_value_unref (initial_value); @@ -115,13 +112,6 @@ query_length_as_int (GtkCssStyleProperty *property, g_value_set_int (value, round (_gtk_css_number_value_get (css_value, 100))); } -static GtkCssValue * -assign_length_from_int (GtkCssStyleProperty *property, - const GValue *value) -{ - return _gtk_css_number_value_new (g_value_get_int (value), GTK_CSS_PX); -} - static void query_font_size (GtkCssStyleProperty *property, const GtkCssValue *css_value, @@ -131,13 +121,6 @@ query_font_size (GtkCssStyleProperty *property, g_value_set_double (value, _gtk_css_number_value_get (css_value, 100)); } -static GtkCssValue * -assign_font_size (GtkCssStyleProperty *property, - const GValue *value) -{ - return _gtk_css_number_value_new (g_value_get_double (value), GTK_CSS_PX); -} - static void query_border (GtkCssStyleProperty *property, const GtkCssValue *css_value, @@ -155,21 +138,6 @@ query_border (GtkCssStyleProperty *property, g_value_set_boxed (value, &border); } -static GtkCssValue * -assign_border (GtkCssStyleProperty *property, - const GValue *value) -{ - const GtkBorder *border = g_value_get_boxed (value); - - if (border == NULL) - return _gtk_css_initial_value_new (); - else - return _gtk_css_border_value_new (_gtk_css_number_value_new (border->top, GTK_CSS_PX), - _gtk_css_number_value_new (border->right, GTK_CSS_PX), - _gtk_css_number_value_new (border->bottom, GTK_CSS_PX), - _gtk_css_number_value_new (border->left, GTK_CSS_PX)); -} - static GtkCssValue * color_parse (GtkCssStyleProperty *property, GtkCssParser *parser) @@ -186,13 +154,6 @@ color_query (GtkCssStyleProperty *property, g_value_set_boxed (value, _gtk_css_rgba_value_get_rgba (css_value)); } -static GtkCssValue * -color_assign (GtkCssStyleProperty *property, - const GValue *value) -{ - return _gtk_css_rgba_value_new_from_rgba (g_value_get_boxed (value)); -} - static GtkCssValue * font_family_parse_one (GtkCssParser *parser) { @@ -256,26 +217,6 @@ font_family_query (GtkCssStyleProperty *property, g_value_set_boxed (value, g_ptr_array_free (array, FALSE)); } -static GtkCssValue * -font_family_assign (GtkCssStyleProperty *property, - const GValue *value) -{ - const char **names; - GtkCssValue *result; - GPtrArray *array; - - array = g_ptr_array_new (); - - for (names = g_value_get_boxed (value); *names; names++) - { - g_ptr_array_add (array, _gtk_css_string_value_new (*names)); - } - - result = _gtk_css_array_value_new_from_array ((GtkCssValue **) array->pdata, array->len); - g_ptr_array_free (array, TRUE); - return result; -} - static GtkCssValue * font_style_parse (GtkCssStyleProperty *property, GtkCssParser *parser) @@ -297,13 +238,6 @@ font_style_query (GtkCssStyleProperty *property, g_value_set_enum (value, _gtk_css_font_style_value_get (css_value)); } -static GtkCssValue * -font_style_assign (GtkCssStyleProperty *property, - const GValue *value) -{ - return _gtk_css_font_style_value_new (g_value_get_enum (value)); -} - static GtkCssValue * font_weight_parse (GtkCssStyleProperty *property, GtkCssParser *parser) @@ -325,13 +259,6 @@ font_weight_query (GtkCssStyleProperty *property, g_value_set_enum (value, _gtk_css_font_weight_value_get (css_value)); } -static GtkCssValue * -font_weight_assign (GtkCssStyleProperty *property, - const GValue *value) -{ - return _gtk_css_font_weight_value_new (g_value_get_enum (value)); -} - static GtkCssValue * font_variant_parse (GtkCssStyleProperty *property, GtkCssParser *parser) @@ -353,13 +280,6 @@ font_variant_query (GtkCssStyleProperty *property, g_value_set_enum (value, _gtk_css_font_variant_value_get (css_value)); } -static GtkCssValue * -font_variant_assign (GtkCssStyleProperty *property, - const GValue *value) -{ - return _gtk_css_font_variant_value_new (g_value_get_enum (value)); -} - static GtkCssValue * font_stretch_parse (GtkCssStyleProperty *property, GtkCssParser *parser) @@ -381,13 +301,6 @@ font_stretch_query (GtkCssStyleProperty *property, g_value_set_enum (value, _gtk_css_font_stretch_value_get (css_value)); } -static GtkCssValue * -font_stretch_assign (GtkCssStyleProperty *property, - const GValue *value) -{ - return _gtk_css_font_stretch_value_new (g_value_get_enum (value)); -} - static GtkCssValue * parse_border_style (GtkCssStyleProperty *property, GtkCssParser *parser) @@ -409,13 +322,6 @@ query_border_style (GtkCssStyleProperty *property, g_value_set_enum (value, _gtk_css_border_style_value_get (css_value)); } -static GtkCssValue * -assign_border_style (GtkCssStyleProperty *property, - const GValue *value) -{ - return _gtk_css_border_style_value_new (g_value_get_enum (value)); -} - static GtkCssValue * parse_css_area_one (GtkCssParser *parser) { @@ -605,30 +511,6 @@ bindings_value_query (GtkCssStyleProperty *property, g_value_take_boxed (value, array); } -static GtkCssValue * -bindings_value_assign (GtkCssStyleProperty *property, - const GValue *value) -{ - GPtrArray *binding_sets = g_value_get_boxed (value); - GtkCssValue **values, *result; - guint i; - - if (binding_sets == NULL || binding_sets->len == 0) - return _gtk_css_array_value_new (_gtk_css_string_value_new (NULL)); - - values = g_new (GtkCssValue *, binding_sets->len); - - for (i = 0; i < binding_sets->len; i++) - { - GtkBindingSet *binding_set = g_ptr_array_index (binding_sets, i); - values[i] = _gtk_css_string_value_new (binding_set->set_name); - } - - result = _gtk_css_array_value_new_from_array (values, binding_sets->len); - g_free (values); - return result; -} - static GtkCssValue * parse_letter_spacing (GtkCssStyleProperty *property, GtkCssParser *parser) @@ -745,14 +627,6 @@ css_image_value_query (GtkCssStyleProperty *property, } } -static GtkCssValue * -css_image_value_assign (GtkCssStyleProperty *property, - const GValue *value) -{ - g_warning ("FIXME: assigning images is not implemented"); - return _gtk_css_image_value_new (NULL); -} - static GtkCssValue * background_image_value_parse_one (GtkCssParser *parser) { @@ -774,13 +648,6 @@ background_image_value_query (GtkCssStyleProperty *property, css_image_value_query (property, _gtk_css_array_value_get_nth (css_value, 0), value); } -static GtkCssValue * -background_image_value_assign (GtkCssStyleProperty *property, - const GValue *value) -{ - return _gtk_css_array_value_new (css_image_value_assign (property, value)); -} - static GtkCssValue * dpi_parse (GtkCssStyleProperty *property, GtkCssParser *parser) @@ -1033,7 +900,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_FOREGROUND | GTK_CSS_AFFECTS_TEXT | GTK_CSS_AFFECTS_SYMBOLIC_ICON, color_parse, color_query, - color_assign, _gtk_css_color_value_new_rgba (1, 1, 1, 1)); gtk_css_style_property_register ("-gtk-dpi", GTK_CSS_PROPERTY_DPI, @@ -1042,7 +908,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_FONT | GTK_CSS_AFFECTS_TEXT | GTK_CSS_AFFECTS_SIZE, dpi_parse, NULL, - NULL, _gtk_css_number_value_new (96.0, GTK_CSS_NUMBER)); gtk_css_style_property_register ("font-size", GTK_CSS_PROPERTY_FONT_SIZE, @@ -1051,7 +916,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_FONT | GTK_CSS_AFFECTS_TEXT | GTK_CSS_AFFECTS_SIZE, font_size_parse, query_font_size, - assign_font_size, _gtk_css_font_size_value_new (GTK_CSS_FONT_SIZE_MEDIUM)); gtk_css_style_property_register ("-gtk-icon-theme", GTK_CSS_PROPERTY_ICON_THEME, @@ -1060,7 +924,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_ICON | GTK_CSS_AFFECTS_SYMBOLIC_ICON, icon_theme_value_parse, NULL, - NULL, gtk_css_icon_theme_value_new (NULL)); gtk_css_style_property_register ("-gtk-icon-palette", GTK_CSS_PROPERTY_ICON_PALETTE, @@ -1069,7 +932,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_SYMBOLIC_ICON, icon_palette_parse, NULL, - NULL, gtk_css_palette_value_new_default ()); @@ -1082,7 +944,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BACKGROUND, color_parse, color_query, - color_assign, _gtk_css_color_value_new_rgba (0, 0, 0, 0)); gtk_css_style_property_register ("font-family", @@ -1092,7 +953,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_FONT | GTK_CSS_AFFECTS_TEXT, font_family_parse, font_family_query, - font_family_assign, _gtk_css_array_value_new (_gtk_css_string_value_new ("Sans"))); gtk_css_style_property_register ("font-style", GTK_CSS_PROPERTY_FONT_STYLE, @@ -1101,7 +961,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_FONT | GTK_CSS_AFFECTS_TEXT, font_style_parse, font_style_query, - font_style_assign, _gtk_css_font_style_value_new (PANGO_STYLE_NORMAL)); gtk_css_style_property_register ("font-variant", GTK_CSS_PROPERTY_FONT_VARIANT, @@ -1110,7 +969,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_FONT | GTK_CSS_AFFECTS_TEXT, font_variant_parse, font_variant_query, - font_variant_assign, _gtk_css_font_variant_value_new (PANGO_VARIANT_NORMAL)); gtk_css_style_property_register ("font-weight", GTK_CSS_PROPERTY_FONT_WEIGHT, @@ -1119,7 +977,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_FONT | GTK_CSS_AFFECTS_TEXT, font_weight_parse, font_weight_query, - font_weight_assign, _gtk_css_font_weight_value_new (PANGO_WEIGHT_NORMAL)); gtk_css_style_property_register ("font-stretch", GTK_CSS_PROPERTY_FONT_STRETCH, @@ -1128,7 +985,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_FONT | GTK_CSS_AFFECTS_TEXT, font_stretch_parse, font_stretch_query, - font_stretch_assign, _gtk_css_font_stretch_value_new (PANGO_STRETCH_NORMAL)); gtk_css_style_property_register ("letter-spacing", @@ -1138,7 +994,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_TEXT | GTK_CSS_AFFECTS_TEXT_ATTRS, parse_letter_spacing, NULL, - NULL, _gtk_css_number_value_new (0.0, GTK_CSS_PX)); gtk_css_style_property_register ("text-decoration-line", @@ -1148,7 +1003,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_TEXT | GTK_CSS_AFFECTS_TEXT_ATTRS, parse_text_decoration_line, NULL, - NULL, _gtk_css_text_decoration_line_value_new (GTK_CSS_TEXT_DECORATION_LINE_NONE)); gtk_css_style_property_register ("text-decoration-color", GTK_CSS_PROPERTY_TEXT_DECORATION_COLOR, @@ -1157,7 +1011,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_TEXT | GTK_CSS_AFFECTS_TEXT_ATTRS, color_parse, NULL, - NULL, _gtk_css_color_value_new_current_color ()); gtk_css_style_property_register ("text-decoration-style", GTK_CSS_PROPERTY_TEXT_DECORATION_STYLE, @@ -1166,7 +1019,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_TEXT | GTK_CSS_AFFECTS_TEXT_ATTRS, parse_text_decoration_style, NULL, - NULL, _gtk_css_text_decoration_style_value_new (GTK_CSS_TEXT_DECORATION_STYLE_SOLID)); gtk_css_style_property_register ("text-shadow", @@ -1176,7 +1028,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_TEXT | GTK_CSS_AFFECTS_CLIP, shadow_value_parse, NULL, - NULL, _gtk_css_shadows_value_new_none ()); gtk_css_style_property_register ("box-shadow", @@ -1186,7 +1037,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BACKGROUND | GTK_CSS_AFFECTS_CLIP, box_shadow_value_parse, NULL, - NULL, _gtk_css_shadows_value_new_none ()); gtk_css_style_property_register ("margin-top", @@ -1196,7 +1046,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_SIZE, parse_margin, query_length_as_int, - assign_length_from_int, _gtk_css_number_value_new (0.0, GTK_CSS_PX)); gtk_css_style_property_register ("margin-left", GTK_CSS_PROPERTY_MARGIN_LEFT, @@ -1205,7 +1054,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_SIZE, parse_margin, query_length_as_int, - assign_length_from_int, _gtk_css_number_value_new (0.0, GTK_CSS_PX)); gtk_css_style_property_register ("margin-bottom", GTK_CSS_PROPERTY_MARGIN_BOTTOM, @@ -1214,7 +1062,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_SIZE, parse_margin, query_length_as_int, - assign_length_from_int, _gtk_css_number_value_new (0.0, GTK_CSS_PX)); gtk_css_style_property_register ("margin-right", GTK_CSS_PROPERTY_MARGIN_RIGHT, @@ -1223,7 +1070,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_SIZE, parse_margin, query_length_as_int, - assign_length_from_int, _gtk_css_number_value_new (0.0, GTK_CSS_PX)); gtk_css_style_property_register ("padding-top", GTK_CSS_PROPERTY_PADDING_TOP, @@ -1232,7 +1078,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_SIZE, parse_padding, query_length_as_int, - assign_length_from_int, _gtk_css_number_value_new (0.0, GTK_CSS_PX)); gtk_css_style_property_register ("padding-left", GTK_CSS_PROPERTY_PADDING_LEFT, @@ -1241,7 +1086,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_SIZE, parse_padding, query_length_as_int, - assign_length_from_int, _gtk_css_number_value_new (0.0, GTK_CSS_PX)); gtk_css_style_property_register ("padding-bottom", GTK_CSS_PROPERTY_PADDING_BOTTOM, @@ -1250,7 +1094,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_SIZE, parse_padding, query_length_as_int, - assign_length_from_int, _gtk_css_number_value_new (0.0, GTK_CSS_PX)); gtk_css_style_property_register ("padding-right", GTK_CSS_PROPERTY_PADDING_RIGHT, @@ -1259,7 +1102,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_SIZE, parse_padding, query_length_as_int, - assign_length_from_int, _gtk_css_number_value_new (0.0, GTK_CSS_PX)); /* IMPORTANT: the border-width properties must come after border-style properties, * they depend on them for their value computation. @@ -1271,7 +1113,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BORDER, parse_border_style, query_border_style, - assign_border_style, _gtk_css_border_style_value_new (GTK_BORDER_STYLE_NONE)); gtk_css_style_property_register ("border-top-width", GTK_CSS_PROPERTY_BORDER_TOP_WIDTH, @@ -1280,7 +1121,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BORDER | GTK_CSS_AFFECTS_SIZE, parse_border_width, query_length_as_int, - assign_length_from_int, _gtk_css_number_value_new (0.0, GTK_CSS_PX)); gtk_css_style_property_register ("border-left-style", GTK_CSS_PROPERTY_BORDER_LEFT_STYLE, @@ -1289,7 +1129,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BORDER, parse_border_style, query_border_style, - assign_border_style, _gtk_css_border_style_value_new (GTK_BORDER_STYLE_NONE)); gtk_css_style_property_register ("border-left-width", GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH, @@ -1298,7 +1137,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BORDER | GTK_CSS_AFFECTS_SIZE, parse_border_width, query_length_as_int, - assign_length_from_int, _gtk_css_number_value_new (0.0, GTK_CSS_PX)); gtk_css_style_property_register ("border-bottom-style", GTK_CSS_PROPERTY_BORDER_BOTTOM_STYLE, @@ -1307,7 +1145,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BORDER, parse_border_style, query_border_style, - assign_border_style, _gtk_css_border_style_value_new (GTK_BORDER_STYLE_NONE)); gtk_css_style_property_register ("border-bottom-width", GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH, @@ -1316,7 +1153,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BORDER | GTK_CSS_AFFECTS_SIZE, parse_border_width, query_length_as_int, - assign_length_from_int, _gtk_css_number_value_new (0.0, GTK_CSS_PX)); gtk_css_style_property_register ("border-right-style", GTK_CSS_PROPERTY_BORDER_RIGHT_STYLE, @@ -1325,7 +1161,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BORDER, parse_border_style, query_border_style, - assign_border_style, _gtk_css_border_style_value_new (GTK_BORDER_STYLE_NONE)); gtk_css_style_property_register ("border-right-width", GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH, @@ -1334,7 +1169,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BORDER | GTK_CSS_AFFECTS_SIZE, parse_border_width, query_length_as_int, - assign_length_from_int, _gtk_css_number_value_new (0.0, GTK_CSS_PX)); gtk_css_style_property_register ("border-top-left-radius", @@ -1344,7 +1178,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BACKGROUND | GTK_CSS_AFFECTS_BORDER, border_corner_radius_value_parse, NULL, - NULL, _gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX), _gtk_css_number_value_new (0, GTK_CSS_PX))); gtk_css_style_property_register ("border-top-right-radius", @@ -1354,7 +1187,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BACKGROUND | GTK_CSS_AFFECTS_BORDER, border_corner_radius_value_parse, NULL, - NULL, _gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX), _gtk_css_number_value_new (0, GTK_CSS_PX))); gtk_css_style_property_register ("border-bottom-right-radius", @@ -1364,7 +1196,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BACKGROUND | GTK_CSS_AFFECTS_BORDER, border_corner_radius_value_parse, NULL, - NULL, _gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX), _gtk_css_number_value_new (0, GTK_CSS_PX))); gtk_css_style_property_register ("border-bottom-left-radius", @@ -1374,7 +1205,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BACKGROUND | GTK_CSS_AFFECTS_BORDER, border_corner_radius_value_parse, NULL, - NULL, _gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX), _gtk_css_number_value_new (0, GTK_CSS_PX))); @@ -1385,7 +1215,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_OUTLINE | GTK_CSS_AFFECTS_CLIP, parse_border_style, query_border_style, - assign_border_style, _gtk_css_border_style_value_new (GTK_BORDER_STYLE_NONE)); gtk_css_style_property_register ("outline-width", GTK_CSS_PROPERTY_OUTLINE_WIDTH, @@ -1394,7 +1223,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_OUTLINE | GTK_CSS_AFFECTS_CLIP, parse_border_width, query_length_as_int, - assign_length_from_int, _gtk_css_number_value_new (0.0, GTK_CSS_PX)); gtk_css_style_property_register ("outline-offset", GTK_CSS_PROPERTY_OUTLINE_OFFSET, @@ -1403,7 +1231,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_OUTLINE | GTK_CSS_AFFECTS_CLIP, outline_parse, query_length_as_int, - assign_length_from_int, _gtk_css_number_value_new (0.0, GTK_CSS_PX)); gtk_css_style_property_register ("-gtk-outline-top-left-radius", @@ -1413,7 +1240,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_OUTLINE, border_corner_radius_value_parse, NULL, - NULL, _gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX), _gtk_css_number_value_new (0, GTK_CSS_PX))); _gtk_style_property_add_alias ("-gtk-outline-top-left-radius", "outline-top-left-radius"); @@ -1424,7 +1250,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_OUTLINE, border_corner_radius_value_parse, NULL, - NULL, _gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX), _gtk_css_number_value_new (0, GTK_CSS_PX))); _gtk_style_property_add_alias ("-gtk-outline-top-right-radius", "outline-top-right-radius"); @@ -1435,7 +1260,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_OUTLINE, border_corner_radius_value_parse, NULL, - NULL, _gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX), _gtk_css_number_value_new (0, GTK_CSS_PX))); _gtk_style_property_add_alias ("-gtk-outline-bottom-right-radius", "outline-bottom-right-radius"); @@ -1446,7 +1270,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_OUTLINE, border_corner_radius_value_parse, NULL, - NULL, _gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX), _gtk_css_number_value_new (0, GTK_CSS_PX))); _gtk_style_property_add_alias ("-gtk-outline-bottom-left-radius", "outline-bottom-left-radius"); @@ -1458,7 +1281,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BACKGROUND, parse_css_area, NULL, - NULL, _gtk_css_array_value_new (_gtk_css_area_value_new (GTK_CSS_AREA_BORDER_BOX))); gtk_css_style_property_register ("background-origin", GTK_CSS_PROPERTY_BACKGROUND_ORIGIN, @@ -1467,7 +1289,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BACKGROUND, parse_css_area, NULL, - NULL, _gtk_css_array_value_new (_gtk_css_area_value_new (GTK_CSS_AREA_PADDING_BOX))); gtk_css_style_property_register ("background-size", GTK_CSS_PROPERTY_BACKGROUND_SIZE, @@ -1476,7 +1297,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BACKGROUND, background_size_parse, NULL, - NULL, _gtk_css_array_value_new (_gtk_css_bg_size_value_new (NULL, NULL))); gtk_css_style_property_register ("background-position", GTK_CSS_PROPERTY_BACKGROUND_POSITION, @@ -1485,7 +1305,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BACKGROUND, background_position_parse, NULL, - NULL, _gtk_css_array_value_new (_gtk_css_position_value_new (_gtk_css_number_value_new (0, GTK_CSS_PERCENT), _gtk_css_number_value_new (0, GTK_CSS_PERCENT)))); @@ -1496,7 +1315,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BORDER, color_parse, color_query, - color_assign, _gtk_css_color_value_new_current_color ()); gtk_css_style_property_register ("border-right-color", GTK_CSS_PROPERTY_BORDER_RIGHT_COLOR, @@ -1505,7 +1323,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BORDER, color_parse, color_query, - color_assign, _gtk_css_color_value_new_current_color ()); gtk_css_style_property_register ("border-bottom-color", GTK_CSS_PROPERTY_BORDER_BOTTOM_COLOR, @@ -1514,7 +1331,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BORDER, color_parse, color_query, - color_assign, _gtk_css_color_value_new_current_color ()); gtk_css_style_property_register ("border-left-color", GTK_CSS_PROPERTY_BORDER_LEFT_COLOR, @@ -1523,7 +1339,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BORDER, color_parse, color_query, - color_assign, _gtk_css_color_value_new_current_color ()); gtk_css_style_property_register ("outline-color", GTK_CSS_PROPERTY_OUTLINE_COLOR, @@ -1532,7 +1347,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_OUTLINE, color_parse, color_query, - color_assign, _gtk_css_color_value_new_current_color ()); gtk_css_style_property_register ("background-repeat", @@ -1542,7 +1356,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BACKGROUND, background_repeat_value_parse, NULL, - NULL, _gtk_css_array_value_new (_gtk_css_background_repeat_value_new (GTK_CSS_REPEAT_STYLE_REPEAT, GTK_CSS_REPEAT_STYLE_REPEAT))); gtk_css_style_property_register ("background-image", @@ -1552,7 +1365,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BACKGROUND, background_image_value_parse, background_image_value_query, - background_image_value_assign, _gtk_css_array_value_new (_gtk_css_image_value_new (NULL))); gtk_css_style_property_register ("background-blend-mode", @@ -1562,7 +1374,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BACKGROUND, blend_mode_value_parse, NULL, - NULL, _gtk_css_array_value_new (_gtk_css_blend_mode_value_new (GTK_CSS_BLEND_MODE_NORMAL))); gtk_css_style_property_register ("border-image-source", @@ -1572,7 +1383,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BORDER, css_image_value_parse, css_image_value_query, - css_image_value_assign, _gtk_css_image_value_new (NULL)); gtk_css_style_property_register ("border-image-repeat", GTK_CSS_PROPERTY_BORDER_IMAGE_REPEAT, @@ -1581,7 +1391,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BORDER, border_image_repeat_parse, NULL, - NULL, _gtk_css_border_repeat_value_new (GTK_CSS_REPEAT_STYLE_STRETCH, GTK_CSS_REPEAT_STYLE_STRETCH)); @@ -1592,7 +1401,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BORDER, border_image_slice_parse, query_border, - assign_border, _gtk_css_border_value_new (_gtk_css_number_value_new (100, GTK_CSS_PERCENT), _gtk_css_number_value_new (100, GTK_CSS_PERCENT), _gtk_css_number_value_new (100, GTK_CSS_PERCENT), @@ -1604,7 +1412,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_BORDER, border_image_width_parse, query_border, - assign_border, _gtk_css_border_value_new (_gtk_css_number_value_new (1, GTK_CSS_NUMBER), _gtk_css_number_value_new (1, GTK_CSS_NUMBER), _gtk_css_number_value_new (1, GTK_CSS_NUMBER), @@ -1617,7 +1424,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_ICON | GTK_CSS_AFFECTS_SYMBOLIC_ICON, css_image_value_parse_with_builtin, NULL, - NULL, _gtk_css_image_value_new (gtk_css_image_builtin_new ())); gtk_css_style_property_register ("-gtk-icon-shadow", GTK_CSS_PROPERTY_ICON_SHADOW, @@ -1626,7 +1432,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_ICON | GTK_CSS_AFFECTS_SYMBOLIC_ICON | GTK_CSS_AFFECTS_CLIP, shadow_value_parse, NULL, - NULL, _gtk_css_shadows_value_new_none ()); _gtk_style_property_add_alias ("-gtk-icon-shadow", "icon-shadow"); gtk_css_style_property_register ("-gtk-icon-style", @@ -1636,7 +1441,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_ICON | GTK_CSS_AFFECTS_SYMBOLIC_ICON, icon_style_parse, NULL, - NULL, _gtk_css_icon_style_value_new (GTK_CSS_ICON_STYLE_REQUESTED)); gtk_css_style_property_register ("-gtk-icon-transform", GTK_CSS_PROPERTY_ICON_TRANSFORM, @@ -1645,7 +1449,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_ICON | GTK_CSS_AFFECTS_SYMBOLIC_ICON | GTK_CSS_AFFECTS_CLIP, transform_value_parse, NULL, - NULL, _gtk_css_transform_value_new_none ()); gtk_css_style_property_register ("min-width", @@ -1655,7 +1458,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_SIZE, minmax_parse, query_length_as_int, - NULL, _gtk_css_number_value_new (0, GTK_CSS_PX)); gtk_css_style_property_register ("min-height", GTK_CSS_PROPERTY_MIN_HEIGHT, @@ -1664,7 +1466,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_SIZE, minmax_parse, query_length_as_int, - NULL, _gtk_css_number_value_new (0, GTK_CSS_PX)); gtk_css_style_property_register ("transition-property", @@ -1674,7 +1475,6 @@ _gtk_css_style_property_init_properties (void) 0, transition_property_parse, NULL, - NULL, _gtk_css_array_value_new (_gtk_css_ident_value_new ("all"))); gtk_css_style_property_register ("transition-duration", GTK_CSS_PROPERTY_TRANSITION_DURATION, @@ -1683,7 +1483,6 @@ _gtk_css_style_property_init_properties (void) 0, transition_time_parse, NULL, - NULL, _gtk_css_array_value_new (_gtk_css_number_value_new (0, GTK_CSS_S))); gtk_css_style_property_register ("transition-timing-function", GTK_CSS_PROPERTY_TRANSITION_TIMING_FUNCTION, @@ -1692,7 +1491,6 @@ _gtk_css_style_property_init_properties (void) 0, transition_timing_function_parse, NULL, - NULL, _gtk_css_array_value_new ( _gtk_css_ease_value_new_cubic_bezier (0.25, 0.1, 0.25, 1.0))); gtk_css_style_property_register ("transition-delay", @@ -1702,7 +1500,6 @@ _gtk_css_style_property_init_properties (void) 0, transition_time_parse, NULL, - NULL, _gtk_css_array_value_new (_gtk_css_number_value_new (0, GTK_CSS_S))); gtk_css_style_property_register ("animation-name", @@ -1712,7 +1509,6 @@ _gtk_css_style_property_init_properties (void) 0, transition_property_parse, NULL, - NULL, _gtk_css_array_value_new (_gtk_css_ident_value_new ("none"))); gtk_css_style_property_register ("animation-duration", GTK_CSS_PROPERTY_ANIMATION_DURATION, @@ -1721,7 +1517,6 @@ _gtk_css_style_property_init_properties (void) 0, transition_time_parse, NULL, - NULL, _gtk_css_array_value_new (_gtk_css_number_value_new (0, GTK_CSS_S))); gtk_css_style_property_register ("animation-timing-function", GTK_CSS_PROPERTY_ANIMATION_TIMING_FUNCTION, @@ -1730,7 +1525,6 @@ _gtk_css_style_property_init_properties (void) 0, transition_timing_function_parse, NULL, - NULL, _gtk_css_array_value_new ( _gtk_css_ease_value_new_cubic_bezier (0.25, 0.1, 0.25, 1.0))); gtk_css_style_property_register ("animation-iteration-count", @@ -1740,7 +1534,6 @@ _gtk_css_style_property_init_properties (void) 0, iteration_count_parse, NULL, - NULL, _gtk_css_array_value_new (_gtk_css_number_value_new (1, GTK_CSS_NUMBER))); gtk_css_style_property_register ("animation-direction", GTK_CSS_PROPERTY_ANIMATION_DIRECTION, @@ -1749,7 +1542,6 @@ _gtk_css_style_property_init_properties (void) 0, parse_css_direction, NULL, - NULL, _gtk_css_array_value_new (_gtk_css_direction_value_new (GTK_CSS_DIRECTION_NORMAL))); gtk_css_style_property_register ("animation-play-state", GTK_CSS_PROPERTY_ANIMATION_PLAY_STATE, @@ -1758,7 +1550,6 @@ _gtk_css_style_property_init_properties (void) 0, parse_css_play_state, NULL, - NULL, _gtk_css_array_value_new (_gtk_css_play_state_value_new (GTK_CSS_PLAY_STATE_RUNNING))); gtk_css_style_property_register ("animation-delay", GTK_CSS_PROPERTY_ANIMATION_DELAY, @@ -1767,7 +1558,6 @@ _gtk_css_style_property_init_properties (void) 0, transition_time_parse, NULL, - NULL, _gtk_css_array_value_new (_gtk_css_number_value_new (0, GTK_CSS_S))); gtk_css_style_property_register ("animation-fill-mode", GTK_CSS_PROPERTY_ANIMATION_FILL_MODE, @@ -1776,7 +1566,6 @@ _gtk_css_style_property_init_properties (void) 0, parse_css_fill_mode, NULL, - NULL, _gtk_css_array_value_new (_gtk_css_fill_mode_value_new (GTK_CSS_FILL_NONE))); gtk_css_style_property_register ("opacity", @@ -1786,7 +1575,6 @@ _gtk_css_style_property_init_properties (void) 0, opacity_parse, opacity_query, - NULL, _gtk_css_number_value_new (1, GTK_CSS_NUMBER)); gtk_css_style_property_register ("-gtk-icon-effect", GTK_CSS_PROPERTY_ICON_EFFECT, @@ -1795,7 +1583,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_ICON, image_effect_parse, NULL, - NULL, _gtk_css_icon_effect_value_new (GTK_CSS_ICON_EFFECT_NONE)); _gtk_style_property_add_alias ("-gtk-icon-effect", "-gtk-image-effect"); @@ -1807,7 +1594,6 @@ _gtk_css_style_property_init_properties (void) 0, bindings_value_parse, bindings_value_query, - bindings_value_assign, _gtk_css_array_value_new (_gtk_css_string_value_new (NULL))); _gtk_style_property_add_alias ("-gtk-key-bindings", "gtk-key-bindings"); @@ -1818,7 +1604,6 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_TEXT, color_parse, color_query, - color_assign, _gtk_css_color_value_new_current_color ()); gtk_css_style_property_register ("-gtk-secondary-caret-color", GTK_CSS_PROPERTY_SECONDARY_CARET_COLOR, @@ -1827,6 +1612,5 @@ _gtk_css_style_property_init_properties (void) GTK_CSS_AFFECTS_TEXT, color_parse, color_query, - color_assign, _gtk_css_color_value_new_current_color ()); } diff --git a/gtk/gtkcssstylepropertyprivate.h b/gtk/gtkcssstylepropertyprivate.h index b62d47897e..1403dee181 100644 --- a/gtk/gtkcssstylepropertyprivate.h +++ b/gtk/gtkcssstylepropertyprivate.h @@ -39,8 +39,6 @@ typedef GtkCssValue * (* GtkCssStylePropertyParseFunc) (GtkCssStyleProperty typedef void (* GtkCssStylePropertyQueryFunc) (GtkCssStyleProperty *property, const GtkCssValue *cssvalue, GValue *value); -typedef GtkCssValue * (* GtkCssStylePropertyAssignFunc) (GtkCssStyleProperty *property, - const GValue *value); struct _GtkCssStyleProperty { GtkStyleProperty parent; @@ -53,7 +51,6 @@ struct _GtkCssStyleProperty GtkCssStylePropertyParseFunc parse_value; GtkCssStylePropertyQueryFunc query_value; - GtkCssStylePropertyAssignFunc assign_value; }; struct _GtkCssStylePropertyClass diff --git a/gtk/gtkstyleproperty.c b/gtk/gtkstyleproperty.c index e79849bd28..fd49943a25 100644 --- a/gtk/gtkstyleproperty.c +++ b/gtk/gtkstyleproperty.c @@ -158,37 +158,6 @@ _gtk_style_property_parse_value (GtkStyleProperty *property, return klass->parse_value (property, parser); } -/** - * _gtk_style_property_assign: - * @property: the property - * @props: The properties to assign to - * @state: The state to assign - * @value: (out): the #GValue with the value to be - * assigned - * - * This function is called by gtk_style_properties_set() and in - * turn gtk_style_context_set() and similar functions to set the - * value from code using old APIs. - **/ -void -_gtk_style_property_assign (GtkStyleProperty *property, - GtkStyleProperties *props, - GtkStateFlags state, - const GValue *value) -{ - GtkStylePropertyClass *klass; - - g_return_if_fail (GTK_IS_STYLE_PROPERTY (property)); -G_GNUC_BEGIN_IGNORE_DEPRECATIONS; - g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props)); -G_GNUC_END_IGNORE_DEPRECATIONS; - g_return_if_fail (value != NULL); - - klass = GTK_STYLE_PROPERTY_GET_CLASS (property); - - klass->assign (property, props, state, value); -} - /** * _gtk_style_property_query: * @property: the property @@ -298,9 +267,8 @@ _gtk_style_property_get_name (GtkStyleProperty *property) * @property: the property to query * * Gets the value type of the @property, if the property is usable - * in public API via _gtk_style_property_assign() and - * _gtk_style_property_query(). If the @property is not usable in that - * way, %G_TYPE_NONE is returned. + * in public API via _gtk_style_property_query(). If the @property is not + * usable in that way, %G_TYPE_NONE is returned. * * Returns: the value type in use or %G_TYPE_NONE if none. **/ diff --git a/gtk/gtkstylepropertyprivate.h b/gtk/gtkstylepropertyprivate.h index 59b281fb5f..c6ef1f8a04 100644 --- a/gtk/gtkstylepropertyprivate.h +++ b/gtk/gtkstylepropertyprivate.h @@ -49,10 +49,6 @@ struct _GtkStylePropertyClass { GObjectClass parent_class; - void (* assign) (GtkStyleProperty *property, - GtkStyleProperties *props, - GtkStateFlags state, - const GValue *value); void (* query) (GtkStyleProperty *property, GValue *value, GtkStyleQueryFunc query_func, @@ -82,10 +78,6 @@ void _gtk_style_property_query (GtkStyleProperty * GValue *value, GtkStyleQueryFunc query_func, gpointer query_data); -void _gtk_style_property_assign (GtkStyleProperty *property, - GtkStyleProperties *props, - GtkStateFlags state, - const GValue *value); G_END_DECLS