summaryrefslogtreecommitdiffstats
path: root/apps/plugins/pictureflow
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2020-07-28 10:58:34 -0400
committerWilliam Wilgus <wilgus.william@gmail.com>2020-08-16 10:35:57 -0400
commitd553bb1149800daf16dcb92bc0608fe6248e1dab (patch)
tree86cdcf361ef387a3d624485d1e6c6e062d7ce85b /apps/plugins/pictureflow
parent94eb1df58b4ad4e25941782832d20e1c8d57f0c5 (diff)
downloadrockbox-d553bb1149800daf16dcb92bc0608fe6248e1dab.tar.gz
rockbox-d553bb1149800daf16dcb92bc0608fe6248e1dab.tar.bz2
rockbox-d553bb1149800daf16dcb92bc0608fe6248e1dab.zip
root_menu move tag cache init check to pictureflow plugin
let pictureflow decide if the tag cache is ready instead of core Change-Id: I2ab9b375d773dbbc28ea41fbf7bb6fb361ace8fd
Diffstat (limited to 'apps/plugins/pictureflow')
-rw-r--r--apps/plugins/pictureflow/pictureflow.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c
index ba3ae3018f..d1da10ee09 100644
--- a/apps/plugins/pictureflow/pictureflow.c
+++ b/apps/plugins/pictureflow/pictureflow.c
@@ -530,6 +530,26 @@ static void draw_progressbar(int step, int count, char *msg);
static void draw_splashscreen(unsigned char * buf_tmp, size_t buf_tmp_size);
static void free_all_slide_prio(int prio);
+static bool check_database(bool prompt)
+{
+ bool needwarn = true;
+ struct tagcache_stat *stat = rb->tagcache_get_stat();
+ while ( !(stat->initialized && stat->ready) )
+ {
+ if (needwarn)
+ rb->splash(0, ID2P(LANG_TAGCACHE_BUSY));
+ if (!prompt)
+ return false;
+ else if (rb->action_userabort(HZ/5))
+ return false;
+
+ needwarn = false;
+ stat = rb->tagcache_get_stat();
+ rb->yield();
+ }
+ return true;
+}
+
static bool confirm_quit(void)
{
const struct text_message prompt =
@@ -3821,6 +3841,17 @@ enum plugin_status plugin_start(const void *parameter)
void * buf;
size_t buf_size;
+ bool prompt = (parameter && ((char *) parameter)[0] == ACTIVITY_MAINMENU);
+
+ if (!check_database(prompt))
+ {
+ if (prompt)
+ return PLUGIN_OK;
+ else
+ error_wait("Please enable database");
+
+ return PLUGIN_ERROR;
+ }
atexit(cleanup);