summaryrefslogtreecommitdiff
path: root/plugins/hotkeys/actionhandlers.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/hotkeys/actionhandlers.c')
-rw-r--r--plugins/hotkeys/actionhandlers.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/plugins/hotkeys/actionhandlers.c b/plugins/hotkeys/actionhandlers.c
index ec1f305c..ec8e00b5 100644
--- a/plugins/hotkeys/actionhandlers.c
+++ b/plugins/hotkeys/actionhandlers.c
@@ -248,3 +248,33 @@ action_sort_by_title_handler (DB_plugin_action_t *act, int ctx) {
deadbeef->sendmessage (DB_EV_PLAYLISTCHANGED, 0, 0, 0);
return 0;
}
+
+int
+action_invert_selection_handler (DB_plugin_action_t *act, int ctx) {
+ deadbeef->pl_lock ();
+ DB_playItem_t *it = deadbeef->pl_get_first (PL_MAIN);
+ while (it) {
+ if (deadbeef->pl_is_selected (it)) {
+ deadbeef->pl_set_selected (it, 0);
+ }
+ else {
+ deadbeef->pl_set_selected (it, 1);
+ }
+ DB_playItem_t *next = deadbeef->pl_get_next (it, PL_MAIN);
+ deadbeef->pl_item_unref (it);
+ it = next;
+ }
+ deadbeef->pl_unlock ();
+ deadbeef->sendmessage (DB_EV_PLAYLISTCHANGED, 0, 0, 0);
+ return 0;
+}
+
+int
+action_clear_playlist_handler (DB_plugin_action_t *act, int ctx) {
+ deadbeef->pl_clear ();
+ deadbeef->pl_save_current ();
+ deadbeef->sendmessage (DB_EV_PLAYLISTCHANGED, 0, 0, 0);
+ return 0;
+}
+
+