Code

added option "second-column"
authorMatt Portas <m.r.portas@warwick.ac.uk>
Mon, 23 Nov 2009 21:09:49 +0000 (21:09 +0000)
committerMax Kellermann <max@duempel.org>
Mon, 23 Nov 2009 21:10:30 +0000 (22:10 +0100)
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.

doc/config.sample
doc/ncmpc.1
src/conf.c
src/options.c
src/options.h
src/song_paint.c

index 9bd61c75d3322370acd2f224b53faeb7253b8173..7dcfaead68f4da03427642ee1e6faa7897a91e7b 100644 (file)
 ## 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
index 13f2eb268118a92d6df9d3e728f4cd78c5286266..e09a65c512499ba2c4a8eecb902ed2d18d1728ea 100644 (file)
@@ -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
index 9ff0b55c5e99f00d81644aefc781a5eff2d18b2b..527306b8fe16bc3c04a7dcee831786bd69b7141f 100644 (file)
@@ -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;
index 9746d3ab78c08b67052ba11076887499f0b138fa..f50f18c795b4fb5ce342ee5e858d7a61c9aec0d7 100644 (file)
@@ -65,6 +65,7 @@ options_t options = {
        .scroll = DEFAULT_SCROLL,
        .welcome_screen_list = true,
        .jump_prefix_only = true,
+       .second_column = true,
 #endif
 };
 
index 8a0a9d353d0b4a56ba3170d9603907c6e72fff19..ef78e5b82de5fce24369c69381f2b29c848d2d5e 100644 (file)
@@ -75,6 +75,7 @@ typedef struct {
        bool welcome_screen_list;
        bool display_time;
        bool jump_prefix_only;
+       bool second_column;
 #endif
 } options_t;
 
index 0e2e74194383f3fb25f19ce3cf1c8377f3cddb04..5c0eee462d70fd77abf23438b7b049e6ed59888a 100644 (file)
@@ -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));