[Glade-devel] Passing user data to signal handler

On Tue, Feb 03, 2004 at 09:41:04PM -0500, Joe Scaduto wrote:

g_signal_connect_object (gpointer instance,
                         const gchar *detailed_signal,
                         GCallback c_handler,
                         gpointer gobject,
                         GConnectFlags connect_flags);

It was my understanding that the 'instance' was the 'glade name' used in
to reference to the specific widget in my Glade application 

Yes, that's the object that sends the signal.

and gobject 
was any data I wished to pass to the handler. 

One would use the user_data parameter in the regular signal_connect for
that.  signal_connect_object specifically swaps the first argument of the
callback from "instance" to "gobject", and is useful, for example, if you
want a button click to do something to some other object.

So if I populate the 'Object' 
field this would not reference to the 'glade name' but to a string representation
of an object?

Your signal callback would get whatever object was referenced by the glade
name in the "Object" field, not the string, as its first argument.  Try it
and see what happens (if you were using Python instead of C, you'd have
tried it already ;}).  You can't use this to pass in static data like
strings or numbers.

Dave Cook

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