summaryrefslogtreecommitdiff
path: root/apps/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/tree.c')
-rw-r--r--apps/tree.c30
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
569static void tree_prepare_usb(void *parameter)
570{
571 (void) parameter;
572 rundb_shutdown();
573 tagdb_shutdown();
574}
575
576static bool dirbrowse(void) 569static 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 */
1632void tree_flush(void)
1633{
1634 rundb_shutdown();
1635 tagdb_shutdown();
1636}
1637
1638void tree_restore(void)
1639{
1640 tagdb_init();
1641 rundb_init();
1642}