Skip to content

Commit

Permalink
Start implementing untested ui_browser_window_cocoa_open function
Browse files Browse the repository at this point in the history
  • Loading branch information
inactive123 committed Jun 8, 2016
1 parent d9e61e5 commit 9e5ad14
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions ui/drivers/cocoa/ui_cocoa_browser_window.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,25 @@

static bool ui_browser_window_cocoa_open(ui_browser_window_state_t *state)
{
NSOpenPanel* panel = (NSOpenPanel*)[NSOpenPanel openPanel];
NSArray *filetypes = [[NSArray alloc] initWithObjects:BOXSTRING("dylib"), BOXSTRING("Core"), nil];
[panel setAllowedFileTypes:filetypes];
#if defined(MAC_OS_X_VERSION_10_6)
[panel setMessage:BOXSTRING(state->title)];
if ([panel runModalForDirectory:BOXSTRING(state->path) file:nil] == 1)
return true;
#else
[panel setTitle:NSLocalizedString(BOXSTRING(string->title), BOXSTRING("open panel"))];
[panel setDirectory:BOXSTRING(state->startdir)];
[panel setCanChooseDirectories:NO];
[panel setCanChooseFiles:YES];
[panel setAllowsMultipleSelection:NO];
[panel setTreatsFilePackagesAsDirectories:NO];
NSInteger result = [panel runModal];
if (result == 1)
return true;
#endif

return false;
}

Expand Down
2 changes: 2 additions & 0 deletions ui/ui_companion_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ typedef struct ui_msg_window_state

typedef struct ui_browser_window_state
{
void *window;
char *filters;
char *startdir;
char *path;
char *title;
} ui_browser_window_state_t;
Expand Down

0 comments on commit 9e5ad14

Please sign in to comment.