From 9afb563e52434f3901ba47552c628e527d1701df Mon Sep 17 00:00:00 2001 From: waker Date: Sat, 24 Nov 2012 13:53:09 +0100 Subject: gtkui: added cycle play order hotkeys --- plugins/gtkui/actionhandlers.c | 26 ++++++++++++++++++++++++++ plugins/gtkui/actionhandlers.h | 3 +++ plugins/gtkui/gtkui.c | 10 +++++++++- 3 files changed, 38 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/gtkui/actionhandlers.c b/plugins/gtkui/actionhandlers.c index b1f159fb..c8d16424 100644 --- a/plugins/gtkui/actionhandlers.c +++ b/plugins/gtkui/actionhandlers.c @@ -1008,3 +1008,29 @@ action_playback_order_linear_handler(DB_plugin_action_t *act, int ctx) { g_idle_add (action_playback_order_linear_handler_cb, NULL); return 0; } + +//deadbeef->conf_get_int ("playback.loop", PLAYBACK_MODE_LOOP_ALL) +gboolean +action_playback_order_cycle_handler_cb (void *data) { + int ord = deadbeef->conf_get_int ("playback.order", PLAYBACK_ORDER_LINEAR); + switch (ord) { + case PLAYBACK_ORDER_LINEAR: + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (lookup_widget (mainwin, "order_shuffle")), 1); + break; + case PLAYBACK_ORDER_SHUFFLE_TRACKS: + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (lookup_widget (mainwin, "order_shuffle_albums")), 1); + break; + case PLAYBACK_ORDER_SHUFFLE_ALBUMS: + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (lookup_widget (mainwin, "order_random")), 1); + break; + case PLAYBACK_ORDER_RANDOM: + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (lookup_widget (mainwin, "order_linear")), 1); + break; + } +} + +int +action_playback_order_cycle_handler(DB_plugin_action_t *act, int ctx) { + g_idle_add (action_playback_order_cycle_handler_cb, NULL); + return 0; +} diff --git a/plugins/gtkui/actionhandlers.h b/plugins/gtkui/actionhandlers.h index 3b5e7027..036b922d 100644 --- a/plugins/gtkui/actionhandlers.h +++ b/plugins/gtkui/actionhandlers.h @@ -207,4 +207,7 @@ action_playback_order_shuffle_handler(DB_plugin_action_t *act, int ctx); int action_playback_order_linear_handler(DB_plugin_action_t *act, int ctx); +int +action_playback_order_cycle_handler(DB_plugin_action_t *act, int ctx); + #endif diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c index 172b2759..61c3cafa 100644 --- a/plugins/gtkui/gtkui.c +++ b/plugins/gtkui/gtkui.c @@ -1413,12 +1413,20 @@ static DB_plugin_action_t action_playback_loop_all = { .next = &action_playback_loop_single }; +static DB_plugin_action_t action_playback_order_cycle = { + .title = "Playback/Cycle playback order", + .name = "order_cycle", + .flags = DB_ACTION_COMMON, + .callback = action_playback_order_cycle_handler, + .next = &action_playback_loop_all +}; + static DB_plugin_action_t action_playback_order_random = { .title = "Playback/Playback order - Random", .name = "order_random", .flags = DB_ACTION_COMMON, .callback = action_playback_order_random_handler, - .next = &action_playback_loop_all + .next = &action_playback_order_cycle }; static DB_plugin_action_t action_playback_order_shuffle_albums = { -- cgit v1.2.3