[Glade-users] gtk_widget_destroy



Parrish M Myers wrote:

Hi,

Thank you all for your help with opening a dialog with a button.  It
works nicely.  I have a new question though.  I have chosen to create
the dialog each time I try to open it (rather than just show and hide)
because the dialog is small.  When I try to close the newly created
dialog I call the gtk_widgtet_destroy function.  This closes the new
dialog ok... but I can't open a second instance of the dialog again.  I
get an assertion failed error message:

in getwidget.c ... GTK_IS_WIDGET(dialog) failed.

The only way I have found to get around this problem is to have the new
dialog call my own function that does the following:

close_dialog () {
   gtk_widget_destroy(new_dialog);
   gtk_widget_destroyed(new_dialog, &new_dialog);
}

This seems to be the only way to reset the new_dialog pointer to NULL.
Is there a function that automagically calls both functions... Or am I
required to call the two seperately?

It would probably be better to connect to the "destroy" signal of the
dialog and set the pointer to it to NULL there. Then you know it will
definitely be set to NULL when the dialog is destroyed.

Dialogs can be destroyed in several ways, e.g. the delete_event signal
from the window manager, or you may set up the Escape key to destroy it.

Damon







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