56 lines
1.1 KiB
C
56 lines
1.1 KiB
C
#include "my_gobj.h"
|
|
|
|
struct _MyGobj {
|
|
GObject parent_instance;
|
|
|
|
// Private data goes here
|
|
};
|
|
|
|
G_DEFINE_TYPE (MyGobj, my_gobj, G_TYPE_OBJECT)
|
|
|
|
static void my_gobj_dispose (GObject *gobject)
|
|
{
|
|
MyGobj *obj = my_gobj_get_instance_private(MY_GOBJ(gobject));
|
|
|
|
// Called multiple times after last unref
|
|
|
|
G_OBJECT_CLASS(my_gobj_parent_class)->dispose(gobject);
|
|
}
|
|
|
|
static void my_gobj_finalize (GObject *gobject)
|
|
{
|
|
MyGobj *obj = my_gobj_get_instance_private(MY_GOBJ(gobject));
|
|
|
|
// Called once after last unref
|
|
|
|
G_OBJECT_CLASS(my_gobj_parent_class)->finalize(gobject);
|
|
}
|
|
|
|
static void my_gobj_constructed (GObject *gobject)
|
|
{
|
|
// Called once per g_object_new
|
|
G_OBJECT_CLASS(my_gobj_parent_class)->constructed(gobject);
|
|
}
|
|
|
|
static void my_gobj_class_init(MyGobjClass *klass)
|
|
{
|
|
GObjectClass *object_class = G_OBJECT_CLASS(klass);
|
|
|
|
object_class->dispose = my_gobj_dispose;
|
|
object_class->finalize = my_gobj_finalize;
|
|
object_class->constructed = my_gobj_constructed;
|
|
|
|
// Called once upon first g_object_new of this type
|
|
}
|
|
|
|
static void my_gobj_init(MyGobj *self)
|
|
{
|
|
// Called once per g_object_new
|
|
}
|
|
|
|
MyGobj *my_gobj_new(void)
|
|
{
|
|
return g_object_new (MY_TYPE_GOBJ,
|
|
0);
|
|
}
|