utilisation dangereuse des labels des boutons (synth, state, rules,...) pour deux fonctions (sur fsm et widget)

This commit is contained in:
Jean Sirmai 2024-09-24 17:15:39 +02:00
parent 6a914d3da4
commit 3e1ff4a54a
Signed by: jean
GPG Key ID: FB3115C340E057E3
5 changed files with 25 additions and 11 deletions

View File

@ -83,28 +83,35 @@ void fsm_journal_event (int severity,
void fsm_init (char *initial_message_from_main) void fsm_init (char *initial_message_from_main)
{ {
fsm_journal_init (&gg_logs); fsm_journal_init (&gg_logs);
fsm_journal_event (MESSAGE, MAIN, "main", initial_message_from_main, "👋️ (☕️)");
fsm_journal_event (MESSAGE, FSM, "fsm/dispatch", "fsm initialisation", "has began"); fsm_journal_event (MESSAGE, MAIN, "main", initial_message_from_main,
"👋️ (☕️)");
fsm_journal_event (MESSAGE, FSM, "fsm/dispatch", "fsm initialisation",
"has began");
fsm_journal_event (MESSAGE, FSM, "fsm/dispatch", "measures list init()", fsm_journal_event (MESSAGE, FSM, "fsm/dispatch", "measures list init()",
"measurement processes"); "measurement processes");
fsm_measures_list_init(); fsm_measures_list_init();
fsm_journal_event (MESSAGE, FSM, "fsm/dispatch", "results list init()", fsm_journal_event (MESSAGE, FSM, "fsm/dispatch", "results list init()",
"measurement results (gross)"); "measurement results (gross)");
fsm_results_list_init(); fsm_results_list_init();
fsm_journal_event (MESSAGE, FSM, "fsm/dispatch", "displayables list init()", fsm_journal_event (MESSAGE, FSM, "fsm/dispatch", "displayables list init()",
"displayable results"); "displayable results");
fsm_displayables_list_init(); fsm_displayables_list_init();
fsm_journal_event (MESSAGE, FSM, "fsm/dispatch", "preferences list init()", fsm_journal_event (MESSAGE, FSM, "fsm/dispatch", "preferences list init()",
"preferences"); "preferences");
fsm_preferences_list_init(); fsm_preferences_list_init();
fsm_journal_event (MESSAGE, FSM, "fsm/dispatch", "fsm initialisation", fsm_journal_event (MESSAGE, FSM, "fsm/dispatch", "fsm initialisation",
"has ended 😇️ | 👉️ app initialization begins"); "has ended 😇️");
} }

View File

@ -135,7 +135,7 @@ int main (int argc, char **argv)
// def: src/fsm/dispatch fsm = finite state machine // def: src/fsm/dispatch fsm = finite state machine
fsm_init ("first instruction / first log"); fsm_init ("first instruction / first log");
fsm_journal_event (INFO, MAIN, "main", "*app = gtk_application_new()", fsm_journal_event (INFO, MAIN, "main", "*app = gtk_application_new()",
"new app requested"); "| 👉️ app initialization requested");
GtkApplication *app = gtk_application_new ("org.gem-graph", GtkApplication *app = gtk_application_new ("org.gem-graph",
G_APPLICATION_DEFAULT_FLAGS); G_APPLICATION_DEFAULT_FLAGS);
@ -152,8 +152,7 @@ int main (int argc, char **argv)
fsm_journal_event (INFO, MAIN, "main", "g_object unref (app)", "bye bye app !"); fsm_journal_event (INFO, MAIN, "main", "g_object unref (app)", "bye bye app !");
g_object_unref (app); g_object_unref (app);
fsm_journal_event (INFO, MAIN, "main", "That'all folks !", "👋️😄️\ fsm_journal_event (INFO, MAIN, "main", "That'all folks !", "👋️😄️");
\n NB I use logs to structure the project better.");
fsm_journal_publication_request(); fsm_journal_publication_request();
return status; return status;

View File

@ -341,8 +341,14 @@ static void switch_state_rules_data()
} }
// TODO Il doit y avoir plus élégant,... ET SURTOUT MOINS DANGEREUX !!! // TODO Il doit y avoir plus élégant,... ET SURTOUT MOINS DANGEREUX !!!
// >>> voir le détail dans prefer.c : // que d'utiliser: strcmp (toggled_button_name, "label_du_bouton") car:
// Les noms d'icônes sont utilisés pour deux fonctions distinctes... // ces labels sont utilisés pour deux fonctions distinctes:
// (1) ici (just below): pour changer l'état de la fsm
// et là: src/widget/topbar/left.c:
// btt_SYNTH = GTK_BUTTON (gtk_check_button_new_with_label ("synth"));
// pour changer la page (le widget) affiché
// IL FAUT REGROUPER CES DEUX FONCTIONS
void on_toggle_state_rules_data (GtkWidget *toggled_button, gpointer user_data) void on_toggle_state_rules_data (GtkWidget *toggled_button, gpointer user_data)
{ {
const char *toggled_button_name const char *toggled_button_name

View File

@ -87,7 +87,8 @@ static GListModel *get_user_tree_model (GObject *item, gpointer root)
void *widget_get_user_rules_tree () void *widget_get_user_rules_tree ()
{ {
fsm_journal_event (DEBUG, RULES_TREE, "widget/tree", "get user rules tree", "[We, the people,]..."); fsm_journal_event (DEBUG, RULES_TREE, "util/tree", "get_user_rules_tree()",
"[We, the people,] <-- a tree node sample (root)");
struct TreeNode_t *tree_root = widget_create_user_tree_node("We, the people,"); struct TreeNode_t *tree_root = widget_create_user_tree_node("We, the people,");
widget_let_us_create_a_complex_useless_and_expensive_tree (tree_root); widget_let_us_create_a_complex_useless_and_expensive_tree (tree_root);

View File

@ -83,6 +83,7 @@ void window_design_topbar_left (GtkWidget *header_bar)
#define YOU_WANT_TO_START_ON_ANOTHER_PAGE 0 #define YOU_WANT_TO_START_ON_ANOTHER_PAGE 0
/******************************************************************************/ /******************************************************************************/
/* use the next lineS to select the page that will be presented first */ /* use the next lineS to select the page that will be presented first */
@ -91,13 +92,13 @@ void window_design_topbar_left (GtkWidget *header_bar)
/* the last one is the winner (and the winner takes it all !...) */ /* the last one is the winner (and the winner takes it all !...) */
/* THE LAST ONE IS THE WINNER (AND THE WINNER TAKES IT ALL !...) */ /* THE LAST ONE IS THE WINNER (AND THE WINNER TAKES IT ALL !...) */
/******************************************************************************/ /******************************************************************************/
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_rules()), TRUE);
if (YOU_WANT_TO_START_ON_ANOTHER_PAGE) { // select one if (YOU_WANT_TO_START_ON_ANOTHER_PAGE) { // select one
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_synth()), TRUE); gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_synth()), TRUE);
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_rules()), TRUE); gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_rules()), TRUE);
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_state()), TRUE); gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_state()), TRUE);
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_data()), TRUE); gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_data()), TRUE);
} } else
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_rules()), TRUE);
} }