mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-18 09:32:40 -05:00
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
3 changed files with 36 additions and 14 deletions
18
apps/misc.c
18
apps/misc.c
|
|
@ -46,6 +46,7 @@
|
||||||
#ifdef HAVE_MMC
|
#ifdef HAVE_MMC
|
||||||
#include "ata_mmc.h"
|
#include "ata_mmc.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "tree.h"
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
#include "bmp.h"
|
#include "bmp.h"
|
||||||
|
|
@ -381,6 +382,16 @@ bool settings_parseline(char* line, char** name, char** value)
|
||||||
return true;
|
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)
|
static bool clean_shutdown(void (*callback)(void *), void *parameter)
|
||||||
{
|
{
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
|
|
@ -396,6 +407,9 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter)
|
||||||
splash(0, true, str(LANG_SHUTTINGDOWN));
|
splash(0, true, str(LANG_SHUTTINGDOWN));
|
||||||
if (callback != NULL)
|
if (callback != NULL)
|
||||||
callback(parameter);
|
callback(parameter);
|
||||||
|
|
||||||
|
system_flush();
|
||||||
|
|
||||||
shutdown_hw();
|
shutdown_hw();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -467,7 +481,11 @@ long default_event_handler_ex(long event, void (*callback)(void *), void *parame
|
||||||
#ifdef HAVE_MMC
|
#ifdef HAVE_MMC
|
||||||
if (!mmc_touched() || (mmc_remove_request() == SYS_MMC_EXTRACTED))
|
if (!mmc_touched() || (mmc_remove_request() == SYS_MMC_EXTRACTED))
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
system_flush();
|
||||||
usb_screen();
|
usb_screen();
|
||||||
|
system_restore();
|
||||||
|
}
|
||||||
return SYS_USB_CONNECTED;
|
return SYS_USB_CONNECTED;
|
||||||
case SYS_POWEROFF:
|
case SYS_POWEROFF:
|
||||||
if (!clean_shutdown(callback, parameter))
|
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;
|
return currmode;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tree_prepare_usb(void *parameter)
|
|
||||||
{
|
|
||||||
(void) parameter;
|
|
||||||
rundb_shutdown();
|
|
||||||
tagdb_shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool dirbrowse(void)
|
static bool dirbrowse(void)
|
||||||
{
|
{
|
||||||
int numentries=0;
|
int numentries=0;
|
||||||
|
|
@ -764,13 +757,13 @@ static bool dirbrowse(void)
|
||||||
case TREE_OFF:
|
case TREE_OFF:
|
||||||
if (*tc.dirfilter < NUM_FILTER_MODES)
|
if (*tc.dirfilter < NUM_FILTER_MODES)
|
||||||
{
|
{
|
||||||
/* Stop the music if it is playing, else show the shutdown
|
/* Stop the music if it is playing, else power off */
|
||||||
screen */
|
|
||||||
if(audio_status())
|
if(audio_status())
|
||||||
audio_stop();
|
audio_stop();
|
||||||
else {
|
else {
|
||||||
if (!charger_inserted()) {
|
if (!charger_inserted()) {
|
||||||
shutdown_screen();
|
if(shutdown_screen())
|
||||||
|
reload_dir = true;
|
||||||
} else {
|
} else {
|
||||||
charging_splash();
|
charging_splash();
|
||||||
}
|
}
|
||||||
|
|
@ -1126,11 +1119,8 @@ static bool dirbrowse(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (default_event_handler_ex(button, tree_prepare_usb, NULL)
|
if (default_event_handler(button) == SYS_USB_CONNECTED)
|
||||||
== SYS_USB_CONNECTED)
|
|
||||||
{
|
{
|
||||||
tagdb_init(); /* re-init database */
|
|
||||||
rundb_init();
|
|
||||||
if(*tc.dirfilter > NUM_FILTER_MODES)
|
if(*tc.dirfilter > NUM_FILTER_MODES)
|
||||||
/* leave sub-browsers after usb, doing otherwise
|
/* leave sub-browsers after usb, doing otherwise
|
||||||
might be confusing to the user */
|
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);
|
void reload_directory(void);
|
||||||
bool check_rockboxdir(void);
|
bool check_rockboxdir(void);
|
||||||
struct tree_context* tree_get_context(void);
|
struct tree_context* tree_get_context(void);
|
||||||
|
void tree_flush(void);
|
||||||
|
void tree_restore(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue