<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Arial; font-size: 12pt; color: #000000'><P><BR>----- Original Message -----<BR>Date: Fri, 24 Apr 2009 20:05:05 +0800<BR>From: ??? &lt;wispernano@gmail.com&gt;<BR>Subject: [gtkbuilder] when destroyed, the window cannot open again<BR>To: gtk-list@gnome.org<BR>Message-ID:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;a4dfa4410904240505j7d28d31bn675851b90dfdebcc@mail.gmail.com&gt;<BR>Content-Type: text/plain; charset="utf-8"<BR><BR>I wirte a sample application use GktBuilder + glade3. there are one<BR>main-window(top level) and some other child-window (top level too, creat and<BR>show when the menu item is actived, in my code it is named window_rank).<BR>after close the child-window for first time, i click the menu item again.<BR>But this child-window cannot be created and showed again. with many errors<BR>or warming like this:<BR><BR>(lsacs_gsecu:11866): GLib-GObject-WARNING **: invalid unclassed pointer in<BR>cast to `GtkCList'<BR><BR>(lsacs_gsecu:11866): Gtk-CRITICAL **: gtk_clist_append: assertion<BR>`GTK_IS_CLIST (clist)' failed<BR><BR>(lsacs_gsecu:11866): GLib-GObject-WARNING **: invalid unclassed pointer in<BR>cast to `GtkCList' </P>
<P>...</P>
<P>etc.</P>
<P>------------------------------------------------------------------------------------------------------------------------------------------------------------------------</P>
<P>&nbsp;</P>
<P>I had the same problem with my first Glade 3-based GUI. What you need to do is i connect to the "delete-event" </P>
<P>in the child-window code, as follows:</P>
<P>&nbsp;</P>
<P>&nbsp;&nbsp;&nbsp; g_signal_connect(GTK_WINDOW(cwin), "delete-event",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // I used cwClose for the callback,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; G_CALLBACK(cwClose_window), NULL);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // but you can use any name you want.</P>
<P>&nbsp;</P>
<P>&nbsp;and then write the callback function, also in the child window code, as follows:</P>
<P>&nbsp;</P>
<P>gboolean cwClose_window(GtkWidget *window, GdkEvent *event, gpointer user_data)<BR>{<BR>&nbsp;&nbsp;&nbsp; gtk_widget_hide(GTK_WIDGET(cwin));<BR>&nbsp;&nbsp;&nbsp; return TRUE;<BR>}</P>
<P>&nbsp;</P>
<P>This "Hides" the window, rather than disposing of it, when the delete-event is triggered, so that when you try to open the child-window again, it will be revealed.</P>
<P>&nbsp;</P>
<P>Hope this helps.</P></div></body></html>