According to GObject reference
g_signal_connect_swapped(instance, detailed_signal, c_handler, data); connects a GCallback function to a signal for a particular object. The instance on which the signal is emitted and data will be swapped when calling the handler.
I don't quite get what this means. Does this mean that the data
will point to the object pointed to byinstance
and instance
will point to the object that was pointed to by data
or am I making a mistake here?
If former is the case then what is the logic behind this?
self
as the first argument, e.g.:g_signal_connect_swapped (self->some_internal_child, "button-press-event", (GCallback)my_mouse_handler, self)
. Doing that withoutswapped
would mean having an ugly signature on the receiving side with a 1st argument that probably isn't interesting in the majority of cases, and which you can often get fromself->
anyway. Or at least that's how I've made use of this so far... – Sympathy