21.01.10, 23:40, "Martin Kalbfuß" <ma.kalbfuss@xxxxxx>: > Hi, > I've set up an object, based on GObject. It's working, but I'm confused > about creating constructors. My head hurts. Can anyone give me a small > code example as starting point. That would be very kind. > Thanks, MyObject * my_object_new(void) { return MY_OBJECT(g_object_new(MY_TYPE_OBJECT, NULL)); } MyObject * my_object_new_from_file(const char *name) { MyObject *object; object = MY_OBJECT(g_object_new(MY_TYPE_OBJECT, NULL)); my_object_load_from_file(MY_OBJECT(object), name); return object; } .. if I understood it right. GObject's GInstanceInitFunc (g_type_register_static_simple()) can't be parametrized, afaik... But you can specify initial values to some properties: g_object_new(MY_TYPE_OBJECT, "prop1", 10, "prop2", "foo", NULL); 2all: I have a perl-script that generates GObject templates; tell if you need it here (I have no idea how to attach it -- base64?) -- Artur _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list