diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2011-12-06 12:02:49 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2011-12-06 12:02:49 +0000 |
commit | 565191ad502d1505d388d138b4d0e5df4a5e2500 (patch) | |
tree | 0f8c1bdfb45dbb24343a216ca6e2d73c5bc022c0 | |
parent | a55982d130c45ebb1b227296943b4173b61ce17d (diff) | |
download | rockbox-565191ad502d1505d388d138b4d0e5df4a5e2500.tar.gz rockbox-565191ad502d1505d388d138b4d0e5df4a5e2500.zip |
Add a shortcut type 'shutdown' which will turn off the player
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31157 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/shortcuts.c | 18 | ||||
-rw-r--r-- | apps/shortcuts.h | 1 | ||||
-rw-r--r-- | manual/main_menu/main.tex | 3 |
3 files changed, 22 insertions, 0 deletions
diff --git a/apps/shortcuts.c b/apps/shortcuts.c index 554184948c..e9fa71eeef 100644 --- a/apps/shortcuts.c +++ b/apps/shortcuts.c | |||
@@ -51,6 +51,7 @@ static const char * const type_strings[SHORTCUT_TYPE_COUNT] = { | |||
51 | [SHORTCUT_BROWSER] = "browse", | 51 | [SHORTCUT_BROWSER] = "browse", |
52 | [SHORTCUT_PLAYLISTMENU] = "playlist menu", | 52 | [SHORTCUT_PLAYLISTMENU] = "playlist menu", |
53 | [SHORTCUT_SEPARATOR] = "separator", | 53 | [SHORTCUT_SEPARATOR] = "separator", |
54 | [SHORTCUT_SHUTDOWN] = "shutdown", | ||
54 | }; | 55 | }; |
55 | 56 | ||
56 | struct shortcut { | 57 | struct shortcut { |
@@ -138,6 +139,7 @@ static bool verify_shortcut(struct shortcut* sc) | |||
138 | return sc->u.setting != NULL; | 139 | return sc->u.setting != NULL; |
139 | case SHORTCUT_DEBUGITEM: | 140 | case SHORTCUT_DEBUGITEM: |
140 | case SHORTCUT_SEPARATOR: | 141 | case SHORTCUT_SEPARATOR: |
142 | case SHORTCUT_SHUTDOWN: | ||
141 | default: | 143 | default: |
142 | break; | 144 | break; |
143 | } | 145 | } |
@@ -258,6 +260,7 @@ int readline_cb(int n, char *buf, void *parameters) | |||
258 | sc->u.setting = find_setting_by_cfgname(value, NULL); | 260 | sc->u.setting = find_setting_by_cfgname(value, NULL); |
259 | break; | 261 | break; |
260 | case SHORTCUT_SEPARATOR: | 262 | case SHORTCUT_SEPARATOR: |
263 | case SHORTCUT_SHUTDOWN: | ||
261 | break; | 264 | break; |
262 | } | 265 | } |
263 | } | 266 | } |
@@ -310,6 +313,11 @@ static const char * shortcut_menu_get_name(int selected_item, void * data, | |||
310 | return sc->name[0] ? sc->name : P2STR(ID2P(sc->u.setting->lang_id)); | 313 | return sc->name[0] ? sc->name : P2STR(ID2P(sc->u.setting->lang_id)); |
311 | else if (sc->type == SHORTCUT_SEPARATOR) | 314 | else if (sc->type == SHORTCUT_SEPARATOR) |
312 | return sc->name; | 315 | return sc->name; |
316 | else if (sc->type == SHORTCUT_SHUTDOWN && sc->name[0] == '\0') | ||
317 | { | ||
318 | /* No translation support as only soft_shutdown has LANG_SHUTDOWN defined */ | ||
319 | return type_strings[SHORTCUT_SHUTDOWN]; | ||
320 | } | ||
313 | return sc->name[0] ? sc->name : sc->u.path; | 321 | return sc->name[0] ? sc->name : sc->u.path; |
314 | } | 322 | } |
315 | 323 | ||
@@ -341,6 +349,8 @@ static enum themable_icons shortcut_menu_get_icon(int selected_item, void * data | |||
341 | return Icon_Menu_functioncall; | 349 | return Icon_Menu_functioncall; |
342 | case SHORTCUT_PLAYLISTMENU: | 350 | case SHORTCUT_PLAYLISTMENU: |
343 | return Icon_Playlist; | 351 | return Icon_Playlist; |
352 | case SHORTCUT_SHUTDOWN: | ||
353 | return Icon_System_menu; | ||
344 | default: | 354 | default: |
345 | break; | 355 | break; |
346 | } | 356 | } |
@@ -413,6 +423,14 @@ int do_shortcut_menu(void *ignored) | |||
413 | case SHORTCUT_DEBUGITEM: | 423 | case SHORTCUT_DEBUGITEM: |
414 | run_debug_screen(sc->u.path); | 424 | run_debug_screen(sc->u.path); |
415 | break; | 425 | break; |
426 | case SHORTCUT_SHUTDOWN: | ||
427 | #if CONFIG_CHARGING | ||
428 | if (charger_inserted()) | ||
429 | charging_splash(); | ||
430 | else | ||
431 | #endif | ||
432 | sys_poweroff(); | ||
433 | break; | ||
416 | case SHORTCUT_UNDEFINED: | 434 | case SHORTCUT_UNDEFINED: |
417 | default: | 435 | default: |
418 | break; | 436 | break; |
diff --git a/apps/shortcuts.h b/apps/shortcuts.h index d36b2a90fb..c18834a66f 100644 --- a/apps/shortcuts.h +++ b/apps/shortcuts.h | |||
@@ -32,6 +32,7 @@ enum shortcut_type { | |||
32 | SHORTCUT_BROWSER, | 32 | SHORTCUT_BROWSER, |
33 | SHORTCUT_PLAYLISTMENU, | 33 | SHORTCUT_PLAYLISTMENU, |
34 | SHORTCUT_SEPARATOR, | 34 | SHORTCUT_SEPARATOR, |
35 | SHORTCUT_SHUTDOWN, | ||
35 | 36 | ||
36 | SHORTCUT_TYPE_COUNT | 37 | SHORTCUT_TYPE_COUNT |
37 | }; | 38 | }; |
diff --git a/manual/main_menu/main.tex b/manual/main_menu/main.tex index 223ef2bd8d..2fa3366ada 100644 --- a/manual/main_menu/main.tex +++ b/manual/main_menu/main.tex | |||
@@ -280,6 +280,7 @@ settings. With a shortcut, | |||
280 | \item A setting can be configured (any which can be added to the | 280 | \item A setting can be configured (any which can be added to the |
281 | \setting{Quick Screen}) | 281 | \setting{Quick Screen}) |
282 | \item A debug menu item can be displayed (useful for developers mostly) | 282 | \item A debug menu item can be displayed (useful for developers mostly) |
283 | \item A shortcut to shutdown the player | ||
283 | \end{itemize} | 284 | \end{itemize} |
284 | 285 | ||
285 | \note{Shortcuts into the database are not possible} | 286 | \note{Shortcuts into the database are not possible} |
@@ -309,6 +310,8 @@ Available types are: | |||
309 | \item[debug] \config{data} is the name of the debug menu item to display | 310 | \item[debug] \config{data} is the name of the debug menu item to display |
310 | \item[separator] \config{data} is ignored; \config{name} can be used to display text, | 311 | \item[separator] \config{data} is ignored; \config{name} can be used to display text, |
311 | or left blank to make the list more accessible with visual gaps | 312 | or left blank to make the list more accessible with visual gaps |
313 | \item[shutdown] \config{data} is ignored; \config{name} can be used to display text, | ||
314 | Causes the player to turn off. | ||
312 | \end{description} | 315 | \end{description} |
313 | 316 | ||
314 | If the name/icon items are not specified, a sensible default will be used. | 317 | If the name/icon items are not specified, a sensible default will be used. |