summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 25ddef4)
raw | patch | inline | side by side (parent: 25ddef4)
author | Max Kellermann <max@duempel.org> | |
Sun, 11 Oct 2009 13:41:34 +0000 (15:41 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Sun, 11 Oct 2009 13:41:34 +0000 (15:41 +0200) |
NEWS | patch | blob | history | |
src/screen_browser.c | patch | blob | history |
index 15ed5c3ed3da214cab19d742380e8b35f3563267..7b12cbec5f0cd462cf66e0bc2d8beca5f0737c2f 100644 (file)
--- a/NEWS
+++ b/NEWS
* screen_text: start searching at window origin, not bottom
* strfsong: support multiple values for a tag
* screen_browser: different colors for directories and playlists
+* screen_browser: display song duration
ncmpc 0.15 - 2009-09-24
diff --git a/src/screen_browser.c b/src/screen_browser.c
index edcd2d93bbbc9c820eac4701be8e1fcfb7fd46ef..922e4de52fe2e8d2b316a15934d3f068fb4fc74a 100644 (file)
--- a/src/screen_browser.c
+++ b/src/screen_browser.c
#include "filelist.h"
#include "colors.h"
#include "paint.h"
+#include "utils.h"
#include <mpd/client.h>
}
static void
-screen_browser_paint_song(WINDOW *w, unsigned width, bool selected,
+screen_browser_paint_song(WINDOW *w, G_GNUC_UNUSED unsigned y,
+ unsigned width, bool selected,
bool highlight, const struct mpd_song *song)
{
char buffer[width * 4];
strfsong(buffer, sizeof(buffer), options.list_format, song);
row_paint_text(w, width, highlight ? COLOR_LIST_BOLD : COLOR_LIST,
selected, buffer);
+
+#ifndef NCMPC_MINI
+ if (mpd_song_get_duration(song) > 0) {
+ char duration[32];
+ format_duration_short(duration, sizeof(duration),
+ mpd_song_get_duration(song));
+ wmove(w, y, width - strlen(duration) - 1);
+ waddch(w, ' ');
+ waddstr(w, duration);
+ }
+#endif
}
static void
static void
screen_browser_paint_callback(WINDOW *w, unsigned i,
- G_GNUC_UNUSED unsigned y, unsigned width,
+ unsigned y, unsigned width,
bool selected, void *data)
{
const struct filelist *fl = (const struct filelist *) data;
break;
case MPD_ENTITY_TYPE_SONG:
- screen_browser_paint_song(w, width, selected, highlight,
+ screen_browser_paint_song(w, y, width, selected, highlight,
mpd_entity_get_song(entity));
break;