Re: gtk_type_foreach?



On Mon, 21 Sep 1998, Johannes Keukelaar wrote:

> //On 15 Sep 1998, Marius Vollmer wrote:
> //
> //> johannes@nada.kth.se (Johannes Keukelaar) writes:
> //> 
> //> > Is there any reason why there is no gtk_type_foreach function?
> //> 
> //> Hmm.  I'm not saying that such a function wouldn't be useful, but you
> //> must be aware that most types are dynamically added to the type
> //> system.  You will only find GtkFileSelection in the type list after at
> //> least one GtkFileSelection widget has been created.  (Types are never
> //> removed from the system, tho.)
> //
> //I could probably find a use for this sort of thing too, but, exactly as
> //Tim Janik describes, it is better implemented with a "hook" function that
> //allows the programmer to get notified when new types are created. 
> 
> That _could_ be enough. But you'd have to define the hook such that, at the 
> time of installation, it will be called for each of the types then registered. 
> (But then, your hook might depend on that it gets called for more basic types 
> before it gets called for their derived types. Interesting problem.)

the call sequence for the class_foreach function will asure that the hook
will get called for base classes first.
note however that i'm talking class_foreach here, not type_forech, i.e.
the hook gets invoked when the class is created not the type itself,
and it is the actuall class pointer that is passed to the hook, not the
type id itself (that can be retrived through the class of course).
this will most times be shortly after the type got created but need not
to be so. there is actually not much point in having a hook for pure
type registrations at least i can't come up with somthing, and there
wouldn't be much to pass to that function (other than the plain type id ;).

> 
> Johannes.
> 

---
ciaoTJ



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