From 62decc42e7f6752d786090277ac4b7f2d2036ad4 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Sun, 4 Nov 2007 12:10:41 +0000 Subject: return to the main menu if stop is pressed in the wps context menu, (blame pondlife for the hack :D ) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15457 a1c6a512-1295-4272-9138-f99709370657 --- apps/menu.c | 12 ++++++++++++ apps/onplay.c | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/menu.c b/apps/menu.c index 35b2527..f9a2f3c 100644 --- a/apps/menu.c +++ b/apps/menu.c @@ -291,6 +291,12 @@ bool do_setting_from_menu(const struct menu_item_ex *temp) return false; } +/* HACK ALERT: this is needed so pressing stop in the wps context menu returns to + the main menu as it is expected. otherwise there can be nasty side-effects + if any of the items are selected. */ +extern const struct menu_item_ex wps_onplay_menu; + +/* display a menu */ int do_menu(const struct menu_item_ex *start_menu, int *start_selected) { int selected = start_selected? *start_selected : 0; @@ -369,6 +375,12 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected) else if (action == ACTION_TREE_STOP) { redraw_lists = list_stop_handler(); + /*return to the main menu if stop is pressed in the WPS context menu */ + if (menu == &wps_onplay_menu) + { + ret = GO_TO_ROOT; + done = true; + } } else if (action == ACTION_STD_CONTEXT && menu == &root_menu_) diff --git a/apps/onplay.c b/apps/onplay.c index a4da371..d4c5579 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -81,7 +81,7 @@ static bool clipboard_is_copy = false; #define MAKE_ONPLAYMENU( name, str, callback, icon, ... ) \ static const struct menu_item_ex *name##_[] = {__VA_ARGS__}; \ static const struct menu_callback_with_desc name##__ = {callback,str,icon};\ - static const struct menu_item_ex name = \ + const struct menu_item_ex name = \ {MT_MENU|MENU_HAS_DESC|MENU_EXITAFTERTHISMENU| \ MENU_ITEM_COUNT(sizeof( name##_)/sizeof(*name##_)), \ { (void*)name##_},{.callback_and_desc = & name##__}}; -- cgit v1.1