diff options
author | waker <wakeroid@gmail.com> | 2012-11-24 14:04:24 +0100 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2012-11-24 14:04:24 +0100 |
commit | d03201c8933688dc078eef401cbccdff25657c35 (patch) | |
tree | a2ab0aaa1133f218cadddecf2eb63e3be5a2de0a /plugins | |
parent | bf755d6c49ae1c65f10d13958ea3d32f92786ffe (diff) |
hotkeys: added prev/next playlist hotkeys
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/hotkeys/actionhandlers.c | 22 | ||||
-rw-r--r-- | plugins/hotkeys/actionhandlers.h | 6 | ||||
-rw-r--r-- | plugins/hotkeys/hotkeys.c | 8 |
3 files changed, 32 insertions, 4 deletions
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 }; |