On Sat, 2007-10-06 at 12:12 -0400, Andrew Smith wrote: > Hi > > I accidentally learned that it's possible to have a working GTK > application without a call to gtk_main(): > > int main() > { > GtkWidget* mainDialog; > int rc; > > gtk_init(&argc, &argv); > > /* main window */ > mainDialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, > GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, > _("some question")); > gtk_window_set_title(GTK_WINDOW(mainDialog), "question?"); > gtk_dialog_add_buttons(GTK_DIALOG(mainDialog), > _("yes"), GTK_RESPONSE_OK, > _("no"), GTK_RESPONSE_CANCEL, > NULL); > > rc = gtk_dialog_run(GTK_DIALOG(mainDialog)); > > if(rc == GTK_RESPONSE_OK) > { > //do something > } > > return 0; > } > > This works fine except I don't see the dialog in the taskbar or the tast > switcher. That's my first question - can I still only use a GtkDialog or > do I need to make a GtkWindow to have it show up in the taskbar? > > And the second question - is there anything obviously wrong with not > calling gtk_main()?
You have not called gtk_widget_show_all(). gtk_dialog_run() calls gtk_main_loop_new() and gtk_main_loop_run() itself (it creates a nested main loop), which is what gtk_main() would (amongst other things) do, so in this simple case it should work. Chris _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list