Re: GObject constructors



On Fri, Dec 08, 2006 at 12:32:25AM -0500, Samuel Cormier-Iijima wrote:
I was wondering if there was a way for GObject *constructors* (not
some_object_new, but some_object_constructor which is overridden in
class_init) to raise an error or somehow prevent the object from being
constructed if the right parameters aren't set... the object needs
certain CONSTRUCT_ONLY params set otherwise it should not create the
object.

constructor() always gets all construction properties set,
at least to defaults (unless you call it manually).  If you
mean set to something else than the default, well, defaults
are supposed to be valid values.

Anyway, constructor() cannot fail AFAIK it would make
g_object_newv() crash.  However, it can construct an object
that is understood as invalid by your app.  So instead of
checking whehter the object was constructed you can check
whether it is valid.

Yeti


--
Whatever.



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