Bonjour,

j'aimerais savoir si il existe, dans GTK, une fonction qui permet d'ordonner à un GtkDialog de se fermer

J'ai le code suivant:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
void* play(void* dialog) { 
    GtkWidget* dialogAttente = (GtkWidget*) dialog;
    
    int clockStart = clock()/CLOCKS_PER_SEC;  
    while(((clock()/CLOCKS_PER_SEC)- clockStart) < 5) {
         clock();
    }   
    
    // Instruction pour terminer le dialog                  
      
    gtk_widget_destroy(dialogAttente);
    return NULL;
}

void procedure() {
    GtkWidget* dialogAttente = gtk_dialog_new();
    gtk_widget_set_parent(dialogAttente, gui->fenetre);
    GtkWidget* label = gtk_label_new("Veuillez patienter...");
    
    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialogAttente)->vbox), label, TRUE, FALSE, 0);
    gtk_widget_show_all(GTK_DIALOG(dialogAttente)->vbox);
    pthread_t threadJeuRobot;
    
    gtk_dialog_run(GTK_DIALOG(dialogAttente)); 
    pthread_create(&threadJeuRobot, NULL, play, dialogAttente);
}
l'idée est la suivante: la fonction "procedure", gérée par le thread principal crée un dialog, l'ouvre, et crée un second thread, qui doit fermer le dialog après 5 secondes d'attente

Seulement il me faut l'instruction permettant de fermer le dialog ; le gtk_widget_destroy n'a pas l'air de faire l'affaire

une idée?

Merci d'avance