summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d976347)
raw | patch | inline | side by side (parent: d976347)
author | Max Kellermann <max@duempel.org> | |
Wed, 1 Oct 2008 07:24:59 +0000 (09:24 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Wed, 1 Oct 2008 07:24:59 +0000 (09:24 +0200) |
To unify the code, wrap list_window_cmd() in artist_lw_cmd(), which
properly checks the current mode.
properly checks the current mode.
src/screen_artist.c | patch | blob | history |
diff --git a/src/screen_artist.c b/src/screen_artist.c
index 07a3f8f649f95788131293d2bd03cc48fdbd92bf..03b4fed421ab69165d61a4776f750f389e834875 100644 (file)
--- a/src/screen_artist.c
+++ b/src/screen_artist.c
}
}
+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;
}
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;
}