aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-01 09:24:59 +0200
committerMax Kellermann <max@duempel.org>2008-10-01 09:24:59 +0200
commitf1621fda772bc464a4a224e586882d4f6635643c (patch)
tree77627a3b15283154f40a0c18cf595d35fc15af6f
parentd97634730540ae063746c5c59dc87d7299719171 (diff)
downloadmpd-f1621fda772bc464a4a224e586882d4f6635643c.tar.gz
mpd-f1621fda772bc464a4a224e586882d4f6635643c.tar.xz
mpd-f1621fda772bc464a4a224e586882d4f6635643c.zip
screen_artist: moved code to artist_lw_cmd()
To unify the code, wrap list_window_cmd() in artist_lw_cmd(), which properly checks the current mode.
-rw-r--r--src/screen_artist.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/screen_artist.c b/src/screen_artist.c
index 07a3f8f64..03b4fed42 100644
--- a/src/screen_artist.c
+++ b/src/screen_artist.c
@@ -287,14 +287,31 @@ add_query(mpdclient_t *c, int table, char *_filter)
}
static int
+artist_lw_cmd(command_t cmd)
+{
+ switch (mode) {
+ case LIST_ARTISTS:
+ case LIST_ALBUMS:
+ return list_window_cmd(browser.lw, metalist_length, cmd);
+
+ case LIST_SONGS:
+ return list_window_cmd(browser.lw,
+ filelist_length(browser.filelist),
+ cmd);
+ }
+
+ assert(0);
+ return 0;
+}
+
+static int
artist_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
{
char *selected;
int ret;
- if (browser.filelist == NULL && metalist != NULL &&
- list_window_cmd(browser.lw, metalist_length, cmd)) {
- list_window_paint(browser.lw, artist_lw_callback, metalist);
+ if (artist_lw_cmd(cmd)) {
+ artist_repaint();
wrefresh(browser.lw->w);
return 1;
}
@@ -467,15 +484,6 @@ artist_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
break;
}
- if (browser.filelist != NULL &&
- list_window_cmd(browser.lw, filelist_length(browser.filelist),
- cmd)) {
- list_window_paint(browser.lw, browser_lw_callback,
- browser.filelist);
- wrefresh(browser.lw->w);
- return 1;
- }
-
return 0;
}