returning ACTION_EXIT_AFTER_THIS_MENUITEM from a menu callback will exit
the menu when the subitem returns. Use this with the preset item context menus git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12501 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
2816dc9c13
commit
9144be5253
3 changed files with 18 additions and 1 deletions
|
@ -156,6 +156,8 @@ enum {
|
|||
/* main menu */
|
||||
ACTION_REQUEST_MENUITEM,
|
||||
ACTION_EXIT_MENUITEM,
|
||||
ACTION_EXIT_AFTER_THIS_MENUITEM, /* if a menu returns this the menu will exit
|
||||
once the subitem returns */
|
||||
ACTION_ENTER_MENUITEM,
|
||||
ACTION_MENU_WPS,
|
||||
|
||||
|
|
|
@ -614,7 +614,14 @@ int do_menu(const struct menu_item_ex *start_menu)
|
|||
|
||||
if (menu_callback)
|
||||
{
|
||||
int old_action = action;
|
||||
action = menu_callback(action, menu);
|
||||
if (action == ACTION_EXIT_AFTER_THIS_MENUITEM)
|
||||
{
|
||||
action = old_action;
|
||||
ret = MENU_SELECTED_EXIT; /* will exit after returning
|
||||
from selection */
|
||||
}
|
||||
}
|
||||
|
||||
if (gui_synclist_do_button(&lists,action,LIST_WRAP_UNLESS_HELD))
|
||||
|
|
|
@ -1211,8 +1211,16 @@ MENUITEM_FUNCTION(radio_edit_preset_item, ID2P(LANG_FM_EDIT_PRESET),
|
|||
radio_edit_preset, NULL, NOICON);
|
||||
MENUITEM_FUNCTION(radio_delete_preset_item, ID2P(LANG_FM_DELETE_PRESET),
|
||||
radio_delete_preset, NULL, NOICON);
|
||||
int radio_preset_callback(int action, const struct menu_item_ex *this_item)
|
||||
{
|
||||
(void)this_item;
|
||||
if (action == ACTION_STD_OK)
|
||||
return ACTION_EXIT_AFTER_THIS_MENUITEM;
|
||||
return action;
|
||||
}
|
||||
MAKE_MENU(handle_radio_preset_menu, ID2P(LANG_FM_BUTTONBAR_PRESETS),
|
||||
NULL, NOICON, &radio_edit_preset_item, &radio_delete_preset_item);
|
||||
radio_preset_callback, NOICON, &radio_edit_preset_item,
|
||||
&radio_delete_preset_item);
|
||||
/* present a list of preset stations */
|
||||
char * presets_get_name(int selected_item, void * data, char *buffer)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue