Re: Destroying file selection



On Fri, 2003-01-31 at 20:28, Raymond Wan wrote:
> Hi all,
> 
> 	I've created a file selection window which I want destroyed when I
> hit cancel.  However, I don't know what I'm doing wrong as I've tried
> various combinations and, when I click it, I destroy everything but the
> window -- I've destroyed the button, the vbox of the filesel window, and
> even the whole program.  I can't seem to get the window.  I don't know is
> it because of what I'm destroying, how I'm connecting the callback, or how
> I've created the filesel window.  In a previous version, I cheated with a
> global variable and that worked -- I was hoping to find the better
> solution to this.
> 
> 	My code is below, much of it taken from samples.  However, the
> samples I've seen are usually small programs and clicking cancel to kill
> the program is fine in those cases.  In comments are the various things
> I've tried...  Any help would be appreciated; thank you! 

I suspect you probably got something slightly wrong in your first
attempt, and then wandered off into more and more complex variants.
Most straightforward thing would be along the lines of:

static void
fileBoxCancel (GtkWidget *w, GtkWidget *filesel)
{
  gtk_widget_destroy (filesel);
}

g_signal_connect (GTK_FILE_SELECTION (filesel)->cancel_button,
"clicked", 
                  G_CALLBACK (fileBoxCancel), filesel);


(If you use g_signal_connect_swapped(), you could use
gtk_widget_destroy()
as your callback directly, but the above is more general.)

Regards,
                                               Owen





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