summaryrefslogtreecommitdiffstats
path: root/apps/plugins/pictureflow/pictureflow.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/pictureflow/pictureflow.c')
-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);