From d03201c8933688dc078eef401cbccdff25657c35 Mon Sep 17 00:00:00 2001 From: waker Date: Sat, 24 Nov 2012 14:04:24 +0100 Subject: hotkeys: added prev/next playlist hotkeys --- plugins/hotkeys/actionhandlers.c | 22 ++++++++++++++++++++++ plugins/hotkeys/actionhandlers.h | 6 ++++++ plugins/hotkeys/hotkeys.c | 8 ++++---- 3 files changed, 32 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/hotkeys/actionhandlers.c b/plugins/hotkeys/actionhandlers.c index b2b93047..72e3f3cb 100644 --- a/plugins/hotkeys/actionhandlers.c +++ b/plugins/hotkeys/actionhandlers.c @@ -72,3 +72,25 @@ action_reload_metadata_handler (DB_plugin_action_t *act, int ctx) { deadbeef->sendmessage (DB_EV_PLAYLIST_REFRESH, 0, 0, 0); return 0; } + +int +action_next_playlist_handler (DB_plugin_action_t *act, int ctx) { + int tab = deadbeef->plt_get_curr_idx (); + if (tab < deadbeef->plt_get_count ()-1) { + tab++; + deadbeef->plt_set_curr_idx (tab); + deadbeef->conf_set_int ("playlist.current", tab); + } + return 0; +} + +int +action_prev_playlist_handler (DB_plugin_action_t *act, int ctx) { + int tab = deadbeef->plt_get_curr_idx (); + if (tab > 0) { + tab--; + deadbeef->plt_set_curr_idx (tab); + deadbeef->conf_set_int ("playlist.current", tab); + } + return 0; +} diff --git a/plugins/hotkeys/actionhandlers.h b/plugins/hotkeys/actionhandlers.h index f6f5db20..20f7f660 100644 --- a/plugins/hotkeys/actionhandlers.h +++ b/plugins/hotkeys/actionhandlers.h @@ -30,4 +30,10 @@ action_jump_to_current_handler (DB_plugin_action_t *act, int ctx); int action_reload_metadata_handler (DB_plugin_action_t *act, int ctx); +int +action_next_playlist_handler (DB_plugin_action_t *act, int ctx); + +int +action_prev_playlist_handler (DB_plugin_action_t *act, int ctx); + #endif diff --git a/plugins/hotkeys/hotkeys.c b/plugins/hotkeys/hotkeys.c index ce6cd079..676e9a13 100644 --- a/plugins/hotkeys/hotkeys.c +++ b/plugins/hotkeys/hotkeys.c @@ -712,18 +712,18 @@ static DB_plugin_action_t action_jump_to_current = { }; static DB_plugin_action_t action_next_playlist = { - .title = "Edit/[stub] Next playlist", + .title = "Edit/Next playlist", .name = "sort_next_playlist", .flags = DB_ACTION_COMMON, - .callback = NULL, + .callback = action_next_playlist_handler, .next = &action_jump_to_current }; static DB_plugin_action_t action_prev_playlist = { - .title = "Edit/[stub] Prev playlist", + .title = "Edit/Prev playlist", .name = "sort_prev_playlist", .flags = DB_ACTION_COMMON, - .callback = NULL, + .callback = action_prev_playlist_handler, .next = &action_next_playlist }; -- cgit v1.2.3