Re: [gnome-db] libgda: Take class hierarchy into account in gda_dict_declare_object?

On Fri, 2007-01-12 at 11:48 +0100, Vivien Malerba wrote:
> On 1/12/07, Armin Burgmeier <armin arbur net> wrote:
> > When wrapping GdaQuery for libgdamm I noticed that every time one wants
> > to use a GdaQuery in C++ libgda prints an ugly warning to the screen
> > (and probably does not behave correctly) that is caused by the GdaDict
> > object declaration system (namely gda_dict_declare_object_as() ).
> > libgdamm subclasses GdaQuery to allow implementing default signal
> > handlers and stuff in C++ but this causes said function not to recognize
> > it as a GdaQuery anymore.
> >
> > I am not sure about the semantics of that dict object declaration stuff,
> > this is why I am asking: Would it be possible to take parent types into
> > account if no GdaRegisterDictStruct for the given GType was found? I
> > could come up with a patch if you think that this is OK.
> You can try to change gda_dict_declare_object() in gda-query.c with
> gda_dict_declare_object_as() specifying GDA_TYPE_QUERY as the last
> argument. This causes GdaDict to take the specified data type instead
> of the one determined by the object itself (which is obviously not
> GDA_TYPE_QUERY if you subclass it). This is done for the GdaGraphQuery
> object which registers itself as a GDA_TYPE_GRAPH.
> Tell me if it works.

That sounds like a good fix for now.

I'm not sure what this code is meant to do, but: If some code is trying
to find a registered object by finding one with a specific GType, maybe
that code should fall back to looking at the parent GTypes. However,
this does all sound like it might be an abuse of the GType system.

Murray Cumming
murrayc murrayc com

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