summaryrefslogtreecommitdiff
path: root/apps/root_menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/root_menu.c')
-rw-r--r--apps/root_menu.c56
1 files changed, 53 insertions, 3 deletions
diff --git a/apps/root_menu.c b/apps/root_menu.c
index c234614bc6..0dbf179d9e 100644
--- a/apps/root_menu.c
+++ b/apps/root_menu.c
@@ -61,6 +61,9 @@
61#ifdef HAVE_RTC_ALARM 61#ifdef HAVE_RTC_ALARM
62#include "rtc.h" 62#include "rtc.h"
63#endif 63#endif
64#ifdef HAVE_TAGCACHE
65#include "tagcache.h"
66#endif
64 67
65struct root_items { 68struct root_items {
66 int (*function)(void* param); 69 int (*function)(void* param);
@@ -99,11 +102,58 @@ static int browser(void* param)
99 break; 102 break;
100#ifdef HAVE_TAGCACHE 103#ifdef HAVE_TAGCACHE
101 case GO_TO_DBBROWSER: 104 case GO_TO_DBBROWSER:
102 if ((last_screen != GO_TO_ROOT) && !tagcache_is_usable()) 105 if (!tagcache_is_usable())
103 { 106 {
104 gui_syncsplash(HZ, true, str(LANG_TAGCACHE_BUSY)); 107 /* Re-init if required */
105 return GO_TO_PREVIOUS; 108 struct tagcache_stat *stat = tagcache_get_stat();
109 if (!stat->ready && !stat->commit_delayed && stat->processed_entries == 0)
110 {
111 /* Prompt the user */
112 char *lines[]={str(LANG_TAGCACHE_BUSY), str(LANG_TAGCACHE_FORCE_UPDATE)};
113 struct text_message message={lines, 2};
114 if(gui_syncyesno_run(&message, NULL, NULL) == YESNO_NO)
115 return GO_TO_PREVIOUS;
116 int i;
117 FOR_NB_SCREENS(i)
118 screens[i].clear_display();
119
120 /* Start initialisation */
121 tagcache_rebuild();
122 }
123
124 /* Now display progress until it's ready or the user exits */
125 while(!tagcache_is_usable())
126 {
127 gui_syncstatusbar_draw(&statusbars, false);
128 stat = tagcache_get_stat();
129
130 /* Maybe just needs to reboot due to delayed commit */
131 if (stat->commit_delayed)
132 {
133 gui_syncsplash(HZ*2, true, str(LANG_PLEASE_REBOOT));
134 break;
135 }
136
137 /* Display building progress */
138 if (stat->commit_step > 0)
139 {
140 gui_syncsplash(0, true, "%s [%d/%d]",
141 str(LANG_TAGCACHE_INIT), stat->commit_step,
142 tagcache_get_max_commit_step());
143 }
144 else
145 {
146 gui_syncsplash(0, true, str(LANG_BUILDING_DATABASE),
147 stat->processed_entries);
148 }
149
150 /* Allow user to exit */
151 if (action_userabort(HZ/2))
152 break;
153 }
106 } 154 }
155 if (!tagcache_is_usable())
156 return GO_TO_PREVIOUS;
107 filter = SHOW_ID3DB; 157 filter = SHOW_ID3DB;
108 tc->dirlevel = last_db_dirlevel; 158 tc->dirlevel = last_db_dirlevel;
109 break; 159 break;