Re: g_signal_lookup for interfaces



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);

James.




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