summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2012-11-24 13:30:22 +0100
committerGravatar waker <wakeroid@gmail.com>2012-11-24 13:30:22 +0100
commit5bfdd5e0c4021ff0dd3f5670bce335465350c3b3 (patch)
tree02d41e3cd653edce6f8eb45903d88d283c52407b
parent7bcde9ee91093fc791a246e3dd06bb2d4f499911 (diff)
gtkui: added loopmode hotkeys
-rw-r--r--plugins/gtkui/actionhandlers.c33
-rw-r--r--plugins/gtkui/actionhandlers.h9
-rw-r--r--plugins/gtkui/gtkui.c59
-rw-r--r--plugins/hotkeys/hotkeys.c58
4 files changed, 101 insertions, 58 deletions
diff --git a/plugins/gtkui/actionhandlers.c b/plugins/gtkui/actionhandlers.c
index d3d80082..04386cca 100644
--- a/plugins/gtkui/actionhandlers.c
+++ b/plugins/gtkui/actionhandlers.c
@@ -932,3 +932,36 @@ action_hide_eq_handler(DB_plugin_action_t *act, int ctx) {
return 0;
}
+gboolean
+action_playback_loop_off_handler_cb (void *data) {
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (lookup_widget (mainwin, "loop_disable")), 1);
+}
+
+int
+action_playback_loop_off_handler(DB_plugin_action_t *act, int ctx) {
+ g_idle_add (action_playback_loop_off_handler_cb, NULL);
+ return 0;
+}
+
+gboolean
+action_playback_loop_single_handler_cb (void *data) {
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (lookup_widget (mainwin, "loop_single")), 1);
+}
+
+int
+action_playback_loop_single_handler(DB_plugin_action_t *act, int ctx) {
+ g_idle_add (action_playback_loop_single_handler_cb, NULL);
+ return 0;
+}
+
+gboolean
+action_playback_loop_all_handler_cb (void *data) {
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (lookup_widget (mainwin, "loop_all")), 1);
+}
+
+int
+action_playback_loop_all_handler(DB_plugin_action_t *act, int ctx) {
+ g_idle_add (action_playback_loop_all_handler_cb, NULL);
+ return 0;
+}
+
diff --git a/plugins/gtkui/actionhandlers.h b/plugins/gtkui/actionhandlers.h
index 08e19df5..18b15171 100644
--- a/plugins/gtkui/actionhandlers.h
+++ b/plugins/gtkui/actionhandlers.h
@@ -186,4 +186,13 @@ action_show_eq_handler(DB_plugin_action_t *act, int ctx);
int
action_hide_eq_handler(DB_plugin_action_t *act, int ctx);
+int
+action_playback_loop_off_handler(DB_plugin_action_t *act, int ctx);
+
+int
+action_playback_loop_single_handler(DB_plugin_action_t *act, int ctx);
+
+int
+action_playback_loop_all_handler(DB_plugin_action_t *act, int ctx);
+
#endif
diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c
index 0a9e2652..3f49647d 100644
--- a/plugins/gtkui/gtkui.c
+++ b/plugins/gtkui/gtkui.c
@@ -1389,12 +1389,69 @@ static DB_plugin_action_t action_show_help = {
.next = &action_track_properties
};
+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
+};
+
+static DB_plugin_action_t action_playback_loop_single = {
+ .title = "Playback/Playback looping - Single track",
+ .name = "loop_track",
+ .flags = DB_ACTION_COMMON,
+ .callback = action_playback_loop_single_handler,
+ .next = &action_playback_loop_off
+};
+
+static DB_plugin_action_t action_playback_loop_all = {
+ .title = "Playback/Playback looping - All",
+ .name = "loop_all",
+ .flags = DB_ACTION_COMMON,
+ .callback = action_playback_loop_all_handler,
+ .next = &action_playback_loop_single
+};
+
+static DB_plugin_action_t action_playback_order_random = {
+ .title = "Playback/[stub] Playback order - Random",
+ .name = "order_random",
+ .flags = DB_ACTION_COMMON,
+ .callback = NULL,
+ .next = &action_playback_loop_all
+};
+
+static DB_plugin_action_t action_playback_order_shuffle_albums = {
+ .title = "Playback/[stub] Playback order - Shuffle albums",
+ .name = "order_shuffle_albums",
+ .flags = DB_ACTION_COMMON,
+ .callback = NULL,
+ .next = &action_playback_order_random
+};
+
+static DB_plugin_action_t action_playback_order_shuffle = {
+ .title = "Playback/[stub] Playback order - Shuffle tracks",
+ .name = "order_shuffle",
+ .flags = DB_ACTION_COMMON,
+ .callback = NULL,
+ .next = &action_playback_order_shuffle_albums
+};
+
+static DB_plugin_action_t action_playback_order_linear = {
+ .title = "Playback/[stub] Playback order - Linear",
+ .name = "order_linear",
+ .flags = DB_ACTION_COMMON,
+ .callback = NULL,
+ .next = &action_playback_order_shuffle
+};
+
+
static DB_plugin_action_t action_cursor_follows_playback = {
.title = "Playback/Cursor follows playback toggle",
.name = "toggle_cursor_follows_playback",
.flags = DB_ACTION_COMMON,
.callback = action_cursor_follows_playback_handler,
- .next = &action_show_help
+ .next = &action_playback_order_linear
};
diff --git a/plugins/hotkeys/hotkeys.c b/plugins/hotkeys/hotkeys.c
index 5f8bb8c2..ce6cd079 100644
--- a/plugins/hotkeys/hotkeys.c
+++ b/plugins/hotkeys/hotkeys.c
@@ -711,68 +711,12 @@ static DB_plugin_action_t action_jump_to_current = {
.next = &action_reload_metadata
};
-static DB_plugin_action_t action_playback_loop_off = {
- .title = "Playback/[stub] Playback looping - Don't loop",
- .name = "loop_off",
- .flags = DB_ACTION_COMMON,
- .callback = NULL,
- .next = &action_jump_to_current
-};
-
-static DB_plugin_action_t action_playback_loop_single = {
- .title = "Playback/[stub] Playback looping - Single track",
- .name = "loop_track",
- .flags = DB_ACTION_COMMON,
- .callback = NULL,
- .next = &action_playback_loop_off
-};
-
-static DB_plugin_action_t action_playback_loop_all = {
- .title = "Playback/[stub] Playback looping - All",
- .name = "loop_all",
- .flags = DB_ACTION_COMMON,
- .callback = NULL,
- .next = &action_playback_loop_single
-};
-
-static DB_plugin_action_t action_playback_order_random = {
- .title = "Playback/[stub] Playback order - Random",
- .name = "order_random",
- .flags = DB_ACTION_COMMON,
- .callback = NULL,
- .next = &action_playback_loop_all
-};
-
-static DB_plugin_action_t action_playback_order_shuffle_albums = {
- .title = "Playback/[stub] Playback order - Shuffle albums",
- .name = "order_shuffle_albums",
- .flags = DB_ACTION_COMMON,
- .callback = NULL,
- .next = &action_playback_order_random
-};
-
-static DB_plugin_action_t action_playback_order_shuffle = {
- .title = "Playback/[stub] Playback order - Shuffle tracks",
- .name = "order_shuffle",
- .flags = DB_ACTION_COMMON,
- .callback = NULL,
- .next = &action_playback_order_shuffle_albums
-};
-
-static DB_plugin_action_t action_playback_order_linear = {
- .title = "Playback/[stub] Playback order - Linear",
- .name = "order_linear",
- .flags = DB_ACTION_COMMON,
- .callback = NULL,
- .next = &action_playback_order_shuffle
-};
-
static DB_plugin_action_t action_next_playlist = {
.title = "Edit/[stub] Next playlist",
.name = "sort_next_playlist",
.flags = DB_ACTION_COMMON,
.callback = NULL,
- .next = &action_playback_order_linear
+ .next = &action_jump_to_current
};
static DB_plugin_action_t action_prev_playlist = {