From 149bc03d86e1ae8c2d05fb9d657500252a8ba20a Mon Sep 17 00:00:00 2001 From: Steve Bavin Date: Thu, 8 Mar 2007 08:20:30 +0000 Subject: 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 --- apps/root_menu.c | 59 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 31 insertions(+), 28 deletions(-) (limited to 'apps/root_menu.c') 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) case GO_TO_DBBROWSER: if (!tagcache_is_usable()) { - /* Check if we're still initialising, so status is unknown */ - struct tagcache_stat *stat = tagcache_get_stat(); - if (!stat->initialized) - { - gui_syncsplash(HZ*2, true, str(LANG_TAGCACHE_BUSY)); - return GO_TO_PREVIOUS; - } - - /* Re-init if required */ - if (!stat->ready && !stat->commit_delayed && stat->processed_entries == 0) - { - /* Prompt the user */ - char *lines[]={str(LANG_TAGCACHE_BUSY), str(LANG_TAGCACHE_FORCE_UPDATE)}; - struct text_message message={lines, 2}; - if(gui_syncyesno_run(&message, NULL, NULL) == YESNO_NO) - return GO_TO_PREVIOUS; - int i; - FOR_NB_SCREENS(i) - screens[i].clear_display(); - - /* Start initialisation */ - tagcache_rebuild(); - } + bool reinit_attempted = false; /* Now display progress until it's ready or the user exits */ while(!tagcache_is_usable()) { gui_syncstatusbar_draw(&statusbars, false); - stat = tagcache_get_stat(); + struct tagcache_stat *stat = tagcache_get_stat(); + + /* Allow user to exit */ + if (action_userabort(HZ/2)) + break; /* Maybe just needs to reboot due to delayed commit */ if (stat->commit_delayed) @@ -141,6 +123,31 @@ static int browser(void* param) break; } + /* Check if ready status is known */ + if (!stat->readyvalid) + { + gui_syncsplash(0, true, str(LANG_TAGCACHE_BUSY)); + continue; + } + + /* Re-init if required */ + if (!reinit_attempted && !stat->ready && + stat->processed_entries == 0 && stat->commit_step == 0) + { + /* Prompt the user */ + reinit_attempted = true; + char *lines[]={str(LANG_TAGCACHE_BUSY), str(LANG_TAGCACHE_FORCE_UPDATE)}; + struct text_message message={lines, 2}; + if(gui_syncyesno_run(&message, NULL, NULL) == YESNO_NO) + break; + int i; + FOR_NB_SCREENS(i) + screens[i].clear_display(); + + /* Start initialisation */ + tagcache_rebuild(); + } + /* Display building progress */ if (stat->commit_step > 0) { @@ -153,10 +160,6 @@ static int browser(void* param) gui_syncsplash(0, true, str(LANG_BUILDING_DATABASE), stat->processed_entries); } - - /* Allow user to exit */ - if (action_userabort(HZ/2)) - break; } } if (!tagcache_is_usable()) -- cgit v1.2.3