Re: Glade 2 & passing data to signal handlers

Joe Scaduto wrote:
On Sat, 2003-10-18 at 11:24, Russell Shaw wrote:

Yes, but it will be over-written next time you generate the code.
Most users don't use this generated code and use gladelib xml which
is less intrusive on your program.

 Thanks I appreciate the help.....I found what the problem was at least
I think.  When Glade created the
g_signal_connect_swapped((gpointer) okLoginButton, "clicked",
                          G_CALLBACK (on_okLoginButton_clicked),
GTK_OBJECT (loginDialog) ); connection the first parameter of on_okLoginButton_clicked is
loginDialog not okLoginButton.  Which would make my callback function:

void on_okLoginButton_clicked(gpointer user_data, GtkButton *button)

not(which Glade had orginally created for me):

void on_okLoginButton_clicked(GtkButton *button, gpointer user_data)

Correct me if I am wrong but I think the difference between
g_signal_connect and g_signal_connect_swapped is the order the
parameters are recieve by your callback function.

Yes. The connect functions are usually macros involving g_signal_connect_object():

#define     g_signal_connect                (instance, detailed_signal, c_handler, data)
#define     g_signal_connect_after          (instance, detailed_signal, c_handler, data)
#define     g_signal_connect_swapped        (instance, detailed_signal, c_handler, data)
gulong      g_signal_connect_object         (gpointer instance,
                                             const gchar *detailed_signal,
                                             GCallback c_handler,
                                             gpointer gobject,
                                             GConnectFlags connect_flags);

Some theory:

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