Re: Interface signals.



Tim Janik <timj gtk org> writes:

> On 20 Dec 2000 jrb redhat com wrote:
> 
> > 
> > What is the status of signals on interfaces, and when should I set them?
> > There is no equivilant of a GClassInitFunc for them.  Should I do it in
> > the initial get_type() stage?  I don't think I should do it when I add
> > the interface to a class, as that could happen several times?
> 
> urm, yes, type_init is probably a bad idea, but interfaces have no
> common one-time initializer. haven't actually run into this yet,
> for the moment, it's probably best if you use the base_init function
> of the interface's GTypeInfo structure and guard that against multiple
> invocations, i.e.:
> 
> static void
> my_interface_base_class_init (gpointer g_class)
> {
>   static gboolean signals_setup = FALSE;
>   
>   if (!signals_setup)
>     {
>       signals_setup = TRUE;
>       
>       /* do signal_new here */
>     }
> }

Okay, I'll try that.  It does seem a little inelegant, but that's okay.

> i'd like to review your code using interface signals btw, while the
> signal system should definitely support them now, i suspect there're
> still issues with destroying signals of dynamic interfaces.

I'll let you know when I get it working with signals, so you can play
with it.

-Jonathan




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