Re: Creating object based on GObject



On Mon, 2007-08-13 at 13:07 +0200, Tomasz Jankowski wrote:
Hello!

I want to do such thing: Object, during create process, should be added to
objects' table (GHashTable). In this table I use one of objects' properties
as key (each object have other value of this property). This property is set
only during 'g_object_new' execution and it can't be changed later by user.
The problem is that object should be added to that list during
'g_object_new' call too and I don't know how can I do it. I tried to do it
in 'instance_init', but it was bad idea, because properties are still set
with default values, they are set with values passed to 'g_object_new' after
'instance_init'.

Is there any way to do it during 'g_object_new' run?

Override the construct method of GObject,

In your construct function:

1. Chain up to the parent (GObject) class's construct method
2. Act upon your construct properties.

Regards,

-- 
Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA

Tel: +44 (0)7729 980173 - (No signal in the lab!)




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]