Advertisement
Guest User

Untitled

a guest
Feb 4th, 2014
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.77 KB | None | 0 0
  1. diff --git a/apps/lang/english.lang b/apps/lang/english.lang
  2. index 42bc2f3..696123e 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. @@ -13209,3 +13192,17 @@
  30. swcodec: "Q"
  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 71844dd..86b43e7 100644
  49. --- a/apps/root_menu.c
  50. +++ b/apps/root_menu.c
  51. @@ -466,7 +466,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. +#ifndef 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. @@ -477,9 +482,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. @@ -488,6 +492,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. @@ -506,10 +511,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. @@ -543,7 +546,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. @@ -568,7 +574,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. @@ -580,7 +589,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. @@ -589,9 +598,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. }
  144.  
  145. diff --git a/firmware/export/config/archosplayer.h b/firmware/export/config/archosplayer.h
  146. index af12557..dfaa046 100644
  147. --- a/firmware/export/config/archosplayer.h
  148. +++ b/firmware/export/config/archosplayer.h
  149. @@ -107,3 +107,6 @@
  150.  
  151. /* Define this if a programmable hotkey is mapped */
  152. #define HAVE_HOTKEY
  153. +
  154. +/* Define this if the target is to have Shut Down in the Main Menu by default */
  155. +#define HAVE_SHUTDOWN_IN_MAIN_MENU
  156. diff --git a/manual/advanced_topics/main.tex b/manual/advanced_topics/main.tex
  157. index efd3361..7bc96ee 100644
  158. --- a/manual/advanced_topics/main.tex
  159. +++ b/manual/advanced_topics/main.tex
  160. @@ -14,7 +14,7 @@ To accomplish this, load a \fname{.cfg} file (as described in
  161. words: \config{bookmarks}, \config{files}, \opt{tagcache}{\config{database}, }%
  162. \config{wps}, \config{settings}, \opt{recording}{\config{recording}, }%
  163. \opt{radio}{\config{radio}, }\config{playlists}, \config{plugins},
  164. -\config{system\_menu}, \opt{PLAYER_PAD}{\config{shutdown}, }\config{shortcuts}.
  165. +\config{system\_menu}, \config{shortcuts}, \config{shutdown}.
  166. Each of the words, if it occurs in the list, activates the appropriate item
  167. in the main menu. The order of the items is given by the order of the words
  168. in the list. The items whose words do not occur in the list will be hidden,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement