diff options
author | waker <wakeroid@gmail.com> | 2012-11-25 12:06:13 +0100 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2012-11-25 12:06:13 +0100 |
commit | 4d190480e4dbb382673e5a2f698fe39c9feb9b80 (patch) | |
tree | 1f20b25c59054b0d724202bf8334f764c64e7906 /plugins/hotkeys | |
parent | b4fb95c1a8fc2bc7a87a98355e64ac2945b79f02 (diff) |
added add/remove to/from playqueue hotkeys
Diffstat (limited to 'plugins/hotkeys')
-rw-r--r-- | plugins/hotkeys/actionhandlers.c | 28 | ||||
-rw-r--r-- | plugins/hotkeys/actionhandlers.h | 6 | ||||
-rw-r--r-- | plugins/hotkeys/hotkeys.c | 10 |
3 files changed, 39 insertions, 5 deletions
diff --git a/plugins/hotkeys/actionhandlers.c b/plugins/hotkeys/actionhandlers.c index ec8e00b5..ab90a788 100644 --- a/plugins/hotkeys/actionhandlers.c +++ b/plugins/hotkeys/actionhandlers.c @@ -277,4 +277,32 @@ action_clear_playlist_handler (DB_plugin_action_t *act, int ctx) { return 0; } +int +action_add_to_playqueue_handler (DB_plugin_action_t *act, int ctx) { + DB_playItem_t *it = deadbeef->pl_get_first (PL_MAIN); + while (it) { + if (deadbeef->pl_is_selected (it)) { + deadbeef->pl_playqueue_push (it); + } + DB_playItem_t *next = deadbeef->pl_get_next (it, PL_MAIN); + deadbeef->pl_item_unref (it); + it = next; + } + deadbeef->sendmessage (DB_EV_PLAYLIST_REFRESH, 0, 0, 0); + return 0; +} +int +action_remove_from_playqueue_handler (DB_plugin_action_t *act, int ctx) { + DB_playItem_t *it = deadbeef->pl_get_first (PL_MAIN); + while (it) { + if (deadbeef->pl_is_selected (it)) { + deadbeef->pl_playqueue_remove (it); + } + DB_playItem_t *next = deadbeef->pl_get_next (it, PL_MAIN); + deadbeef->pl_item_unref (it); + it = next; + } + deadbeef->sendmessage (DB_EV_PLAYLIST_REFRESH, 0, 0, 0); + return 0; +} diff --git a/plugins/hotkeys/actionhandlers.h b/plugins/hotkeys/actionhandlers.h index b1f65db2..7457f8eb 100644 --- a/plugins/hotkeys/actionhandlers.h +++ b/plugins/hotkeys/actionhandlers.h @@ -90,4 +90,10 @@ action_invert_selection_handler (DB_plugin_action_t *act, int ctx); int action_clear_playlist_handler (DB_plugin_action_t *act, int ctx); +int +action_add_to_playqueue_handler (DB_plugin_action_t *act, int ctx); + +int +action_remove_from_playqueue_handler (DB_plugin_action_t *act, int ctx); + #endif diff --git a/plugins/hotkeys/hotkeys.c b/plugins/hotkeys/hotkeys.c index 8e3adea7..ca519976 100644 --- a/plugins/hotkeys/hotkeys.c +++ b/plugins/hotkeys/hotkeys.c @@ -698,7 +698,7 @@ action_toggle_stop_after_current_cb (struct DB_plugin_action_s *action, int ctx) static DB_plugin_action_t action_reload_metadata = { .title = "Reload metadata", .name = "reload_metadata", - .flags = DB_ACTION_MULTIPLE_TRACKS | DB_ACTION_ADD_MENU, + .flags = DB_ACTION_MULTIPLE_TRACKS, .callback = action_reload_metadata_handler, .next = NULL }; @@ -873,18 +873,18 @@ static DB_plugin_action_t action_clear_playlist = { }; static DB_plugin_action_t action_remove_from_playqueue = { - .title = "Playback/[stub] Add To Playback Queue", + .title = "Playback/Remove from playback queue", .name = "remove_from_playback_queue", .flags = DB_ACTION_MULTIPLE_TRACKS, - .callback = NULL, + .callback = action_remove_from_playqueue_handler, .next = &action_clear_playlist }; static DB_plugin_action_t action_add_to_playqueue = { - .title = "Playback/[stub] Add To Playback Queue", + .title = "Playback/Add to playback queue", .name = "add_to_playback_queue", .flags = DB_ACTION_MULTIPLE_TRACKS, - .callback = NULL, + .callback = action_add_to_playqueue_handler, .next = &action_remove_from_playqueue }; |