Guest User

Untitled

a guest
Apr 7th, 2014
96
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/apps/lang/english.lang b/apps/lang/english.lang
  2. index 9914b16..e5582da 100644
  3. --- a/apps/lang/english.lang
  4. +++ b/apps/lang/english.lang
  5. @@ -6617,19 +6617,16 @@
  6. </phrase>
  7. <phrase>
  8. id: LANG_SHUTDOWN
  9. - desc: in main menu
  10. + desc: used in the main menu
  11. user: core
  12. <source>
  13. - *: none
  14. - soft_shutdown: "Shut down"
  15. + *: "Shut down"
  16. </source>
  17. <dest>
  18. - *: none
  19. - soft_shutdown: "Shut down"
  20. + *: "Shut down"
  21. </dest>
  22. <voice>
  23. - *: none
  24. - soft_shutdown: "Shut down"
  25. + *: "Shut down"
  26. </voice>
  27. </phrase>
  28. <phrase>
  29. diff --git a/apps/root_menu.c b/apps/root_menu.c
  30. index c94a444..f518897 100644
  31. --- a/apps/root_menu.c
  32. +++ b/apps/root_menu.c
  33. @@ -468,7 +468,12 @@ MENUITEM_RETURNVALUE(playlists, ID2P(LANG_CATALOG), GO_TO_PLAYLISTS_SCREEN,
  34. MENUITEM_RETURNVALUE(system_menu_, ID2P(LANG_SYSTEM), GO_TO_SYSTEM_SCREEN,
  35. NULL, Icon_System_menu);
  36.  
  37. -#if CONFIG_KEYPAD == PLAYER_PAD
  38. +#ifdef HAVE_SHUTDOWN_IN_MAIN_MENU
  39. +#define SHUTDOWN_PREFIX ""
  40. +#else
  41. +#define SHUTDOWN_PREFIX "!"
  42. +#endif
  43. +
  44. static int do_shutdown(void)
  45. {
  46. #if CONFIG_CHARGING
  47. @@ -481,12 +486,13 @@ static int do_shutdown(void)
  48. }
  49. MENUITEM_FUNCTION(do_shutdown_item, 0, ID2P(LANG_SHUTDOWN),
  50. do_shutdown, NULL, NULL, Icon_NOICON);
  51. -#endif
  52.  
  53. struct menu_item_ex root_menu_;
  54. static struct menu_callback_with_desc root_menu_desc = {
  55. item_callback, ID2P(LANG_ROCKBOX_TITLE), Icon_Rockbox };
  56.  
  57. +/* If an item starts with '!' it wont be added to the menu
  58. + by default but remains accessible to the target*/
  59. static struct menu_table menu_table[] = {
  60. /* Order here represents the default ordering */
  61. { "bookmarks", &bookmarks },
  62. @@ -505,10 +511,8 @@ static struct menu_table menu_table[] = {
  63. { "playlists", &playlists },
  64. { "plugins", &rocks_browser },
  65. { "system_menu", &system_menu_ },
  66. -#if CONFIG_KEYPAD == PLAYER_PAD
  67. - { "shutdown", &do_shutdown_item },
  68. -#endif
  69. { "shortcuts", &shortcut_menu },
  70. + { SHUTDOWN_PREFIX "shutdown", &do_shutdown_item },
  71. };
  72. #define MAX_MENU_ITEMS (sizeof(menu_table) / sizeof(struct menu_table))
  73. static struct menu_item_ex *root_menu__[MAX_MENU_ITEMS];
  74. @@ -549,7 +553,10 @@ void root_menu_load_from_cfg(void* setting, char *value)
  75. *end = '\0';
  76. for (i=0; i<MAX_MENU_ITEMS; i++)
  77. {
  78. - if (*start && !strcmp(start, menu_table[i].string))
  79. + char *string = menu_table[i].string;
  80. + if (string[0] == '!')
  81. + string++;
  82. + if (*start && !strcmp(start, string))
  83. {
  84. root_menu__[menu_item_count++] = (struct menu_item_ex *)menu_table[i].item;
  85. if (menu_table[i].item == &menu_)
  86. @@ -574,7 +581,10 @@ char* root_menu_write_to_cfg(void* setting, char*buf, int buf_len)
  87. {
  88. if (menu_table[j].item == root_menu__[i])
  89. {
  90. - written = snprintf(buf, buf_len, "%s, ", menu_table[j].string);
  91. + char *out = menu_table[j].string;
  92. + if (out[0] == '!')
  93. + out++;
  94. + written = snprintf(buf, buf_len, "%s,", out);
  95. buf_len -= written;
  96. buf += written;
  97. break;
  98. @@ -586,7 +596,7 @@ char* root_menu_write_to_cfg(void* setting, char*buf, int buf_len)
  99.  
  100. void root_menu_set_default(void* setting, void* defaultval)
  101. {
  102. - unsigned i;
  103. + unsigned i, count = 0;
  104. (void)defaultval;
  105.  
  106. root_menu_.flags = MENU_HAS_DESC | MT_MENU;
  107. @@ -595,9 +605,13 @@ void root_menu_set_default(void* setting, void* defaultval)
  108.  
  109. for (i=0; i<MAX_MENU_ITEMS; i++)
  110. {
  111. - root_menu__[i] = (struct menu_item_ex *)menu_table[i].item;
  112. + if (menu_table[i].string[0] != '!')
  113. + {
  114. + root_menu__[count] = (struct menu_item_ex *)menu_table[i].item;
  115. + count++;
  116. + }
  117. }
  118. - root_menu_.flags |= MENU_ITEM_COUNT(MAX_MENU_ITEMS);
  119. + root_menu_.flags |= MENU_ITEM_COUNT(count);
  120. *(bool*)setting = false;
  121. }
  122.  
  123. diff --git a/firmware/export/config/android.h b/firmware/export/config/android.h
  124. index 2aee700..f380b67 100644
  125. --- a/firmware/export/config/android.h
  126. +++ b/firmware/export/config/android.h
  127. @@ -107,3 +107,6 @@
  128. /* No special storage */
  129. #define CONFIG_STORAGE STORAGE_HOSTFS
  130. #define HAVE_STORAGE_FLUSH
  131. +
  132. +/* Define this if the target is to have Shut Down in the Main Menu by default */
  133. +#define HAVE_SHUTDOWN_IN_MAIN_MENU
  134. diff --git a/firmware/export/config/archosplayer.h b/firmware/export/config/archosplayer.h
  135. index 2e0219c..990fa8a 100644
  136. --- a/firmware/export/config/archosplayer.h
  137. +++ b/firmware/export/config/archosplayer.h
  138. @@ -109,3 +109,6 @@
  139.  
  140. /* Define this if a programmable hotkey is mapped */
  141. #define HAVE_HOTKEY
  142. +
  143. +/* Define this if the target is to have Shut Down in the Main Menu by default */
  144. +#define HAVE_SHUTDOWN_IN_MAIN_MENU
  145. diff --git a/manual/advanced_topics/main.tex b/manual/advanced_topics/main.tex
  146. index efd3361..7bc96ee 100644
  147. --- a/manual/advanced_topics/main.tex
  148. +++ b/manual/advanced_topics/main.tex
  149. @@ -14,7 +14,7 @@ To accomplish this, load a \fname{.cfg} file (as described in
  150. words: \config{bookmarks}, \config{files}, \opt{tagcache}{\config{database}, }%
  151. \config{wps}, \config{settings}, \opt{recording}{\config{recording}, }%
  152. \opt{radio}{\config{radio}, }\config{playlists}, \config{plugins},
  153. -\config{system\_menu}, \opt{PLAYER_PAD}{\config{shutdown}, }\config{shortcuts}.
  154. +\config{system\_menu}, \config{shortcuts}, \config{shutdown}.
  155. Each of the words, if it occurs in the list, activates the appropriate item
  156. in the main menu. The order of the items is given by the order of the words
  157. in the list. The items whose words do not occur in the list will be hidden,
RAW Paste Data