From f2a608b13136f0c577928c01797d0827b47f0f2a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 8 Jul 2015 00:37:44 +0200 Subject: [PATCH] Create menu_environ callback --- menu/drivers/glui.c | 13 +++++++++++++ menu/drivers/null.c | 1 + menu/drivers/rgui.c | 12 ++++++++++++ menu/drivers/rmenu.c | 12 ++++++++++++ menu/drivers/rmenu_xui.cpp | 12 ++++++++++++ menu/drivers/xmb.c | 26 ++++++++++++++++++++++++++ menu/menu_driver.h | 9 +++++++++ 7 files changed, 85 insertions(+) diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index ed74d6b058..6398b9b942 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -773,6 +773,18 @@ 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) +{ + switch (type) + { + default: + return -1; + } + + return 0; +} + menu_ctx_driver_t menu_ctx_glui = { NULL, glui_get_message, @@ -802,5 +814,6 @@ menu_ctx_driver_t menu_ctx_glui = { NULL, glui_load_image, "glui", + glui_environ, NULL, }; diff --git a/menu/drivers/null.c b/menu/drivers/null.c index 4b8ddf8c6d..3c1d03df57 100644 --- a/menu/drivers/null.c +++ b/menu/drivers/null.c @@ -53,4 +53,5 @@ menu_ctx_driver_t menu_ctx_null = { NULL, /* load_image */ "null", NULL, + NULL, }; diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 882a471f72..cf0ffc8d4e 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -736,6 +736,17 @@ 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) +{ + switch (type) + { + default: + return -1; + } + + return 0; +} + menu_ctx_driver_t menu_ctx_rgui = { rgui_set_texture, rgui_set_message, @@ -765,5 +776,6 @@ menu_ctx_driver_t menu_ctx_rgui = { NULL, NULL, "rgui", + rgui_environ, NULL, }; diff --git a/menu/drivers/rmenu.c b/menu/drivers/rmenu.c index 423c9f3771..68df30f66e 100644 --- a/menu/drivers/rmenu.c +++ b/menu/drivers/rmenu.c @@ -312,6 +312,17 @@ static void rmenu_free(void *data) { } +static int rmenu_environ(void *data, void *data2, menu_environ_cb_t type) +{ + switch (type) + { + default: + return -1; + } + + return 0; +} + menu_ctx_driver_t menu_ctx_rmenu = { rmenu_set_texture, rmenu_render_messagebox, @@ -341,5 +352,6 @@ menu_ctx_driver_t menu_ctx_rmenu = { NULL, NULL, "rmenu", + rmenu_environ, NULL, }; diff --git a/menu/drivers/rmenu_xui.cpp b/menu/drivers/rmenu_xui.cpp index 15a7b41a92..99ea8c5d2a 100644 --- a/menu/drivers/rmenu_xui.cpp +++ b/menu/drivers/rmenu_xui.cpp @@ -676,6 +676,17 @@ 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) +{ + switch (type) + { + default: + return -1; + } + + return 0; +} + menu_ctx_driver_t menu_ctx_rmenu_xui = { NULL, rmenu_xui_render_messagebox, @@ -705,5 +716,6 @@ menu_ctx_driver_t menu_ctx_rmenu_xui = { rmenu_xui_list_set_selection, NULL, "rmenu_xui", + rmenu_xui_environ, NULL, }; diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index e8a3cd2cc5..b1f1726177 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -1056,6 +1056,31 @@ static void xmb_refresh_horizontal_list(xmb_handle_t *xmb, xmb_context_reset_horizontal_list(xmb, menu, themepath); } +static int xmb_environ(void *data, void *data2, menu_environ_cb_t type) +{ + switch (type) + { + case MENU_ENVIRON_RESET_HORIZONTAL_LIST: + { + char mediapath[PATH_MAX_LENGTH] = {0}; + char themepath[PATH_MAX_LENGTH] = {0}; + + xmb_handle_t *xmb = (xmb_handle_t*)data; + menu_handle_t *menu = (menu_handle_t*)data2; + 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_reset_horizontal_list(xmb, menu, themepath); + } + break; + default: + return -1; + } + + return 0; +} + static void xmb_list_open(xmb_handle_t *xmb) { int dir = 0; @@ -2572,5 +2597,6 @@ menu_ctx_driver_t menu_ctx_xmb = { xmb_list_bind_init, xmb_load_image, "xmb", + xmb_environ, NULL, }; diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 0cac9228ec..e492eb567e 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -43,6 +43,13 @@ typedef enum MENU_IMAGE_BOXART } menu_image_type_t; +typedef enum +{ + MENU_ENVIRON_NONE = 0, + MENU_ENVIRON_RESET_HORIZONTAL_LIST, + MENU_ENVIRON_LAST +} menu_environ_cb_t; + typedef struct { void *userdata; @@ -107,6 +114,8 @@ 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); bool (*perform_action)(void* data, unsigned action); } menu_ctx_driver_t;