summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 728309e)
raw | patch | inline | side by side (parent: 728309e)
author | Max Kellermann <max@duempel.org> | |
Thu, 25 Sep 2008 19:35:06 +0000 (21:35 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Thu, 25 Sep 2008 19:35:06 +0000 (21:35 +0200) |
CMD_ADD ('a') appends a song to the playlist, no matter if it is
already there, i.e. unlike CMD_SELECT, it does not toggle the song.
already there, i.e. unlike CMD_SELECT, it does not toggle the song.
diff --git a/src/screen_artist.c b/src/screen_artist.c
index 71b168841dc73d8c18f82e5f86244ed4e025507b..07a3f8f649f95788131293d2bd03cc48fdbd92bf 100644 (file)
--- a/src/screen_artist.c
+++ b/src/screen_artist.c
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)) {
break;
case CMD_SELECT:
+ case CMD_ADD:
switch(mode) {
case LIST_ARTISTS:
selected = g_list_nth_data(metalist,
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 9ce6fedd8f68626858caac90fca6ad63fca49ff0..bad13ea0294bb3a7bb48030f629904a0bd9da335 100644 (file)
--- a/src/screen_browser.c
+++ b/src/screen_browser.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 1b7c70608618030f2f76359fdfb26b7582e59ff5..5441f41c758ae3d1385ed23c3f1d424f2e4c8b89 100644 (file)
--- a/src/screen_browser.h
+++ b/src/screen_browser.h
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 24cd8afc747f40f3b78755ccb1eec91afb3306f0..a0a7c7ccea575fd8bb91f4cdaa0af501e63ebf35 100644 (file)
--- a/src/screen_file.c
+++ b/src/screen_file.c
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 3ac4b0543ecdbe79536d9acf3785272fb9de552b..2637af9631f4f88bf7b91ed0057c38dc18d98049 100644 (file)
--- a/src/screen_help.c
+++ b/src/screen_help.c
{ 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 },
{ 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 b93aef01a12f067e0f8502fc21301855632aeb0e..981c0a58bc4a1e332f09ff4d4314b2d2740277dc 100644 (file)
--- a/src/screen_search.c
+++ b/src/screen_search.c
/* 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();