I am kind of new to GTK. I am in the process of porting our
application that was written with ncures and pthreads to GTK.
        Well I am in evaluation stage, but Try this:
        void dialog (void)
         {      
                 GtkWidget *dialog;     
            gdk_threads_enter();
                dialog = gtk_message_dialog_new(NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
                                                GTK_MESSAGE_WARNING,
GTK_BUTTONS_OK, "Sample message");
                 g_signal_connect_swapped (GTK_OBJECT (dialog), 
                                     "response", 
                                     G_CALLBACK (gtk_widget_destroy),
                                     GTK_OBJECT (dialog));
           /* Add the label, and show everything we've added to the dialog.
*/
            gtk_widget_show_all (dialog);
                gdk_threads_leave();
                }
        ALSO:
        in make file have something like this:
        $(TARGET) : $(TARGET).o 
                $(CC) -o $(TARGET) $(TARGET).o `pkg-config --libs
gthread-2.0` `pkg-config --libs gtk+-2.0` -lgtk-x11-2.0 -lpthread  
        $(TARGET).o : $(TARGET).c 
                $(CC) -D_REENTRANT -c `pkg-config --cflags gthread-2.0`
`pkg-config --cflags gtk+-2.0` $(TARGET).c  

*       From: Jean-Yves Lefort <jylefort brutele be> 
*       To: gtk-list gnome org 
*       Subject: Multithreading and dialog boxes 
*       Date: Sat, 22 Jun 2002 12:13:19 +0200 

Hi,

(Gtk2) Whenever I run a dialog box from inside a thread, the dialog box
never gets destroyed, and it hangs my application:

void dialog (void) {
        GtkWidget *dialog;

        gdk_threads_enter();

        dialog = gtk_message_dialog_new(NULL,
                                        GTK_DIALOG_DESTROY_WITH_PARENT,
                                        GTK_MESSAGE_WARNING,
                                        GTK_BUTTONS_OK,
                                        "Sample message");

        gtk_dialog_run(GTK_DIALOG(dialog));
        gtk_widget_destroy(dialog);

        gdk_threads_leave();
}

It works fine when called within the main thread, btw.

Any clue?

Regards,
Jean-Yves Lefort

-- 
Jean-Yves Lefort

_______________________________________________
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to