summaryrefslogtreecommitdiff
path: root/apps/onplay.c
diff options
context:
space:
mode:
authorJeffrey Goode <jeffg7@gmail.com>2010-05-11 13:40:25 +0000
committerJeffrey Goode <jeffg7@gmail.com>2010-05-11 13:40:25 +0000
commite141f80e11c08fbb9d404c192f1ef4bcf28c7a74 (patch)
treebce928acbd2bfe793b8a3250d7305ef17f9f94bc /apps/onplay.c
parent565a863dd50b62245e52e18caaf5306955f6b9f5 (diff)
Add Insert Shuffled to hotkey options
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25950 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/onplay.c')
-rw-r--r--apps/onplay.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/apps/onplay.c b/apps/onplay.c
index fc236fc854..da94dbd5b8 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -1195,6 +1195,19 @@ static bool open_with(void)
return list_viewers();
}
+static int playlist_insert_shuffled(void)
+{
+ if ((audio_status() & AUDIO_STATUS_PLAY) ||
+ (selected_file_attr & ATTR_DIRECTORY) ||
+ ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U))
+ {
+ playlist_insert_func((intptr_t*)PLAYLIST_INSERT_SHUFFLED);
+ return ONPLAY_START_PLAY;
+ }
+
+ return ONPLAY_RELOAD_DIR;
+}
+
struct hotkey_assignment {
int action; /* hotkey_action */
int lang_id; /* Language ID */
@@ -1228,6 +1241,9 @@ static struct hotkey_assignment hotkey_items[] = {
{ HOTKEY_INSERT, LANG_INSERT,
HOTKEY_FUNC(playlist_insert_func, (intptr_t*)PLAYLIST_INSERT),
ONPLAY_START_PLAY },
+ { HOTKEY_INSERT_SHUFFLED, LANG_INSERT_SHUFFLED,
+ HOTKEY_FUNC(playlist_insert_shuffled, NULL),
+ ONPLAY_OK },
};
static const int num_hotkey_items = sizeof(hotkey_items) / sizeof(hotkey_items[0]);
@@ -1261,15 +1277,20 @@ static int execute_hotkey(bool is_wps)
{
/* run the associated function (with optional param), if any */
const struct menu_func func = this_item->func;
+ int func_return;
if (func.function != NULL)
{
if (func.param != NULL)
- (*func.function_w_param)(func.param);
+ func_return = (*func.function_w_param)(func.param);
else
- (*func.function)();
+ func_return = (*func.function)();
}
/* return with the associated code */
- return this_item->return_code;
+ const int return_code = this_item->return_code;
+ /* ONPLAY_OK here means to use the function return code */
+ if (return_code == ONPLAY_OK)
+ return func_return;
+ return return_code;
}
}