[nk] add initial dir for file picker

This commit is contained in:
radius 2016-06-05 22:18:20 -05:00
parent ed2177d524
commit fa3fee12e9
3 changed files with 14 additions and 5 deletions

View File

@ -50,12 +50,14 @@
static void nk_menu_main(nk_menu_handle_t *nk)
{
settings_t *settings = config_get_ptr();
struct nk_context *ctx = &nk->ctx;
if (nk->window[NK_WND_SETTINGS].open)
nk_wnd_settings(nk);
if (nk->window[NK_WND_FILE_PICKER].open)
nk_wnd_file_picker(nk);
nk_wnd_file_picker(nk, settings->directory.menu_content);
if (nk->window[NK_WND_SHADER_PARAMETERS].open)
nk_wnd_shader_parameters(nk);
if (nk->window[NK_WND_MAIN].open)

View File

@ -95,7 +95,7 @@ typedef struct nk_menu_handle
void nk_wnd_shader_parameters(nk_menu_handle_t *zr);
void nk_wnd_main(nk_menu_handle_t *zr);
void nk_wnd_file_picker(nk_menu_handle_t *zr);
void nk_wnd_file_picker(nk_menu_handle_t *zr, const char* startup_path);
void nk_wnd_settings(nk_menu_handle_t *zr);
void nk_wnd_set_state(nk_menu_handle_t *zr, const int id,
struct nk_vec2 pos, struct nk_vec2 size);

View File

@ -61,10 +61,10 @@ void load_icons(nk_menu_handle_t *nk)
assets_loaded = true;
}
void nk_wnd_file_picker(nk_menu_handle_t *nk)
void nk_wnd_file_picker(nk_menu_handle_t *nk, const char* startup_path)
{
struct nk_panel layout;
struct nk_context *ctx = &nk->ctx;
struct nk_context *ctx = &nk->ctx;
const int id = NK_WND_FILE_PICKER;
int i = 0;
static file_list_t *drives = NULL;
@ -77,10 +77,17 @@ void nk_wnd_file_picker(nk_menu_handle_t *nk)
frontend_driver_parse_drive_list(drives);
}
if (!string_is_empty(startup_path) && string_is_empty(path))
{
RARCH_LOG("beep\n");
strlcpy(path, startup_path, sizeof(path));
files = dir_list_new(path, NULL, true, true);
}
if (!assets_loaded)
load_icons(nk);
if (nk_begin(ctx, &layout, "Select File", nk_rect(440, 10, 330, 400),
if (nk_begin(ctx, &layout, "Select File", nk_rect(10, 10, 500, 400),
NK_WINDOW_CLOSABLE|NK_WINDOW_MINIMIZABLE|NK_WINDOW_MOVABLE|
NK_WINDOW_BORDER))
{