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


short version:
I want to use a GObject as a thing that can hold simple types (like ints
and pointers) that does reference counting.  Is that possible?  I want
to use it like a hashtable that will garbage collect itself when all the
references to it are gone.

more explaining:
I have a simple struct that I always allocate dynamically.  This struct
contains three pointer elements and an 'int ref_count'.  I use ref_count
to implement a simple reference counter, of course.  The code is simple
and contained, so there's not much for me to worry about when it comes
to making sure the ref_count is handled well, but, for various reasons,
I think maybe it would be better to do this with a GObject instead.

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.


- Ben

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