aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/command.c2
-rw-r--r--src/command.h1
-rw-r--r--src/screen_browse.h4
-rw-r--r--src/screen_file.c83
-rw-r--r--src/screen_help.c1
-rw-r--r--src/screen_search.c5
6 files changed, 96 insertions, 0 deletions
diff --git a/src/command.c b/src/command.c
index 3210f39d9..d0d141904 100644
--- a/src/command.c
+++ b/src/command.c
@@ -118,6 +118,8 @@ static command_definition_t cmds[] =
N_("Decrease volume") },
{ { ' ', 0, 0 }, 0, CMD_SELECT, "select",
N_("Select/deselect song in playlist") },
+ { { 't', 0, 0 }, 0, CMD_SELECT_ALL, "select_all",
+ N_("Select all listed items") },
{ { DEL, 'd', 0 }, 0, CMD_DELETE, "delete",
N_("Delete song from playlist") },
{ { 'Z', 0, 0 }, 0, CMD_SHUFFLE, "shuffle",
diff --git a/src/command.h b/src/command.h
index 745b5283b..1d5b9500a 100644
--- a/src/command.h
+++ b/src/command.h
@@ -9,6 +9,7 @@ typedef enum
CMD_NONE = 0,
CMD_PLAY,
CMD_SELECT,
+ CMD_SELECT_ALL,
CMD_PAUSE,
CMD_STOP,
CMD_TRACK_NEXT,
diff --git a/src/screen_browse.h b/src/screen_browse.h
index ddb3f21b0..3487b2d38 100644
--- a/src/screen_browse.h
+++ b/src/screen_browse.h
@@ -12,6 +12,10 @@ int browse_handle_select(screen_t *screen,
mpdclient_t *c,
list_window_t *lw,
mpdclient_filelist_t *filelist);
+int browse_handle_select_all (screen_t *screen,
+ mpdclient_t *c,
+ list_window_t *lw,
+ mpdclient_filelist_t *filelist);
int browse_handle_enter(screen_t *screen,
mpdclient_t *c,
list_window_t *lw,
diff --git a/src/screen_file.c b/src/screen_file.c
index 14a11478c..142c91e12 100644
--- a/src/screen_file.c
+++ b/src/screen_file.c
@@ -523,6 +523,89 @@ browse_handle_select(screen_t *screen,
return 0;
}
+int
+browse_handle_select_all (screen_t *screen,
+ mpdclient_t *c,
+ list_window_t *lw,
+ mpdclient_filelist_t *filelist)
+{
+ filelist_entry_t *entry;
+ GList *temp = filelist->list;
+
+ if ( filelist==NULL )
+ return -1;
+ for (filelist->list = g_list_first(filelist->list);
+ filelist->list;
+ filelist->list = g_list_next(filelist->list))
+ {
+ entry=( filelist_entry_t *) filelist->list->data;
+ if( entry==NULL || entry->entity==NULL)
+ return -1;
+
+ if( entry->entity->type==MPD_INFO_ENTITY_TYPE_PLAYLISTFILE )
+ load_playlist(screen, c, entry);
+
+ if( entry->entity->type==MPD_INFO_ENTITY_TYPE_DIRECTORY )
+ {
+ mpd_Directory *dir = entry->entity->info.directory;
+#ifdef USE_OLD_ADD
+ add_directory(c, tmp);
+#else
+ if( mpdclient_cmd_add_path_utf8(c, dir->path) == 0 )
+ {
+ char *tmp = utf8_to_locale(dir->path);
+
+ screen_status_printf(_("Adding \'%s\' to playlist\n"), tmp);
+ g_free(tmp);
+ }
+#endif
+ }
+
+ if( entry->entity->type!=MPD_INFO_ENTITY_TYPE_SONG )
+ continue;
+
+ if( entry->flags & HIGHLIGHT )
+ entry->flags &= ~HIGHLIGHT;
+ else
+ entry->flags |= HIGHLIGHT;
+
+ if( entry->flags & HIGHLIGHT )
+ {
+ if( entry->entity->type==MPD_INFO_ENTITY_TYPE_SONG )
+ {
+ mpd_Song *song = entry->entity->info.song;
+
+ if( mpdclient_cmd_add(c, song) == 0 )
+ {
+ char buf[BUFSIZE];
+
+ strfsong(buf, BUFSIZE, LIST_FORMAT, song);
+ screen_status_printf(_("Adding \'%s\' to playlist\n"), buf);
+ }
+ }
+ }
+ /*else
+ {
+ //remove song from playlist
+ if( entry->entity->type==MPD_INFO_ENTITY_TYPE_SONG )
+ {
+ mpd_Song *song = entry->entity->info.song;
+
+ if( song )
+ {
+ int index = playlist_get_index_from_file(c, song->file);
+
+ while( (index=playlist_get_index_from_file(c, song->file))>=0 )
+ mpdclient_cmd_delete(c, index);
+ }
+ }
+ }
+ return 0;*/
+ }
+ filelist->list = temp;
+ return 0;
+}
+
static void
browse_init(WINDOW *w, int cols, int rows)
{
diff --git a/src/screen_help.c b/src/screen_help.c
index 8be8463f3..515e69bc1 100644
--- a/src/screen_help.c
+++ b/src/screen_help.c
@@ -125,6 +125,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_SELECT_ALL, NULL },
{ 0, CMD_SEARCH_MODE, NULL },
#endif
#ifdef ENABLE_LYRICS_SCREEN
diff --git a/src/screen_search.c b/src/screen_search.c
index 4dfc6d0ad..76398e478 100644
--- a/src/screen_search.c
+++ b/src/screen_search.c
@@ -491,6 +491,11 @@ search_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
/* call list_window_cmd to go to the next item */
return list_window_cmd(lw, filelist->length, cmd);
+ case CMD_SELECT_ALL:
+ browse_handle_select_all (screen, c, lw, filelist);
+ paint (screen, c);
+ return 0;
+
case CMD_SEARCH_MODE:
options.search_mode++;
if( mode[options.search_mode].label == NULL )