Re: Destroying file selection
- From: Michael Hagemann <michael hagemann unibas ch>
- To: gtk-list gnome org
- Subject: Re: Destroying file selection
- Date: Mon, 03 Feb 2003 10:58:01 +0100
On Mon, 03 Feb 2003 11:44:40 +1100 (EST) Raymond Wan wrote:
> If you or someone else has the time to look over my code that
> would be great -- I'm getting quite confused. I've stripped away as much
> as I could so that I have the main window, a menu, and the fileselector
> that replicates the problem. I figured if I just have the fileselector,
> then I would have the tutorial code. I'm guessing I must have made a
> mistake elsewhere in the code or overlooked something obvious.
What makes me suspicious about your code is the following line:
> g_signal_connect (GTK_FILE_SELECTION (filesel)->ok_button, "destroy",
> G_CALLBACK (gtk_main_quit), NULL);
This seems to kill the app as soon as the filesel is destroyed!?
And the thing I liked most about the 2.0 series is that you now have
gtk_dialog_run(). I typically us it with a generic accept function
along the lines of:
gint response_accept_cb(GtkWidget *widget, gpointer *data)
{
GtkWidget *dialog = (GtkWidget *) data;
gtk_dialog_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
return TRUE;
}
[...]
g_signal_connect (
GTK_OBJECT (GTK_FILE_SELECTION (file_selection)->ok_button), "clicked",
G_CALLBACK (response_accept_cb), file_selection);
response = gtk_dialog_run(GTK_DIALOG(file_selection));
if (response == GTK_RESPONSE_ACCEPT)
{
[...]
}
gtk_widget_destroy(file_selection);
}
HTH,
michael
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]