Re: gtk_type_foreach?



On Tue, 15 Sep 1998, Johannes Keukelaar wrote:

> Hi *,
> 
> Is there any reason why there is no gtk_type_foreach function? Something that 
> would call g_hash_table_foreach on type_name_2_type_ht in gtktypeutils.c with a 
> user-supplied function and gpointer data? This would greatly simplify 
> dynamically type-extensible systems, allowing them to find out which types 
> exist that are derived from some basic type, for example. (Say, to construct an 
> add-a-new-node menu dynamically.)

walking the internal type names hash table is probably a bad idea, since
1) you have to redo this after distinct time intervals since new types
   may have been introduced, and
2) it would open up the internal data structures of the typing system
   to the application progarmmer, which would be a _very_ bad idea since
   a) applications should never mess with that,
   b) it's of no relevant use to an application since all significant
      information of a type is exported through the gtktypeutils.h API, and
   c) the type system occasionally relocates this stuff within memory.

a fesible way for applications to gain information about certain existing types
and types that have yet to be registered would be the gtk_type_add_class_hook and
gtk_type_foreach_class functions which i suggested in an older mail to this list:
> Date: Mon, 24 Aug 1998 00:37:22 +0200 (CEST)
> Subject: hook functions (Re: Sound events in Gtk)

so far, there haven't been any comments on that issue, so i think i'll eventually
implement what i proposed there.

the GtkTypeBaseClass stuff i suggested in that mail has already been implemented
in CVS gtk+ as GtkTypeObject and GtkTypeClass structures, since i needed those
definitions to start out a new proxy-object hierarchy in GLE.

> If there is no such reason (apart from that nobody ever needed one), I'll 
> volunteer to write one for gtk+1.0.4/5.

gtk+1.0.x is a pure maintenance branch at this point, so API extensions like
the above will only be implemented for gtk+' devel version.

> 
> Regards,
> 
> Johannes.
> 

---
ciaoTJ




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