mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 04:14:00 +00:00
(Apple) Add toolbar buttons to the file browser to quickly browse to important locations
This commit is contained in:
parent
9befaf995b
commit
fb8fd8555b
@ -97,18 +97,25 @@ static void file_action(enum file_action action, NSString* source, NSString* tar
|
||||
{
|
||||
if ((self = [super initWithStyle:UITableViewStylePlain]))
|
||||
{
|
||||
_path = path;
|
||||
_path = path ? path : NSHomeDirectory();
|
||||
_directoryDelegate = delegate;
|
||||
|
||||
self = [super initWithStyle:UITableViewStylePlain];
|
||||
self.hidesHeaders = YES;
|
||||
|
||||
// NOTE: The "App" and "Root" buttons aren't really needed for non-jailbreak devices.
|
||||
self.toolbarItems =
|
||||
@[
|
||||
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self
|
||||
action:@selector(refresh)],
|
||||
[[UIBarButtonItem alloc] initWithTitle:@"Home" style:UIBarButtonItemStyleBordered target:self
|
||||
action:@selector(gotoHomeDir)],
|
||||
[[UIBarButtonItem alloc] initWithTitle:@"App" style:UIBarButtonItemStyleBordered target:self
|
||||
action:@selector(gotoAppDir)],
|
||||
[[UIBarButtonItem alloc] initWithTitle:@"Root" style:UIBarButtonItemStyleBordered target:self
|
||||
action:@selector(gotoRootDir)],
|
||||
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self
|
||||
action:nil],
|
||||
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self
|
||||
action:@selector(refresh)],
|
||||
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self
|
||||
action:@selector(createNewFolder)]
|
||||
];
|
||||
@ -123,6 +130,21 @@ static void file_action(enum file_action action, NSString* source, NSString* tar
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)gotoHomeDir
|
||||
{
|
||||
[self browseTo:NSHomeDirectory()];
|
||||
}
|
||||
|
||||
- (void)gotoAppDir
|
||||
{
|
||||
[self browseTo:NSBundle.mainBundle.bundlePath];
|
||||
}
|
||||
|
||||
- (void)gotoRootDir
|
||||
{
|
||||
[self browseTo:@"/"];
|
||||
}
|
||||
|
||||
- (void)browseTo:(NSString*)path
|
||||
{
|
||||
_path = path;
|
||||
|
@ -251,7 +251,7 @@
|
||||
|
||||
- (void)wasSelectedOnTableView:(UITableView*)tableView ofController:(UIViewController*)controller
|
||||
{
|
||||
RADirectoryList* list = [[RADirectoryList alloc] initWithPath:@"/" delegate:self];
|
||||
RADirectoryList* list = [[RADirectoryList alloc] initWithPath:nil delegate:self];
|
||||
[controller.navigationController pushViewController:list animated:YES];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user