From 3e1ff4a54acb5a038c072d17746bebc7fc575d7c Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Tue, 24 Sep 2024 17:15:39 +0200 Subject: [PATCH] utilisation dangereuse des labels des boutons (synth, state, rules,...) pour deux fonctions (sur fsm et widget) --- src/fsm/dispatch.c | 13 ++++++++++--- src/main.c | 5 ++--- src/signal.c | 10 ++++++++-- src/util/tree.c | 3 ++- src/widget/topbar/left.c | 5 +++-- 5 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/fsm/dispatch.c b/src/fsm/dispatch.c index e28b43d..469bd00 100644 --- a/src/fsm/dispatch.c +++ b/src/fsm/dispatch.c @@ -83,28 +83,35 @@ void fsm_journal_event (int severity, void fsm_init (char *initial_message_from_main) { 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()", "measurement processes"); fsm_measures_list_init(); + fsm_journal_event (MESSAGE, FSM, "fsm/dispatch", "results list init()", "measurement results (gross)"); fsm_results_list_init(); + fsm_journal_event (MESSAGE, FSM, "fsm/dispatch", "displayables list init()", "displayable results"); fsm_displayables_list_init(); + fsm_journal_event (MESSAGE, FSM, "fsm/dispatch", "preferences list init()", "preferences"); fsm_preferences_list_init(); + fsm_journal_event (MESSAGE, FSM, "fsm/dispatch", "fsm initialisation", - "has ended 😇️ | 👉️ app initialization begins"); + "has ended 😇️"); } diff --git a/src/main.c b/src/main.c index ee55cec..685d5da 100644 --- a/src/main.c +++ b/src/main.c @@ -135,7 +135,7 @@ int main (int argc, char **argv) // def: src/fsm/dispatch fsm = finite state machine fsm_init ("first instruction / first log"); fsm_journal_event (INFO, MAIN, "main", "*app = gtk_application_new()", - "new app requested"); + "| 👉️ app initialization requested"); GtkApplication *app = gtk_application_new ("org.gem-graph", 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 !"); g_object_unref (app); - fsm_journal_event (INFO, MAIN, "main", "That'all folks !", "👋️😄️\ - \n NB I use logs to structure the project better."); + fsm_journal_event (INFO, MAIN, "main", "That'all folks !", "👋️😄️"); fsm_journal_publication_request(); return status; diff --git a/src/signal.c b/src/signal.c index 7be6b3d..33e2991 100644 --- a/src/signal.c +++ b/src/signal.c @@ -341,8 +341,14 @@ static void switch_state_rules_data() } // TODO Il doit y avoir plus élégant,... ET SURTOUT MOINS DANGEREUX !!! -// >>> voir le détail dans prefer.c : -// Les noms d'icônes sont utilisés pour deux fonctions distinctes... +// que d'utiliser: strcmp (toggled_button_name, "label_du_bouton") car: +// 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) { const char *toggled_button_name diff --git a/src/util/tree.c b/src/util/tree.c index 230d461..f23727c 100644 --- a/src/util/tree.c +++ b/src/util/tree.c @@ -87,7 +87,8 @@ static GListModel *get_user_tree_model (GObject *item, gpointer root) 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,"); widget_let_us_create_a_complex_useless_and_expensive_tree (tree_root); diff --git a/src/widget/topbar/left.c b/src/widget/topbar/left.c index e807bdb..4ce3641 100644 --- a/src/widget/topbar/left.c +++ b/src/widget/topbar/left.c @@ -83,6 +83,7 @@ void window_design_topbar_left (GtkWidget *header_bar) + #define YOU_WANT_TO_START_ON_ANOTHER_PAGE 0 /******************************************************************************/ /* 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 !...) */ /******************************************************************************/ - gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_rules()), TRUE); 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_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_data()), TRUE); - } + } else + gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_rules()), TRUE); }