From 5b5003dcb12b0fe22f497a62d3024f3cf7a10fd1 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Sat, 24 Jul 2004 21:26:41 +0000 Subject: New feature: clean shutdown if you press OFF twice in the file browser, or select "Shut off" in the main menu. Players only have the menu option, due to lack of keys. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4940 a1c6a512-1295-4272-9138-f99709370657 --- apps/screens.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'apps/screens.c') diff --git a/apps/screens.c b/apps/screens.c index 28d9a48869..c099822525 100644 --- a/apps/screens.c +++ b/apps/screens.c @@ -39,6 +39,7 @@ #include "adc.h" #include "action.h" #include "talk.h" +#include "misc.h" #ifdef HAVE_LCD_BITMAP #define BMPHEIGHT_usb_logo 32 @@ -1090,3 +1091,41 @@ bool set_time_screen(char* string, struct tm *tm) return false; } #endif + +bool shutdown_screen(void) +{ + int button; + bool done = false; + + lcd_stop_scroll(); + +#ifdef HAVE_LCD_CHARCELLS + splash(0, true, "Push STOP to shut off"); +#else + splash(0, true, "Push OFF to shut off"); +#endif + while(!done) + { + button = button_get_w_tmo(HZ*2); + switch(button) + { +#ifdef HAVE_PLAYER_KEYPAD + case BUTTON_STOP: +#else + case BUTTON_OFF: +#endif + clean_shutdown(); + break; + + default: + /* Return if any other button was pushed, or if there + was a timeout. We ignore RELEASE events, since we may + have been called by a button down event, and the user might + not have released the button yet. */ + if(!(button & BUTTON_REL)) + done = true; + break; + } + } + return false; +} -- cgit v1.2.3