diff --git a/callback.c b/callback.c index ba35ddb..04b4d24 100644 --- a/callback.c +++ b/callback.c @@ -202,23 +202,24 @@ void on_open_STATE (GtkWidget *btt_open_STATE, gpointer user_data) { void on_open_RULES (GtkWidget *btt_open_RULES, gpointer data) { if (0) printf("on_open_RULES status = %d\n", get_status ()); - window_main_child (main_window, RULES); + if (! gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("rules")))) window_main_child (main_window, RULES); }// SWITCH_TO (RULES);} void on_open_DATA (GtkWidget *btt_open_DATA, gpointer data) { if (0) printf("on_open_DATA status = %d\n", get_status ()); - window_main_child (main_window, DATA); + if (! gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("data analysis")))) window_main_child (main_window, DATA); }// SWITCH_TO (DATA);} -void on_toggle_STATE_RULES_DATA (char *source, gpointer user_data) { +void on_toggle_STATE_RULES_DATA (GtkWidget *btt, 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",\ + char *source = ""; + if (0) printf("gtk_check_button_get_active > %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)))); diff --git a/callback.h b/callback.h index dba7b27..3516c50 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 (char *source, gpointer user_data); +void on_toggle_STATE_RULES_DATA (GtkWidget *btt, gpointer user_data); diff --git a/contain.c b/contain.c index caa947a..ac29708 100644 --- a/contain.c +++ b/contain.c @@ -198,14 +198,17 @@ void window_header_bar (GtkWindow *window, char *title){ btt_open_STATE = GTK_BUTTON (gtk_check_button_new_with_label ("state")); g_signal_connect (btt_open_STATE, "toggled", G_CALLBACK (on_open_STATE), no_local_data); + g_signal_connect (btt_open_STATE, "toggled", G_CALLBACK (on_toggle_STATE_RULES_DATA), no_local_data); gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_STATE), group_STATE_RULES_DATA); btt_open_RULES = GTK_BUTTON (gtk_check_button_new_with_label ("rules")); g_signal_connect (btt_open_RULES, "toggled", G_CALLBACK (on_open_RULES), no_local_data); + g_signal_connect (btt_open_RULES, "toggled", G_CALLBACK (on_toggle_STATE_RULES_DATA), no_local_data); gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_RULES), group_STATE_RULES_DATA); btt_open_DATA = GTK_BUTTON (gtk_check_button_new_with_label ("data analysis")); g_signal_connect (btt_open_DATA, "toggled", G_CALLBACK (on_open_DATA), no_local_data); + g_signal_connect (btt_open_DATA, "toggled", G_CALLBACK (on_toggle_STATE_RULES_DATA), no_local_data); gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_DATA), group_STATE_RULES_DATA); // gtk_check_button_set_label (GTK_CHECK_BUTTON (btt_open_DATA), "any label"); @@ -215,9 +218,9 @@ void window_header_bar (GtkWindow *window, char *title){ gtk_check_button_get_label (GTK_CHECK_BUTTON (btt_open_DATA))); 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_get_active (GTK_CHECK_BUTTON (get_GtkButton ("state"))), + gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("rules"))), + gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("data analysis")))); // gtk_check_button_set_active (GTK_CHECK_BUTTON (get_GtkButton ("state")), TRUE); @@ -226,7 +229,7 @@ void window_header_bar (GtkWindow *window, char *title){ 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) ; +// on_toggle_STATE_RULES_DATA (, 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