Re: anonymous/generic GObjects? how to set/get custom properties without subclassing?

On Wed, 2 Feb 2005 15:09:00 -0800, Ben Johnson <ben blarg net> wrote:
> The only reason I didn't use a GObject to begin with is I don't
> understand very well how the property thing works...  I don't know if it
> possible to just set random properties without first declaring them...
> you know.

You need to call g_object_class_install_property() first.

usualy a property is "handled" by the object in question (i.e.
"width-request" is something that is handled in the gtkwidget.c code).

I've also used a GObject to implement an observer model; the object is basicly
just a dummy object with a bunch of properties that anyone can set/get or
g_signal_connect (... "notify::subject") to; but this limits me to
have a limited
hardcoded number of "subjects" for observation. (ofcourse; a method could be
written to add dynamic properties, but thats starting to look like a hack, note
also that there is no g_object_class_uninstall_property() ).


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