[Glade-users] Problems with signalhandler data.
Damon Chaplin
damon@ximian.com
Mon, 05 Feb 2001 11:53:15 +0000
Roberto Diaz wrote:
>
> Hi.
>
> I am trying to build a project with glade... But I am having troubles..
>
> I have a menu item called "about1" in its signals I have the following:
>
> Signal: activate
> Handler: about1_activate
> Data: dialog1
>
> dialog1 is a dialog window I have created too..
>
> in the signal handler at handlers.c I have:
>
> void
> on_about1_activate (GtkMenuItem *menuitem,
> gpointer user_data)
> {
> gtk_widget_show (GTK_WIDGET(user_data));
> }
>
> I understand the Data field is what is recieved as a gpointer but if I
> compile I get the following:
>
> bash-2.03$ src/gframes
>
> Gtk-WARNING **: invalid cast from (NULL) pointer to `GtkWidget'
>
> Gtk-CRITICAL **: file gtkwidget.c: line 1424 (gtk_widget_show): assertion
> `widget != NULL' failed.
>
> What am I doing wrong? why the data has not be appened in the signal
> handlers registration proccess at interface.c (you say I must not to
> edit this file):?
>
> What data can I put in the Data field? can not it be other widgets?
You can only use widgets within the same window. (Look at the interface.c
file - the create_XXX() functions know nothing about other windows.)
You have to keep track of pointers to the windows in the interface yourself,
either using global variables or by "attaching" them to parent windows.
Damon