From: Matt Portas Date: Mon, 23 Nov 2009 21:09:49 +0000 (+0000) Subject: added option "second-column" X-Git-Tag: release-0.16~20 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d0453b4b1835c335ddf9191a2044b6b731bbe7f4;p=ncmpc.git added option "second-column" This allows the second column displaying the song length to be disabled using the config file. By default it is set to on, so it shouldn't affect anyone unless they specify it. --- diff --git a/doc/config.sample b/doc/config.sample index 9bd61c7..7dcfaea 100644 --- a/doc/config.sample +++ b/doc/config.sample @@ -101,6 +101,9 @@ ## Automatically save the lyrics after receiving them. #lyrics-autosave = no +## Display song length in second column +#second-column = yes + ############## Colors ####################### ## ## base colors: black, red, green, yellow, blue, magenta, cyan, white diff --git a/doc/ncmpc.1 b/doc/ncmpc.1 index 13f2eb2..e09a65c 100644 --- a/doc/ncmpc.1 +++ b/doc/ncmpc.1 @@ -123,6 +123,9 @@ When using the jump command, search for the prefix of an entry. That means typin .TP .B lyrics\-autosave = yes|no Automatically save lyrics after receiving them. +.TP +.B second-column = yes|no +Display song length in a second column. .SS Display .TP .B welcome\-screen\-list = yes|no diff --git a/src/conf.c b/src/conf.c index 9ff0b55..527306b 100644 --- a/src/conf.c +++ b/src/conf.c @@ -77,6 +77,7 @@ #define CONF_DISPLAY_TIME "display-time" #define CONF_JUMP_PREFIX_ONLY "jump-prefix-only" #define CONF_LYRICS_AUTOSAVE "lyrics-autosave" +#define CONF_SECOND_COLUMN "second-column" static bool str2bool(char *str) @@ -519,6 +520,12 @@ parse_line(char *line) options.lyrics_autosave = str2bool(value); #else {} +#endif + else if (!strcasecmp(CONF_SECOND_COLUMN, name)) +#ifdef NCMPC_MINI + {} +#else + options.second_column = str2bool(value); #endif else match_found = false; diff --git a/src/options.c b/src/options.c index 9746d3a..f50f18c 100644 --- a/src/options.c +++ b/src/options.c @@ -65,6 +65,7 @@ options_t options = { .scroll = DEFAULT_SCROLL, .welcome_screen_list = true, .jump_prefix_only = true, + .second_column = true, #endif }; diff --git a/src/options.h b/src/options.h index 8a0a9d3..ef78e5b 100644 --- a/src/options.h +++ b/src/options.h @@ -75,6 +75,7 @@ typedef struct { bool welcome_screen_list; bool display_time; bool jump_prefix_only; + bool second_column; #endif } options_t; diff --git a/src/song_paint.c b/src/song_paint.c index 0e2e741..5c0eee4 100644 --- a/src/song_paint.c +++ b/src/song_paint.c @@ -43,7 +43,7 @@ paint_song_row(WINDOW *w, G_GNUC_UNUSED unsigned y, unsigned width, selected, buffer); #ifndef NCMPC_MINI - if (mpd_song_get_duration(song) > 0) { + if (options.second_column && mpd_song_get_duration(song) > 0) { char duration[32]; format_duration_short(duration, sizeof(duration), mpd_song_get_duration(song));