summaryrefslogtreecommitdiff
path: root/apps/onplay.c
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2005-06-23 10:11:10 +0000
committerJens Arnold <amiconn@rockbox.org>2005-06-23 10:11:10 +0000
commitda2b45f2e5cfcdf730849fbd5261ef8f0761bdcb (patch)
treeae220e13ae2d7013815b4d06423d7fd90f13fdd1 /apps/onplay.c
parent3263620c5c296dd181e8a54d1bc51c5869b129ff (diff)
downloadrockbox-da2b45f2e5cfcdf730849fbd5261ef8f0761bdcb.zip
rockbox-da2b45f2e5cfcdf730849fbd5261ef8f0761bdcb.tar.gz
rockbox-da2b45f2e5cfcdf730849fbd5261ef8f0761bdcb.tar.bz2
rockbox-da2b45f2e5cfcdf730849fbd5261ef8f0761bdcb.tar.xz
When exiting the context menu with the menu button, call the main menu. Mainly useful on Ondio which can't have both main menu and context menu bound in wps. Holding MODE on Ondio will now bring up the wps context menu instead of the main menu.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6840 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/onplay.c')
-rw-r--r--apps/onplay.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/apps/onplay.c b/apps/onplay.c
index f686533..762ab9e 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -51,6 +51,7 @@
#ifdef HAVE_LCD_BITMAP
#include "icons.h"
#endif
+#include "main_menu.h"
#define DEFAULT_PLAYLIST_NAME "/dynamic.m3u"
@@ -488,6 +489,19 @@ bool create_dir(void)
return true;
}
+static bool exit_to_main;
+
+/* catch MENU_EXIT_MENU within context menu to call the main menu afterwards */
+static int onplay_callback(int key, int menu)
+{
+ (void)menu;
+
+ if (key == MENU_EXIT_MENU)
+ exit_to_main = true;
+
+ return key;
+}
+
int onplay(char* file, int attr, int from)
{
struct menu_item items[8]; /* increase this if you add entries! */
@@ -495,6 +509,7 @@ int onplay(char* file, int attr, int from)
onplay_result = ONPLAY_OK;
context=from;
+ exit_to_main = false;
selected_file = file;
selected_file_attr = attr;
@@ -523,7 +538,7 @@ int onplay(char* file, int attr, int from)
i++;
}
-#ifdef HAVE_MULTIVOLUME
+#ifdef HAVE_MULTIVOLUME
if (!(attr & ATTR_VOLUME)) /* no rename+delete for volumes */
#endif
{
@@ -570,11 +585,14 @@ int onplay(char* file, int attr, int from)
button_clear_queue();
if (i)
{
- m = menu_init( items, i, NULL, NULL, NULL, NULL );
+ m = menu_init( items, i, onplay_callback, NULL, NULL, NULL );
result = menu_show(m);
if (result >= 0)
items[result].function();
menu_exit(m);
+
+ if (exit_to_main)
+ result = main_menu();
#ifdef HAVE_LCD_BITMAP
if (global_settings.statusbar)