diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2005-09-14 09:07:05 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2005-09-14 09:07:05 +0000 |
commit | 74353a7fe46c5d6973bffb2488f7c8276e088e80 (patch) | |
tree | 807383a9bb7b21b9dcd4850307f2f1ff861a7bc8 /apps/tree.c | |
parent | 7b86bade5963dc47d3368e9a6e4fc002db79159e (diff) | |
download | rockbox-74353a7fe46c5d6973bffb2488f7c8276e088e80.tar.gz rockbox-74353a7fe46c5d6973bffb2488f7c8276e088e80.zip |
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
Diffstat (limited to 'apps/tree.c')
-rw-r--r-- | apps/tree.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/apps/tree.c b/apps/tree.c index a88d58b165..e8bf46f1af 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -566,13 +566,6 @@ static bool check_changed_id3mode(bool currmode) | |||
566 | return currmode; | 566 | return currmode; |
567 | } | 567 | } |
568 | 568 | ||
569 | static void tree_prepare_usb(void *parameter) | ||
570 | { | ||
571 | (void) parameter; | ||
572 | rundb_shutdown(); | ||
573 | tagdb_shutdown(); | ||
574 | } | ||
575 | |||
576 | static bool dirbrowse(void) | 569 | static bool dirbrowse(void) |
577 | { | 570 | { |
578 | int numentries=0; | 571 | int numentries=0; |
@@ -764,13 +757,13 @@ static bool dirbrowse(void) | |||
764 | case TREE_OFF: | 757 | case TREE_OFF: |
765 | if (*tc.dirfilter < NUM_FILTER_MODES) | 758 | if (*tc.dirfilter < NUM_FILTER_MODES) |
766 | { | 759 | { |
767 | /* Stop the music if it is playing, else show the shutdown | 760 | /* Stop the music if it is playing, else power off */ |
768 | screen */ | ||
769 | if(audio_status()) | 761 | if(audio_status()) |
770 | audio_stop(); | 762 | audio_stop(); |
771 | else { | 763 | else { |
772 | if (!charger_inserted()) { | 764 | if (!charger_inserted()) { |
773 | shutdown_screen(); | 765 | if(shutdown_screen()) |
766 | reload_dir = true; | ||
774 | } else { | 767 | } else { |
775 | charging_splash(); | 768 | charging_splash(); |
776 | } | 769 | } |
@@ -1126,11 +1119,8 @@ static bool dirbrowse(void) | |||
1126 | #endif | 1119 | #endif |
1127 | 1120 | ||
1128 | default: | 1121 | default: |
1129 | if (default_event_handler_ex(button, tree_prepare_usb, NULL) | 1122 | if (default_event_handler(button) == SYS_USB_CONNECTED) |
1130 | == SYS_USB_CONNECTED) | ||
1131 | { | 1123 | { |
1132 | tagdb_init(); /* re-init database */ | ||
1133 | rundb_init(); | ||
1134 | if(*tc.dirfilter > NUM_FILTER_MODES) | 1124 | if(*tc.dirfilter > NUM_FILTER_MODES) |
1135 | /* leave sub-browsers after usb, doing otherwise | 1125 | /* leave sub-browsers after usb, doing otherwise |
1136 | might be confusing to the user */ | 1126 | might be confusing to the user */ |
@@ -1638,3 +1628,15 @@ void ft_play_filename(char *dir, char *file) | |||
1638 | } | 1628 | } |
1639 | } | 1629 | } |
1640 | 1630 | ||
1631 | /* These two functions are called by the USB and shutdown handlers */ | ||
1632 | void tree_flush(void) | ||
1633 | { | ||
1634 | rundb_shutdown(); | ||
1635 | tagdb_shutdown(); | ||
1636 | } | ||
1637 | |||
1638 | void tree_restore(void) | ||
1639 | { | ||
1640 | tagdb_init(); | ||
1641 | rundb_init(); | ||
1642 | } | ||