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
This commit is contained in:
parent
7b86bade59
commit
74353a7fe4
18
apps/misc.c
18
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))
|
||||
|
|
30
apps/tree.c
30
apps/tree.c
|
@ -566,13 +566,6 @@ static bool check_changed_id3mode(bool currmode)
|
|||
return currmode;
|
||||
}
|
||||
|
||||
static void tree_prepare_usb(void *parameter)
|
||||
{
|
||||
(void) parameter;
|
||||
rundb_shutdown();
|
||||
tagdb_shutdown();
|
||||
}
|
||||
|
||||
static bool dirbrowse(void)
|
||||
{
|
||||
int numentries=0;
|
||||
|
@ -764,13 +757,13 @@ static bool dirbrowse(void)
|
|||
case TREE_OFF:
|
||||
if (*tc.dirfilter < NUM_FILTER_MODES)
|
||||
{
|
||||
/* Stop the music if it is playing, else show the shutdown
|
||||
screen */
|
||||
/* Stop the music if it is playing, else power off */
|
||||
if(audio_status())
|
||||
audio_stop();
|
||||
else {
|
||||
if (!charger_inserted()) {
|
||||
shutdown_screen();
|
||||
if(shutdown_screen())
|
||||
reload_dir = true;
|
||||
} else {
|
||||
charging_splash();
|
||||
}
|
||||
|
@ -1126,11 +1119,8 @@ static bool dirbrowse(void)
|
|||
#endif
|
||||
|
||||
default:
|
||||
if (default_event_handler_ex(button, tree_prepare_usb, NULL)
|
||||
== SYS_USB_CONNECTED)
|
||||
if (default_event_handler(button) == SYS_USB_CONNECTED)
|
||||
{
|
||||
tagdb_init(); /* re-init database */
|
||||
rundb_init();
|
||||
if(*tc.dirfilter > NUM_FILTER_MODES)
|
||||
/* leave sub-browsers after usb, doing otherwise
|
||||
might be confusing to the user */
|
||||
|
@ -1638,3 +1628,15 @@ void ft_play_filename(char *dir, char *file)
|
|||
}
|
||||
}
|
||||
|
||||
/* These two functions are called by the USB and shutdown handlers */
|
||||
void tree_flush(void)
|
||||
{
|
||||
rundb_shutdown();
|
||||
tagdb_shutdown();
|
||||
}
|
||||
|
||||
void tree_restore(void)
|
||||
{
|
||||
tagdb_init();
|
||||
rundb_init();
|
||||
}
|
||||
|
|
|
@ -193,5 +193,7 @@ char *getcwd(char *buf, int size);
|
|||
void reload_directory(void);
|
||||
bool check_rockboxdir(void);
|
||||
struct tree_context* tree_get_context(void);
|
||||
void tree_flush(void);
|
||||
void tree_restore(void);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user