Re: g_signal_lookup for interfaces



On Thu, 18 Oct 2001, James Henstridge wrote:

> Bill Haneman wrote:
> 
> >Hi:
> >
> >I guess this one is for you, Tim...
> >
> >We have defined a number of signals in ATK on interfaces.  We know we 
> >can't define properties on interfaces now, but we have been using 
> >signals on interfaces, which is supported.
> >
> >However in order to intercept these signals we need to register an 
> >emission hook.  In the bridge to at-spi this is done via a string-based 
> >register call containing the names of the signal and type.
> >[where type_name = "AtkText", signal_name = "text-caret-moved"]
> >
> >GType *type = g_type_from_name(type_name);
> >
> >However, if we call 
> >
> >g_signal_lookup (signal_name, type); 
> >
> Calling the atk_text_get_type() function for your interface doesn't 
> guarantee your atk_text_base_init() function will be called (this is 
> delayed til the first time the interface is used (ie. getting the class 
> pointer for a type implementing the interface).  Not sure how best to 
> force the interface to initialise though.  For GObject subclasses, it is 
> as simple as:
>   class = g_type_class_ref(type);
>   id = g_signal_lookup(name, type);
>   ...
>   g_type_class_unref(class);

its the same for interfaces, say you added an interface to class foo,
the interface is initialized once you cause the foo-class to be created,
e.g. via g_type_class_ref(TYPE_FOO).

> 
> James.
> 

---
ciaoTJ




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