On Thu, 2004-03-18 at 13:50, Toth Zoltan wrote:
On Thu, 2004-03-18 at 11:46, Ruben Rubio wrote:
[snip]
The think is, im creating a GTK app using Glade, and I want when a person click on next it will create a new window and will close the first one. I have tried a lot. Im able to open the new window but I dont know how to close the first one. This is my last code: on_cmdNext_clicked (GtkButton *button, gpointer user_data) { GtkWidget *nextstep;
GtkWidget *oldwindow;
nextstep = create_srcStepTwo(); gtk_widget_show(nextstep);
oldwindow=lookup_widget( button , "window1");
// in interface.c : GLADE_HOOKUP_OBJECT_NO_REF (window1,
window1, "window1");
gtk_widget_destroy( oldwindow );
//gtk_widget_destroy (button); //Here fails How can i get the pointer to // the first window?? }
The lookup_widget() stuff is ok if you're using Glade2, but not the Gtk
way of doing this things ;)
As example, this function is not defined in a Glade generated project
but in a Glade-2 generated one.
To get the window pointer using only Gtk functions, you can pass it as
user_data when you connect the clicked signal:
g_signal_connect(button, "clicked", on_cmdNext_clicked,
pointer_to_window);
Then the pointer is passed to your callback, and you can use it as
needed:
void
on_cmdNext_clicked (GtkButton *button, gpointer user_data)
{
GtkWidget *nextstep;
GtkWidget* window;
window = GTK_WIDGET(user_data);
nextstep = create_srcStepTwo();
gtk_widget_show( nextstep );
gtk_widget_destroy( window );
}
I'm not telling you to don't use lookup_widget(). It's really usefull.
It's just to tell you that lookup_widget() is not a Gtk function but a
Glade defined function.
You can take a look at this function in the support.c file generated by
Glade.
Hope this helps.
--
Iago Rubio http://www.iagorubio.com
GPGkey pgp.rediris.es id 0x909BD4DD fingerprint =
D18A B950 5F03 BB9A DD89 AA75 FEDF 1978 909B D4DD
********** iago.rubio(AT)hispalinux.es **********
--------------------------------------------------
Attachment:
signature.asc
Description: This is a digitally signed message part