From c8e587137a08a307fdc84f89612c80e90ef307d5 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Thu, 13 Jun 2024 09:26:01 +0200 Subject: [PATCH] WIP: on_toggle_STATE_RULES_DATA button in callback --- callback.c | 19 ++++++++++++++++--- callback.h | 2 +- contain.c | 26 ++++++++++++++++---------- dialog.c | 2 +- 4 files changed, 34 insertions(+), 15 deletions(-) diff --git a/callback.c b/callback.c index 6840698..fba6dec 100644 --- a/callback.c +++ b/callback.c @@ -184,10 +184,23 @@ void on_toggle_model_exec (GtkWidget *btt_run_stop_model_exec, gpointer data) // gtk_button_set_label (GTK_BUTTON (btt_run_stop_model_exec), "stop"); } -void on_toggle_state_rules (GtkWidget *btt_toggle_state_rules, gpointer data) +void on_toggle_STATE_RULES_DATA (GtkWidget *btt_toggle_STATE_RULES_DATA, gpointer data) { -// gtk_button_set_label (GTK_BUTTON (btt_toggle_state_rules), "state"); -// gtk_button_set_label (GTK_BUTTON (btt_toggle_state_rules), "rules"); + const char* current_label = gtk_button_get_label (GTK_BUTTON (btt_toggle_STATE_RULES_DATA)); +// if (! strcmp (current_label, "rules")) printf ("callback.c (line 190) - strcomp +\n"); +// else printf ("callback.c (line 191) - strcomp -\n"); + + if (! strcmp (current_label, "rules")) gtk_button_set_label (GTK_BUTTON (btt_toggle_STATE_RULES_DATA), "state"); + else gtk_button_set_label (GTK_BUTTON (btt_toggle_STATE_RULES_DATA), "rules"); + +// if (! strcmp (current_label, " rules ")) gtk_button_set_label (GTK_BUTTON (btt_toggle_STATE_RULES_DATA), " state "); +// else if (! strcmp (current_label, " state ")) gtk_button_set_label (GTK_BUTTON (btt_toggle_STATE_RULES_DATA), "analyse"); +// else if (! strcmp (current_label, "analyse")) gtk_button_set_label (GTK_BUTTON (btt_toggle_STATE_RULES_DATA), " rules "); + + +// gtk_button_set_label (GTK_BUTTON (btt_toggle_STATE_RULES_DATA), "state"); +// gtk_button_set_label (GTK_BUTTON (btt_toggle_STATE_RULES_DATA), "rules"); +// gtk_window_present (dialog_window); } void on_toggle_observ_interpret (GtkWidget *btt_toggle_observ_interpret, gpointer data) diff --git a/callback.h b/callback.h index 87031de..b4a4b5b 100644 --- a/callback.h +++ b/callback.h @@ -16,7 +16,7 @@ void on_axis_value_change (GtkAdjustment *adjustment, gpointer data); void on_toggle_exec_edit (GtkWidget *btt_exec_xor_edit, GtkWidget *btt_run_stop_model_exec); void on_toggle_model_exec (GtkWidget *btt_run_stop_model_exec, gpointer data); -void on_toggle_state_rules (GtkWidget *btt_toggle_state_rules, gpointer data); +void on_toggle_STATE_RULES_DATA (GtkWidget *btt_toggle_STATE_RULES_DATA, gpointer data); void on_toggle_observ_interpret (GtkWidget *btt_toggle_observ_interpret, gpointer data); void on_SAVE_CURRENT_MODEL_BEFORE_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data); diff --git a/contain.c b/contain.c index bac54c2..d8104f1 100644 --- a/contain.c +++ b/contain.c @@ -164,24 +164,30 @@ void window_header_bar (GtkWindow *window, char *title){ gpointer no_local_data = NULL; - GtkButton *run_stop_model_exec = GTK_BUTTON (gtk_button_new_with_label (" run ")); - g_signal_connect (run_stop_model_exec, "clicked", G_CALLBACK (on_toggle_model_exec), no_local_data); - GtkButton *exec_xor_edit = GTK_BUTTON (gtk_toggle_button_new ()); gtk_button_set_icon_name (exec_xor_edit, "system-run-symbolic"); gtk_button_set_icon_name (exec_xor_edit, "power-profile-balanced-rtl-symbolic"); - g_signal_connect (exec_xor_edit, "clicked", G_CALLBACK (on_toggle_exec_edit), run_stop_model_exec); +// g_signal_connect (exec_xor_edit, "clicked", G_CALLBACK (on_toggle_exec_edit), run_stop_model_exec); - GtkButton *toggle_state_rules = GTK_BUTTON (gtk_button_new_with_label ("state")); - g_signal_connect (toggle_state_rules, "clicked", G_CALLBACK (on_toggle_state_rules), no_local_data); +// GtkWidget* separe = gtk_separator_new (GTK_ORIENTATION_VERTICAL); +// gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (separe)); - GtkButton *observ_interpret = GTK_BUTTON (gtk_button_new_with_label ("observe")); - g_signal_connect (observ_interpret, "clicked", G_CALLBACK (on_toggle_observ_interpret), no_local_data); + GtkWidget *any_Label = GTK_WIDGET (gtk_label_new ("------------")); + + GtkButton *run_stop_model_exec = GTK_BUTTON (gtk_button_new_with_label (" run ")); + g_signal_connect (run_stop_model_exec, "clicked", G_CALLBACK (on_toggle_model_exec), no_local_data); + + GtkButton *btt_toggle_STATE_RULES_DATA = GTK_BUTTON (gtk_button_new_with_label ("rules")); + g_signal_connect (btt_toggle_STATE_RULES_DATA, "clicked", G_CALLBACK (on_toggle_STATE_RULES_DATA), no_local_data); + +// GtkButton *observ_interpret = GTK_BUTTON (gtk_button_new_with_label ("data analysis")); +// g_signal_connect (observ_interpret, "clicked", G_CALLBACK (on_toggle_observ_interpret), no_local_data); gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (exec_xor_edit)); gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (run_stop_model_exec)); - gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (toggle_state_rules)); - gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (observ_interpret)); + gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (any_Label)); + gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_toggle_STATE_RULES_DATA)); +// gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (observ_interpret)); icons_for_fun (GTK_HEADER_BAR (header_bar)); // https://iconduck.com/sets/adwaita-icon-theme } diff --git a/dialog.c b/dialog.c index 1a745b0..a872962 100644 --- a/dialog.c +++ b/dialog.c @@ -31,7 +31,7 @@ void dialog_window_design (GtkWindow *main_window, GtkWindow *dialog_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_modal (GTK_WINDOW (dialog_window), TRUE); - gtk_window_present (GTK_WINDOW (dialog_window)); +// gtk_window_present (GTK_WINDOW (dialog_window)); see button... }