diff options
Diffstat (limited to 'apps/onplay.c')
-rw-r--r-- | apps/onplay.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/apps/onplay.c b/apps/onplay.c index f686533324..762ab9e58b 100644 --- a/apps/onplay.c +++ b/apps/onplay.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #ifdef HAVE_LCD_BITMAP | 51 | #ifdef HAVE_LCD_BITMAP |
52 | #include "icons.h" | 52 | #include "icons.h" |
53 | #endif | 53 | #endif |
54 | #include "main_menu.h" | ||
54 | 55 | ||
55 | #define DEFAULT_PLAYLIST_NAME "/dynamic.m3u" | 56 | #define DEFAULT_PLAYLIST_NAME "/dynamic.m3u" |
56 | 57 | ||
@@ -488,6 +489,19 @@ bool create_dir(void) | |||
488 | return true; | 489 | return true; |
489 | } | 490 | } |
490 | 491 | ||
492 | static bool exit_to_main; | ||
493 | |||
494 | /* catch MENU_EXIT_MENU within context menu to call the main menu afterwards */ | ||
495 | static int onplay_callback(int key, int menu) | ||
496 | { | ||
497 | (void)menu; | ||
498 | |||
499 | if (key == MENU_EXIT_MENU) | ||
500 | exit_to_main = true; | ||
501 | |||
502 | return key; | ||
503 | } | ||
504 | |||
491 | int onplay(char* file, int attr, int from) | 505 | int onplay(char* file, int attr, int from) |
492 | { | 506 | { |
493 | struct menu_item items[8]; /* increase this if you add entries! */ | 507 | struct menu_item items[8]; /* increase this if you add entries! */ |
@@ -495,6 +509,7 @@ int onplay(char* file, int attr, int from) | |||
495 | 509 | ||
496 | onplay_result = ONPLAY_OK; | 510 | onplay_result = ONPLAY_OK; |
497 | context=from; | 511 | context=from; |
512 | exit_to_main = false; | ||
498 | selected_file = file; | 513 | selected_file = file; |
499 | selected_file_attr = attr; | 514 | selected_file_attr = attr; |
500 | 515 | ||
@@ -523,7 +538,7 @@ int onplay(char* file, int attr, int from) | |||
523 | i++; | 538 | i++; |
524 | } | 539 | } |
525 | 540 | ||
526 | #ifdef HAVE_MULTIVOLUME | 541 | #ifdef HAVE_MULTIVOLUME |
527 | if (!(attr & ATTR_VOLUME)) /* no rename+delete for volumes */ | 542 | if (!(attr & ATTR_VOLUME)) /* no rename+delete for volumes */ |
528 | #endif | 543 | #endif |
529 | { | 544 | { |
@@ -570,11 +585,14 @@ int onplay(char* file, int attr, int from) | |||
570 | button_clear_queue(); | 585 | button_clear_queue(); |
571 | if (i) | 586 | if (i) |
572 | { | 587 | { |
573 | m = menu_init( items, i, NULL, NULL, NULL, NULL ); | 588 | m = menu_init( items, i, onplay_callback, NULL, NULL, NULL ); |
574 | result = menu_show(m); | 589 | result = menu_show(m); |
575 | if (result >= 0) | 590 | if (result >= 0) |
576 | items[result].function(); | 591 | items[result].function(); |
577 | menu_exit(m); | 592 | menu_exit(m); |
593 | |||
594 | if (exit_to_main) | ||
595 | result = main_menu(); | ||
578 | 596 | ||
579 | #ifdef HAVE_LCD_BITMAP | 597 | #ifdef HAVE_LCD_BITMAP |
580 | if (global_settings.statusbar) | 598 | if (global_settings.statusbar) |