Re: Signal connection
- From: Owen Taylor <otaylor redhat com>
- To: Roger Leigh <roger whinlatter uklinux net>
- Cc: gtk-list gnome org
- Subject: Re: Signal connection
- Date: 09 Aug 2003 09:50:46 -0400
On Fri, 2003-08-08 at 14:39, Roger Leigh wrote:
> Hello,
>
> I would like to connect a callback (gtk_widget_grab_focus) to a
> signal, using g_signal_connect_swapped. I would also like this to run
> after the default handler. However, there isn't a
> g_signal_connect_swapped_after() function.
>
> Is there another way to achieve this effect? I looked at
> GConnectFlags and the functions that use this, but I'm not sure these
> functions are appropriate. g_signal_connect_data() looks promising,
> but I'm not sure about using a GClosure (I don't need one, whatever
> they are). What a GClosure actually /is/ isn't documented, at least
> in my version of the docs, so I'm unsure what to do here. Any
> suggestions would be kindly appreciated!
g_signal_connect_data() will work.
The GClosureNotify there has nothing to do with closures; it's
just used because it has the right signature. It's a function
to call when the signal is disconnected to free the callback data
and you can pass NULL.
Personally I avoid g_signal_connect_swapped() in most cases and
simply have a callback function with the normal argument order
that calls the function I want to call with the arguments in the
right order. g_signal_connect_swapped() is just a shortcut
that can make your code harder to read and maintain.
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]