Maintaining a GtkWindow



Hi,

I am trying to create a window that can be opened from a menu entry. The window is created successfully when the menu entry is first clicked on. However, when the close button (on the window manager) is clicked (generating a destroy event), the window destroys itself. I have tried to hide the widget instead, but the next call to show_airbrush_dialog() generates an error:

Gtk-CRITICAL **: file ../../gtk/gtkwidget.c: line 1770 (gtk_widget_show_all): assertion `GTK_IS_WIDGET (widget)' failed


Is there a way of creating a window that can be hidden and shown at will, and is not destroyed when the close button in the window titlebar is clicked?

Best regards,

Chris.

PS. Here is my code sample:


GtkWidget *airbrush_dialog;

void create_airbrush_dialog() {
 airbrush_dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 gtk_signal_connect(GTK_OBJECT(airbrush_dialog),
                    "delete_event",
                    GTK_SIGNAL_FUNC(hide_airbrush_dialog),
                    NULL);
}

gboolean show_airbrush_dialog(GtkWidget *widget) {
 gtk_widget_show_all(airbrush_dialog);
 return TRUE;
}

gboolean hide_airbrush_dialog(GtkWidget *widget) {
 gtk_widget_hide(airbrush_dialog);
 return TRUE;
}


_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963




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