Add mechanism so that task_database informs the menu driver that

we need to refresh the horizontal list. Kivutar; make the icons
work again after we do a horizontal list refresh
This commit is contained in:
twinaphex 2015-07-08 01:01:41 +02:00
parent f2a608b131
commit 039ba91c48
8 changed files with 37 additions and 25 deletions

View File

@ -773,8 +773,7 @@ static void glui_context_reset(void)
settings->menu.wallpaper, "cb_menu_wallpaper", 0, 1, true);
}
static int glui_environ(void *data, void *data2,
menu_environ_cb_t type)
static int glui_environ(menu_environ_cb_t type, void *data)
{
switch (type)
{

View File

@ -736,7 +736,7 @@ static void rgui_populate_entries(const char *path,
rgui_navigation_set(true);
}
static int rgui_environ(void *data, void *data2, menu_environ_cb_t type)
static int rgui_environ(menu_environ_cb_t type, void *data)
{
switch (type)
{

View File

@ -312,7 +312,7 @@ static void rmenu_free(void *data)
{
}
static int rmenu_environ(void *data, void *data2, menu_environ_cb_t type)
static int rmenu_environ(menu_environ_cb_t type, void *data)
{
switch (type)
{

View File

@ -676,7 +676,7 @@ static void rmenu_xui_list_set_selection(file_list_t *list)
XuiListSetCurSel(m_menulist, file_list_get_directory_ptr(list));
}
static int rmenu_xui_environ(void *data, void *data2, menu_environ_cb_t type)
static int rmenu_xui_environ(menu_environ_cb_t type, void *data)
{
switch (type)
{

View File

@ -1041,37 +1041,37 @@ static void xmb_list_open_horizontal_list(xmb_handle_t *xmb, menu_handle_t *menu
static void xmb_refresh_horizontal_list(xmb_handle_t *xmb,
menu_handle_t *menu)
{
settings_t *settings = config_get_ptr();
char mediapath[PATH_MAX_LENGTH] = {0};
char themepath[PATH_MAX_LENGTH] = {0};
settings_t *settings = config_get_ptr();
fill_pathname_join(mediapath, settings->assets_directory, "xmb", sizeof(mediapath));
fill_pathname_join(themepath, mediapath, XMB_THEME, sizeof(themepath));
xmb_context_destroy_horizontal_list(xmb, menu);
if (xmb->horizontal_list)
free(xmb->horizontal_list);
xmb->horizontal_list = NULL;
xmb_context_destroy_horizontal_list(xmb, menu);
xmb_init_horizontal_list(menu, xmb);
xmb_context_reset_horizontal_list(xmb, menu, themepath);
}
static int xmb_environ(void *data, void *data2, menu_environ_cb_t type)
static int xmb_environ(menu_environ_cb_t type, void *data)
{
switch (type)
{
case MENU_ENVIRON_RESET_HORIZONTAL_LIST:
{
char mediapath[PATH_MAX_LENGTH] = {0};
char themepath[PATH_MAX_LENGTH] = {0};
menu_handle_t *menu = menu_driver_get_ptr();
xmb_handle_t *xmb = menu ?
(xmb_handle_t*)menu->userdata : NULL;
xmb_handle_t *xmb = (xmb_handle_t*)data;
menu_handle_t *menu = (menu_handle_t*)data2;
settings_t *settings = config_get_ptr();
if (!xmb || !menu)
return -1;
fill_pathname_join(mediapath, settings->assets_directory, "xmb", sizeof(mediapath));
fill_pathname_join(themepath, mediapath, XMB_THEME, sizeof(themepath));
xmb_context_reset_horizontal_list(xmb, menu, themepath);
xmb_refresh_horizontal_list(xmb, menu);
}
break;
default:
@ -1099,12 +1099,6 @@ static void xmb_list_open(xmb_handle_t *xmb)
else if (xmb->depth < xmb->old_depth)
dir = -1;
/* TODO, call xmb_refresh_horizontal_list when a new scanning process is
started instead of using this condition. It causes a small lag when comming
back to the main menu from a submenu. */
if (dir == -1 && xmb->depth == 1 && xmb->categories.selection_ptr == 0)
xmb_refresh_horizontal_list(xmb, menu);
xmb_list_open_horizontal_list(xmb, menu);
xmb_list_open_old(xmb, xmb->selection_buf_old,

View File

@ -467,3 +467,17 @@ void menu_driver_unset_alive(void)
{
menu_alive = false;
}
bool menu_environment_cb(menu_environ_cb_t type, void *data)
{
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
if (driver->environ_cb)
{
int ret = driver->environ_cb(type, data);
if (ret == 0)
return true;
}
return false;
}

View File

@ -114,8 +114,7 @@ typedef struct menu_ctx_driver
uint32_t label_hash, uint32_t menu_label_hash);
bool (*load_image)(void *data, menu_image_type_t type);
const char *ident;
int (*environ_cb)(void *data, void *data2,
menu_environ_cb_t type);
int (*environ_cb)(menu_environ_cb_t type, void *data);
bool (*perform_action)(void* data, unsigned action);
} menu_ctx_driver_t;
@ -221,6 +220,8 @@ void menu_driver_unset_alive(void);
size_t menu_driver_list_get_selection(void);
bool menu_environment_cb(menu_environ_cb_t type, void *data);
int menu_driver_bind_init(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx,
const char *elem0, const char *elem1,

View File

@ -72,6 +72,7 @@ static int database_info_iterate_start
RARCH_LOG("msg: %s\n", msg);
#endif
db->status = DATABASE_STATUS_ITERATE;
return 0;
@ -410,6 +411,9 @@ void rarch_main_data_db_iterate(bool is_thread, void *data)
else
{
rarch_main_msg_queue_push_new(MSG_SCANNING_OF_DIRECTORY_FINISHED, 0, 180, true);
#ifdef HAVE_MENU
menu_environment_cb(MENU_ENVIRON_RESET_HORIZONTAL_LIST, NULL);
#endif
db->status = DATABASE_STATUS_FREE;
}
break;