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
This commit is contained in:
parent
94eb1df58b
commit
d553bb1149
4 changed files with 54 additions and 28 deletions
|
@ -803,6 +803,10 @@ static const struct plugin_api rockbox_api = {
|
||||||
|
|
||||||
/* new stuff at the end, sort into place next time
|
/* new stuff at the end, sort into place next time
|
||||||
the API gets incompatible */
|
the API gets incompatible */
|
||||||
|
|
||||||
|
#ifdef HAVE_TAGCACHE
|
||||||
|
tagcache_get_stat,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static int plugin_buffer_handle;
|
static int plugin_buffer_handle;
|
||||||
|
|
|
@ -154,7 +154,7 @@ void* plugin_get_buffer(size_t *buffer_size);
|
||||||
#define PLUGIN_MAGIC 0x526F634B /* RocK */
|
#define PLUGIN_MAGIC 0x526F634B /* RocK */
|
||||||
|
|
||||||
/* increase this every time the api struct changes */
|
/* increase this every time the api struct changes */
|
||||||
#define PLUGIN_API_VERSION 239
|
#define PLUGIN_API_VERSION 240
|
||||||
|
|
||||||
/* update this to latest version if a change to the api struct breaks
|
/* update this to latest version if a change to the api struct breaks
|
||||||
backwards compatibility (and please take the opportunity to sort in any
|
backwards compatibility (and please take the opportunity to sort in any
|
||||||
|
@ -930,6 +930,11 @@ struct plugin_api {
|
||||||
|
|
||||||
/* new stuff at the end, sort into place next time
|
/* new stuff at the end, sort into place next time
|
||||||
the API gets incompatible */
|
the API gets incompatible */
|
||||||
|
|
||||||
|
#ifdef HAVE_TAGCACHE
|
||||||
|
struct tagcache_stat* (*tagcache_get_stat)(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* plugin header */
|
/* plugin header */
|
||||||
|
|
|
@ -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 draw_splashscreen(unsigned char * buf_tmp, size_t buf_tmp_size);
|
||||||
static void free_all_slide_prio(int prio);
|
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)
|
static bool confirm_quit(void)
|
||||||
{
|
{
|
||||||
const struct text_message prompt =
|
const struct text_message prompt =
|
||||||
|
@ -3821,6 +3841,17 @@ enum plugin_status plugin_start(const void *parameter)
|
||||||
|
|
||||||
void * buf;
|
void * buf;
|
||||||
size_t buf_size;
|
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);
|
atexit(cleanup);
|
||||||
|
|
||||||
|
|
|
@ -704,7 +704,7 @@ static int load_context_screen(int selection)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_PICTUREFLOW_INTEGRATION
|
#ifdef HAVE_PICTUREFLOW_INTEGRATION
|
||||||
static int load_plugin_screen(char *plug_path)
|
static int load_plugin_screen(char *plug_path, void* plug_param)
|
||||||
{
|
{
|
||||||
int ret_val;
|
int ret_val;
|
||||||
int old_previous = last_screen;
|
int old_previous = last_screen;
|
||||||
|
@ -712,7 +712,7 @@ static int load_plugin_screen(char *plug_path)
|
||||||
global_status.last_screen = (char)next_screen;
|
global_status.last_screen = (char)next_screen;
|
||||||
status_save();
|
status_save();
|
||||||
|
|
||||||
switch (plugin_load(plug_path, NULL))
|
switch (plugin_load(plug_path, plug_param))
|
||||||
{
|
{
|
||||||
case PLUGIN_GOTO_WPS:
|
case PLUGIN_GOTO_WPS:
|
||||||
ret_val = GO_TO_WPS;
|
ret_val = GO_TO_WPS;
|
||||||
|
@ -729,20 +729,6 @@ static int load_plugin_screen(char *plug_path)
|
||||||
last_screen = (old_previous == next_screen) ? GO_TO_ROOT : old_previous;
|
last_screen = (old_previous == next_screen) ? GO_TO_ROOT : old_previous;
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool check_database(void)
|
|
||||||
{
|
|
||||||
bool needwarn = true;
|
|
||||||
while ( !tagcache_is_usable() )
|
|
||||||
{
|
|
||||||
if (needwarn)
|
|
||||||
splash(0, ID2P(LANG_TAGCACHE_BUSY));
|
|
||||||
if ( action_userabort(HZ/5) )
|
|
||||||
return false;
|
|
||||||
needwarn = false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void root_menu(void)
|
void root_menu(void)
|
||||||
|
@ -823,18 +809,18 @@ void root_menu(void)
|
||||||
break;
|
break;
|
||||||
#ifdef HAVE_PICTUREFLOW_INTEGRATION
|
#ifdef HAVE_PICTUREFLOW_INTEGRATION
|
||||||
case GO_TO_PICTUREFLOW:
|
case GO_TO_PICTUREFLOW:
|
||||||
if (check_database())
|
{
|
||||||
{
|
char pf_path[MAX_PATH];
|
||||||
char pf_path[MAX_PATH];
|
char activity[6];/* big enough to display int */
|
||||||
snprintf(pf_path, sizeof(pf_path),
|
snprintf(activity, sizeof(activity), "%d", get_current_activity());
|
||||||
"%s/pictureflow.rock",
|
snprintf(pf_path, sizeof(pf_path),
|
||||||
PLUGIN_DEMOS_DIR);
|
"%s/pictureflow.rock",
|
||||||
next_screen = load_plugin_screen(pf_path);
|
PLUGIN_DEMOS_DIR);
|
||||||
previous_browser = (next_screen != GO_TO_WPS) ? GO_TO_FILEBROWSER : GO_TO_PICTUREFLOW;
|
|
||||||
}
|
next_screen = load_plugin_screen(pf_path, &activity);
|
||||||
else
|
previous_browser = (next_screen != GO_TO_WPS) ? GO_TO_FILEBROWSER : GO_TO_PICTUREFLOW;
|
||||||
next_screen = GO_TO_PREVIOUS;
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
#ifdef HAVE_TAGCACHE
|
#ifdef HAVE_TAGCACHE
|
||||||
|
|
Loading…
Reference in a new issue