From 1342c8f06d710fc6edcfda7544828d7fcd3b814c Mon Sep 17 00:00:00 2001 From: Jeffrey Middleton Date: Thu, 12 Mar 2009 09:43:14 -0500 Subject: [PATCH] Added status-message-time option Controls the length of time a status message displays; the previous setting of 3 seconds from options.c is the default value. --- src/conf.c | 3 +++ src/options.c | 1 + src/options.h | 2 ++ src/screen.c | 5 +---- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/conf.c b/src/conf.c index 13dc5d5..1dc1a43 100644 --- a/src/conf.c +++ b/src/conf.c @@ -56,6 +56,7 @@ #define CONF_AUDIBLE_BELL "audible-bell" #define CONF_VISIBLE_BELL "visible-bell" #define CONF_BELL_ON_WRAP "bell-on-wrap" +#define CONF_STATUS_MESSAGE_TIME "status-message-time" #define CONF_XTERM_TITLE "set-xterm-title" #define CONF_ENABLE_MOUSE "enable-mouse" #define CONF_CROSSFADE_TIME "crossfade-time" @@ -414,6 +415,8 @@ parse_line(char *line) options.visible_bell = str2bool(value); else if (!strcasecmp(CONF_BELL_ON_WRAP, name)) options.bell_on_wrap = str2bool(value); + else if (!strcasecmp(CONF_STATUS_MESSAGE_TIME, name)) + options.status_message_time = atoi(value); else if (!strcasecmp(CONF_XTERM_TITLE, name)) options.enable_xterm_title = str2bool(value); else if (!strcasecmp(CONF_ENABLE_MOUSE, name)) diff --git a/src/options.c b/src/options.c index cc938c3..dd7ba53 100644 --- a/src/options.c +++ b/src/options.c @@ -59,6 +59,7 @@ options_t options = { .wide_cursor = true, .audible_bell = true, .bell_on_wrap = true, + .status_message_time = 3, #ifndef NCMPC_MINI .scroll = DEFAULT_SCROLL, .welcome_screen_list = true, diff --git a/src/options.h b/src/options.h index 48a12f2..dbd5a43 100644 --- a/src/options.h +++ b/src/options.h @@ -23,6 +23,7 @@ #include "config.h" #include +#include #define MPD_HOST_ENV "MPD_HOST" #define MPD_PORT_ENV "MPD_PORT" @@ -60,6 +61,7 @@ typedef struct { bool audible_bell; bool visible_bell; bool bell_on_wrap; + GTime status_message_time; #ifndef NCMPC_MINI bool enable_xterm_title; #endif diff --git a/src/screen.c b/src/screen.c index ea6c023..5c92042 100644 --- a/src/screen.c +++ b/src/screen.c @@ -45,9 +45,6 @@ static const GTime SCREEN_WELCOME_TIME = 10; #endif -/** status message time [s] */ -static const GTime SCREEN_STATUS_MESSAGE_TIME = 3; - /* minimum window size */ static const int SCREEN_MIN_COLS = 14; static const int SCREEN_MIN_ROWS = 5; @@ -273,7 +270,7 @@ paint_status_window(mpdclient_t *c) const char *str = NULL; int x = 0; - if( time(NULL) - screen.status_timestamp <= SCREEN_STATUS_MESSAGE_TIME ) + if( time(NULL) - screen.status_timestamp <= options.status_message_time ) return; wmove(w, 0, 0); -- 2.30.2