diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index f0be657565..6e5179bbf0 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -14152,16 +14152,16 @@
id: LANG_TOGGLE_ITEM
- desc: in main_menu_config
+ desc: deprecated
user: core
- *: "Toggle Item"
+ *: ""
- *: "Toggle Item"
+ *: ""
- *: "Toggle Item"
+ *: ""
@@ -14222,13 +14222,13 @@
id: LANG_MAIN_MENU_ORDER
- desc: main_menu_config plugin title
+ desc: deprecated
user: core
- *: "Rockbox Main Menu Order"
+ *: ""
- *: "Rockbox Main Menu Order"
+ *: ""
*: ""
diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c
index f16fce9487..8805b52944 100644
--- a/apps/menus/main_menu.c
+++ b/apps/menus/main_menu.c
@@ -495,6 +495,15 @@ MAKE_MENU(info_menu, ID2P(LANG_SYSTEM), 0, Icon_System_menu,
/* INFO MENU */
/***********************************/
+static int main_menu_config(void)
+{
+ plugin_load(PLUGIN_APPS_DIR "/main_menu_config.rock", NULL);
+ return 0;
+}
+
+MENUITEM_FUNCTION(main_menu_config_item, 0, ID2P(LANG_MAIN_MENU),
+ main_menu_config, NULL, Icon_Rockbox);
+
/***********************************/
/* MAIN MENU */
@@ -509,6 +518,7 @@ MAKE_MENU(main_menu_, ID2P(LANG_SETTINGS), NULL,
#if CONFIG_RTC
&timedate_item,
#endif
+ &main_menu_config_item,
&manage_settings,
);
/* MAIN MENU */
diff --git a/apps/plugin.c b/apps/plugin.c
index 87c4f1eab7..dd92791622 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -860,7 +860,8 @@ int plugin_load(const char* plugin, const void* parameter)
/* for some plugins, the SBS can be left enabled */
const char *sepch = strrchr(plugin, PATH_SEPCH);
- bool theme_enabled = sepch && !strcmp("properties.rock", sepch + 1);
+ bool theme_enabled = sepch && (!strcmp("properties.rock", sepch + 1) ||
+ !strcmp("main_menu_config.rock", sepch + 1));
if (current_plugin_handle)
{
diff --git a/apps/plugins/main_menu_config.c b/apps/plugins/main_menu_config.c
index b4b5813b21..c42169ad38 100644
--- a/apps/plugins/main_menu_config.c
+++ b/apps/plugins/main_menu_config.c
@@ -40,11 +40,14 @@ static const char * menu_get_name(int selected_item, void * data,
char * buffer, size_t buffer_len)
{
(void)data;
- (void)buffer;
- (void)buffer_len;
unsigned char *p = menu_items[selected_item].name;
int id = P2ID(p);
- return (id != -1) ? rb->str(id) : p;
+
+ rb->snprintf(buffer, buffer_len, "%s: %s", (id != -1) ? rb->str(id) : p,
+ menu_items[selected_item].enabled ?
+ rb->str(LANG_ON) : rb->str(LANG_OFF));
+
+ return buffer;
}
static enum themable_icons menu_get_icon(int selected_item, void * data)
@@ -157,7 +160,8 @@ static int menu_speak_item(int selected_item, void *data)
if (id != -1)
{
- rb->talk_id(id, false);
+ rb->talk_number(selected_item + 1, false);
+ rb->talk_id(id, true);
rb->talk_id(menu_items[selected_item].enabled ? LANG_ON : LANG_OFF, true);
}
@@ -172,6 +176,7 @@ enum plugin_status plugin_start(const void* parameter)
rb->global_settings->show_icons = true;
struct gui_synclist list;
bool done = false;
+ bool changed = false;
int action, cur_sel;
menu_table = rb->root_menu_get_options(&menu_item_count);
@@ -182,59 +187,72 @@ enum plugin_status plugin_start(const void* parameter)
rb->gui_synclist_set_voice_callback(&list, menu_speak_item);
rb->gui_synclist_set_icon_callback(&list, menu_get_icon);
rb->gui_synclist_set_nb_items(&list, menu_item_count);
- rb->gui_synclist_set_title(&list, rb->str(LANG_MAIN_MENU_ORDER), Icon_Rockbox);
- rb->gui_synclist_draw(&list);
+ rb->gui_synclist_set_title(&list, rb->str(LANG_MAIN_MENU), Icon_Rockbox);
rb->gui_synclist_speak_item(&list);
while (!done)
{
+ rb->gui_synclist_draw(&list);
cur_sel = rb->gui_synclist_get_sel_pos(&list);
- action = rb->get_action(CONTEXT_LIST,TIMEOUT_BLOCK);
+ action = rb->get_action(CONTEXT_LIST, HZ/10);
if (rb->gui_synclist_do_button(&list, &action))
continue;
switch (action)
{
case ACTION_STD_OK:
+ menu_items[cur_sel].enabled = !menu_items[cur_sel].enabled;
+ rb->gui_synclist_speak_item(&list);
+ changed = true;
+ break;
+ case ACTION_STD_CONTEXT:
{
- MENUITEM_STRINGLIST(menu, "Main Menu Editor", NULL,
- ID2P(LANG_TOGGLE_ITEM),
+ MENUITEM_STRINGLIST(menu, ID2P(LANG_MAIN_MENU), NULL,
ID2P(LANG_MOVE_ITEM_UP),
ID2P(LANG_MOVE_ITEM_DOWN),
- "----------",
- ID2P(LANG_LOAD_DEFAULT_CONFIGURATION),
- ID2P(LANG_SAVE_EXIT));
+ ID2P(LANG_LOAD_DEFAULT_CONFIGURATION));
switch (rb->do_menu(&menu, NULL, NULL, false))
{
case 0:
- menu_items[cur_sel].enabled = !menu_items[cur_sel].enabled;
+ if (cur_sel == 0)
+ {
+ rb->splash(HZ, ID2P(LANG_FAILED));
+ break;
+ }
+ swap_items(cur_sel, cur_sel - 1);
+ rb->gui_synclist_select_item(&list, cur_sel - 1); /* speaks */
+ changed = true;
break;
case 1:
- if (cur_sel == 0)
- break;
- swap_items(cur_sel, cur_sel - 1);
- break;
- case 2:
if (cur_sel + 1 == menu_item_count)
+ {
+ rb->splash(HZ, ID2P(LANG_FAILED));
break;
+ }
swap_items(cur_sel, cur_sel + 1);
+ rb->gui_synclist_select_item(&list, cur_sel + 1); /* speaks */
+ changed = true;
break;
- case 4:
- rb->root_menu_set_default(&rb->global_settings->root_menu_customized, NULL);
- load_from_cfg();
- break;
- case 5:
- done = true;
- save_to_cfg();
- rb->global_settings->root_menu_customized = true;
- rb->settings_save();
- break;
- }
- if (!done)
- {
- rb->gui_synclist_draw(&list);
- rb->gui_synclist_speak_item(&list);
+ case 2:;
+ static const char *lines[] =
+ {ID2P(LANG_RESET_ASK), ID2P(LANG_LOAD_DEFAULT_CONFIGURATION)};
+ static const struct text_message message={lines, 2};
+
+ switch(rb->gui_syncyesno_run(&message, NULL, NULL))
+ {
+ case YESNO_YES:
+ rb->root_menu_set_default(&rb->global_settings->root_menu_customized, NULL);
+ load_from_cfg();
+ break;
+ default:
+ rb->splash(HZ, ID2P(LANG_CANCEL));
+ break;
+ }
+ /* fall-through */
+ default:
+ rb->gui_synclist_speak_item(&list);
}
+ rb->gui_synclist_set_title(&list, rb->str(LANG_MAIN_MENU), Icon_Rockbox);
break;
}
case ACTION_STD_CANCEL:
@@ -243,6 +261,13 @@ enum plugin_status plugin_start(const void* parameter)
}
}
+ if (changed)
+ {
+ save_to_cfg();
+ rb->global_settings->root_menu_customized = true;
+ rb->settings_save();
+ }
rb->global_settings->show_icons = show_icons;
+
return PLUGIN_OK;
}
diff --git a/manual/advanced_topics/main.tex b/manual/advanced_topics/main.tex
index 7d6bb0ae0b..93ca3fccd0 100755
--- a/manual/advanced_topics/main.tex
+++ b/manual/advanced_topics/main.tex
@@ -5,10 +5,11 @@
\subsection{\label{ref:CustomisingTheMainMenu}Customising The Main Menu}
-It is possible to customise the main menu, i.e. to reorder or to hide some
-of its items (only the main menu can be customised, submenus can not).
-To accomplish this, load a \fname{.cfg} file (as described in
-\reference{ref:manage_settings}) containing the following line:
+The easiest way to reorder or to hide menu items is via the settings menu
+(see \reference{ref:main_menu_config}).
+
+To accomplish this using a text editor instead, load a \fname{.cfg} file
+(as described in \reference{ref:manage_settings}) containing the following line:
\config{root~menu~order:items}, where ``items'' is a comma separated list
(no spaces around the commas!) of the following
words: \config{bookmarks}, \config{files}, \opt{tagcache}{\config{database}, }%
@@ -32,10 +33,6 @@ for changing the settings (the latter will be added automatically).
To reset the menu items to the default, use \config{root~menu~order:-} (i.e.
use a hyphen instead of ``items'').
-This configuration entry can only be created and edited with a text editor or
-the Main Menu Config Plugin (see \reference{ref:main_menu_config}).
-It is not possible to change this setting via the settings menu.
-
\subsection{\label{ref:CustomisingThePlayername}Customising The Playername}
Some themes show a customizable playername in the Whats Playing Screen.
diff --git a/manual/main_menu/main.tex b/manual/main_menu/main.tex
index a9e78a6bf8..e4c9e99130 100644
--- a/manual/main_menu/main.tex
+++ b/manual/main_menu/main.tex
@@ -141,6 +141,22 @@ to recording. The details of this menu are covered in detail in
\reference{ref:Recordingsettings}.
}
+\subsection{Main Menu}
+{\label{ref:main_menu_config}}
+Allows you to hide or reorder items from the main menu.
+
+Press \ActionStdOk{} to toggle an item's visibility.
+
+Press \ActionStdContext{} to access the following options:
+\begin{description}
+\item[Move Item Up] Swap selected menu item with the previous one
+\item[Move Item down] Swap selected menu item with the next one
+\item[Load Default Configuration] Discard all customization
+\end{description}
+
+For an advanced description of the associated configuration entry,
+see \reference{ref:CustomisingTheMainMenu}.
+
\subsection{Manage Settings}
The \setting{Manage Settings} option allows the saving and re-loading of user
configuration settings, browsing the hard drive for alternate firmwares, and finally
diff --git a/manual/plugins/main_menu_config.tex b/manual/plugins/main_menu_config.tex
index b21c0020c6..40c4a1a5ca 100644
--- a/manual/plugins/main_menu_config.tex
+++ b/manual/plugins/main_menu_config.tex
@@ -1,17 +1,2 @@
\subsection{Main Menu Configuration}
-{\label{ref:main_menu_config}}
-
-This plugin helps you customizing the main menu (i.e. reorder or hide menu
-items). It changes the appropriate configuration file as described in
-\reference{ref:CustomisingTheMainMenu}.
-
-When you start the plugin, the available main menu items will be displayed.
-By pressing \ActionStdOk{} you open a menu with the following options:
-\begin{description}
-\item[Toggle Item] Hide the selected menu item or make it visible again
-\item[Move Item Up] Swap the selected menu item with the previous one
-\item[Move Item down] Swap the selected menu item with the next one
-\item[Load Default Configuration] Discards all customization
-\item[Exit] Save your changes to the configuration file and exit the plugin
-\end{description}
-You can leave the plugin without saving by pressing \ActionStdCancel{}.
+see \reference{ref:main_menu_config}