diff options
author | William Wilgus <wilgus.william@gmail.com> | 2020-07-28 10:58:34 -0400 |
---|---|---|
committer | William Wilgus <wilgus.william@gmail.com> | 2020-08-16 10:35:57 -0400 |
commit | d553bb1149800daf16dcb92bc0608fe6248e1dab (patch) | |
tree | 86cdcf361ef387a3d624485d1e6c6e062d7ce85b /apps/plugins/pictureflow/pictureflow.c | |
parent | 94eb1df58b4ad4e25941782832d20e1c8d57f0c5 (diff) | |
download | rockbox-d553bb1149800daf16dcb92bc0608fe6248e1dab.tar.gz 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/pictureflow.c')
-rw-r--r-- | apps/plugins/pictureflow/pictureflow.c | 31 |
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); | |||
530 | static void draw_splashscreen(unsigned char * buf_tmp, size_t buf_tmp_size); | 530 | static void draw_splashscreen(unsigned char * buf_tmp, size_t buf_tmp_size); |
531 | static void free_all_slide_prio(int prio); | 531 | static void free_all_slide_prio(int prio); |
532 | 532 | ||
533 | static bool check_database(bool prompt) | ||
534 | { | ||
535 | bool needwarn = true; | ||
536 | struct tagcache_stat *stat = rb->tagcache_get_stat(); | ||
537 | while ( !(stat->initialized && stat->ready) ) | ||
538 | { | ||
539 | if (needwarn) | ||
540 | rb->splash(0, ID2P(LANG_TAGCACHE_BUSY)); | ||
541 | if (!prompt) | ||
542 | return false; | ||
543 | else if (rb->action_userabort(HZ/5)) | ||
544 | return false; | ||
545 | |||
546 | needwarn = false; | ||
547 | stat = rb->tagcache_get_stat(); | ||
548 | rb->yield(); | ||
549 | } | ||
550 | return true; | ||
551 | } | ||
552 | |||
533 | static bool confirm_quit(void) | 553 | static bool confirm_quit(void) |
534 | { | 554 | { |
535 | const struct text_message prompt = | 555 | const struct text_message prompt = |
@@ -3821,6 +3841,17 @@ enum plugin_status plugin_start(const void *parameter) | |||
3821 | 3841 | ||
3822 | void * buf; | 3842 | void * buf; |
3823 | size_t buf_size; | 3843 | size_t buf_size; |
3844 | bool prompt = (parameter && ((char *) parameter)[0] == ACTIVITY_MAINMENU); | ||
3845 | |||
3846 | if (!check_database(prompt)) | ||
3847 | { | ||
3848 | if (prompt) | ||
3849 | return PLUGIN_OK; | ||
3850 | else | ||
3851 | error_wait("Please enable database"); | ||
3852 | |||
3853 | return PLUGIN_ERROR; | ||
3854 | } | ||
3824 | 3855 | ||
3825 | atexit(cleanup); | 3856 | atexit(cleanup); |
3826 | 3857 | ||