Re: Glade 2 & passing data to signal handlers

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

 



Joe Scaduto wrote:
Hey I am a newbie to GTK+ 2 and Glade 2.  I have been playing around
with GTK and I understand the concept behind signals and events.  My
problem arised when I decided to use Glade 2 and wanted to connect a
'clicked' signal for a 'modal' 'dialog' window 'button'.  When
connecting any signal handler to a signal I know you can pass extra data
to the handler if you wish.  In Glade 2 when connecting a signal you can
also set the extra data and it casts it as a GTK_OBJECT.  In my
callbacks.c file my handler is there: code snippet

void on_okLoginButton_clicked(GtkButton *button, gpointer user_data)
{
  gtk_widget_destroy( GTK_WIDGET(user_data) );
}

My call to destroy the dialog window only destroys the button.  However
when I change the widget to destroy to: GTK_WIDGET(button), everything
works fine.  Seems to me something is reversed.  Also I went into my
interface.c file and found the actual code to call the handler and found
this:

g_signal_connect_swapped((gpointer) okLoginButton, "clicked",
                          G_CALLBACK (on_okLoginButton_clicked),
                          GTK_OBJECT (loginDialog) );

Where loginDialog is my dialog window I want to close.

If you actually read the whole thing and are willing to help a newbie
out I would greatly appreciate any explanation of this if anyone has ran
into this problem.

Maybe you need: g_signal_connect((gpointer) okLoginButton, "clicked", G_CALLBACK (on_okLoginButton_clicked), GTK_OBJECT (loginDialog) );

_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux