Re: [gtk-list] Re: querying object args and gtk+ class initialis
- From: Tim Janik <timj gtk org>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: querying object args and gtk+ class initialis
- Date: Wed, 28 Apr 1999 23:54:21 +0200 (CEST)
On Thu, 29 Apr 1999, Michael Beach wrote:
> >>
> >> Paradoxically though, gtk_args_query() contains the following snippet of
> >> code...
> >>
> >> g_return_val_if_fail (arg_info_hash_table != NULL, NULL);
> >>
> >> /* make sure the types class has been initialized, because
> >> * the argument setup happens in the gtk_*_class_init() functions.
> >> */
> >> gtk_type_class (class_type);
> >>
> >> ie it wants to call gtk_type_class() to ensure that class initialisation is
> >> done, but unless some class has been previously initialised through some
> >> other
> >> path of execution it can never get that far, as it will bomb out due to
> >> arg_info_hash_table being uninitialised. Indeed, when the call to
> >> gtk_type_class() is uncommented in my code fragment above, the error goes
> >> away,
> >> as the call results in object_arg_info_ht being initialised.
> >>
> >> To me, all of this looks like a bit of a buglet.
> > [...]
> >
> > yeah, you're absolutely correct, i added that line
> >> gtk_type_class (class_type);
> > when we had a similar problem with signals, where a query function needed
> > the class to be initialized, and didn't really think about the hash table
> > constrains of the argument code.
> >
> > the proper fix would be:
> >
> > @@ gtkarg.c:gtk_args_query
> > - /* make sure the types class has been initialized, because
> > - * the argument setup happens in the gtk_*_class_init() functions.
> > - */
> > - gtk_type_class (class_type);
> >
> > @@ gtkarg.h:gtk_args_query
> > + /* make sure the types class has been initialized, so a
> > + * arg_info_hash_table != NULL is passed into this function
> > + */
> > GtkArg* gtk_args_query (GtkType class_type,
> >
> > @@ gtkcontainer.h:gtk_container_query_child_args
> > + gtk_type_class (class_type);
> > +
> > return gtk_args_query (class_type, container_child_arg_info_ht, arg_flags,
> > n_args);
> >
> > @@ gtkobject.h:gtk_object_query_args
> > + gtk_type_class (class_type);
> > +
> > return gtk_args_query (class_type, object_arg_info_ht, arg_flags, n_args);
> >
>
> Great, those patches look like they'll do the trick. However I've not
> encountered the function gtk_container_query_child_args before. So, what's the
> difference between an ordinary arg, and a "child_arg" of a container? If the
> answer is long, a pointer to something to read would be fine.
unfortunately there's no specific doumentation available yet, though the
gtk-list archives might reveal the ongoing discussion before the actuall
implementation happened. basically the normal object args cover things
like a label's text string, or the GtkWidget::visible state. what child-args
care about is packing flags like in boxes, e.g. expand or fill, as such a
given child arg only exists for a specific container<->child combination.
you can easily grasp the funcitonality by plaing around with GLE's widget
editor, it's a gtk module available from gnome cvs or its homepage
http://www.SoftHome.net/pub/users/timj/gle/index.htm
the latest version should work fine with the gtk+ 1.2.2 version.
>
> ----------------------------------
> Michael Beach
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]