Re: anonymous/generic GObjects? how to set/get custom properties without subclassing?
- From: Tristan Van Berkom <tristan van berkom gmail com>
- To: Ben Johnson <ben blarg net>, gtk-list <gtk-list gnome org>
- Cc:
- Subject: Re: anonymous/generic GObjects? how to set/get custom properties without subclassing?
- Date: Thu, 3 Feb 2005 09:33:01 -0500
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.
http://developer.gnome.org/doc/API/2.0/gobject/gobject-The-Base-Object-Type.html#g-object-class-install-property
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() ).
Cheers,
-Tristan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]