diff options
author | Steve Bavin <pondlife@pondlife.me> | 2007-03-08 08:20:30 +0000 |
---|---|---|
committer | Steve Bavin <pondlife@pondlife.me> | 2007-03-08 08:20:30 +0000 |
commit | 149bc03d86e1ae8c2d05fb9d657500252a8ba20a (patch) | |
tree | f5207faaa0f05af465760d9c9017d31df1d38a19 /apps/root_menu.c | |
parent | b1646abc18eab961c815822cf548518315b2ee7d (diff) | |
download | rockbox-149bc03d86e1ae8c2d05fb9d657500252a8ba20a.tar.gz rockbox-149bc03d86e1ae8c2d05fb9d657500252a8ba20a.zip |
Really don't try to initialise while the database status is unknown
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12684 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/root_menu.c')
-rw-r--r-- | apps/root_menu.c | 59 |
1 files changed, 31 insertions, 28 deletions
diff --git a/apps/root_menu.c b/apps/root_menu.c index fa00a06ed5..b9847dfd54 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c | |||
@@ -104,35 +104,17 @@ static int browser(void* param) | |||
104 | case GO_TO_DBBROWSER: | 104 | case GO_TO_DBBROWSER: |
105 | if (!tagcache_is_usable()) | 105 | if (!tagcache_is_usable()) |
106 | { | 106 | { |
107 | /* Check if we're still initialising, so status is unknown */ | 107 | bool reinit_attempted = false; |
108 | struct tagcache_stat *stat = tagcache_get_stat(); | ||
109 | if (!stat->initialized) | ||
110 | { | ||
111 | gui_syncsplash(HZ*2, true, str(LANG_TAGCACHE_BUSY)); | ||
112 | return GO_TO_PREVIOUS; | ||
113 | } | ||
114 | |||
115 | /* Re-init if required */ | ||
116 | if (!stat->ready && !stat->commit_delayed && stat->processed_entries == 0) | ||
117 | { | ||
118 | /* Prompt the user */ | ||
119 | char *lines[]={str(LANG_TAGCACHE_BUSY), str(LANG_TAGCACHE_FORCE_UPDATE)}; | ||
120 | struct text_message message={lines, 2}; | ||
121 | if(gui_syncyesno_run(&message, NULL, NULL) == YESNO_NO) | ||
122 | return GO_TO_PREVIOUS; | ||
123 | int i; | ||
124 | FOR_NB_SCREENS(i) | ||
125 | screens[i].clear_display(); | ||
126 | |||
127 | /* Start initialisation */ | ||
128 | tagcache_rebuild(); | ||
129 | } | ||
130 | 108 | ||
131 | /* Now display progress until it's ready or the user exits */ | 109 | /* Now display progress until it's ready or the user exits */ |
132 | while(!tagcache_is_usable()) | 110 | while(!tagcache_is_usable()) |
133 | { | 111 | { |
134 | gui_syncstatusbar_draw(&statusbars, false); | 112 | gui_syncstatusbar_draw(&statusbars, false); |
135 | stat = tagcache_get_stat(); | 113 | struct tagcache_stat *stat = tagcache_get_stat(); |
114 | |||
115 | /* Allow user to exit */ | ||
116 | if (action_userabort(HZ/2)) | ||
117 | break; | ||
136 | 118 | ||
137 | /* Maybe just needs to reboot due to delayed commit */ | 119 | /* Maybe just needs to reboot due to delayed commit */ |
138 | if (stat->commit_delayed) | 120 | if (stat->commit_delayed) |
@@ -141,6 +123,31 @@ static int browser(void* param) | |||
141 | break; | 123 | break; |
142 | } | 124 | } |
143 | 125 | ||
126 | /* Check if ready status is known */ | ||
127 | if (!stat->readyvalid) | ||
128 | { | ||
129 | gui_syncsplash(0, true, str(LANG_TAGCACHE_BUSY)); | ||
130 | continue; | ||
131 | } | ||
132 | |||
133 | /* Re-init if required */ | ||
134 | if (!reinit_attempted && !stat->ready && | ||
135 | stat->processed_entries == 0 && stat->commit_step == 0) | ||
136 | { | ||
137 | /* Prompt the user */ | ||
138 | reinit_attempted = true; | ||
139 | char *lines[]={str(LANG_TAGCACHE_BUSY), str(LANG_TAGCACHE_FORCE_UPDATE)}; | ||
140 | struct text_message message={lines, 2}; | ||
141 | if(gui_syncyesno_run(&message, NULL, NULL) == YESNO_NO) | ||
142 | break; | ||
143 | int i; | ||
144 | FOR_NB_SCREENS(i) | ||
145 | screens[i].clear_display(); | ||
146 | |||
147 | /* Start initialisation */ | ||
148 | tagcache_rebuild(); | ||
149 | } | ||
150 | |||
144 | /* Display building progress */ | 151 | /* Display building progress */ |
145 | if (stat->commit_step > 0) | 152 | if (stat->commit_step > 0) |
146 | { | 153 | { |
@@ -153,10 +160,6 @@ static int browser(void* param) | |||
153 | gui_syncsplash(0, true, str(LANG_BUILDING_DATABASE), | 160 | gui_syncsplash(0, true, str(LANG_BUILDING_DATABASE), |
154 | stat->processed_entries); | 161 | stat->processed_entries); |
155 | } | 162 | } |
156 | |||
157 | /* Allow user to exit */ | ||
158 | if (action_userabort(HZ/2)) | ||
159 | break; | ||
160 | } | 163 | } |
161 | } | 164 | } |
162 | if (!tagcache_is_usable()) | 165 | if (!tagcache_is_usable()) |