From 48e8884ab1d39a0d219ddbe42dc05fa5cfd4736d Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Sat, 22 Jun 2024 06:03:23 +0200 Subject: [PATCH] =?UTF-8?q?WIP:=20un=20peu=20'tricky'...=20=20je=20ne=20l?= =?UTF-8?q?=C3=A2che=20pas=20le=20fil...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- callback.c | 17 ++++++++++++----- callback.h | 2 +- contain.c | 6 ++++-- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/callback.c b/callback.c index 868a628..ba35ddb 100644 --- a/callback.c +++ b/callback.c @@ -190,8 +190,8 @@ void on_toggle_EXEC_EDIT (GtkWidget *btt_XOR_EXEC_EDIT, GtkWidget *btt_MODEL_RUN -void on_open_STATE (GtkWidget *btt_open_STATE, gpointer data) { - printf("on_open_STATE status = %d\n", get_status ()); +void on_open_STATE (GtkWidget *btt_open_STATE, gpointer user_data) { + if (0) printf("on_open_STATE status = %d\n", get_status ()); printf("gtk_check_button_get_active > after = %d, %d, %d from callback : on_open_STATE()\n",\ gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("state"))), // (GTK_CHECK_BUTTON (btt_open_STATE)), gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("rules"))), // (GTK_CHECK_BUTTON (btt_open_RULES)), @@ -201,12 +201,12 @@ void on_open_STATE (GtkWidget *btt_open_STATE, gpointer data) { }// SWITCH_TO (STATE);} void on_open_RULES (GtkWidget *btt_open_RULES, gpointer data) { - printf("on_open_RULES status = %d\n", get_status ()); + if (0) printf("on_open_RULES status = %d\n", get_status ()); window_main_child (main_window, RULES); }// SWITCH_TO (RULES);} void on_open_DATA (GtkWidget *btt_open_DATA, gpointer data) { - printf("on_open_DATA status = %d\n", get_status ()); + if (0) printf("on_open_DATA status = %d\n", get_status ()); window_main_child (main_window, DATA); }// SWITCH_TO (DATA);} @@ -214,9 +214,16 @@ void on_open_DATA (GtkWidget *btt_open_DATA, gpointer data) { -void on_toggle_STATE_RULES_DATA (GtkToggleButton *source, gpointer user_data) { +void on_toggle_STATE_RULES_DATA (char *source, gpointer user_data) { // https://docs.gtk.org/gtk4/class.ToggleButton.html < f..k ! bad code ++ // g_print ("Toggle button [%s] is active: %s\n", gtk_button_get_label (GTK_BUTTON (source)), gtk_toggle_button_get_active (source) ? "Yes" : "No"); + + printf("gtk_check_button_get_active > after = %d, %d, %d from callback : on_toggle_STATE_RULES_DATA()\n",\ + gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton (source))), + gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton (source))), + gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton (source)))); + + int choice = 0; switch (choice) { case (STATE): get_GtkButton ("state"); break; // get_window_child_STATE (); diff --git a/callback.h b/callback.h index 79025dd..dba7b27 100644 --- a/callback.h +++ b/callback.h @@ -24,4 +24,4 @@ void on_open_DATA (GtkWidget *btt_open_DATA, gpointer data); void on_SAVE_CURRENT_MODEL_BEFORE_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data); void on_DISCARD_CURRENT_MODEL_AND_START_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data); void on_WRITE_CURRENT_MODEL (GtkWidget *btt_WRITE_CURRENT_MODEL, gpointer data); -void on_toggle_STATE_RULES_DATA (GtkToggleButton *source, gpointer user_data); +void on_toggle_STATE_RULES_DATA (char *source, gpointer user_data); diff --git a/contain.c b/contain.c index 32b4526..caa947a 100644 --- a/contain.c +++ b/contain.c @@ -214,18 +214,20 @@ void window_header_bar (GtkWindow *window, char *title){ gtk_check_button_get_label (GTK_CHECK_BUTTON (btt_open_RULES)), gtk_check_button_get_label (GTK_CHECK_BUTTON (btt_open_DATA))); - printf("gtk_check_button_get_active > before = %d, %d, %d\n",\ + if (1) printf("gtk_check_button_get_active > before = %d, %d, %d\n",\ gtk_check_button_get_active (GTK_CHECK_BUTTON (btt_open_STATE)), gtk_check_button_get_active (GTK_CHECK_BUTTON (btt_open_RULES)), gtk_check_button_get_active (GTK_CHECK_BUTTON (btt_open_DATA))); // gtk_check_button_set_active (GTK_CHECK_BUTTON (get_GtkButton ("state")), TRUE); - printf("gtk_check_button_get_active > after = %d, %d, %d\n",\ + if (0) printf("gtk_check_button_get_active > after = %d, %d, %d\n",\ gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("state"))), // (GTK_CHECK_BUTTON (btt_open_STATE)), gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("rules"))), // (GTK_CHECK_BUTTON (btt_open_RULES)), gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("data analysis")))); // (GTK_CHECK_BUTTON (btt_open_DATA))); + on_toggle_STATE_RULES_DATA ("state", NULL) ; + gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_XOR_EXEC_EDIT)); gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_MODEL_RUN_STOP)); // << pas ici ! TODO gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (any_Label));