Re: signals connection



On Thu, Mar 20, 2003 at 09:54:09AM -0500, Tristan Van Berkom wrote:
Hmmm... it seems to mean that the callback will be called like this:

c_handler(G_OBJECT(data), detail, (gpointer) instance);
      instead of
c_handler(G_OBJECT(instance), detail, (gpointer) data);

(I guess where detail is often something like GdkEvent)

      I can't think of a practical reason for having such a
function but if its there; theres a good chance that its
usefull for something ;-)

To simply destroy "someobject" when "window" is destroyed, you can do
this:

g_signal_connect_swapped(G_OBJECT(window), "destroy",
        G_CALLBACK(g_free), someobject);

Because of the _swapped, "someobject" will be passed as the first
argument to g_free() so you can use g_free as a callback directly
instead of another function which would just call g_free anyway.

-- 
      Evan Martin
martine cs washington edu
  http://neugierig.org



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