diff options
author | waker <wakeroid@gmail.com> | 2012-11-18 21:13:38 +0100 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2012-11-18 21:13:38 +0100 |
commit | 2a3845d0b8a9a8d0d08cc1c17699ee8cf7a702ee (patch) | |
tree | 15da6b335070dccb03f87a3d98d053f70c92e006 /plugins/hotkeys/hotkeys.c | |
parent | ce61239ec9771efb95790bbbb349ecfdf21f1ac9 (diff) |
gtkui: fixed play and pause hotkeys; removed button accelerators from toolbar
Diffstat (limited to 'plugins/hotkeys/hotkeys.c')
-rw-r--r-- | plugins/hotkeys/hotkeys.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/plugins/hotkeys/hotkeys.c b/plugins/hotkeys/hotkeys.c index aa8e0d42..c516385e 100644 --- a/plugins/hotkeys/hotkeys.c +++ b/plugins/hotkeys/hotkeys.c @@ -532,7 +532,34 @@ hotkeys_reset (void) { int action_play_cb (struct DB_plugin_action_s *action, int ctx) { - deadbeef->sendmessage (DB_EV_PLAY_CURRENT, 0, 0, 0); + DB_output_t *output = deadbeef->get_output (); + if (output->state () == OUTPUT_STATE_PAUSED) { + ddb_playlist_t *plt = deadbeef->plt_get_curr (); + int cur = deadbeef->plt_get_cursor (plt, PL_MAIN); + if (cur != -1) { + ddb_playItem_t *it = deadbeef->plt_get_item_for_idx (plt, cur, PL_MAIN); + ddb_playItem_t *it_playing = deadbeef->streamer_get_playing_track (); + if (it) { + deadbeef->pl_item_unref (it); + } + if (it_playing) { + deadbeef->pl_item_unref (it_playing); + } + if (it != it_playing) { + deadbeef->sendmessage (DB_EV_PLAY_NUM, 0, cur, 0); + } + else { + deadbeef->sendmessage (DB_EV_PLAY_CURRENT, 0, 0, 0); + } + } + else { + deadbeef->sendmessage (DB_EV_PLAY_CURRENT, 0, 0, 0); + } + deadbeef->plt_unref (plt); + } + else { + deadbeef->sendmessage (DB_EV_PLAY_CURRENT, 0, 0, 0); + } return 0; } |