aboutsummaryrefslogtreecommitdiffstats
path: root/src/screen_file.c
diff options
context:
space:
mode:
authorAndreas Obergrusberger <tradiaz@yahoo.de>2007-11-30 16:09:30 +0000
committerAndreas Obergrusberger <tradiaz@yahoo.de>2007-11-30 16:09:30 +0000
commite23ddeed4b98b02a9925035f38dd2ccdadef28b9 (patch)
tree79c5da3c18e448c5e027757805fa9e8db344d0b9 /src/screen_file.c
parent6e3f91f094c0c95036e11a4f070494ab850c3a6d (diff)
downloadmpd-e23ddeed4b98b02a9925035f38dd2ccdadef28b9.tar.gz
mpd-e23ddeed4b98b02a9925035f38dd2ccdadef28b9.tar.xz
mpd-e23ddeed4b98b02a9925035f38dd2ccdadef28b9.zip
cmd_select_all added
git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@7061 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/screen_file.c83
1 files changed, 83 insertions, 0 deletions
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)
{