From 3a5011afcc30047d03aa5c635c15f800e708d7f2 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 27 May 2014 07:57:28 +0200 Subject: [PATCH] (Menu) Add Content Directory option --- frontend/menu/backend/menu_common_backend.c | 17 ++++++++++++++++- frontend/menu/backend/menu_common_backend.h | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/frontend/menu/backend/menu_common_backend.c b/frontend/menu/backend/menu_common_backend.c index 5e1b652a99..12784f0239 100644 --- a/frontend/menu/backend/menu_common_backend.c +++ b/frontend/menu/backend/menu_common_backend.c @@ -298,6 +298,7 @@ static void menu_common_entries_init(void *data, unsigned menu_type) case RGUI_SETTINGS_PATH_OPTIONS: file_list_clear(rgui->selection_buf); file_list_push(rgui->selection_buf, "Browser Directory", RGUI_BROWSER_DIR_PATH, 0); + file_list_push(rgui->selection_buf, "Content Directory", RGUI_CONTENT_DIR_PATH, 0); file_list_push(rgui->selection_buf, "Assets Directory", RGUI_ASSETS_DIR_PATH, 0); #ifdef HAVE_DYNAMIC file_list_push(rgui->selection_buf, "Config Directory", RGUI_CONFIG_DIR_PATH, 0); @@ -532,7 +533,9 @@ static unsigned menu_common_type_is(unsigned type) return ret; } - type_found = type == RGUI_BROWSER_DIR_PATH || + type_found = + type == RGUI_BROWSER_DIR_PATH || + type == RGUI_CONTENT_DIR_PATH || type == RGUI_ASSETS_DIR_PATH || type == RGUI_SHADER_DIR_PATH || type == RGUI_FILTER_DIR_PATH || @@ -1458,6 +1461,11 @@ static int menu_common_iterate(void *data, unsigned action) strlcpy(g_settings.rgui_content_directory, dir, sizeof(g_settings.rgui_content_directory)); menu_flush_stack_type(rgui, RGUI_SETTINGS_PATH_OPTIONS); } + else if (menu_type == RGUI_CONTENT_DIR_PATH) + { + strlcpy(g_settings.content_directory, dir, sizeof(g_settings.content_directory)); + menu_flush_stack_type(rgui, RGUI_SETTINGS_PATH_OPTIONS); + } else if (menu_type == RGUI_ASSETS_DIR_PATH) { strlcpy(g_settings.assets_directory, dir, sizeof(g_settings.assets_directory)); @@ -3013,6 +3021,10 @@ static int menu_common_setting_set(void *data, unsigned setting, unsigned action if (action == RGUI_ACTION_START) *g_settings.rgui_content_directory = '\0'; break; + case RGUI_CONTENT_DIR_PATH: + if (action == RGUI_ACTION_START) + *g_settings.content_directory = '\0'; + break; case RGUI_ASSETS_DIR_PATH: if (action == RGUI_ACTION_START) *g_settings.assets_directory = '\0'; @@ -4066,6 +4078,9 @@ static void menu_common_setting_set_label(char *type_str, size_t type_str_size, case RGUI_BROWSER_DIR_PATH: strlcpy(type_str, *g_settings.rgui_content_directory ? g_settings.rgui_content_directory : "", type_str_size); break; + case RGUI_CONTENT_DIR_PATH: + strlcpy(type_str, *g_settings.content_directory ? g_settings.content_directory : "", type_str_size); + break; case RGUI_ASSETS_DIR_PATH: strlcpy(type_str, *g_settings.assets_directory ? g_settings.assets_directory : "", type_str_size); break; diff --git a/frontend/menu/backend/menu_common_backend.h b/frontend/menu/backend/menu_common_backend.h index 8723ba28d0..2a5960a877 100644 --- a/frontend/menu/backend/menu_common_backend.h +++ b/frontend/menu/backend/menu_common_backend.h @@ -117,6 +117,7 @@ typedef enum RGUI_SETTINGS_PAUSE_IF_WINDOW_FOCUS_LOST, RGUI_SCREENSHOT_DIR_PATH, RGUI_BROWSER_DIR_PATH, + RGUI_CONTENT_DIR_PATH, RGUI_ASSETS_DIR_PATH, RGUI_FILTER_DIR_PATH, RGUI_DSP_FILTER_DIR_PATH,