26 #include <glib-object.h>
50 #define QOF_GOBJECT_DECL(type_name) \
51 GType type_name##_get_type(void);
59 #define QOF_GOBJECT_GET_TYPE(TypeName, type_name, TYPE_PARENT, CODE) \
60 G_DEFINE_TYPE_WITH_CODE(TypeName, type_name, TYPE_PARENT, CODE);
62 #define QOF_GOBJECT_CLASS_INIT(type_name, TypeName) \
63 static void type_name##_dispose(GObject *object); \
64 static void type_name##_finalize(GObject *object); \
65 static void type_name##_class_init(TypeName##Class *klass) \
67 GObjectClass *object_class = G_OBJECT_CLASS(klass); \
68 object_class->dispose = type_name##_dispose; \
69 object_class->finalize = type_name##_finalize; \
72 #define QOF_GOBJECT_DISPOSE(type_name) \
73 static void type_name##_dispose_real(GObject* object); \
74 static void type_name##_dispose(GObject *object) \
76 type_name##_dispose_real(object); \
77 G_OBJECT_CLASS(type_name##_parent_class)->dispose(object); \
80 #define QOF_GOBJECT_FINALIZE(type_name) \
81 static void type_name##_finalize_real(GObject* object); \
82 static void type_name##_finalize(GObject *object) \
84 type_name##_finalize_real(object); \
85 G_OBJECT_CLASS(type_name##_parent_class)->finalize(object); \
88 #define QOF_GOBJECT_IMPL_WITH_CODE(type_name, TypeName, TYPE_PARENT, CODE) \
89 QOF_GOBJECT_GET_TYPE(TypeName, type_name, TYPE_PARENT, CODE); \
90 QOF_GOBJECT_CLASS_INIT(type_name, TypeName); \
91 QOF_GOBJECT_DISPOSE(type_name); \
92 QOF_GOBJECT_FINALIZE(type_name);
94 #define QOF_GOBJECT_IMPL(type_name, TypeName, TYPE_PARENT) \
95 QOF_GOBJECT_IMPL_WITH_CODE(type_name, TypeName, TYPE_PARENT, {})