diff options
author | Christian Soffke <christian.soffke@gmail.com> | 2024-05-11 23:45:25 +0200 |
---|---|---|
committer | Christian Soffke <christian.soffke@gmail.com> | 2024-05-13 18:06:55 +0200 |
commit | 8eeef333a15d99a38f733a45612728dfae66b862 (patch) | |
tree | 75b2aadb15e48da090b39e64b6705f70a8ee1a06 | |
parent | f631bfe5b4fb78d676a37583bb4aa8f3d2e3bf1b (diff) | |
download | rockbox-8eeef333a1.tar.gz rockbox-8eeef333a1.zip |
shortcuts: add 'reboot' type
Enabled by d55dcef
Change-Id: I689e289feb4715aab603bae4a6855cf5e227562b
-rw-r--r-- | apps/shortcuts.c | 21 | ||||
-rw-r--r-- | apps/shortcuts.h | 1 | ||||
-rw-r--r-- | manual/main_menu/main.tex | 3 |
3 files changed, 21 insertions, 4 deletions
diff --git a/apps/shortcuts.c b/apps/shortcuts.c index c64976c46c..a32c298f6d 100644 --- a/apps/shortcuts.c +++ b/apps/shortcuts.c @@ -61,6 +61,7 @@ static const char * const type_strings[SHORTCUT_TYPE_COUNT] = { [SHORTCUT_PLAYLISTMENU] = "playlist menu", [SHORTCUT_SEPARATOR] = "separator", [SHORTCUT_SHUTDOWN] = "shutdown", + [SHORTCUT_REBOOT] = "reboot", [SHORTCUT_TIME] = "time", }; @@ -189,6 +190,7 @@ static bool verify_shortcut(struct shortcut* sc) case SHORTCUT_DEBUGITEM: case SHORTCUT_SEPARATOR: case SHORTCUT_SHUTDOWN: + case SHORTCUT_REBOOT: default: break; } @@ -362,6 +364,7 @@ static int readline_cb(int n, char *buf, void *parameters) break; case SHORTCUT_SEPARATOR: case SHORTCUT_SHUTDOWN: + case SHORTCUT_REBOOT: break; } } @@ -444,10 +447,11 @@ static const char * shortcut_menu_get_name(int selected_item, void * data, } return sc->name; } - else if (sc->type == SHORTCUT_SHUTDOWN && sc->name[0] == '\0') + else if ((sc->type == SHORTCUT_SHUTDOWN || sc->type == SHORTCUT_REBOOT) && + sc->name[0] == '\0') { /* No translation support as only soft_shutdown has LANG_SHUTDOWN defined */ - return type_strings[SHORTCUT_SHUTDOWN]; + return type_strings[sc->type]; } else if (sc->type == SHORTCUT_BROWSER && sc->name[0] == '\0' && (sc->u.path)[0] != '\0') { @@ -524,6 +528,7 @@ static enum themable_icons shortcut_menu_get_icon(int selected_item, void * data case SHORTCUT_PLAYLISTMENU: return Icon_Playlist; case SHORTCUT_SHUTDOWN: + case SHORTCUT_REBOOT: return Icon_System_menu; case SHORTCUT_TIME: return Icon_Menu_functioncall; @@ -605,11 +610,13 @@ static int shortcut_menu_speak_item(int selected_item, void * data) talk_spell(sc->name, false); break; case SHORTCUT_SHUTDOWN: + case SHORTCUT_REBOOT: if (!sc->name[0]) { - talk_spell(type_strings[SHORTCUT_SHUTDOWN], false); + talk_spell(type_strings[sc->type], false); break; } + /* fall-through */ default: talk_spell(sc->name[0] ? sc->name : sc->u.path, false); break; @@ -736,6 +743,14 @@ int do_shortcut_menu(void *ignored) #endif sys_poweroff(); break; + case SHORTCUT_REBOOT: +#if CONFIG_CHARGING + if (charger_inserted()) + charging_splash(); + else +#endif + sys_reboot(); + break; case SHORTCUT_TIME: #if CONFIG_RTC if (!sc->u.timedata.talktime) diff --git a/apps/shortcuts.h b/apps/shortcuts.h index e5e05628bb..aaccccb1b3 100644 --- a/apps/shortcuts.h +++ b/apps/shortcuts.h @@ -33,6 +33,7 @@ enum shortcut_type { SHORTCUT_PLAYLISTMENU, SHORTCUT_SEPARATOR, SHORTCUT_SHUTDOWN, + SHORTCUT_REBOOT, SHORTCUT_TIME, SHORTCUT_TYPE_COUNT diff --git a/manual/main_menu/main.tex b/manual/main_menu/main.tex index 92ff26b2ec..f09606a20b 100644 --- a/manual/main_menu/main.tex +++ b/manual/main_menu/main.tex @@ -293,7 +293,7 @@ settings. With a shortcut, \item The current time can be spoken } \item The sleep timer can be configured - \item The \dap{} can be turned off + \item The \dap{} can be turned off or rebooted \end{itemize} \note{Shortcuts into the database are not possible} @@ -330,6 +330,7 @@ Available types are: or started using the default duration; \config{name} will be ignored in that case. Otherwise \config{name} is required for this shortcut type. \item[shutdown] \config{data} is ignored; \config{name} can be used to display text +\item[reboot] \config{data} is ignored; \config{name} can be used to display text \end{description} If the name/icon items are not specified, a sensible default will be used. |