Re: Creating objects without deriving from GObject



Ryan McDougall said:
> Thanks for the prompt reply Scott, I appreciate it! However there are
> still some broader questions. GObjectClass provides dispose and finalize
> methods; do I have to provide the same for my class? Are there no other
> interactions I need to know about if I'm not deriving from GObject?

if you're not deriving from GObject, that implies that you're doing something
completely unrelated to GObject and which does not need to behave like
GObject.  this is quite rare, in fact, and not terribly helpful, as GObject
does a whole lot of stuff that you, in general, want.

GObjectClass provides dispose and finalize so that the dispose and finalize
methods can be virtual.  if your custom derivable type needs virtual
functions, you'll need to put them in such a class.

GParamSpec is an example of something that is a derivable type (but not
deep-derivable, if i understand correctly) which is not a GObject.  notice
that it provides its own finalize vfunc.


> But a
> question remains, why doesn't g_type_register_fundamental not call this
> function without bothering to ask the user?

because in other places the GType for a fundamental is predefined. 
registering a fundamental and creating a fundamental's id are two distinct
operations.



-- 
muppet <scott at asofyet dot org>



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