diff options
Diffstat (limited to 'apps/main.c')
-rw-r--r-- | apps/main.c | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/apps/main.c b/apps/main.c index 84c77ab1c9..3878e3a9c4 100644 --- a/apps/main.c +++ b/apps/main.c | |||
@@ -106,33 +106,25 @@ void init_dircache(void) | |||
106 | int font_w, font_h; | 106 | int font_w, font_h; |
107 | int result; | 107 | int result; |
108 | char buf[32]; | 108 | char buf[32]; |
109 | bool clear = false; | ||
109 | 110 | ||
110 | dircache_init(); | 111 | dircache_init(); |
111 | if (global_settings.dircache) | 112 | if (global_settings.dircache) |
112 | { | 113 | { |
113 | /* Print "Scanning disk..." to the display. */ | 114 | if (global_settings.dircache_size == 0) |
114 | lcd_getstringsize("A", &font_w, &font_h); | ||
115 | lcd_putsxy((LCD_WIDTH/2) - ((strlen(str(LANG_DIRCACHE_BUILDING))*font_w)/2), | ||
116 | LCD_HEIGHT-font_h*3, str(LANG_DIRCACHE_BUILDING)); | ||
117 | lcd_update(); | ||
118 | |||
119 | result = dircache_build(global_settings.dircache_size); | ||
120 | if (result < 0) | ||
121 | { | 115 | { |
122 | snprintf(buf, sizeof(buf), | 116 | gui_syncsplash(0, true, str(LANG_DIRCACHE_BUILDING)); |
123 | "Failed! Result: %d", | 117 | clear = true; |
124 | result); | ||
125 | lcd_getstringsize("A", &font_w, &font_h); | ||
126 | lcd_putsxy((LCD_WIDTH/2) - ((strlen(buf)*font_w)/2), | ||
127 | LCD_HEIGHT-font_h*2, buf); | ||
128 | } | 118 | } |
129 | else | 119 | |
120 | result = dircache_build(global_settings.dircache_size); | ||
121 | if (result < 0) | ||
122 | gui_syncsplash(0, true, "Failed! Result: %d", result); | ||
123 | |||
124 | if (clear) | ||
130 | { | 125 | { |
131 | /* Clean the text when we are done. */ | 126 | backlight_on(); |
132 | lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | 127 | show_logo(); |
133 | lcd_fillrect(0, LCD_HEIGHT-font_h*3, LCD_WIDTH, font_h); | ||
134 | lcd_set_drawmode(DRMODE_SOLID); | ||
135 | lcd_update(); | ||
136 | } | 128 | } |
137 | } | 129 | } |
138 | } | 130 | } |
@@ -170,7 +162,10 @@ void init_tagcache(void) | |||
170 | tagtree_init(); | 162 | tagtree_init(); |
171 | 163 | ||
172 | if (clear) | 164 | if (clear) |
165 | { | ||
166 | backlight_on(); | ||
173 | show_logo(); | 167 | show_logo(); |
168 | } | ||
174 | } | 169 | } |
175 | 170 | ||
176 | #ifdef SIMULATOR | 171 | #ifdef SIMULATOR |
@@ -389,9 +384,9 @@ void init(void) | |||
389 | settings_load(SETTINGS_ALL); | 384 | settings_load(SETTINGS_ALL); |
390 | 385 | ||
391 | 386 | ||
392 | init_dircache(); | ||
393 | gui_sync_wps_init(); | 387 | gui_sync_wps_init(); |
394 | settings_apply(); | 388 | settings_apply(); |
389 | init_dircache(); | ||
395 | init_tagcache(); | 390 | init_tagcache(); |
396 | 391 | ||
397 | status_init(); | 392 | status_init(); |