Guest User

Untitled

a guest
Feb 4th, 2014
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.73 KB | None | 0 0
  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..c4f8b9c 100644
  49. --- a/apps/root_menu.c
  50. +++ b/apps/root_menu.c
  51. @@ -465,7 +465,10 @@ 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. +#ifndef HAVE_SHUTDOWN_IN_MAIN_MENU
  57. +#define SHUTDOWN_PREFIX "!"
  58. +#endif
  59. +
  60. static int do_shutdown(void)
  61. {
  62. #if CONFIG_CHARGING
  63. @@ -476,9 +479,8 @@ static int do_shutdown(void)
  64. sys_poweroff();
  65. return 0;
  66. }
  67. -MENUITEM_FUNCTION(do_shutdown_item, 0, ID2P(LANG_SHUTDOWN),
  68. +MENUITEM_FUNCTION(do_shutdown_item, 0, ID2P(LANG_SHUTDOWN_MENU_ITEM),
  69. do_shutdown, NULL, NULL, Icon_NOICON);
  70. -#endif
  71.  
  72. struct menu_item_ex root_menu_;
  73. static struct menu_callback_with_desc root_menu_desc = {
  74. @@ -487,6 +489,7 @@ struct menu_table {
  75. char *string;
  76. const struct menu_item_ex *item;
  77. };
  78. +/* If an item starts with '!' it wont be added by default */
  79. static struct menu_table menu_table[] = {
  80. /* Order here represents the default ordering */
  81. { "bookmarks", &bookmarks },
  82. @@ -505,10 +508,8 @@ static struct menu_table menu_table[] = {
  83. { "playlists", &playlists },
  84. { "plugins", &rocks_browser },
  85. { "system_menu", &system_menu_ },
  86. -#if CONFIG_KEYPAD == PLAYER_PAD
  87. - { "shutdown", &do_shutdown_item },
  88. -#endif
  89. { "shortcuts", &shortcut_menu },
  90. + { SHUTDOWN_PREFIX "shutdown", &do_shutdown_item },
  91. };
  92. #define MAX_MENU_ITEMS (sizeof(menu_table) / sizeof(struct menu_table))
  93. static struct menu_item_ex *root_menu__[MAX_MENU_ITEMS];
  94. @@ -542,7 +543,10 @@ void root_menu_load_from_cfg(void* setting, char *value)
  95. *end = '\0';
  96. for (i=0; i<MAX_MENU_ITEMS; i++)
  97. {
  98. - if (*start && !strcmp(start, menu_table[i].string))
  99. + char *string = menu_table[i].string;
  100. + if (string[0] == '!')
  101. + string++;
  102. + if (*start && !strcmp(start, string))
  103. {
  104. root_menu__[menu_item_count++] = (struct menu_item_ex *)menu_table[i].item;
  105. if (menu_table[i].item == &menu_)
  106. @@ -567,7 +571,10 @@ char* root_menu_write_to_cfg(void* setting, char*buf, int buf_len)
  107. {
  108. if (menu_table[j].item == root_menu__[i])
  109. {
  110. - written = snprintf(buf, buf_len, "%s, ", menu_table[j].string);
  111. + char *out = menu_table[j].string;
  112. + if (out[0] == '!')
  113. + out++;
  114. + written = snprintf(buf, buf_len, "%s,", out);
  115. buf_len -= written;
  116. buf += written;
  117. break;
  118. @@ -579,7 +586,7 @@ char* root_menu_write_to_cfg(void* setting, char*buf, int buf_len)
  119.  
  120. void root_menu_set_default(void* setting, void* defaultval)
  121. {
  122. - unsigned i;
  123. + unsigned i, count = 0;
  124. (void)defaultval;
  125.  
  126. root_menu_.flags = MENU_HAS_DESC | MT_MENU;
  127. @@ -588,9 +595,13 @@ void root_menu_set_default(void* setting, void* defaultval)
  128.  
  129. for (i=0; i<MAX_MENU_ITEMS; i++)
  130. {
  131. - root_menu__[i] = (struct menu_item_ex *)menu_table[i].item;
  132. + if (menu_table[i].string[0] != '!')
  133. + {
  134. + root_menu__[count] = (struct menu_item_ex *)menu_table[i].item;
  135. + count++;
  136. + }
  137. }
  138. - root_menu_.flags |= MENU_ITEM_COUNT(MAX_MENU_ITEMS);
  139. + root_menu_.flags |= MENU_ITEM_COUNT(count);
  140. *(bool*)setting = false;
  141. }
  142.  
  143. diff --git a/firmware/export/config/archosplayer.h b/firmware/export/config/archosplayer.h
  144. index af12557..dfaa046 100644
  145. --- a/firmware/export/config/archosplayer.h
  146. +++ b/firmware/export/config/archosplayer.h
  147. @@ -107,3 +107,6 @@
  148.  
  149. /* Define this if a programmable hotkey is mapped */
  150. #define HAVE_HOTKEY
  151. +
  152. +/* Define this if the target is to have Shut Down in the Main Menu by default */
  153. +#define HAVE_SHUTDOWN_IN_MAIN_MENU
  154. diff --git a/manual/advanced_topics/main.tex b/manual/advanced_topics/main.tex
  155. index efd3361..7bc96ee 100644
  156. --- a/manual/advanced_topics/main.tex
  157. +++ b/manual/advanced_topics/main.tex
  158. @@ -14,7 +14,7 @@ To accomplish this, load a \fname{.cfg} file (as described in
  159. words: \config{bookmarks}, \config{files}, \opt{tagcache}{\config{database}, }%
  160. \config{wps}, \config{settings}, \opt{recording}{\config{recording}, }%
  161. \opt{radio}{\config{radio}, }\config{playlists}, \config{plugins},
  162. -\config{system\_menu}, \opt{PLAYER_PAD}{\config{shutdown}, }\config{shortcuts}.
  163. +\config{system\_menu}, \config{shortcuts}, \config{shutdown}.
  164. Each of the words, if it occurs in the list, activates the appropriate item
  165. in the main menu. The order of the items is given by the order of the words
  166. in the list. The items whose words do not occur in the list will be hidden,
Add Comment
Please, Sign In to add comment