WIP: cleaning

This commit is contained in:
Jean Sirmai 2024-09-02 18:50:47 +02:00
parent cbb8495783
commit 0bf0a4fd19
Signed by: jean
GPG Key ID: FB3115C340E057E3
6 changed files with 16 additions and 33 deletions

View File

@ -54,9 +54,8 @@ typedef struct disp_list {int value; struct disp_list *suiv;} disp_list ;
typedef struct journal {int value; struct journal *prev;} journal; typedef struct journal {int value; struct journal *prev;} journal;
// ref: sudo cat /var/log/messages // ref: sudo cat /var/log/messages
GtkApplication *fsf_get_app(); // def: main call: fsm/engine/engine; void fsm_init(); // def: fsm/dispatch; call: main;
void fsm_engine_init(); // def: fsm/engine/engine; call main
void fsm_init(bool mode_console); // def: fsm/dispatch; call: main;
void fsm_preferences_init(); // def: fsm/prefer; call: fsm/dispatch; void fsm_preferences_init(); // def: fsm/prefer; call: fsm/dispatch;
void fsm_measures_list_init(); // def: fsm/measure/manage.c; call: fsm/dispatch; void fsm_measures_list_init(); // def: fsm/measure/manage.c; call: fsm/dispatch;
void fsm_results_list_init(); // def: fsm/results; call: fsm/dispatch; void fsm_results_list_init(); // def: fsm/results; call: fsm/dispatch;

View File

@ -58,18 +58,12 @@
/* F S M I N I T */ /* F S M I N I T */
/******************************************************************************/ /******************************************************************************/
void fsm_init(bool mode_console) void fsm_init()
{ {
if (mode_console) fsm_engine_init(); // pour avancer, en attendant... 😇️
else {
fsm_measures_list_init(); fsm_measures_list_init();
fsm_results_list_init(); fsm_results_list_init();
fsm_displayable_list_init(); fsm_displayable_list_init();
fsm_preferences_init(); fsm_preferences_init();
printf("exemple de format de journal : 2024-08-31 [%s()] %s\
< NB ce printf() se trouve dans 'fsm/dispatch.c'\n", __func__, "message"); // logging TODO TODO
// un exemple : $ sudo cat /var/log/messages
}
} }

View File

@ -28,7 +28,6 @@
#include <stdbool.h> #include <stdbool.h>
#include <time.h> #include <time.h>
#include "../../../include/fsm.h" #include "../../../include/fsm.h"
#include "../../../include/widget.h"
/******************************************************************************/ /******************************************************************************/
@ -52,6 +51,8 @@ static void fsm_strange_engine()
(int)(milliseconds / 1000), /* secs (Must be Non-Negative) */ (int)(milliseconds / 1000), /* secs (Must be Non-Negative) */
(milliseconds % 1000) * 1000000 /* nano (Must be in range of 0 to 999999999) */ (milliseconds % 1000) * 1000000 /* nano (Must be in range of 0 to 999999999) */
}; };
printf("fsm mode_console 😇️ (see@ 'src/engine/engine.c\n");
int stop = 0; int stop = 0;
while (! stop) { while (! stop) {
printf(" | M . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); printf(" | M . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
@ -88,9 +89,9 @@ static void fsm_strange_engine()
printf(" | W =-- . . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); printf(" | W =-- . . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
printf(" | M=- . .|\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); printf(" | M=- . .|\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
printf(" | W- . .|\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); printf(" | W- . .|\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
if (getchar() == '\n') stop = 1; stop = (getchar() == '\n');
} }
// if (stop) g_object_unref (fsf_get_app()); // widget_design_main_window (NULL); // widget_get_main_window()); printf("\x1b[1Fsrc/fsm/engine.c | src/fsm/engine.c fsm_strange_engine stopped\n");
} }

View File

@ -133,20 +133,17 @@
#include "../include/signal.h" #include "../include/signal.h"
#include "../include/fsm.h" #include "../include/fsm.h"
GtkApplication *app;
GtkApplication *fsf_get_app() {return app;}
int main (int argc, char **argv) int main (int argc, char **argv)
{ {
int status; int status;
app = gtk_application_new ("org.gem-graph", G_APPLICATION_DEFAULT_FLAGS); GtkApplication *app = gtk_application_new ("org.gem-graph", G_APPLICATION_DEFAULT_FLAGS);
bool mode_console = FALSE; // TRUE FALSE fsm_engine_init(); // def: fsm/engine/engine;
fsm_init (mode_console); // fsm = finite state machine (see : src/fsm/dispatch.c) fsm_init (); // fsm = finite state machine (see : src/fsm/dispatch.c)
g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL); g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL);
// on_windows_activation <> see : src/widget/dispatch.c // on_windows_activation <> see: src/widget/dispatch.c (NOT src/signal.c)
status = g_application_run (G_APPLICATION (app), argc, argv); status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app); g_object_unref (app);

View File

@ -66,20 +66,7 @@ void on_windows_activation (GtkApplication *app)
dialog_window = GTK_WINDOW (gtk_application_window_new (app)); dialog_window = GTK_WINDOW (gtk_application_window_new (app));
text_window = GTK_WINDOW (gtk_application_window_new (app)); text_window = GTK_WINDOW (gtk_application_window_new (app));
//-----------------------------------------------------------------------------------//
//-----------------------------------------------------------------------------------//
printf("mode_console 😇️\
(see@ 'src/widget/dispatch.c on_windows_activation() < POUR RÉACTIVER GTK4)\n");
// S I P A S M O D E - C O N S O L E
widget_design_main_window (main_window); // def: widget/topbar/dispatch widget_design_main_window (main_window); // def: widget/topbar/dispatch
// S I P A S M O D E - C O N S O L E
fsm_engine_init();
//-----------------------------------------------------------------------------------//
//-----------------------------------------------------------------------------------//
widget_design_dialog_window (main_window, dialog_window); widget_design_dialog_window (main_window, dialog_window);
widget_design_text_window (main_window, text_window); widget_design_text_window (main_window, text_window);
} }

View File

@ -45,6 +45,11 @@ void *widget_get_data_page()
gtk_paned_set_shrink_start_child (GTK_PANED (measures_and_results), FALSE); gtk_paned_set_shrink_start_child (GTK_PANED (measures_and_results), FALSE);
gtk_paned_set_shrink_end_child (GTK_PANED (measures_and_results), FALSE); gtk_paned_set_shrink_end_child (GTK_PANED (measures_and_results), FALSE);
if (0) printf("exemple de format de journal : 2024-08-31 [%s()] %s\
< NB ce printf() se trouve dans 'widget/results/dispatch.c'\n",
__func__, "message"); // logging TODO TODO
// un exemple : $ sudo cat /var/log/messages
return measures_and_results; return measures_and_results;
} }