From 95d2f0b83100ea573baa64407c0bcc1afcf4790c Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 7 Oct 2016 05:41:30 +0200 Subject: [PATCH] css: Remove custom properties Those aren't used anymore, now that theming engines are gone. --- gtk/Makefile.am | 4 - gtk/gtkcsscustomproperty.c | 277 ------------------------------ gtk/gtkcsscustompropertyprivate.h | 59 ------- gtk/gtkcssstylefuncs.c | 209 ++-------------------- gtk/gtkcssstylefuncsprivate.h | 5 - gtk/gtkcsstypedvalue.c | 135 --------------- gtk/gtkcsstypedvalueprivate.h | 38 ---- 7 files changed, 16 insertions(+), 711 deletions(-) delete mode 100644 gtk/gtkcsscustomproperty.c delete mode 100644 gtk/gtkcsscustompropertyprivate.h delete mode 100644 gtk/gtkcsstypedvalue.c delete mode 100644 gtk/gtkcsstypedvalueprivate.h diff --git a/gtk/Makefile.am b/gtk/Makefile.am index 4ae9bac4e1..4b70e99dad 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -404,7 +404,6 @@ gtk_private_h_sources = \ gtkcsscolorvalueprivate.h \ gtkcsscornervalueprivate.h \ gtkcsscustomgadgetprivate.h \ - gtkcsscustompropertyprivate.h \ gtkcssdimensionvalueprivate.h \ gtkcsseasevalueprivate.h \ gtkcssenumvalueprivate.h \ @@ -454,7 +453,6 @@ gtk_private_h_sources = \ gtkcsstransformvalueprivate.h \ gtkcsstransientnodeprivate.h \ gtkcsstransitionprivate.h \ - gtkcsstypedvalueprivate.h \ gtkcssunsetvalueprivate.h \ gtkcssvalueprivate.h \ gtkcsswin32sizevalueprivate.h \ @@ -673,7 +671,6 @@ gtk_base_c_sources = \ gtkcsscolorvalue.c \ gtkcsscornervalue.c \ gtkcsscustomgadget.c \ - gtkcsscustomproperty.c \ gtkcssdimensionvalue.c \ gtkcsseasevalue.c \ gtkcssenumvalue.c \ @@ -725,7 +722,6 @@ gtk_base_c_sources = \ gtkcsstransformvalue.c \ gtkcsstransientnode.c \ gtkcsstransition.c \ - gtkcsstypedvalue.c \ gtkcssunsetvalue.c \ gtkcsstypes.c \ gtkcssvalue.c \ diff --git a/gtk/gtkcsscustomproperty.c b/gtk/gtkcsscustomproperty.c deleted file mode 100644 index ff3e35a082..0000000000 --- a/gtk/gtkcsscustomproperty.c +++ /dev/null @@ -1,277 +0,0 @@ -/* - * Copyright © 2011 Red Hat Inc. - * - * 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.1 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 . - * - * Authors: Benjamin Otte - */ - -#include "config.h" - -#include "gtkcsscustompropertyprivate.h" - -#include - -#include "gtkcssstylefuncsprivate.h" -#include "gtkcsstypedvalueprivate.h" - -#include "deprecated/gtksymboliccolor.h" - -G_DEFINE_TYPE (GtkCssCustomProperty, _gtk_css_custom_property, GTK_TYPE_CSS_STYLE_PROPERTY) - -static GtkCssValue * -gtk_css_custom_property_parse_value (GtkStyleProperty *property, - GtkCssParser *parser) -{ - _gtk_css_parser_error_full (parser, - GTK_CSS_PROVIDER_ERROR_NAME, - "Custom CSS properties are no longer supported."); - return NULL; -} - -static void -gtk_css_custom_property_query (GtkStyleProperty *property, - GValue *value, - GtkStyleQueryFunc query_func, - 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); - - g_value_init (value, custom->pspec->value_type); - g_value_copy (_gtk_css_typed_value_get (css_value), value); -} - -static void -_gtk_css_custom_property_class_init (GtkCssCustomPropertyClass *klass) -{ - GtkStylePropertyClass *property_class = GTK_STYLE_PROPERTY_CLASS (klass); - - property_class->parse_value = gtk_css_custom_property_parse_value; - property_class->query = gtk_css_custom_property_query; -} - -static void -_gtk_css_custom_property_init (GtkCssCustomProperty *custom) -{ -} - -static GtkCssValue * -gtk_css_custom_property_create_initial_value (GParamSpec *pspec) -{ - GValue value = G_VALUE_INIT; - GtkCssValue *result; - - g_value_init (&value, pspec->value_type); - - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - if (pspec->value_type == PANGO_TYPE_FONT_DESCRIPTION) - g_value_take_boxed (&value, pango_font_description_from_string ("Sans 10")); - else if (pspec->value_type == GDK_TYPE_RGBA) - { - GdkRGBA color; - gdk_rgba_parse (&color, "pink"); - g_value_set_boxed (&value, &color); - } - else if (pspec->value_type == GDK_TYPE_COLOR) - { - GdkColor color; - gdk_color_parse ("pink", &color); - g_value_set_boxed (&value, &color); - } - else if (pspec->value_type == GTK_TYPE_BORDER) - { - g_value_take_boxed (&value, gtk_border_new ()); - } - else - g_param_value_set_default (pspec, &value); -G_GNUC_END_IGNORE_DEPRECATIONS - - result = _gtk_css_typed_value_new (&value); - g_value_unset (&value); - - return result; -} - -/* Property registration functions */ - -/** - * gtk_theming_engine_register_property: (skip) - * @name_space: namespace for the property name - * @parse_func: (nullable): parsing function to use, or %NULL - * @pspec: the #GParamSpec for the new property - * - * Registers a property so it can be used in the CSS file format, - * on the CSS file the property will look like - * "-${@name_space}-${property_name}". being - * ${property_name} the given to @pspec. @name_space will usually - * be the theme engine name. - * - * For any type a @parse_func may be provided, being this function - * used for turning any property value (between “:” and “;”) in - * CSS to the #GValue needed. For basic types there is already - * builtin parsing support, so %NULL may be provided for these - * cases. - * - * Engines must ensure property registration happens exactly once, - * usually GTK+ deals with theming engines as singletons, so this - * should be guaranteed to happen once, but bear this in mind - * when creating #GtkThemeEngines yourself. - * - * In order to make use of the custom registered properties in - * the CSS file, make sure the engine is loaded first by specifying - * the engine property, either in a previous rule or within the same - * one. - * |[ - * * { - * engine: someengine; - * -SomeEngine-custom-property: 2; - * } - * ]| - * - * Since: 3.0 - * - * Deprecated: 3.8: Code should use the default properties provided by CSS. - **/ -void -gtk_theming_engine_register_property (const gchar *name_space, - GtkStylePropertyParser parse_func, - GParamSpec *pspec) -{ - GtkCssCustomProperty *node; - GtkCssValue *initial; - gchar *name; - - g_return_if_fail (name_space != NULL); - g_return_if_fail (strchr (name_space, ' ') == NULL); - g_return_if_fail (G_IS_PARAM_SPEC (pspec)); - - name = g_strdup_printf ("-%s-%s", name_space, pspec->name); - - /* This also initializes the default properties */ - if (_gtk_style_property_lookup (pspec->name)) - { - g_warning ("a property with name '%s' already exists", name); - g_free (name); - return; - } - - initial = gtk_css_custom_property_create_initial_value (pspec); - - node = g_object_new (GTK_TYPE_CSS_CUSTOM_PROPERTY, - "initial-value", initial, - "name", name, - "value-type", pspec->value_type, - NULL); - node->pspec = pspec; - node->property_parse_func = parse_func; - - _gtk_css_value_unref (initial); - g_free (name); -} - -/** - * gtk_style_properties_register_property: (skip) - * @parse_func: (nullable): parsing function to use, or %NULL - * @pspec: the #GParamSpec for the new property - * - * Registers a property so it can be used in the CSS file format. - * This function is the low-level equivalent of - * gtk_theming_engine_register_property(), if you are implementing - * a theming engine, you want to use that function instead. - * - * Since: 3.0 - * - * Deprecated: 3.8: Code should use the default properties provided by CSS. - **/ -void -gtk_style_properties_register_property (GtkStylePropertyParser parse_func, - GParamSpec *pspec) -{ - GtkCssCustomProperty *node; - GtkCssValue *initial; - - g_return_if_fail (G_IS_PARAM_SPEC (pspec)); - - /* This also initializes the default properties */ - if (_gtk_style_property_lookup (pspec->name)) - { - g_warning ("a property with name '%s' already exists", pspec->name); - return; - } - - initial = gtk_css_custom_property_create_initial_value (pspec); - - node = g_object_new (GTK_TYPE_CSS_CUSTOM_PROPERTY, - "initial-value", initial, - "name", pspec->name, - "value-type", pspec->value_type, - NULL); - node->pspec = pspec; - node->property_parse_func = parse_func; - - _gtk_css_value_unref (initial); -} - -/** - * gtk_style_properties_lookup_property: (skip) - * @property_name: property name to look up - * @parse_func: (out): return location for the parse function - * @pspec: (out) (transfer none): return location for the #GParamSpec - * - * Returns %TRUE if a property has been registered, if @pspec or - * @parse_func are not %NULL, the #GParamSpec and parsing function - * will be respectively returned. - * - * Returns: %TRUE if the property is registered, %FALSE otherwise - * - * Since: 3.0 - * - * Deprecated: 3.8: This code could only look up custom properties and - * those are deprecated. - **/ -gboolean -gtk_style_properties_lookup_property (const gchar *property_name, - GtkStylePropertyParser *parse_func, - GParamSpec **pspec) -{ - GtkStyleProperty *node; - gboolean found = FALSE; - - g_return_val_if_fail (property_name != NULL, FALSE); - - node = _gtk_style_property_lookup (property_name); - - if (GTK_IS_CSS_CUSTOM_PROPERTY (node)) - { - GtkCssCustomProperty *custom = GTK_CSS_CUSTOM_PROPERTY (node); - - if (pspec) - *pspec = custom->pspec; - - if (parse_func) - *parse_func = custom->property_parse_func; - - found = TRUE; - } - - return found; -} - diff --git a/gtk/gtkcsscustompropertyprivate.h b/gtk/gtkcsscustompropertyprivate.h deleted file mode 100644 index 2b5fd8066c..0000000000 --- a/gtk/gtkcsscustompropertyprivate.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright © 2011 Red Hat Inc. - * - * 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.1 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 . - * - * Authors: Benjamin Otte - */ - -#ifndef __GTK_CSS_CUSTOM_PROPERTY_PRIVATE_H__ -#define __GTK_CSS_CUSTOM_PROPERTY_PRIVATE_H__ - -#include "gtk/gtkcssstylepropertyprivate.h" - -G_BEGIN_DECLS - -#define GTK_TYPE_CSS_CUSTOM_PROPERTY (_gtk_css_custom_property_get_type ()) -#define GTK_CSS_CUSTOM_PROPERTY(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, GTK_TYPE_CSS_CUSTOM_PROPERTY, GtkCssCustomProperty)) -#define GTK_CSS_CUSTOM_PROPERTY_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST (cls, GTK_TYPE_CSS_CUSTOM_PROPERTY, GtkCssCustomPropertyClass)) -#define GTK_IS_CSS_CUSTOM_PROPERTY(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, GTK_TYPE_CSS_CUSTOM_PROPERTY)) -#define GTK_IS_CSS_CUSTOM_PROPERTY_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE (obj, GTK_TYPE_CSS_CUSTOM_PROPERTY)) -#define GTK_CSS_CUSTOM_PROPERTY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CSS_CUSTOM_PROPERTY, GtkCssCustomPropertyClass)) - -typedef struct _GtkCssCustomProperty GtkCssCustomProperty; -typedef struct _GtkCssCustomPropertyClass GtkCssCustomPropertyClass; - -typedef gboolean (* GtkStylePropertyParser) (const gchar *string, - GValue *value, - GError **error); - -struct _GtkCssCustomProperty -{ - GtkCssStyleProperty parent; - - GParamSpec *pspec; - GtkStylePropertyParser property_parse_func; -}; - -struct _GtkCssCustomPropertyClass -{ - GtkCssStylePropertyClass parent_class; -}; - -GType _gtk_css_custom_property_get_type (void) G_GNUC_CONST; - - -G_END_DECLS - -#endif /* __GTK_CSS_CUSTOM_PROPERTY_PRIVATE_H__ */ diff --git a/gtk/gtkcssstylefuncs.c b/gtk/gtkcssstylefuncs.c index 00c3f53952..24531ea307 100644 --- a/gtk/gtkcssstylefuncs.c +++ b/gtk/gtkcssstylefuncs.c @@ -31,7 +31,6 @@ #include "gtkcssimagegradientprivate.h" #include "gtkcssprovider.h" #include "gtkcssrgbavalueprivate.h" -#include "gtkcsstypedvalueprivate.h" #include "gtkcsstypesprivate.h" #include "gtkprivatetypebuiltins.h" #include "gtkstylecontextprivate.h" @@ -48,29 +47,21 @@ static GHashTable *parse_funcs = NULL; static GHashTable *print_funcs = NULL; -static GHashTable *compute_funcs = NULL; typedef gboolean (* GtkStyleParseFunc) (GtkCssParser *parser, GValue *value); typedef void (* GtkStylePrintFunc) (const GValue *value, GString *string); -typedef GtkCssValue * (* GtkStyleComputeFunc) (GtkStyleProviderPrivate *provider, - GtkCssStyle *values, - GtkCssStyle *parent_values, - GtkCssValue *specified); static void register_conversion_function (GType type, GtkStyleParseFunc parse, - GtkStylePrintFunc print, - GtkStyleComputeFunc compute) + GtkStylePrintFunc print) { if (parse) g_hash_table_insert (parse_funcs, GSIZE_TO_POINTER (type), parse); if (print) g_hash_table_insert (print_funcs, GSIZE_TO_POINTER (type), print); - if (compute) - g_hash_table_insert (compute_funcs, GSIZE_TO_POINTER (type), compute); } static void @@ -179,48 +170,6 @@ rgba_value_print (const GValue *value, } } -static GtkCssValue * -rgba_value_compute (GtkStyleProviderPrivate *provider, - GtkCssStyle *values, - GtkCssStyle *parent_values, - GtkCssValue *specified) -{ - GdkRGBA white = { 1, 1, 1, 1 }; - const GValue *value; - - value = _gtk_css_typed_value_get (specified); - - G_GNUC_BEGIN_IGNORE_DEPRECATIONS; - - if (G_VALUE_HOLDS (value, GTK_TYPE_SYMBOLIC_COLOR)) - { - GtkSymbolicColor *symbolic = g_value_get_boxed (value); - GtkCssValue *val; - GValue new_value = G_VALUE_INIT; - GdkRGBA rgba; - - val = _gtk_css_color_value_resolve (_gtk_symbolic_color_get_css_value (symbolic), - provider, - gtk_css_style_get_value (values, GTK_CSS_PROPERTY_COLOR), - NULL); - if (val != NULL) - { - rgba = *_gtk_css_rgba_value_get_rgba (val); - _gtk_css_value_unref (val); - } - else - rgba = white; - - g_value_init (&new_value, GDK_TYPE_RGBA); - g_value_set_boxed (&new_value, &rgba); - return _gtk_css_typed_value_new_take (&new_value); - } - else - return _gtk_css_value_ref (specified); - - G_GNUC_END_IGNORE_DEPRECATIONS; -} - static gboolean color_value_parse (GtkCssParser *parser, GValue *value) @@ -275,47 +224,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS } } -static GtkCssValue * -color_value_compute (GtkStyleProviderPrivate *provider, - GtkCssStyle *values, - GtkCssStyle *parent_values, - GtkCssValue *specified) -{ - GdkColor color = { 0, 65535, 65535, 65535 }; - const GValue *value; - - value = _gtk_css_typed_value_get (specified); - - G_GNUC_BEGIN_IGNORE_DEPRECATIONS; - - if (G_VALUE_HOLDS (value, GTK_TYPE_SYMBOLIC_COLOR)) - { - GValue new_value = G_VALUE_INIT; - GtkCssValue *val; - - val = _gtk_css_color_value_resolve (_gtk_symbolic_color_get_css_value (g_value_get_boxed (value)), - provider, - gtk_css_style_get_value (values, GTK_CSS_PROPERTY_COLOR), - NULL); - if (val != NULL) - { - const GdkRGBA *rgba = _gtk_css_rgba_value_get_rgba (val); - color.red = rgba->red * 65535. + 0.5; - color.green = rgba->green * 65535. + 0.5; - color.blue = rgba->blue * 65535. + 0.5; - _gtk_css_value_unref (val); - } - - g_value_init (&new_value, GDK_TYPE_COLOR); - g_value_set_boxed (&new_value, &color); - return _gtk_css_typed_value_new_take (&new_value); - } - else - return _gtk_css_value_ref (specified); - - G_GNUC_END_IGNORE_DEPRECATIONS; -} - static gboolean symbolic_color_value_parse (GtkCssParser *parser, GValue *value) @@ -784,33 +692,6 @@ pattern_value_print (const GValue *value, } } -static GtkCssValue * -pattern_value_compute (GtkStyleProviderPrivate *provider, - GtkCssStyle *values, - GtkCssStyle *parent_values, - GtkCssValue *specified) -{ - const GValue *value = _gtk_css_typed_value_get (specified); - - G_GNUC_BEGIN_IGNORE_DEPRECATIONS; - - if (G_VALUE_HOLDS (value, GTK_TYPE_GRADIENT)) - { - GValue new_value = G_VALUE_INIT; - cairo_pattern_t *gradient; - - gradient = _gtk_gradient_resolve_full (g_value_get_boxed (value), provider, values, parent_values); - - g_value_init (&new_value, CAIRO_GOBJECT_TYPE_PATTERN); - g_value_take_boxed (&new_value, gradient); - return _gtk_css_typed_value_new_take (&new_value); - } - else - return _gtk_css_value_ref (specified); - - G_GNUC_END_IGNORE_DEPRECATIONS; -} - static gboolean enum_value_parse (GtkCssParser *parser, GValue *value) @@ -914,81 +795,65 @@ gtk_css_style_funcs_init (void) parse_funcs = g_hash_table_new (NULL, NULL); print_funcs = g_hash_table_new (NULL, NULL); - compute_funcs = g_hash_table_new (NULL, NULL); register_conversion_function (GDK_TYPE_RGBA, rgba_value_parse, - rgba_value_print, - rgba_value_compute); + rgba_value_print); G_GNUC_BEGIN_IGNORE_DEPRECATIONS; register_conversion_function (GDK_TYPE_COLOR, color_value_parse, - color_value_print, - color_value_compute); + color_value_print); register_conversion_function (GTK_TYPE_SYMBOLIC_COLOR, symbolic_color_value_parse, - symbolic_color_value_print, - NULL); + symbolic_color_value_print); G_GNUC_END_IGNORE_DEPRECATIONS; register_conversion_function (PANGO_TYPE_FONT_DESCRIPTION, font_description_value_parse, - font_description_value_print, - NULL); + font_description_value_print); register_conversion_function (G_TYPE_BOOLEAN, boolean_value_parse, - boolean_value_print, - NULL); + boolean_value_print); register_conversion_function (G_TYPE_INT, int_value_parse, - int_value_print, - NULL); + int_value_print); register_conversion_function (G_TYPE_UINT, uint_value_parse, - uint_value_print, - NULL); + uint_value_print); register_conversion_function (G_TYPE_DOUBLE, double_value_parse, - double_value_print, - NULL); + double_value_print); register_conversion_function (G_TYPE_FLOAT, float_value_parse, - float_value_print, - NULL); + float_value_print); register_conversion_function (G_TYPE_STRING, string_value_parse, - string_value_print, - NULL); + string_value_print); register_conversion_function (GTK_TYPE_BORDER, border_value_parse, - border_value_print, - NULL); + border_value_print); G_GNUC_BEGIN_IGNORE_DEPRECATIONS; register_conversion_function (GTK_TYPE_GRADIENT, gradient_value_parse, - gradient_value_print, - NULL); + gradient_value_print); G_GNUC_END_IGNORE_DEPRECATIONS; register_conversion_function (CAIRO_GOBJECT_TYPE_PATTERN, pattern_value_parse, - pattern_value_print, - pattern_value_compute); + pattern_value_print); register_conversion_function (G_TYPE_ENUM, enum_value_parse, - enum_value_print, - NULL); + enum_value_print); register_conversion_function (G_TYPE_FLAGS, flags_value_parse, - flags_value_print, - NULL); + flags_value_print); } /** @@ -1063,45 +928,3 @@ _gtk_css_style_funcs_print_value (const GValue *value, func (value, string); } -/** - * _gtk_css_style_compute_value: - * @provider: Style provider to look up information from - * @values: The values to compute for - * @parent_values: Values to look up inherited values from - * @target_type: Type the resulting value should have - * @specified: the value to use for the computation - * - * Converts the @specified value into the @computed value using the - * information in @context. The values must have matching types, ie - * @specified must be a result of a call to - * _gtk_css_style_parse_value() with the same type as @computed. - * - * Returns: the resulting value - **/ -GtkCssValue * -_gtk_css_style_funcs_compute_value (GtkStyleProviderPrivate *provider, - GtkCssStyle *style, - GtkCssStyle *parent_style, - GType target_type, - GtkCssValue *specified) -{ - GtkStyleComputeFunc func; - - g_return_val_if_fail (GTK_IS_STYLE_PROVIDER (provider), NULL); - g_return_val_if_fail (GTK_IS_CSS_STYLE (style), NULL); - g_return_val_if_fail (parent_style == NULL || GTK_IS_CSS_STYLE (parent_style), NULL); - - gtk_css_style_funcs_init (); - - func = g_hash_table_lookup (compute_funcs, - GSIZE_TO_POINTER (target_type)); - if (func == NULL) - func = g_hash_table_lookup (compute_funcs, - GSIZE_TO_POINTER (g_type_fundamental (target_type))); - - if (func) - return func (provider, style, parent_style, specified); - else - return _gtk_css_value_ref (specified); -} - diff --git a/gtk/gtkcssstylefuncsprivate.h b/gtk/gtkcssstylefuncsprivate.h index 72e94152cf..6352ecf1d7 100644 --- a/gtk/gtkcssstylefuncsprivate.h +++ b/gtk/gtkcssstylefuncsprivate.h @@ -28,11 +28,6 @@ gboolean _gtk_css_style_funcs_parse_value (GValue GtkCssParser *parser); void _gtk_css_style_funcs_print_value (const GValue *value, GString *string); -GtkCssValue * _gtk_css_style_funcs_compute_value (GtkStyleProviderPrivate *provider, - GtkCssStyle *style, - GtkCssStyle *parent_style, - GType target_type, - GtkCssValue *specified); G_END_DECLS diff --git a/gtk/gtkcsstypedvalue.c b/gtk/gtkcsstypedvalue.c deleted file mode 100644 index 9f8ff1abc4..0000000000 --- a/gtk/gtkcsstypedvalue.c +++ /dev/null @@ -1,135 +0,0 @@ -/* GTK - The GIMP Toolkit - * Copyright (C) 2011 Red Hat, Inc. - * - * 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 . - */ - -#include "config.h" - -#include "gtkcsstypedvalueprivate.h" - -#include "gtkcsscustompropertyprivate.h" -#include "gtkcssstylefuncsprivate.h" - -struct _GtkCssValue { - GTK_CSS_VALUE_BASE - GValue value; -}; - -static void -gtk_css_value_typed_free (GtkCssValue *value) -{ - g_value_unset (&value->value); - g_slice_free (GtkCssValue, value); -} - -static GtkCssValue * -gtk_css_value_typed_compute (GtkCssValue *value, - guint property_id, - GtkStyleProviderPrivate *provider, - GtkCssStyle *style, - GtkCssStyle *parent_style) -{ - GtkCssCustomProperty *custom = GTK_CSS_CUSTOM_PROPERTY (_gtk_css_style_property_lookup_by_id (property_id)); - - return _gtk_css_style_funcs_compute_value (provider, style, parent_style, custom->pspec->value_type, value); -} - -static gboolean -gtk_css_value_typed_equal (const GtkCssValue *value1, - const GtkCssValue *value2) -{ - return FALSE; -} - -static GtkCssValue * -gtk_css_value_typed_transition (GtkCssValue *start, - GtkCssValue *end, - guint property_id, - double progress) -{ - return NULL; -} - -static void -gtk_css_value_typed_print (const GtkCssValue *value, - GString *string) -{ - _gtk_css_style_funcs_print_value (&value->value, string); -} - -static const GtkCssValueClass GTK_CSS_VALUE_TYPED = { - gtk_css_value_typed_free, - gtk_css_value_typed_compute, - gtk_css_value_typed_equal, - gtk_css_value_typed_transition, - gtk_css_value_typed_print -}; - -static GtkCssValue * -gtk_css_typed_value_new_for_type (GType type) -{ - GtkCssValue *result; - - result = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_TYPED); - - g_value_init (&result->value, type); - - return result; -} - -GtkCssValue * -_gtk_css_typed_value_new (const GValue *value) -{ - GtkCssValue *result; - - g_return_val_if_fail (G_IS_VALUE (value), NULL); - - result = gtk_css_typed_value_new_for_type (G_VALUE_TYPE (value)); - - g_value_copy (value, &result->value); - - return result; -} - -GtkCssValue * -_gtk_css_typed_value_new_take (GValue *value) -{ - GtkCssValue *result; - - g_return_val_if_fail (G_IS_VALUE (value), NULL); - - result = _gtk_css_typed_value_new (value); - g_value_unset (value); - - return result; -} - -gboolean -_gtk_is_css_typed_value_of_type (const GtkCssValue *value, - GType type) -{ - if (value->class != >K_CSS_VALUE_TYPED) - return FALSE; - - return G_VALUE_HOLDS (&value->value, type); -} - -const GValue * -_gtk_css_typed_value_get (const GtkCssValue *value) -{ - g_return_val_if_fail (value->class == >K_CSS_VALUE_TYPED, NULL); - - return &value->value; -} diff --git a/gtk/gtkcsstypedvalueprivate.h b/gtk/gtkcsstypedvalueprivate.h deleted file mode 100644 index 3061b9be53..0000000000 --- a/gtk/gtkcsstypedvalueprivate.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright © 2012 Red Hat Inc. - * - * 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.1 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 . - * - * Authors: Alexander Larsson - */ - -#ifndef __GTK_CSS_TYPED_VALUE_PRIVATE_H__ -#define __GTK_CSS_TYPED_VALUE_PRIVATE_H__ - -#include "gtkcssparserprivate.h" -#include "gtkcssvalueprivate.h" - -G_BEGIN_DECLS - -GtkCssValue * _gtk_css_typed_value_new (const GValue *value); -GtkCssValue * _gtk_css_typed_value_new_take (GValue *value); - -gboolean _gtk_is_css_typed_value_of_type (const GtkCssValue *value, - GType type); - -const GValue * _gtk_css_typed_value_get (const GtkCssValue *value); - -G_END_DECLS - -#endif /* __GTK_CSS_TYPED_VALUE_PRIVATE_H__ */