From 0b3ea1bfcba0e56e72cacfcb88944dcf2e3b3a07 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Tue, 12 Oct 2004 11:00:19 +0000 Subject: Now the FM, V2 and Ondio players use the new SYS_POWEROFF event. Now you can safely turn off the player by holding OFF. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5259 a1c6a512-1295-4272-9138-f99709370657 --- apps/misc.c | 5 +++++ apps/tree.c | 26 +++++++++++++++----------- 2 files changed, 20 insertions(+), 11 deletions(-) (limited to 'apps') diff --git a/apps/misc.c b/apps/misc.c index 96d23a8388..5be6264fdc 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -217,6 +217,7 @@ bool clean_shutdown(void) { lcd_clear_display(); splash(0, true, str(LANG_SHUTTINGDOWN)); + sleep(HZ); mpeg_stop(); ata_flush(); ata_spindown(1); @@ -239,6 +240,10 @@ int default_event_handler(int event) #endif usb_screen(); return SYS_USB_CONNECTED; + case SYS_POWEROFF: + if (!clean_shutdown()) + return SYS_POWEROFF; + break; } return 0; } diff --git a/apps/tree.c b/apps/tree.c index 1a92dfd3a9..03c7d2ca37 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -946,21 +946,25 @@ static bool dirbrowse(const char *root, const int *dirfilter) break; #ifdef TREE_OFF +#ifndef HAVE_SW_POWEROFF case TREE_OFF: - /* Stop the music if it is playing, else show the shutdown - screen */ - if(mpeg_status()) - mpeg_stop(); - else { - if (!charger_inserted()) { - shutdown_screen(); - } else { - charging_splash(); + if (*dirfilter < NUM_FILTER_MODES) + { + /* Stop the music if it is playing, else show the shutdown + screen */ + if(mpeg_status()) + mpeg_stop(); + else { + if (!charger_inserted()) { + shutdown_screen(); + } else { + charging_splash(); + } + restore = true; } - restore = true; } break; - +#endif case TREE_OFF | BUTTON_REPEAT: if (charger_inserted()) { charging_splash(); -- cgit v1.2.3