From 74353a7fe46c5d6973bffb2488f7c8276e088e80 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Wed, 14 Sep 2005 09:07:05 +0000 Subject: The database is now always synched when entering USB mode or shutting down, and not only in the tree browser git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7516 a1c6a512-1295-4272-9138-f99709370657 --- apps/misc.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'apps/misc.c') diff --git a/apps/misc.c b/apps/misc.c index ddf8d06e7b..d1b5c2274f 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -46,6 +46,7 @@ #ifdef HAVE_MMC #include "ata_mmc.h" #endif +#include "tree.h" #ifdef HAVE_LCD_BITMAP #include "bmp.h" @@ -381,6 +382,16 @@ bool settings_parseline(char* line, char** name, char** value) return true; } +static void system_flush(void) +{ + tree_flush(); +} + +static void system_restore(void) +{ + tree_restore(); +} + static bool clean_shutdown(void (*callback)(void *), void *parameter) { #ifdef SIMULATOR @@ -396,6 +407,9 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter) splash(0, true, str(LANG_SHUTTINGDOWN)); if (callback != NULL) callback(parameter); + + system_flush(); + shutdown_hw(); } #endif @@ -467,7 +481,11 @@ long default_event_handler_ex(long event, void (*callback)(void *), void *parame #ifdef HAVE_MMC if (!mmc_touched() || (mmc_remove_request() == SYS_MMC_EXTRACTED)) #endif + { + system_flush(); usb_screen(); + system_restore(); + } return SYS_USB_CONNECTED; case SYS_POWEROFF: if (!clean_shutdown(callback, parameter)) -- cgit v1.2.3