The whole idea of GUI programming is based on the "event driven" idea. This means that your application does not anymore go through a flow from the beginning to the end, but that you prepare your application by building your GUI and setting up event handlers, and then you hand over the control to the the special main loop. Programming this way takes time getting used to, but any other way of programming in a GUI environment will not really work. The reason is that it is not only you that need to carry out tasks, but there are lots of tasks that happen "behind the scenes", like repainting of exposed areas, handling of keyboard events, etc. So what you do in your event handlers is that you define additional handlers that you want to happen as well, in addition or in replacement to the default handlers. In another word, don't try to work around the event driven design of gtk, but adapt it instead... But regarding your error message. Dialogs and gtk_dialog_run() are a bit of an exception to the normal event handling paradigm, as it will wait syncronously until the dialog is closed. This code works fine. But the gtk_main() fails, because you have no other widgets defined. But if all you want to do is to run a dialog and quit, then you don't need to run gtk_main() at all. Hope this helps. Regards, Dov On Wed, Dec 29, 2004 at 02:51:34PM +0000, Joao Victor wrote: > Hi, > > i'm trying to make a very simple program that shows the gtk file > chooser, and quits after the user selects something. > > So basically i called gtk_file_chooser_dialog_new, and did: > > --------- > if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) { > gtk_widget_destroy (dialog); > gtk_main_quit (); > } > else { > gtk_widget_destroy (dialog); > gtk_main_quit (); > } > > gtk_main (); > return 0; > -------- > > The thing is: the gtk_main_quit is being called, but i'm getting this error: > > "Gtk-CRITICAL **: file gtkmain.c: line 1231 (gtk_main_quit): assertion > `main_loops != NULL' failed" > > Why's that? > > I've taken a look at zenity's code, but zenity uses a callback... i > didn't want to use callback for this. > > Thanks, > J.V. > _______________________________________________ > > gtk-list@xxxxxxxxx > http://mail.gnome.org/mailman/listinfo/gtk-list _______________________________________________ gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list