diff options
author | Benjamin Otte <otte@redhat.com> | 2011-12-31 19:28:59 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2012-01-09 18:37:52 +0100 |
commit | 0a3ac5efbced071e080af10e03748eb53e747807 (patch) | |
tree | 8cd60f23243ad6747ef318945c3ed36e340bcb24 /gtk/gtkstyleproperty.c | |
parent | edb8bf4b1d9506770f67fc82ce0113ea54a8af1b (diff) | |
download | gtk+-0a3ac5efbced071e080af10e03748eb53e747807.tar.gz |
styleproperty: Move id handling
only real style properties can have an id, so let
GtkCssStylePropertyClass handle it.
Diffstat (limited to 'gtk/gtkstyleproperty.c')
-rw-r--r-- | gtk/gtkstyleproperty.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/gtk/gtkstyleproperty.c b/gtk/gtkstyleproperty.c index 69a16f2e3a..842a1ce0db 100644 --- a/gtk/gtkstyleproperty.c +++ b/gtk/gtkstyleproperty.c @@ -60,7 +60,6 @@ enum { static GHashTable *parse_funcs = NULL; static GHashTable *print_funcs = NULL; -static GPtrArray *__style_property_array = NULL; G_DEFINE_ABSTRACT_TYPE (GtkStyleProperty, _gtk_style_property, G_TYPE_OBJECT) @@ -1616,25 +1615,13 @@ transparent_color_value_parse (GtkCssParser *parser, guint _gtk_style_property_get_count (void) { - return __style_property_array ? __style_property_array->len : 0; + return _gtk_css_style_property_get_n_properties (); } GtkStyleProperty * _gtk_style_property_get (guint id) { - g_assert (__style_property_array); - - return g_ptr_array_index (__style_property_array, id); -} - -static void -_gtk_style_property_generate_id (GtkStyleProperty *node) -{ - if (__style_property_array == NULL) - __style_property_array = g_ptr_array_new (); - - node->id = __style_property_array->len; - g_ptr_array_add (__style_property_array, node); + return GTK_STYLE_PROPERTY (_gtk_css_style_property_lookup_by_id (id)); } static void @@ -1842,7 +1829,10 @@ _gtk_style_property_get_id (GtkStyleProperty *property) { g_return_val_if_fail (property != NULL, FALSE); - return property->id; + if (GTK_IS_CSS_STYLE_PROPERTY (property)) + return _gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (property)); + else + return 0; } static gboolean @@ -2545,8 +2535,6 @@ _gtk_style_property_register (GParamSpec *pspec, node->parse_func = parse_func; node->print_func = print_func; - _gtk_style_property_generate_id (node); - /* initialize the initial value */ if (initial_value) { |