gtk_main question

Ok I messed with GTK for a while, but it seems I can't quit gtk_main() the
way I need to. I have an app that simply needs to call a message box
(dialog) at one time, wait for the user to press OK, destroy the message
box and continue its execution. How would I do that? I made the dialog
appear, but when the user press OK, either the window stays there (if I
use gtk_widget_destroy and gtk_main_quit) and the program can continue, or
the window disapears but everything hang there (if I use only
gtk_widget_destroy) while gtk probably stays in the gtk_main loop.

What am I doing wrong here?

Relating code:

int destroy_msgbox(GtkWidget *widget, GtkWidget *entry)

main(int argc, char *argv[])
 printf("Widget *should* be gone by now...\n");

int msgbox(int argc, char *argv[])
 gtk_init (&argc, &argv);
 dialog_window = gtk_dialog_new ();      
 gtk_signal_connect (GTK_OBJECT (dialog_window), "destroy",
  GTK_SIGNAL_FUNC(destroy_msgbox), &dialog_window);
 gtk_signal_connect (GTK_OBJECT (dialog_window), "delete_event",
  GTK_SIGNAL_FUNC(destroy_msgbox), &dialog_window);
 gtk_window_set_title (GTK_WINDOW (dialog_window), "Socket Script");
 gtk_container_border_width (GTK_CONTAINER (dialog_window), 0);
 label = gtk_label_new ("This would be our message");
 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog_window)->vbox),
  label, TRUE, TRUE, 0);
 gtk_widget_show (label);
 button = gtk_button_new_with_label ("OK");
 gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
  GTK_SIGNAL_FUNC(destroy_msgbox), GTK_OBJECT (dialog_window));
 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog_window)->action_area),
  button, TRUE, TRUE, 0);
 gtk_widget_show (button);
 gtk_widget_show (dialog_window);
DarkElf Network SysAdmin              
OKC.OK.US.UnderNet.Org Operator      
    Check the main resource for developers at

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