diff options
author | waker <wakeroid@gmail.com> | 2012-11-24 13:56:50 +0100 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2012-11-24 13:56:50 +0100 |
commit | bf755d6c49ae1c65f10d13958ea3d32f92786ffe (patch) | |
tree | b05f319676fd2289d4f661559cff585d08e2bdd7 | |
parent | 9afb563e52434f3901ba47552c628e527d1701df (diff) |
gtkui: added cycle loop mode hotkeys
-rw-r--r-- | plugins/gtkui/actionhandlers.c | 23 | ||||
-rw-r--r-- | plugins/gtkui/actionhandlers.h | 3 | ||||
-rw-r--r-- | plugins/gtkui/gtkui.c | 10 |
3 files changed, 34 insertions, 2 deletions
diff --git a/plugins/gtkui/actionhandlers.c b/plugins/gtkui/actionhandlers.c index c8d16424..bacb96c2 100644 --- a/plugins/gtkui/actionhandlers.c +++ b/plugins/gtkui/actionhandlers.c @@ -1009,7 +1009,6 @@ action_playback_order_linear_handler(DB_plugin_action_t *act, int ctx) { 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); @@ -1034,3 +1033,25 @@ action_playback_order_cycle_handler(DB_plugin_action_t *act, int ctx) { g_idle_add (action_playback_order_cycle_handler_cb, NULL); return 0; } + +gboolean +action_playback_loop_cycle_handler_cb (void *data) { + int ord = deadbeef->conf_get_int ("playback.loop", PLAYBACK_MODE_LOOP_ALL); + switch (ord) { + case PLAYBACK_MODE_LOOP_ALL: + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (lookup_widget (mainwin, "loop_single")), 1); + break; + case PLAYBACK_MODE_LOOP_SINGLE: + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (lookup_widget (mainwin, "loop_disable")), 1); + break; + case PLAYBACK_MODE_NOLOOP: + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (lookup_widget (mainwin, "loop_all")), 1); + break; + } +} + +int +action_playback_loop_cycle_handler(DB_plugin_action_t *act, int ctx) { + g_idle_add (action_playback_loop_cycle_handler_cb, NULL); + return 0; +} diff --git a/plugins/gtkui/actionhandlers.h b/plugins/gtkui/actionhandlers.h index 036b922d..272ea873 100644 --- a/plugins/gtkui/actionhandlers.h +++ b/plugins/gtkui/actionhandlers.h @@ -210,4 +210,7 @@ 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); +int +action_playback_loop_cycle_handler(DB_plugin_action_t *act, int ctx); + #endif diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c index 61c3cafa..adfb4869 100644 --- a/plugins/gtkui/gtkui.c +++ b/plugins/gtkui/gtkui.c @@ -1389,12 +1389,20 @@ static DB_plugin_action_t action_show_help = { .next = &action_track_properties }; +static DB_plugin_action_t action_playback_loop_cycle = { + .title = "Playback/Cycle playback looping mode", + .name = "loop_cycle", + .flags = DB_ACTION_COMMON, + .callback = action_playback_loop_cycle_handler, + .next = &action_show_help +}; + static DB_plugin_action_t action_playback_loop_off = { .title = "Playback/Playback looping - Don't loop", .name = "loop_off", .flags = DB_ACTION_COMMON, .callback = action_playback_loop_off_handler, - .next = &action_show_help + .next = &action_playback_loop_cycle }; static DB_plugin_action_t action_playback_loop_single = { |