Code

Added status-message-time option
authorJeffrey Middleton <jefromi@gmail.com>
Thu, 12 Mar 2009 14:43:14 +0000 (09:43 -0500)
committerJeffrey Middleton <jefromi@gmail.com>
Thu, 12 Mar 2009 14:43:14 +0000 (09:43 -0500)
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
src/options.c
src/options.h
src/screen.c

index 13dc5d50c5cdeb1c4ddd8891c49560cf902944f3..1dc1a4333c9d99b918643854ca9b6ee5af083756 100644 (file)
@@ -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))
index cc938c330334f709c340a5ce4dec306237d1acfe..dd7ba532c68aa1346141dc4f44bf9a944180fdf8 100644 (file)
@@ -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,
index 48a12f2b81e3eba8b89085f8670e858b51322abe..dbd5a43ce93a1199be5765034b7eefa22f9c3150 100644 (file)
@@ -23,6 +23,7 @@
 #include "config.h"
 
 #include <stdbool.h>
+#include <glib.h>
 
 #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
index ea6c02310424b26abc0aa5e5e7b9c5aee7fcccfa..5c9204237de4d3affb1fdfd3b54ad267fe91311f 100644 (file)
@@ -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);