[gtk+/wip/css: 36/167] styleproperty: Make this an object
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/css: 36/167] styleproperty: Make this an object
- Date: Sun, 8 Jan 2012 21:25:54 +0000 (UTC)
commit 6022a351e1083ea42c8572cc7adc2fe40f1c18bd
Author: Benjamin Otte <otte redhat com>
Date: Sat Dec 31 03:54:17 2011 +0100
styleproperty: Make this an object
gtk/gtkstyleproperty.c | 27 ++++++++++++++++++++++++++-
gtk/gtkstylepropertyprivate.h | 21 +++++++++++++++++++--
2 files changed, 45 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkstyleproperty.c b/gtk/gtkstyleproperty.c
index fb1ca24..0f70738 100644
--- a/gtk/gtkstyleproperty.c
+++ b/gtk/gtkstyleproperty.c
@@ -55,6 +55,31 @@ static GHashTable *print_funcs = NULL;
static GHashTable *properties = NULL;
static GPtrArray *__style_property_array = NULL;
+G_DEFINE_TYPE (GtkStyleProperty, _gtk_style_property, G_TYPE_OBJECT)
+
+static void
+gtk_style_property_finalize (GObject *object)
+{
+ GtkStyleProperty *property = GTK_STYLE_PROPERTY (object);
+
+ g_warning ("finalizing %s `%s', how could this happen?", G_OBJECT_TYPE_NAME (object), property->pspec->name);
+
+ G_OBJECT_CLASS (_gtk_style_property_parent_class)->finalize (object);
+}
+
+static void
+_gtk_style_property_class_init (GtkStylePropertyClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = gtk_style_property_finalize;
+}
+
+static void
+_gtk_style_property_init (GtkStyleProperty *property)
+{
+}
+
static void
register_conversion_function (GType type,
GtkStyleParseFunc parse,
@@ -3228,7 +3253,7 @@ _gtk_style_property_register (GParamSpec *pspec,
return;
}
- node = g_slice_new0 (GtkStyleProperty);
+ node = g_object_new (GTK_TYPE_STYLE_PROPERTY, NULL);
node->flags = flags;
node->pspec = pspec;
node->property_parse_func = property_parse_func;
diff --git a/gtk/gtkstylepropertyprivate.h b/gtk/gtkstylepropertyprivate.h
index 4f5902a..263cc9f 100644
--- a/gtk/gtkstylepropertyprivate.h
+++ b/gtk/gtkstylepropertyprivate.h
@@ -25,7 +25,16 @@
G_BEGIN_DECLS
-typedef struct _GtkStyleProperty GtkStyleProperty;
+#define GTK_TYPE_STYLE_PROPERTY (_gtk_style_property_get_type ())
+#define GTK_STYLE_PROPERTY(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, GTK_TYPE_STYLE_PROPERTY, GtkStyleProperty))
+#define GTK_STYLE_PROPERTY_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST (cls, GTK_TYPE_STYLE_PROPERTY, GtkStylePropertyClass))
+#define GTK_IS_STYLE_PROPERTY(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, GTK_TYPE_STYLE_PROPERTY))
+#define GTK_IS_STYLE_PROPERTY_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE (obj, GTK_TYPE_STYLE_PROPERTY))
+#define GTK_STYLE_PROPERTY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_STYLE_PROPERTY, GtkStylePropertyClass))
+
+typedef struct _GtkStyleProperty GtkStyleProperty;
+typedef struct _GtkStylePropertyClass GtkStylePropertyClass;
+
typedef enum {
GTK_STYLE_PROPERTY_INHERIT = (1 << 0)
} GtkStylePropertyFlags;
@@ -44,9 +53,10 @@ typedef void (* GtkStylePrintFunc) (const GValue
typedef void (* GtkStyleUnsetFunc) (GtkStyleProperties *props,
GtkStateFlags state);
-
struct _GtkStyleProperty
{
+ GObject parent;
+
GParamSpec *pspec;
GtkStylePropertyFlags flags;
guint id;
@@ -60,6 +70,13 @@ struct _GtkStyleProperty
GtkStyleUnsetFunc unset_func;
};
+struct _GtkStylePropertyClass
+{
+ GObjectClass parent_class;
+};
+
+GType _gtk_style_property_get_type (void) G_GNUC_CONST;
+
guint _gtk_style_property_get_count (void);
const GtkStyleProperty * _gtk_style_property_get (guint id);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]