diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/screen_artist.c | 7 | ||||
-rw-r--r-- | src/screen_browser.c | 11 | ||||
-rw-r--r-- | src/screen_browser.h | 3 | ||||
-rw-r--r-- | src/screen_file.c | 7 | ||||
-rw-r--r-- | src/screen_help.c | 2 | ||||
-rw-r--r-- | src/screen_search.c | 8 |
6 files changed, 37 insertions, 1 deletions
diff --git a/src/screen_artist.c b/src/screen_artist.c index 71b168841..07a3f8f64 100644 --- a/src/screen_artist.c +++ b/src/screen_artist.c @@ -290,6 +290,7 @@ 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)) { @@ -396,6 +397,7 @@ artist_cmd(screen_t *screen, mpdclient_t *c, command_t cmd) break; case CMD_SELECT: + case CMD_ADD: switch(mode) { case LIST_ARTISTS: selected = g_list_nth_data(metalist, @@ -423,7 +425,10 @@ artist_cmd(screen_t *screen, mpdclient_t *c, command_t cmd) break; case LIST_SONGS: - if (browser_handle_select(&browser, c) == 0) + ret = cmd == CMD_SELECT + ? browser_handle_select(&browser, c) + : browser_handle_add(&browser, c); + if (ret == 0) /* continue and select next item... */ cmd = CMD_LIST_NEXT; break; diff --git a/src/screen_browser.c b/src/screen_browser.c index 9ce6fedd8..bad13ea02 100644 --- a/src/screen_browser.c +++ b/src/screen_browser.c @@ -391,6 +391,17 @@ browser_handle_select(struct screen_browser *browser, mpdclient_t *c) return browser_select_entry(c, entry, TRUE); } +int +browser_handle_add(struct screen_browser *browser, mpdclient_t *c) +{ + struct filelist_entry *entry = browser_get_selected(browser); + + if (entry == NULL || entry->entity == NULL) + return -1; + + return browser_select_entry(c, entry, FALSE); +} + void browser_handle_select_all(struct screen_browser *browser, mpdclient_t *c) { diff --git a/src/screen_browser.h b/src/screen_browser.h index 1b7c70608..5441f41c7 100644 --- a/src/screen_browser.h +++ b/src/screen_browser.h @@ -48,6 +48,9 @@ const char *browser_lw_callback(unsigned index, int *highlight, void *filelist); int browser_handle_select(struct screen_browser *browser, mpdclient_t *c); +int +browser_handle_add(struct screen_browser *browser, mpdclient_t *c); + void browser_handle_select_all(struct screen_browser *browser, mpdclient_t *c); diff --git a/src/screen_file.c b/src/screen_file.c index 24cd8afc7..a0a7c7cce 100644 --- a/src/screen_file.c +++ b/src/screen_file.c @@ -223,6 +223,13 @@ browse_cmd(screen_t *screen, mpdclient_t *c, command_t cmd) cmd = CMD_LIST_NEXT; } break; + + case CMD_ADD: + if (browser_handle_add(&browser, c) == 0) + /* continue and select next item... */ + cmd = CMD_LIST_NEXT; + break; + case CMD_DELETE: handle_delete(screen, c); file_repaint(); diff --git a/src/screen_help.c b/src/screen_help.c index 3ac4b0543..2637af963 100644 --- a/src/screen_help.c +++ b/src/screen_help.c @@ -107,6 +107,7 @@ static help_text_row_t help_text[] = { 2, CMD_NONE, NULL }, { 0, CMD_PLAY, N_("Enter directory/Select and play song") }, { 0, CMD_SELECT, NULL }, + { 0, CMD_ADD, N_("Append song to playlist") }, { 0, CMD_SAVE_PLAYLIST, NULL }, { 0, CMD_DELETE, N_("Delete playlist") }, { 0, CMD_GO_PARENT_DIRECTORY, NULL }, @@ -121,6 +122,7 @@ static help_text_row_t help_text[] = { 0, CMD_SCREEN_SEARCH, N_("Search") }, { 0, CMD_PLAY, N_("Select and play") }, { 0, CMD_SELECT, NULL }, + { 0, CMD_ADD, N_("Append song to playlist") }, { 0, CMD_SELECT_ALL, NULL }, { 0, CMD_SEARCH_MODE, NULL }, #endif diff --git a/src/screen_search.c b/src/screen_search.c index b93aef01a..981c0a58b 100644 --- a/src/screen_search.c +++ b/src/screen_search.c @@ -445,6 +445,14 @@ search_cmd(screen_t *screen, mpdclient_t *c, command_t cmd) /* 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); search_repaint(); |