summaryrefslogtreecommitdiff
path: root/plugins/hotkeys
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2012-11-24 14:22:12 +0100
committerGravatar waker <wakeroid@gmail.com>2012-11-24 14:22:12 +0100
commit0e9e6e3d073c5b034568ba3c7f6f85e7197628cc (patch)
treef8b790391075ebe82e6941c71a72ff6cbe5dbd28 /plugins/hotkeys
parentd03201c8933688dc078eef401cbccdff25657c35 (diff)
gtkui: added hotkeys for switching to playlist1-10; removed old play_random hardcoded hotkey
Diffstat (limited to 'plugins/hotkeys')
-rw-r--r--plugins/hotkeys/actionhandlers.c101
-rw-r--r--plugins/hotkeys/actionhandlers.h30
-rw-r--r--plugins/hotkeys/hotkeys.c86
3 files changed, 214 insertions, 3 deletions
diff --git a/plugins/hotkeys/actionhandlers.c b/plugins/hotkeys/actionhandlers.c
index 72e3f3cb..c1d49b26 100644
--- a/plugins/hotkeys/actionhandlers.c
+++ b/plugins/hotkeys/actionhandlers.c
@@ -94,3 +94,104 @@ action_prev_playlist_handler (DB_plugin_action_t *act, int ctx) {
}
return 0;
}
+
+int
+action_playlist1_handler (DB_plugin_action_t *act, int ctx) {
+ int pl = 0;
+ if (pl < deadbeef->plt_get_count ()) {
+ deadbeef->plt_set_curr_idx (pl);
+ deadbeef->conf_set_int ("playlist.current", pl);
+ }
+ return 0;
+}
+
+int
+action_playlist2_handler (DB_plugin_action_t *act, int ctx) {
+ int pl = 1;
+ if (pl < deadbeef->plt_get_count ()) {
+ deadbeef->plt_set_curr_idx (pl);
+ deadbeef->conf_set_int ("playlist.current", pl);
+ }
+ return 0;
+}
+
+int
+action_playlist3_handler (DB_plugin_action_t *act, int ctx) {
+ int pl = 2;
+ if (pl < deadbeef->plt_get_count ()) {
+ deadbeef->plt_set_curr_idx (pl);
+ deadbeef->conf_set_int ("playlist.current", pl);
+ }
+ return 0;
+}
+
+int
+action_playlist4_handler (DB_plugin_action_t *act, int ctx) {
+ int pl = 3;
+ if (pl < deadbeef->plt_get_count ()) {
+ deadbeef->plt_set_curr_idx (pl);
+ deadbeef->conf_set_int ("playlist.current", pl);
+ }
+ return 0;
+}
+
+int
+action_playlist5_handler (DB_plugin_action_t *act, int ctx) {
+ int pl = 4;
+ if (pl < deadbeef->plt_get_count ()) {
+ deadbeef->plt_set_curr_idx (pl);
+ deadbeef->conf_set_int ("playlist.current", pl);
+ }
+ return 0;
+}
+
+int
+action_playlist6_handler (DB_plugin_action_t *act, int ctx) {
+ int pl = 5;
+ if (pl < deadbeef->plt_get_count ()) {
+ deadbeef->plt_set_curr_idx (pl);
+ deadbeef->conf_set_int ("playlist.current", pl);
+ }
+ return 0;
+}
+
+int
+action_playlist7_handler (DB_plugin_action_t *act, int ctx) {
+ int pl = 6;
+ if (pl < deadbeef->plt_get_count ()) {
+ deadbeef->plt_set_curr_idx (pl);
+ deadbeef->conf_set_int ("playlist.current", pl);
+ }
+ return 0;
+}
+
+int
+action_playlist8_handler (DB_plugin_action_t *act, int ctx) {
+ int pl = 7;
+ if (pl < deadbeef->plt_get_count ()) {
+ deadbeef->plt_set_curr_idx (pl);
+ deadbeef->conf_set_int ("playlist.current", pl);
+ }
+ return 0;
+}
+
+int
+action_playlist9_handler (DB_plugin_action_t *act, int ctx) {
+ int pl = 8;
+ if (pl < deadbeef->plt_get_count ()) {
+ deadbeef->plt_set_curr_idx (pl);
+ deadbeef->conf_set_int ("playlist.current", pl);
+ }
+ return 0;
+}
+
+int
+action_playlist10_handler (DB_plugin_action_t *act, int ctx) {
+ int pl = 9;
+ if (pl < deadbeef->plt_get_count ()) {
+ deadbeef->plt_set_curr_idx (pl);
+ deadbeef->conf_set_int ("playlist.current", pl);
+ }
+ return 0;
+}
+
diff --git a/plugins/hotkeys/actionhandlers.h b/plugins/hotkeys/actionhandlers.h
index 20f7f660..a8fde362 100644
--- a/plugins/hotkeys/actionhandlers.h
+++ b/plugins/hotkeys/actionhandlers.h
@@ -36,4 +36,34 @@ action_next_playlist_handler (DB_plugin_action_t *act, int ctx);
int
action_prev_playlist_handler (DB_plugin_action_t *act, int ctx);
+int
+action_playlist1_handler (DB_plugin_action_t *act, int ctx);
+
+int
+action_playlist2_handler (DB_plugin_action_t *act, int ctx);
+
+int
+action_playlist3_handler (DB_plugin_action_t *act, int ctx);
+
+int
+action_playlist4_handler (DB_plugin_action_t *act, int ctx);
+
+int
+action_playlist5_handler (DB_plugin_action_t *act, int ctx);
+
+int
+action_playlist6_handler (DB_plugin_action_t *act, int ctx);
+
+int
+action_playlist7_handler (DB_plugin_action_t *act, int ctx);
+
+int
+action_playlist8_handler (DB_plugin_action_t *act, int ctx);
+
+int
+action_playlist9_handler (DB_plugin_action_t *act, int ctx);
+
+int
+action_playlist10_handler (DB_plugin_action_t *act, int ctx);
+
#endif
diff --git a/plugins/hotkeys/hotkeys.c b/plugins/hotkeys/hotkeys.c
index 676e9a13..624e4e62 100644
--- a/plugins/hotkeys/hotkeys.c
+++ b/plugins/hotkeys/hotkeys.c
@@ -713,7 +713,7 @@ static DB_plugin_action_t action_jump_to_current = {
static DB_plugin_action_t action_next_playlist = {
.title = "Edit/Next playlist",
- .name = "sort_next_playlist",
+ .name = "next_playlist",
.flags = DB_ACTION_COMMON,
.callback = action_next_playlist_handler,
.next = &action_jump_to_current
@@ -721,18 +721,98 @@ static DB_plugin_action_t action_next_playlist = {
static DB_plugin_action_t action_prev_playlist = {
.title = "Edit/Prev playlist",
- .name = "sort_prev_playlist",
+ .name = "prev_playlist",
.flags = DB_ACTION_COMMON,
.callback = action_prev_playlist_handler,
.next = &action_next_playlist
};
+static DB_plugin_action_t action_playlist10 = {
+ .title = "Edit/Switch to playlist 10",
+ .name = "playlist10",
+ .flags = DB_ACTION_COMMON,
+ .callback = action_playlist10_handler,
+ .next = &action_prev_playlist
+};
+
+static DB_plugin_action_t action_playlist9 = {
+ .title = "Edit/Switch to playlist 9",
+ .name = "playlist9",
+ .flags = DB_ACTION_COMMON,
+ .callback = action_playlist9_handler,
+ .next = &action_playlist10
+};
+
+static DB_plugin_action_t action_playlist8 = {
+ .title = "Edit/Switch to playlist 8",
+ .name = "playlist8",
+ .flags = DB_ACTION_COMMON,
+ .callback = action_playlist8_handler,
+ .next = &action_playlist9
+};
+
+static DB_plugin_action_t action_playlist7 = {
+ .title = "Edit/Switch to playlist 7",
+ .name = "playlist7",
+ .flags = DB_ACTION_COMMON,
+ .callback = action_playlist7_handler,
+ .next = &action_playlist8
+};
+
+static DB_plugin_action_t action_playlist6 = {
+ .title = "Edit/Switch to playlist 6",
+ .name = "playlist6",
+ .flags = DB_ACTION_COMMON,
+ .callback = action_playlist6_handler,
+ .next = &action_playlist7
+};
+
+static DB_plugin_action_t action_playlist5 = {
+ .title = "Edit/Switch to playlist 5",
+ .name = "playlist5",
+ .flags = DB_ACTION_COMMON,
+ .callback = action_playlist5_handler,
+ .next = &action_playlist6
+};
+
+static DB_plugin_action_t action_playlist4 = {
+ .title = "Edit/Switch to playlist 4",
+ .name = "playlist4",
+ .flags = DB_ACTION_COMMON,
+ .callback = action_playlist4_handler,
+ .next = &action_playlist5
+};
+
+static DB_plugin_action_t action_playlist3 = {
+ .title = "Edit/Switch to playlist 3",
+ .name = "playlist3",
+ .flags = DB_ACTION_COMMON,
+ .callback = action_playlist3_handler,
+ .next = &action_playlist4
+};
+
+static DB_plugin_action_t action_playlist2 = {
+ .title = "Edit/Switch to playlist 2",
+ .name = "playlist2",
+ .flags = DB_ACTION_COMMON,
+ .callback = action_playlist2_handler,
+ .next = &action_playlist3
+};
+
+static DB_plugin_action_t action_playlist1 = {
+ .title = "Edit/Switch to playlist 1",
+ .name = "playlist1",
+ .flags = DB_ACTION_COMMON,
+ .callback = action_playlist1_handler,
+ .next = &action_playlist2
+};
+
static DB_plugin_action_t action_sort_randomize = {
.title = "Edit/[stub] Sort Randomize",
.name = "sort_randomize",
.flags = DB_ACTION_COMMON,
.callback = NULL,
- .next = &action_prev_playlist
+ .next = &action_playlist1
};
static DB_plugin_action_t action_sort_by_date = {