summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorChristian Soffke <christian.soffke@gmail.com>2024-05-11 23:45:25 +0200
committerChristian Soffke <christian.soffke@gmail.com>2024-05-13 18:06:55 +0200
commit8eeef333a15d99a38f733a45612728dfae66b862 (patch)
tree75b2aadb15e48da090b39e64b6705f70a8ee1a06 /apps
parentf631bfe5b4fb78d676a37583bb4aa8f3d2e3bf1b (diff)
downloadrockbox-8eeef333a15d99a38f733a45612728dfae66b862.tar.gz
rockbox-8eeef333a15d99a38f733a45612728dfae66b862.zip
shortcuts: add 'reboot' type
Enabled by d55dcef Change-Id: I689e289feb4715aab603bae4a6855cf5e227562b
Diffstat (limited to 'apps')
-rw-r--r--apps/shortcuts.c21
-rw-r--r--apps/shortcuts.h1
2 files changed, 19 insertions, 3 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] = {
61 [SHORTCUT_PLAYLISTMENU] = "playlist menu", 61 [SHORTCUT_PLAYLISTMENU] = "playlist menu",
62 [SHORTCUT_SEPARATOR] = "separator", 62 [SHORTCUT_SEPARATOR] = "separator",
63 [SHORTCUT_SHUTDOWN] = "shutdown", 63 [SHORTCUT_SHUTDOWN] = "shutdown",
64 [SHORTCUT_REBOOT] = "reboot",
64 [SHORTCUT_TIME] = "time", 65 [SHORTCUT_TIME] = "time",
65}; 66};
66 67
@@ -189,6 +190,7 @@ static bool verify_shortcut(struct shortcut* sc)
189 case SHORTCUT_DEBUGITEM: 190 case SHORTCUT_DEBUGITEM:
190 case SHORTCUT_SEPARATOR: 191 case SHORTCUT_SEPARATOR:
191 case SHORTCUT_SHUTDOWN: 192 case SHORTCUT_SHUTDOWN:
193 case SHORTCUT_REBOOT:
192 default: 194 default:
193 break; 195 break;
194 } 196 }
@@ -362,6 +364,7 @@ static int readline_cb(int n, char *buf, void *parameters)
362 break; 364 break;
363 case SHORTCUT_SEPARATOR: 365 case SHORTCUT_SEPARATOR:
364 case SHORTCUT_SHUTDOWN: 366 case SHORTCUT_SHUTDOWN:
367 case SHORTCUT_REBOOT:
365 break; 368 break;
366 } 369 }
367 } 370 }
@@ -444,10 +447,11 @@ static const char * shortcut_menu_get_name(int selected_item, void * data,
444 } 447 }
445 return sc->name; 448 return sc->name;
446 } 449 }
447 else if (sc->type == SHORTCUT_SHUTDOWN && sc->name[0] == '\0') 450 else if ((sc->type == SHORTCUT_SHUTDOWN || sc->type == SHORTCUT_REBOOT) &&
451 sc->name[0] == '\0')
448 { 452 {
449 /* No translation support as only soft_shutdown has LANG_SHUTDOWN defined */ 453 /* No translation support as only soft_shutdown has LANG_SHUTDOWN defined */
450 return type_strings[SHORTCUT_SHUTDOWN]; 454 return type_strings[sc->type];
451 } 455 }
452 else if (sc->type == SHORTCUT_BROWSER && sc->name[0] == '\0' && (sc->u.path)[0] != '\0') 456 else if (sc->type == SHORTCUT_BROWSER && sc->name[0] == '\0' && (sc->u.path)[0] != '\0')
453 { 457 {
@@ -524,6 +528,7 @@ static enum themable_icons shortcut_menu_get_icon(int selected_item, void * data
524 case SHORTCUT_PLAYLISTMENU: 528 case SHORTCUT_PLAYLISTMENU:
525 return Icon_Playlist; 529 return Icon_Playlist;
526 case SHORTCUT_SHUTDOWN: 530 case SHORTCUT_SHUTDOWN:
531 case SHORTCUT_REBOOT:
527 return Icon_System_menu; 532 return Icon_System_menu;
528 case SHORTCUT_TIME: 533 case SHORTCUT_TIME:
529 return Icon_Menu_functioncall; 534 return Icon_Menu_functioncall;
@@ -605,11 +610,13 @@ static int shortcut_menu_speak_item(int selected_item, void * data)
605 talk_spell(sc->name, false); 610 talk_spell(sc->name, false);
606 break; 611 break;
607 case SHORTCUT_SHUTDOWN: 612 case SHORTCUT_SHUTDOWN:
613 case SHORTCUT_REBOOT:
608 if (!sc->name[0]) 614 if (!sc->name[0])
609 { 615 {
610 talk_spell(type_strings[SHORTCUT_SHUTDOWN], false); 616 talk_spell(type_strings[sc->type], false);
611 break; 617 break;
612 } 618 }
619 /* fall-through */
613 default: 620 default:
614 talk_spell(sc->name[0] ? sc->name : sc->u.path, false); 621 talk_spell(sc->name[0] ? sc->name : sc->u.path, false);
615 break; 622 break;
@@ -736,6 +743,14 @@ int do_shortcut_menu(void *ignored)
736#endif 743#endif
737 sys_poweroff(); 744 sys_poweroff();
738 break; 745 break;
746 case SHORTCUT_REBOOT:
747#if CONFIG_CHARGING
748 if (charger_inserted())
749 charging_splash();
750 else
751#endif
752 sys_reboot();
753 break;
739 case SHORTCUT_TIME: 754 case SHORTCUT_TIME:
740#if CONFIG_RTC 755#if CONFIG_RTC
741 if (!sc->u.timedata.talktime) 756 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 {
33 SHORTCUT_PLAYLISTMENU, 33 SHORTCUT_PLAYLISTMENU,
34 SHORTCUT_SEPARATOR, 34 SHORTCUT_SEPARATOR,
35 SHORTCUT_SHUTDOWN, 35 SHORTCUT_SHUTDOWN,
36 SHORTCUT_REBOOT,
36 SHORTCUT_TIME, 37 SHORTCUT_TIME,
37 38
38 SHORTCUT_TYPE_COUNT 39 SHORTCUT_TYPE_COUNT