diff options
author | Alexey Yakovenko <waker@users.sourceforge.net> | 2013-10-12 12:02:03 +0200 |
---|---|---|
committer | Alexey Yakovenko <waker@users.sourceforge.net> | 2013-10-12 12:02:03 +0200 |
commit | b11cee15a7867130a37b473a764b2d708dd80d10 (patch) | |
tree | 23d0c0085afd85a2a015e805a18a5dde7043abbc /plugins | |
parent | f281c5aaa06b02c6bb634309ff5311a675636c5e (diff) |
hotkeys: next/prev playlist cycling
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/hotkeys/actionhandlers.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/plugins/hotkeys/actionhandlers.c b/plugins/hotkeys/actionhandlers.c index b351c9f4..9d11d2ed 100644 --- a/plugins/hotkeys/actionhandlers.c +++ b/plugins/hotkeys/actionhandlers.c @@ -76,22 +76,34 @@ action_reload_metadata_handler (DB_plugin_action_t *act, int ctx) { 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) { + + if (tab == deadbeef->plt_get_count ()-1) { + tab = 0; + } + else { tab++; - deadbeef->plt_set_curr_idx (tab); - deadbeef->conf_set_int ("playlist.current", 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) { + + if (tab == 0) { + tab = deadbeef->plt_get_count ()-1; + } + else { tab--; - deadbeef->plt_set_curr_idx (tab); - deadbeef->conf_set_int ("playlist.current", tab); } + + deadbeef->plt_set_curr_idx (tab); + deadbeef->conf_set_int ("playlist.current", tab); + return 0; } |