mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
Move all valid menu return codes to a single file (root_menu.h) so we don't need to rely on GO_TO_ROOT == MENU_ATTACHED_USB.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12937 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
40595bd57a
commit
91e726a1c1
4 changed files with 17 additions and 10 deletions
|
@ -737,7 +737,7 @@ int menu_show(int m)
|
||||||
switch (value)
|
switch (value)
|
||||||
{
|
{
|
||||||
case MENU_ATTACHED_USB:
|
case MENU_ATTACHED_USB:
|
||||||
/* case GO_TO_ROOT: */
|
case GO_TO_ROOT:
|
||||||
return MENU_ATTACHED_USB;
|
return MENU_ATTACHED_USB;
|
||||||
case GO_TO_PREVIOUS:
|
case GO_TO_PREVIOUS:
|
||||||
return MENU_SELECTED_EXIT;
|
return MENU_SELECTED_EXIT;
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "icon.h"
|
#include "icon.h"
|
||||||
#include "icons.h"
|
#include "icons.h"
|
||||||
|
#include "root_menu.h" /* needed for MENU_* return codes */
|
||||||
|
|
||||||
|
|
||||||
enum menu_item_type {
|
enum menu_item_type {
|
||||||
|
@ -193,12 +194,8 @@ int menu_init(const struct menu_item* mitems, int count,
|
||||||
const char *button1, const char *button2, const char *button3);
|
const char *button1, const char *button2, const char *button3);
|
||||||
void menu_exit(int menu);
|
void menu_exit(int menu);
|
||||||
|
|
||||||
/* Returns below define, or number of selected menu item*/
|
/* Returns MENU_* define from root_menu.h, or number of selected menu item*/
|
||||||
int menu_show(int m);
|
int menu_show(int m);
|
||||||
#define MENU_ATTACHED_USB -1
|
|
||||||
#define MENU_SELECTED_EXIT -2
|
|
||||||
#define MENU_EXIT_ALL -3
|
|
||||||
#define MENU_RETURN_TO_WPS -4
|
|
||||||
|
|
||||||
bool menu_run(int menu);
|
bool menu_run(int menu);
|
||||||
int menu_count(int menu);
|
int menu_count(int menu);
|
||||||
|
|
|
@ -429,16 +429,17 @@ void root_menu(void)
|
||||||
{
|
{
|
||||||
switch (ret_val)
|
switch (ret_val)
|
||||||
{
|
{
|
||||||
|
case MENU_ATTACHED_USB:
|
||||||
|
case MENU_SELECTED_EXIT:
|
||||||
|
check_boot();
|
||||||
|
/* fall through */
|
||||||
case GO_TO_ROOT:
|
case GO_TO_ROOT:
|
||||||
if (last_screen != GO_TO_ROOT)
|
if (last_screen != GO_TO_ROOT)
|
||||||
selected = get_selection(last_screen);
|
selected = get_selection(last_screen);
|
||||||
ret_val = do_menu(&root_menu_, &selected);
|
ret_val = do_menu(&root_menu_, &selected);
|
||||||
/* As long as MENU_ATTACHED_USB == GO_TO_ROOT this works */
|
|
||||||
if (ret_val <= GO_TO_ROOT)
|
if (ret_val <= GO_TO_ROOT)
|
||||||
{
|
{
|
||||||
if (ret_val == MENU_ATTACHED_USB)
|
if (ret_val == GO_TO_PREVIOUS)
|
||||||
check_boot();
|
|
||||||
else if (ret_val == GO_TO_PREVIOUS)
|
|
||||||
{
|
{
|
||||||
ret_val = last_screen;
|
ret_val = last_screen;
|
||||||
last_screen = GO_TO_ROOT;
|
last_screen = GO_TO_ROOT;
|
||||||
|
|
|
@ -17,9 +17,16 @@
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#ifndef __ROOT_MENU_H__
|
||||||
|
#define __ROOT_MENU_H__
|
||||||
|
|
||||||
void root_menu(void);
|
void root_menu(void);
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
/* from old menu api, but still required*/
|
||||||
|
MENU_ATTACHED_USB = -10,
|
||||||
|
MENU_SELECTED_EXIT = -9,
|
||||||
|
|
||||||
GO_TO_PREVIOUS_MUSIC = -4,
|
GO_TO_PREVIOUS_MUSIC = -4,
|
||||||
GO_TO_PREVIOUS_BROWSER = -3,
|
GO_TO_PREVIOUS_BROWSER = -3,
|
||||||
GO_TO_PREVIOUS = -2,
|
GO_TO_PREVIOUS = -2,
|
||||||
|
@ -42,3 +49,5 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const struct menu_item_ex root_menu_;
|
extern const struct menu_item_ex root_menu_;
|
||||||
|
|
||||||
|
#endif /* __ROOT_MENU_H__ */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue