problem with gtk_widget_destroy
- From: tom mystery antar com (tom)
- To: gtk-list redhat com
- Subject: problem with gtk_widget_destroy
- Date: 01 May 98 15:34:37 +0100
i have a(nother) problem that's driving me nuts. the following fragment of
code is mostly taken from testgtk.c and the tutorial, but it still doesn't
work and i have no idea *why* :
static void file_open (GtkWidget *widget, gpointer data)
{
static GtkWidget *window = NULL;
if (!window)
{
window = gtk_file_selection_new ("Open file...");
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (destroy_window),
&window);
gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION(window)->ok_button),
"clicked", (GtkSignalFunc) file_open_ok, window);
gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION(window)-
>cancel_button),
"clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy),
GTK_OBJECT(window));
}
if (!GTK_WIDGET_VISIBLE (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
}
all works fine, except the cancel button. for reasons that elude me, it doesn't
destroy the window, but itself. so when you click "cancel", the cancel button
disappears, but everything else stays. closing the window via windowmanager or
by clicking on file->open (which calls this function) again works fine.
can someone explain me how gtk_widget_destroy(window) turns itself into
gtk_widget_destroy(window->cancel_button) ?
for those who don't know testgtk by heart ( :) ) - destroy_window is a function
that only sets window=NULL.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]