From d1918a0d0b32a470ac240ef1e30938b3d0346f5c Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Wed, 12 Jun 2024 00:16:45 +0200 Subject: [PATCH] =?UTF-8?q?WIP:=20gtk=5Fwindow=5Fclose=20(GTK=5FWINDOW=20(?= =?UTF-8?q?data));=20<=20ferme=20la=20fen=C3=AAtre=20dialogue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- callback.c | 11 +++++------ dialog.c | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/callback.c b/callback.c index 4298e14..92f2d6f 100644 --- a/callback.c +++ b/callback.c @@ -198,17 +198,16 @@ void on_toggle_observ_interpret (GtkWidget *btt_toggle_observ_interpret, gpointe void on_SAVE_CURRENT_MODEL_BEFORE_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data) { gtk_widget_set_sensitive (GTK_WIDGET (data), TRUE); - printf ("callback.c (line 200) - SAVE_CURRENT_MODEL_BEFORE_EDITING\n"); + printf ("callback.c (line 201) - SAVE_CURRENT_MODEL_BEFORE_EDITING\n"); } void on_DISCARD_CURRENT_MODEL_AND_START_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data) { - gtk_widget_set_sensitive (GTK_WIDGET (data), FALSE); - printf ("callback.c (line 204) - DISCARD_CURRENT_MODEL_AND_START_EDITING\n"); + gtk_window_close (GTK_WINDOW (data)); + printf ("callback.c (line 206) - DISCARD_CURRENT_MODEL_AND_START_EDITING\n"); } void on_WRITE_CURRENT_MODEL (GtkWidget *btt_WRITE_CURRENT_MODEL, gpointer data) { -// close_request (GTK_WINDOW (data)); < comment fermer la fenêtre ? TODO -// attention: déclaration implicite de la fonction « close_request » - printf ("callback.c (line 208) - WRITE_THE_CURRENT_MODEL\n"); + gtk_window_close (GTK_WINDOW (data)); + printf ("callback.c (line 211) - WRITE_CURRENT_MODEL\n"); } diff --git a/dialog.c b/dialog.c index d7be7ee..9c01762 100644 --- a/dialog.c +++ b/dialog.c @@ -32,7 +32,7 @@ void dialog_window_design (GtkWindow *main_window, GtkWindow *dialog_window){ gtk_box_append (YES_NO_box, GTK_WIDGET (click_yes)); GtkButton *click_no = GTK_BUTTON (gtk_button_new_with_label ("NO")); - g_signal_connect (click_no, "clicked", G_CALLBACK (on_DISCARD_CURRENT_MODEL_AND_START_EDITING), action_save_current_model); + g_signal_connect (click_no, "clicked", G_CALLBACK (on_DISCARD_CURRENT_MODEL_AND_START_EDITING), dialog_window); gtk_box_append (YES_NO_box, GTK_WIDGET (click_no)); GtkBox *WINDOW_CHILD_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 0)); @@ -43,7 +43,7 @@ void dialog_window_design (GtkWindow *main_window, GtkWindow *dialog_window){ gtk_window_set_transient_for (GTK_WINDOW (dialog_window), GTK_WINDOW (main_window)); gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog_window), TRUE); -// gtk_window_set_deletable (GTK_WINDOW (dialog_window), FALSE); // FALSE + gtk_window_set_deletable (GTK_WINDOW (dialog_window), FALSE); // FALSE gtk_window_set_modal (GTK_WINDOW (dialog_window), TRUE); gtk_window_present (GTK_WINDOW (dialog_window)); }