diff options
Diffstat (limited to 'apps/onplay.c')
-rw-r--r-- | apps/onplay.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/apps/onplay.c b/apps/onplay.c index d468c0a545..ab507f08ac 100644 --- a/apps/onplay.c +++ b/apps/onplay.c | |||
@@ -138,7 +138,7 @@ static bool clipboard_clip(struct clipboard *clip, const char *path, | |||
138 | static int bookmark_load_menu_wrapper(void) | 138 | static int bookmark_load_menu_wrapper(void) |
139 | { | 139 | { |
140 | if (get_current_activity() == ACTIVITY_CONTEXTMENU) /* get rid of parent activity */ | 140 | if (get_current_activity() == ACTIVITY_CONTEXTMENU) /* get rid of parent activity */ |
141 | pop_current_activity_without_refresh(); /* when called from ctxt menu */ | 141 | pop_current_activity_without_refresh(); /* when called from ctxt menu */ |
142 | 142 | ||
143 | return bookmark_load_menu(); | 143 | return bookmark_load_menu(); |
144 | } | 144 | } |
@@ -302,7 +302,7 @@ static int add_to_playlist(void* arg) | |||
302 | 302 | ||
303 | /* warn if replacing the playlist */ | 303 | /* warn if replacing the playlist */ |
304 | if (new_playlist && !warn_on_pl_erase()) | 304 | if (new_playlist && !warn_on_pl_erase()) |
305 | return 0; | 305 | return 1; |
306 | 306 | ||
307 | splash(0, ID2P(LANG_WAIT)); | 307 | splash(0, ID2P(LANG_WAIT)); |
308 | 308 | ||
@@ -340,7 +340,7 @@ static int add_to_playlist(void* arg) | |||
340 | } | 340 | } |
341 | 341 | ||
342 | playlist_set_modified(NULL, true); | 342 | playlist_set_modified(NULL, true); |
343 | return false; | 343 | return 0; |
344 | } | 344 | } |
345 | 345 | ||
346 | static bool view_playlist(void) | 346 | static bool view_playlist(void) |
@@ -689,7 +689,7 @@ MENUITEM_FUNCTION(view_cue_item, 0, ID2P(LANG_BROWSE_CUESHEET), | |||
689 | static int browse_id3_wrapper(void) | 689 | static int browse_id3_wrapper(void) |
690 | { | 690 | { |
691 | if (get_current_activity() == ACTIVITY_CONTEXTMENU) /* get rid of parent activity */ | 691 | if (get_current_activity() == ACTIVITY_CONTEXTMENU) /* get rid of parent activity */ |
692 | pop_current_activity_without_refresh(); /* when called from ctxt menu */ | 692 | pop_current_activity_without_refresh(); /* when called from ctxt menu */ |
693 | 693 | ||
694 | if (browse_id3(audio_current_track(), | 694 | if (browse_id3(audio_current_track(), |
695 | playlist_get_display_index(), | 695 | playlist_get_display_index(), |
@@ -806,6 +806,10 @@ static bool onplay_load_plugin(void *param) | |||
806 | if (!prepare_database_sel(param)) | 806 | if (!prepare_database_sel(param)) |
807 | return false; | 807 | return false; |
808 | #endif | 808 | #endif |
809 | |||
810 | if (get_current_activity() == ACTIVITY_CONTEXTMENU) /* get rid of parent activity */ | ||
811 | pop_current_activity_without_refresh(); /* when called from ctxt menu */ | ||
812 | |||
809 | int ret = filetype_load_plugin((const char*)param, selected_file.path); | 813 | int ret = filetype_load_plugin((const char*)param, selected_file.path); |
810 | if (ret == PLUGIN_USB_CONNECTED) | 814 | if (ret == PLUGIN_USB_CONNECTED) |
811 | onplay_result = ONPLAY_RELOAD_DIR; | 815 | onplay_result = ONPLAY_RELOAD_DIR; |
@@ -1251,7 +1255,7 @@ static int execute_hotkey(bool is_wps) | |||
1251 | } | 1255 | } |
1252 | #endif /* HOTKEY */ | 1256 | #endif /* HOTKEY */ |
1253 | 1257 | ||
1254 | int onplay(char* file, int attr, int from_context, bool hotkey) | 1258 | int onplay(char* file, int attr, int from_context, bool hotkey, int customaction) |
1255 | { | 1259 | { |
1256 | const struct menu_item_ex *menu; | 1260 | const struct menu_item_ex *menu; |
1257 | onplay_result = ONPLAY_OK; | 1261 | onplay_result = ONPLAY_OK; |
@@ -1290,6 +1294,14 @@ int onplay(char* file, int attr, int from_context, bool hotkey) | |||
1290 | #else | 1294 | #else |
1291 | (void)hotkey; | 1295 | (void)hotkey; |
1292 | #endif | 1296 | #endif |
1297 | if (customaction == ONPLAY_CUSTOMACTION_SHUFFLE_SONGS) | ||
1298 | { | ||
1299 | int returnCode = add_to_playlist(&addtopl_replace_shuffled); | ||
1300 | if (returnCode == 1) | ||
1301 | // User did not want to erase his current playlist, so let's show again the database main menu | ||
1302 | return ONPLAY_RELOAD_DIR; | ||
1303 | return ONPLAY_START_PLAY; | ||
1304 | } | ||
1293 | 1305 | ||
1294 | push_current_activity(ACTIVITY_CONTEXTMENU); | 1306 | push_current_activity(ACTIVITY_CONTEXTMENU); |
1295 | if (from_context == CONTEXT_WPS) | 1307 | if (from_context == CONTEXT_WPS) |
@@ -1299,7 +1311,7 @@ int onplay(char* file, int attr, int from_context, bool hotkey) | |||
1299 | menu_selection = do_menu(menu, NULL, NULL, false); | 1311 | menu_selection = do_menu(menu, NULL, NULL, false); |
1300 | 1312 | ||
1301 | if (get_current_activity() == ACTIVITY_CONTEXTMENU) /* Activity may have been */ | 1313 | if (get_current_activity() == ACTIVITY_CONTEXTMENU) /* Activity may have been */ |
1302 | pop_current_activity(); /* popped already by menu item */ | 1314 | pop_current_activity(); /* popped already by menu item */ |
1303 | 1315 | ||
1304 | 1316 | ||
1305 | if (menu_selection == GO_TO_WPS) | 1317 | if (menu_selection == GO_TO_WPS) |