[gtk+] styleproperty: Call style properties init function in more places
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] styleproperty: Call style properties init function in more places
- Date: Mon, 9 Jan 2012 21:08:57 +0000 (UTC)
commit c4566da282f2a7c291c8c148e5ca17d476152259
Author: Benjamin Otte <otte redhat com>
Date: Mon Jan 9 22:06:17 2012 +0100
styleproperty: Call style properties init function in more places
In particular, call it when querying properties by id. This is necessary
for make check to not die.
gtk/gtkcssstyleproperty.c | 13 +++++++++++++
gtk/gtkstyleproperty.c | 6 +++---
gtk/gtkstylepropertyprivate.h | 2 ++
3 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkcssstyleproperty.c b/gtk/gtkcssstyleproperty.c
index 70d88a7..d547ce3 100644
--- a/gtk/gtkcssstyleproperty.c
+++ b/gtk/gtkcssstyleproperty.c
@@ -287,6 +287,12 @@ _gtk_css_style_property_get_n_properties (void)
GtkCssStylePropertyClass *klass;
klass = g_type_class_peek (GTK_TYPE_CSS_STYLE_PROPERTY);
+ if (G_UNLIKELY (klass == NULL))
+ {
+ _gtk_style_property_init_properties ();
+ klass = g_type_class_peek (GTK_TYPE_CSS_STYLE_PROPERTY);
+ g_assert (klass);
+ }
return klass->style_properties->len;
}
@@ -307,6 +313,13 @@ _gtk_css_style_property_lookup_by_id (guint id)
GtkCssStylePropertyClass *klass;
klass = g_type_class_peek (GTK_TYPE_CSS_STYLE_PROPERTY);
+ if (G_UNLIKELY (klass == NULL))
+ {
+ _gtk_style_property_init_properties ();
+ klass = g_type_class_peek (GTK_TYPE_CSS_STYLE_PROPERTY);
+ g_assert (klass);
+ }
+ g_return_val_if_fail (id < klass->style_properties->len, NULL);
return g_ptr_array_index (klass->style_properties, id);
}
diff --git a/gtk/gtkstyleproperty.c b/gtk/gtkstyleproperty.c
index a819784..be86c97 100644
--- a/gtk/gtkstyleproperty.c
+++ b/gtk/gtkstyleproperty.c
@@ -226,8 +226,8 @@ _gtk_style_property_query (GtkStyleProperty *property,
klass->query (property, props, state, value);
}
-static void
-gtk_style_property_init_properties (void)
+void
+_gtk_style_property_init_properties (void)
{
static gboolean initialized = FALSE;
@@ -258,7 +258,7 @@ _gtk_style_property_lookup (const char *name)
g_return_val_if_fail (name != NULL, NULL);
- gtk_style_property_init_properties ();
+ _gtk_style_property_init_properties ();
klass = g_type_class_peek (GTK_TYPE_STYLE_PROPERTY);
diff --git a/gtk/gtkstylepropertyprivate.h b/gtk/gtkstylepropertyprivate.h
index 7e97b70..78cef8c 100644
--- a/gtk/gtkstylepropertyprivate.h
+++ b/gtk/gtkstylepropertyprivate.h
@@ -78,6 +78,8 @@ struct _GtkStylePropertyClass
GType _gtk_style_property_get_type (void) G_GNUC_CONST;
+void _gtk_style_property_init_properties (void);
+
GtkStyleProperty * _gtk_style_property_lookup (const char *name);
const char * _gtk_style_property_get_name (GtkStyleProperty *property);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]