Code

screen_queue: use paint_song_row()
authorMax Kellermann <max@duempel.org>
Sun, 11 Oct 2009 17:41:08 +0000 (19:41 +0200)
committerMax Kellermann <max@duempel.org>
Sun, 11 Oct 2009 17:41:08 +0000 (19:41 +0200)
Reuse code from screen_browser.c.  Side effect: this patch disables
horizontal scrolling.  The "hscroll" library will return after an
overhaul.

src/screen_queue.c

index 750e9409372643526037c973c93a7c783353d3e1..b36ba66c8f87d686d6c4fad0bbe3b5064508304b 100644 (file)
@@ -30,7 +30,7 @@
 #include "utils.h"
 #include "strfsong.h"
 #include "wreadln.h"
-#include "colors.h"
+#include "song_paint.h"
 #include "screen.h"
 #include "screen_utils.h"
 #include "screen_song.h"
@@ -543,10 +543,27 @@ screen_queue_title(char *str, size_t size)
        return str;
 }
 
+static void
+screen_queue_paint_callback(WINDOW *w, unsigned i,
+                           unsigned y, unsigned width,
+                           bool selected, G_GNUC_UNUSED void *data)
+{
+       const struct mpd_song *song;
+
+       assert(playlist != NULL);
+       assert(i < playlist_length(playlist));
+
+       song = playlist_get(playlist, i);
+
+       paint_song_row(w, y, width, selected,
+                      (int)mpd_song_get_id(song) == current_song_id,
+                      song);
+}
+
 static void
 screen_queue_paint(void)
 {
-       list_window_paint(lw, screen_queue_lw_callback, NULL);
+       list_window_paint2(lw, screen_queue_paint_callback, NULL);
 }
 
 G_GNUC_PURE