From 3f0e5e147f89f77061739781889571d24da8b7d8 Mon Sep 17 00:00:00 2001 From: Paul Collins Date: Thu, 1 Jan 2009 22:54:04 +0100 Subject: [PATCH] added option to disable the status line clock display I already have a clock, and I don't need ncmpc showing me another one. This patch adds command line options and a config file item to allow the user to flexibly enable or disable the clock. [mk: patch from http://bugs.debian.org/510392; removed command line options] --- src/conf.c | 9 ++++++++- src/options.c | 1 + src/options.h | 1 + src/screen.c | 8 +++++--- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/conf.c b/src/conf.c index 38d5089..67d048a 100644 --- a/src/conf.c +++ b/src/conf.c @@ -72,6 +72,7 @@ #define CONF_SCROLL_SEP "scroll-sep" #define CONF_VISIBLE_BITRATE "visible-bitrate" #define CONF_WELCOME_SCREEN_LIST "welcome-screen-list" +#define CONF_DISPLAY_TIME "display-time" static bool str2bool(char *str) @@ -448,7 +449,13 @@ parse_line(char *line) else if (!strcasecmp(CONF_SCROLL_SEP, name)) { g_free(options.scroll_sep); options.scroll_sep = get_format(value); - } else + } else if (!strcasecmp(CONF_DISPLAY_TIME, name)) +#ifdef NCMPC_MINI + {} +#else + options.display_time = str2bool(value); +#endif + else match_found = false; if (!match_found) diff --git a/src/options.c b/src/options.c index 5bb5fba..3f784d1 100644 --- a/src/options.c +++ b/src/options.c @@ -61,6 +61,7 @@ options_t options = { #ifndef NCMPC_MINI .scroll = DEFAULT_SCROLL, .welcome_screen_list = true, + .display_time = true, #endif }; diff --git a/src/options.h b/src/options.h index 671107a..c48d1b3 100644 --- a/src/options.h +++ b/src/options.h @@ -69,6 +69,7 @@ typedef struct { bool scroll; bool visible_bitrate; bool welcome_screen_list; + bool display_time; #endif } options_t; diff --git a/src/screen.c b/src/screen.c index 1f44f73..924cf4b 100644 --- a/src/screen.c +++ b/src/screen.c @@ -338,10 +338,12 @@ paint_status_window(mpdclient_t *c) } #ifndef NCMPC_MINI } else { - time_t timep; + if (options.display_time) { + time_t timep; - time(&timep); - strftime(screen.buf, screen.buf_size, "%X ",localtime(&timep)); + time(&timep); + strftime(screen.buf, screen.buf_size, "%X ",localtime(&timep)); + } #endif } -- 2.30.2