From be938c611bcf515525946cfafc78e251090266ec Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Wed, 10 Sep 2014 09:28:41 +0400 Subject: [PATCH] Ticket #3247: refactoring of status_msg engine. Initial commit: create global timer. Signed-off-by: Andrew Borodin --- lib/global.c | 2 ++ lib/global.h | 2 ++ src/main.c | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/lib/global.c b/lib/global.c index c4014dcc9..cbd59a5d0 100644 --- a/lib/global.c +++ b/lib/global.c @@ -31,6 +31,7 @@ #include #include "global.h" +#include "lib/timer.h" /* *INDENT-OFF* */ #ifdef ENABLE_SUBSHELL @@ -49,6 +50,7 @@ /* *INDENT-OFF* */ mc_global_t mc_global = { .mc_run_mode = MC_RUN_FULL, + .timer = NULL, .midnight_shutdown = FALSE, .sysconfig_dir = NULL, diff --git a/lib/global.h b/lib/global.h index ecc4d892f..6db4d5f27 100644 --- a/lib/global.h +++ b/lib/global.h @@ -173,6 +173,8 @@ typedef enum typedef struct { mc_run_mode_t mc_run_mode; + /* global timer */ + struct mc_timer_t *timer; /* Used so that widgets know if they are being destroyed or shut down */ gboolean midnight_shutdown; diff --git a/src/main.c b/src/main.c index 377f0dcfe..c74e2fafe 100644 --- a/src/main.c +++ b/src/main.c @@ -47,6 +47,7 @@ #include "lib/tty/tty.h" #include "lib/tty/key.h" /* For init_key() */ #include "lib/tty/mouse.h" /* init_mouse() */ +#include "lib/timer.h" #include "lib/skin.h" #include "lib/filehighlight.h" #include "lib/fileloc.h" @@ -238,6 +239,8 @@ main (int argc, char *argv[]) char *config_migrate_msg; int exit_code = EXIT_FAILURE; + mc_global.timer = mc_timer_new (); + /* We had LC_CTYPE before, LC_ALL includs LC_TYPE as well */ #ifdef HAVE_SETLOCALE (void) setlocale (LC_ALL, ""); @@ -256,6 +259,7 @@ main (int argc, char *argv[]) g_free (mc_global.tty.shell); startup_exit_ok: str_uninit_strings (); + mc_timer_destroy (mc_global.timer); return exit_code; } @@ -497,6 +501,8 @@ main (int argc, char *argv[]) exit_code = EXIT_FAILURE; } + mc_timer_destroy (mc_global.timer); + (void) putchar ('\n'); /* Hack to make shell's prompt start at left of screen */ return exit_code;