summaryrefslogtreecommitdiff
path: root/apps/onplay.c
diff options
context:
space:
mode:
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)
1195 return list_viewers(); 1195 return list_viewers();
1196} 1196}
1197 1197
1198static int playlist_insert_shuffled(void)
1199{
1200 if ((audio_status() & AUDIO_STATUS_PLAY) ||
1201 (selected_file_attr & ATTR_DIRECTORY) ||
1202 ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U))
1203 {
1204 playlist_insert_func((intptr_t*)PLAYLIST_INSERT_SHUFFLED);
1205 return ONPLAY_START_PLAY;
1206 }
1207
1208 return ONPLAY_RELOAD_DIR;
1209}
1210
1198struct hotkey_assignment { 1211struct hotkey_assignment {
1199 int action; /* hotkey_action */ 1212 int action; /* hotkey_action */
1200 int lang_id; /* Language ID */ 1213 int lang_id; /* Language ID */
@@ -1228,6 +1241,9 @@ static struct hotkey_assignment hotkey_items[] = {
1228 { HOTKEY_INSERT, LANG_INSERT, 1241 { HOTKEY_INSERT, LANG_INSERT,
1229 HOTKEY_FUNC(playlist_insert_func, (intptr_t*)PLAYLIST_INSERT), 1242 HOTKEY_FUNC(playlist_insert_func, (intptr_t*)PLAYLIST_INSERT),
1230 ONPLAY_START_PLAY }, 1243 ONPLAY_START_PLAY },
1244 { HOTKEY_INSERT_SHUFFLED, LANG_INSERT_SHUFFLED,
1245 HOTKEY_FUNC(playlist_insert_shuffled, NULL),
1246 ONPLAY_OK },
1231}; 1247};
1232 1248
1233static const int num_hotkey_items = sizeof(hotkey_items) / sizeof(hotkey_items[0]); 1249static const int num_hotkey_items = sizeof(hotkey_items) / sizeof(hotkey_items[0]);
@@ -1261,15 +1277,20 @@ static int execute_hotkey(bool is_wps)
1261 { 1277 {
1262 /* run the associated function (with optional param), if any */ 1278 /* run the associated function (with optional param), if any */
1263 const struct menu_func func = this_item->func; 1279 const struct menu_func func = this_item->func;
1280 int func_return;
1264 if (func.function != NULL) 1281 if (func.function != NULL)
1265 { 1282 {
1266 if (func.param != NULL) 1283 if (func.param != NULL)
1267 (*func.function_w_param)(func.param); 1284 func_return = (*func.function_w_param)(func.param);
1268 else 1285 else
1269 (*func.function)(); 1286 func_return = (*func.function)();
1270 } 1287 }
1271 /* return with the associated code */ 1288 /* return with the associated code */
1272 return this_item->return_code; 1289 const int return_code = this_item->return_code;
1290 /* ONPLAY_OK here means to use the function return code */
1291 if (return_code == ONPLAY_OK)
1292 return func_return;
1293 return return_code;
1273 } 1294 }
1274 } 1295 }
1275 1296