diff options
| author | Louis Burda <quent.burda@gmail.com> | 2023-02-17 22:58:37 +0100 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2023-02-17 22:58:37 +0100 |
| commit | a08e917dbb2310fbc5852e675992b6fd5499cb86 (patch) | |
| tree | 6dcdfe462e8b27c2eaf091aa55dae3fcf0b2f7bd /src/main.c | |
| parent | 4efa0d0f0303be076d013c61a83b2d769778f37d (diff) | |
| download | tmus-a08e917dbb2310fbc5852e675992b6fd5499cb86.tar.gz tmus-a08e917dbb2310fbc5852e675992b6fd5499cb86.zip | |
Use SIGINT to stop player and update player status less frequently
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -4,12 +4,24 @@ #include "player.h" #include "tui.h" +#include <curses.h> #include <locale.h> +static void stop(int sig); static void init(void); static void cleanup(int code, void *arg); void +stop(int sig) +{ + if (player.loaded) { + player_stop(); + } else { + exit(0); + } +} + +void init(void) { setlocale(LC_ALL, ""); @@ -26,7 +38,7 @@ init(void) dbus_init(); on_exit(cleanup, NULL); - signal(SIGINT, exit); + signal(SIGINT, stop); signal(SIGTERM, exit); signal(SIGKILL, exit); } |
