styleproperty: Make this an object

This commit is contained in:
Benjamin Otte 2011-12-31 03:54:17 +01:00
parent 3e24b5dbbe
commit 78dc75a350
2 changed files with 45 additions and 3 deletions

View File

@ -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;

View File

@ -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);