X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=gtk%2Fgtkstyleproperties.c;h=9788006b1612f5dec65c947af8bdea3d25edf9dd;hb=cb27c4b08c278ac7e8a882b638dbf30acd1436cf;hp=e73e74b6ac66b2a69367f4dba609dd880be45e06;hpb=a253d4cfec7c6e130b3dddee6cdfaff5ceb7cbe1;p=~andy%2Fgtk diff --git a/gtk/gtkstyleproperties.c b/gtk/gtkstyleproperties.c index e73e74b6a..9788006b1 100644 --- a/gtk/gtkstyleproperties.c +++ b/gtk/gtkstyleproperties.c @@ -24,12 +24,9 @@ #include #include "gtkstyleprovider.h" -#include "gtksymboliccolor.h" #include "gtkthemingengine.h" -#include "gtkanimationdescription.h" -#include "gtkgradient.h" -#include "gtkshadowprivate.h" #include "gtkcssshorthandpropertyprivate.h" +#include "gtkcsstypedvalueprivate.h" #include "gtkcsstypesprivate.h" #include "gtkborderimageprivate.h" @@ -37,9 +34,11 @@ #include "gtkstylepropertyprivate.h" #include "gtkstyleproviderprivate.h" #include "gtkintl.h" - #include "gtkwin32themeprivate.h" +#include "deprecated/gtkgradient.h" +#include "deprecated/gtksymboliccolorprivate.h" + /** * SECTION:gtkstyleproperties * @Short_description: Store for style property information @@ -280,31 +279,31 @@ gtk_style_properties_finalize (GObject *object) G_OBJECT_CLASS (gtk_style_properties_parent_class)->finalize (object); } -GtkStyleProperties * -gtk_style_properties_get_style (GtkStyleProvider *provider, - GtkWidgetPath *path) -{ - /* Return style set itself */ - return g_object_ref (provider); -} - static void gtk_style_properties_provider_init (GtkStyleProviderIface *iface) { - iface->get_style = gtk_style_properties_get_style; } -static GtkSymbolicColor * +static GtkCssValue * gtk_style_properties_provider_get_color (GtkStyleProviderPrivate *provider, const char *name) { - return gtk_style_properties_lookup_color (GTK_STYLE_PROPERTIES (provider), name); + GtkSymbolicColor *symbolic; + + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; + + symbolic = gtk_style_properties_lookup_color (GTK_STYLE_PROPERTIES (provider), name); + if (symbolic == NULL) + return NULL; + + return _gtk_symbolic_color_get_css_value (symbolic); + + G_GNUC_END_IGNORE_DEPRECATIONS; } static void gtk_style_properties_provider_lookup (GtkStyleProviderPrivate *provider, - GtkWidgetPath *path, - GtkStateFlags state, + const GtkCssMatcher *matcher, GtkCssLookup *lookup) { GtkStyleProperties *props; @@ -330,7 +329,7 @@ gtk_style_properties_provider_lookup (GtkStyleProviderPrivate *provider, if (!_gtk_css_lookup_is_missing (lookup, id)) continue; - value = property_data_match_state (data, state); + value = property_data_match_state (data, _gtk_css_matcher_get_state (matcher)); if (value == NULL) continue; @@ -338,11 +337,19 @@ gtk_style_properties_provider_lookup (GtkStyleProviderPrivate *provider, } } +static GtkCssChange +gtk_style_properties_provider_get_change (GtkStyleProviderPrivate *provider, + const GtkCssMatcher *matcher) +{ + return GTK_CSS_CHANGE_STATE; +} + static void gtk_style_properties_provider_private_init (GtkStyleProviderPrivateInterface *iface) { iface->get_color = gtk_style_properties_provider_get_color; iface->lookup = gtk_style_properties_provider_lookup; + iface->get_change = gtk_style_properties_provider_get_change; } /* GtkStyleProperties methods */ @@ -370,6 +377,8 @@ gtk_style_properties_new (void) * gtk_style_properties_lookup_color() * * Since: 3.0 + * + * Deprecated: 3.8: #GtkSymbolicColor is deprecated. **/ void gtk_style_properties_map_color (GtkStyleProperties *props, @@ -384,6 +393,8 @@ gtk_style_properties_map_color (GtkStyleProperties *props, priv = props->priv; + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; + if (G_UNLIKELY (!priv->color_map)) priv->color_map = g_hash_table_new_full (g_str_hash, g_str_equal, @@ -393,6 +404,10 @@ gtk_style_properties_map_color (GtkStyleProperties *props, g_hash_table_replace (priv->color_map, g_strdup (name), gtk_symbolic_color_ref (color)); + + G_GNUC_END_IGNORE_DEPRECATIONS; + + _gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (props)); } /** @@ -406,6 +421,8 @@ gtk_style_properties_map_color (GtkStyleProperties *props, * Returns: (transfer none): The mapped color * * Since: 3.0 + * + * Deprecated: 3.8: #GtkSymbolicColor is deprecated. **/ GtkSymbolicColor * gtk_style_properties_lookup_color (GtkStyleProperties *props, @@ -434,8 +451,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); @@ -449,6 +464,8 @@ _gtk_style_properties_set_property_by_property (GtkStyleProperties *props, _gtk_css_value_unref (val->value); val->value = _gtk_css_value_ref (value); + + _gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (props)); } /** @@ -631,7 +648,6 @@ gtk_style_properties_get_property (GtkStyleProperties *props, { StyleQueryData query = { props, state }; GtkStyleProperty *node; - GtkCssValue *v; g_return_val_if_fail (GTK_IS_STYLE_PROPERTIES (props), FALSE); g_return_val_if_fail (property != NULL, FALSE); @@ -649,11 +665,10 @@ gtk_style_properties_get_property (GtkStyleProperties *props, return FALSE; } - v = _gtk_style_property_query (node, - style_query_func, - &query); - _gtk_css_value_init_gvalue (v, value); - _gtk_css_value_unref (v); + _gtk_style_property_query (node, + value, + style_query_func, + &query); return TRUE; } @@ -795,6 +810,8 @@ gtk_style_properties_unset_property (GtkStyleProperties *props, data->value = NULL; g_array_remove_index (prop->values, pos); + + _gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (props)); } } @@ -813,6 +830,8 @@ gtk_style_properties_clear (GtkStyleProperties *props) priv = props->priv; g_hash_table_remove_all (priv->properties); + + _gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (props)); } /** @@ -860,7 +879,9 @@ gtk_style_properties_merge (GtkStyleProperties *props, g_hash_table_lookup (priv->color_map, name)) continue; + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; gtk_style_properties_map_color (props, name, color); + G_GNUC_END_IGNORE_DEPRECATIONS; } } @@ -889,7 +910,7 @@ gtk_style_properties_merge (GtkStyleProperties *props, data = &g_array_index (prop_to_merge->values, ValueData, i); if (replace && data->state == GTK_STATE_FLAG_NORMAL && - _gtk_css_value_holds (data->value, PANGO_TYPE_FONT_DESCRIPTION)) + _gtk_is_css_typed_value_of_type (data->value, PANGO_TYPE_FONT_DESCRIPTION)) { /* Let normal state override all states * previously set in the original set @@ -899,19 +920,19 @@ gtk_style_properties_merge (GtkStyleProperties *props, value = property_data_get_value (prop, data->state); - if (_gtk_css_value_holds (data->value, PANGO_TYPE_FONT_DESCRIPTION) && + if (_gtk_is_css_typed_value_of_type (data->value, PANGO_TYPE_FONT_DESCRIPTION) && value->value != NULL) { PangoFontDescription *font_desc; PangoFontDescription *font_desc_to_merge; /* Handle merging of font descriptions */ - font_desc = _gtk_css_value_get_font_description (value->value); - font_desc_to_merge = _gtk_css_value_get_font_description (data->value); + font_desc = g_value_get_boxed (_gtk_css_typed_value_get (value->value)); + font_desc_to_merge = g_value_get_boxed (_gtk_css_typed_value_get (data->value)); pango_font_description_merge (font_desc, font_desc_to_merge, replace); } - else if (_gtk_css_value_holds (data->value, G_TYPE_PTR_ARRAY) && + else if (_gtk_is_css_typed_value_of_type (data->value, G_TYPE_PTR_ARRAY) && value->value != NULL) { GPtrArray *array, *array_to_merge; @@ -920,8 +941,8 @@ gtk_style_properties_merge (GtkStyleProperties *props, /* Append the array, mainly thought * for the gtk-key-bindings property */ - array = _gtk_css_value_get_boxed (value->value); - array_to_merge = _gtk_css_value_get_boxed (data->value); + array = g_value_get_boxed (_gtk_css_typed_value_get (value->value)); + array_to_merge = g_value_get_boxed (_gtk_css_typed_value_get (data->value)); for (i = 0; i < array_to_merge->len; i++) g_ptr_array_add (array, g_ptr_array_index (array_to_merge, i)); @@ -933,4 +954,6 @@ gtk_style_properties_merge (GtkStyleProperties *props, } } } + + _gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (props)); }