1. diff --git a/apps/lang/english.lang b/apps/lang/english.lang
  2. index d0dc5c5..ae5eb1b 100644
  3. --- a/apps/lang/english.lang
  4. +++ b/apps/lang/english.lang
  5. @@ -6616,23 +6616,6 @@
  6. </voice>
  7. </phrase>
  8. <phrase>
  9. - id: LANG_SHUTDOWN
  10. - desc: in main menu
  11. - user: core
  12. - <source>
  13. - *: none
  14. - soft_shutdown: "Shut down"
  15. - </source>
  16. - <dest>
  17. - *: none
  18. - soft_shutdown: "Shut down"
  19. - </dest>
  20. - <voice>
  21. - *: none
  22. - soft_shutdown: "Shut down"
  23. - </voice>
  24. -</phrase>
  25. -<phrase>
  26. id: LANG_ROCKBOX_INFO
  27. desc: displayed topmost on the info screen and in the info menu
  28. user: core
  29. @@ -13161,3 +13144,17 @@
  30. *: "Slow"
  31. </voice>
  32. </phrase>
  33. +<phrase>
  34. + id: LANG_SHUTDOWN_MENU_ITEM
  35. + desc: Optional "Shut Down" main menu item
  36. + user: core
  37. + <source>
  38. + *: "Shut Down"
  39. + </source>
  40. + <dest>
  41. + *: "Shut Down"
  42. + </dest>
  43. + <voice>
  44. + *: "Shut Down"
  45. + </voice>
  46. +</phrase>
  47. diff --git a/apps/root_menu.c b/apps/root_menu.c
  48. index 1ffde91..47a2444 100644
  49. --- a/apps/root_menu.c
  50. +++ b/apps/root_menu.c
  51. @@ -465,7 +465,12 @@ MENUITEM_RETURNVALUE(playlists, ID2P(LANG_CATALOG), GO_TO_PLAYLISTS_SCREEN,
  52. MENUITEM_RETURNVALUE(system_menu_, ID2P(LANG_SYSTEM), GO_TO_SYSTEM_SCREEN,
  53. NULL, Icon_System_menu);
  54.  
  55. -#if CONFIG_KEYPAD == PLAYER_PAD
  56. +#ifdef HAVE_SHUTDOWN_IN_MAIN_MENU
  57. +#define SHUTDOWN_PREFIX ""
  58. +#else
  59. +#define SHUTDOWN_PREFIX "!"
  60. +#endif
  61. +
  62. static int do_shutdown(void)
  63. {
  64. #if CONFIG_CHARGING
  65. @@ -476,9 +481,8 @@ static int do_shutdown(void)
  66. sys_poweroff();
  67. return 0;
  68. }
  69. -MENUITEM_FUNCTION(do_shutdown_item, 0, ID2P(LANG_SHUTDOWN),
  70. +MENUITEM_FUNCTION(do_shutdown_item, 0, ID2P(LANG_SHUTDOWN_MENU_ITEM),
  71. do_shutdown, NULL, NULL, Icon_NOICON);
  72. -#endif
  73.  
  74. struct menu_item_ex root_menu_;
  75. static struct menu_callback_with_desc root_menu_desc = {
  76. @@ -487,6 +491,7 @@ struct menu_table {
  77. char *string;
  78. const struct menu_item_ex *item;
  79. };
  80. +/* If an item starts with '!' it wont be added by default */
  81. static struct menu_table menu_table[] = {
  82. /* Order here represents the default ordering */
  83. { "bookmarks", &bookmarks },
  84. @@ -505,10 +510,8 @@ static struct menu_table menu_table[] = {
  85. { "playlists", &playlists },
  86. { "plugins", &rocks_browser },
  87. { "system_menu", &system_menu_ },
  88. -#if CONFIG_KEYPAD == PLAYER_PAD
  89. - { "shutdown", &do_shutdown_item },
  90. -#endif
  91. { "shortcuts", &shortcut_menu },
  92. + { SHUTDOWN_PREFIX "shutdown", &do_shutdown_item },
  93. };
  94. #define MAX_MENU_ITEMS (sizeof(menu_table) / sizeof(struct menu_table))
  95. static struct menu_item_ex *root_menu__[MAX_MENU_ITEMS];
  96. @@ -542,7 +545,10 @@ void root_menu_load_from_cfg(void* setting, char *value)
  97. *end = '\0';
  98. for (i=0; i<MAX_MENU_ITEMS; i++)
  99. {
  100. - if (*start && !strcmp(start, menu_table[i].string))
  101. + char *string = menu_table[i].string;
  102. + if (string[0] == '!')
  103. + string++;
  104. + if (*start && !strcmp(start, string))
  105. {
  106. root_menu__[menu_item_count++] = (struct menu_item_ex *)menu_table[i].item;
  107. if (menu_table[i].item == &menu_)
  108. @@ -567,7 +573,10 @@ char* root_menu_write_to_cfg(void* setting, char*buf, int buf_len)
  109. {
  110. if (menu_table[j].item == root_menu__[i])
  111. {
  112. - written = snprintf(buf, buf_len, "%s, ", menu_table[j].string);
  113. + char *out = menu_table[j].string;
  114. + if (out[0] == '!')
  115. + out++;
  116. + written = snprintf(buf, buf_len, "%s,", out);
  117. buf_len -= written;
  118. buf += written;
  119. break;
  120. @@ -579,7 +588,7 @@ char* root_menu_write_to_cfg(void* setting, char*buf, int buf_len)
  121.  
  122. void root_menu_set_default(void* setting, void* defaultval)
  123. {
  124. - unsigned i;
  125. + unsigned i, count = 0;
  126. (void)defaultval;
  127.  
  128. root_menu_.flags = MENU_HAS_DESC | MT_MENU;
  129. @@ -588,9 +597,13 @@ void root_menu_set_default(void* setting, void* defaultval)
  130.  
  131. for (i=0; i<MAX_MENU_ITEMS; i++)
  132. {
  133. - root_menu__[i] = (struct menu_item_ex *)menu_table[i].item;
  134. + if (menu_table[i].string[0] != '!')
  135. + {
  136. + root_menu__[count] = (struct menu_item_ex *)menu_table[i].item;
  137. + count++;
  138. + }
  139. }
  140. - root_menu_.flags |= MENU_ITEM_COUNT(MAX_MENU_ITEMS);
  141. + root_menu_.flags |= MENU_ITEM_COUNT(count);
  142. *(bool*)setting = false;
  143. }