aboutsummaryrefslogtreecommitdiffstats
path: root/src/screen_browser.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-02 15:20:18 +0200
committerMax Kellermann <max@duempel.org>2008-10-02 15:20:18 +0200
commita277ac660bdf2871ebbcddcb5288e29a03a46c92 (patch)
treeff30dfe7758c8b79263a2415a75a55c4f8aa6202 /src/screen_browser.c
parentbedf936a8d54bab5e51d5fadb3b42440ec864f61 (diff)
downloadmpd-a277ac660bdf2871ebbcddcb5288e29a03a46c92.tar.gz
mpd-a277ac660bdf2871ebbcddcb5288e29a03a46c92.tar.xz
mpd-a277ac660bdf2871ebbcddcb5288e29a03a46c92.zip
screen_browser: added browser_cmd()
Merge a lot of code from the 3 browser screen into browser_cmd().
Diffstat (limited to 'src/screen_browser.c')
-rw-r--r--src/screen_browser.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/screen_browser.c b/src/screen_browser.c
index bad13ea02..d7dea635e 100644
--- a/src/screen_browser.c
+++ b/src/screen_browser.c
@@ -451,3 +451,56 @@ browser_handle_mouse_event(struct screen_browser *browser, mpdclient_t *c)
}
#endif
+bool
+browser_cmd(struct screen_browser *browser, struct screen *screen,
+ struct mpdclient *c, command_t cmd)
+{
+ switch (cmd) {
+ case CMD_PLAY:
+ browser_handle_enter(browser, c);
+ return true;
+
+ case CMD_SELECT:
+ if (browser_handle_select(browser, c) == 0)
+ /* continue and select next item... */
+ cmd = CMD_LIST_NEXT;
+
+ /* call list_window_cmd to go to the next item */
+ break;
+
+ case CMD_ADD:
+ if (browser_handle_add(browser, c) == 0)
+ /* continue and select next item... */
+ cmd = CMD_LIST_NEXT;
+
+ /* call list_window_cmd to go to the next item */
+ break;
+
+ case CMD_SELECT_ALL:
+ browser_handle_select_all(browser, c);
+ return true;
+
+ case CMD_LIST_FIND:
+ case CMD_LIST_RFIND:
+ case CMD_LIST_FIND_NEXT:
+ case CMD_LIST_RFIND_NEXT:
+ screen_find(screen,
+ browser->lw, filelist_length(browser->filelist),
+ cmd, browser_lw_callback,
+ browser->filelist);
+ return true;
+
+ case CMD_MOUSE_EVENT:
+ browser_handle_mouse_event(browser, c);
+ return true;
+
+ default:
+ break;
+ }
+
+ if (list_window_cmd(browser->lw, filelist_length(browser->filelist),
+ cmd))
+ return true;
+
+ return false;
+}