WIP: on_toggle_STATE_RULES_DATA button in callback

This commit is contained in:
Jean Sirmai 2024-06-13 09:26:01 +02:00
parent 246c2f2cac
commit c8e587137a
Signed by: jean
GPG Key ID: FB3115C340E057E3
4 changed files with 34 additions and 15 deletions

View File

@ -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"); // 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"); const char* current_label = gtk_button_get_label (GTK_BUTTON (btt_toggle_STATE_RULES_DATA));
// gtk_button_set_label (GTK_BUTTON (btt_toggle_state_rules), "rules"); // 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) void on_toggle_observ_interpret (GtkWidget *btt_toggle_observ_interpret, gpointer data)

View File

@ -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_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_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_toggle_observ_interpret (GtkWidget *btt_toggle_observ_interpret, gpointer data);
void on_SAVE_CURRENT_MODEL_BEFORE_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data); void on_SAVE_CURRENT_MODEL_BEFORE_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data);

View File

@ -164,24 +164,30 @@ void window_header_bar (GtkWindow *window, char *title){
gpointer no_local_data = NULL; 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 ()); 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, "system-run-symbolic");
gtk_button_set_icon_name (exec_xor_edit, "power-profile-balanced-rtl-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")); // GtkWidget* separe = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
g_signal_connect (toggle_state_rules, "clicked", G_CALLBACK (on_toggle_state_rules), no_local_data); // gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (separe));
GtkButton *observ_interpret = GTK_BUTTON (gtk_button_new_with_label ("observe")); GtkWidget *any_Label = GTK_WIDGET (gtk_label_new ("------------"));
g_signal_connect (observ_interpret, "clicked", G_CALLBACK (on_toggle_observ_interpret), no_local_data);
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 (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 (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 (any_Label));
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 (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 icons_for_fun (GTK_HEADER_BAR (header_bar)); // https://iconduck.com/sets/adwaita-icon-theme
} }

View File

@ -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_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_set_modal (GTK_WINDOW (dialog_window), TRUE);
gtk_window_present (GTK_WINDOW (dialog_window)); // gtk_window_present (GTK_WINDOW (dialog_window)); see button...
} }