Hi geoffjay!! thank you for reply!!
You are right, I have to use those calls. This code works properly
gint delete_event(GtkWidget *widget, GdkEvent *event, gpointer data )
label=gtk_label_new("just a label");
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),label, TRUE, TRUE, 0);
gint ret= gtk_dialog_run (GTK_DIALOG (dialog));
/* take action depending on ret */
perror("error creating tread\n");
int main( int argc, char *argv )
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (G_OBJECT (window), "delete_event",G_CALLBACK (delete_event), NULL);
box1 = gtk_hbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), box1);
button = gtk_button_new_with_label ("Button 1");
g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (init_dialog), (gpointer) "button 1");
gtk_box_pack_start (GTK_BOX(box1), button, TRUE, TRUE, 0);
gtk_widget_set_name (button, "special button");
This is a summary of a much larger code. I only wanted to post the problem, not the entire code.
I am developing a network application. So a server must be listening using “accept” call, which blocks, so that's why I need another thread. The main thread for the main application, other thread listening on clients to “connect”. When a connection from a client arrives, a dialog is shown, using gtk_dialog_run (GTK_DIALOG (dialog));
So my problem now is that if I use a server thread, it is always running, will never call to gdk_threads_leave. This is a pseudo code example
gdk_threads_leave(); will never be executed
So right now the only solution is to wrap gtk_dialog_run (GTK_DIALOG (dialog)); with these calls.
gtk_dialog_run (GTK_DIALOG (dialog));
Do you find other solution??
Thank you very very much!!!!