diff options
author | Paul Collins <paul@burly.ondioline.org> | 2009-01-01 22:54:04 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-01-01 22:54:04 +0100 |
commit | 3f0e5e147f89f77061739781889571d24da8b7d8 (patch) | |
tree | 521b51c9fcd9d4f8b44d716ef2584fa36287fe44 | |
parent | e67ad30e9bea8ce099b4a6311cf2b20ce6d86263 (diff) | |
download | mpd-3f0e5e147f89f77061739781889571d24da8b7d8.tar.gz mpd-3f0e5e147f89f77061739781889571d24da8b7d8.tar.xz mpd-3f0e5e147f89f77061739781889571d24da8b7d8.zip |
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]
-rw-r--r-- | src/conf.c | 9 | ||||
-rw-r--r-- | src/options.c | 1 | ||||
-rw-r--r-- | src/options.h | 1 | ||||
-rw-r--r-- | src/screen.c | 8 |
4 files changed, 15 insertions, 4 deletions
diff --git a/src/conf.c b/src/conf.c index 38d508954..67d048ae6 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 5bb5fbadd..3f784d11c 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 671107a76..c48d1b390 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 1f44f7398..924cf4bd8 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 } |