summaryrefslogtreecommitdiff
path: root/playlist.c
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-07-31 22:56:59 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-07-31 22:56:59 +0200
commit12e2421e2bf9f8565fee5f3ff40e208408a333d4 (patch)
tree5bdc04278510429bf9d32110640b8658de65ab68 /playlist.c
parent79d0a9187928ccb832eefff59c609dfe03bb79fb (diff)
implemented "delete selection"
Diffstat (limited to 'playlist.c')
-rw-r--r--playlist.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/playlist.c b/playlist.c
index d2f9e9af..c4808acb 100644
--- a/playlist.c
+++ b/playlist.c
@@ -573,3 +573,32 @@ ps_find_meta (playItem_t *it, const char *key) {
}
return "?";
}
+
+void
+ps_delete_selected (void) {
+ playItem_t *next = NULL;
+ for (playItem_t *it = playlist_head; it; it = next) {
+ next = it->next;
+ if (it->selected) {
+ if (it->prev) {
+ it->prev->next = it->next;
+ }
+ if (it->next) {
+ it->next->prev = it->prev;
+ }
+ if (playlist_head == it) {
+ playlist_head = it->next;
+ }
+ if (playlist_tail == it) {
+ playlist_tail = it->prev;
+ }
+ if (playlist_current_ptr == it) {
+ playlist_current_ptr = NULL;
+ }
+ ps_item_free (it);
+ free (it);
+ ps_count--;
+ }
+ }
+}
+