From edc710d124ac7ada93546e36cdb9b425d1e34641 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcelo=20Munhoz=20P=C3=A9los?= Date: Sat, 13 Jul 2013 00:05:21 -0300 Subject: [PATCH] Add toolbar in Rom's list to accommodate refresh and new folder buttons. --- apple/RetroArch/main.m | 4 +++- apple/iOS/browser.m | 20 ++++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/apple/RetroArch/main.m b/apple/RetroArch/main.m index 228051767c..a0fd5ead18 100644 --- a/apple/RetroArch/main.m +++ b/apple/RetroArch/main.m @@ -212,7 +212,7 @@ int main(int argc, char *argv[]) { UIWindow* _window; - bool _isGameTop; + bool _isGameTop, _isRomList; uint32_t _settingMenusInBackStack; uint32_t _enabledOrientations; @@ -272,11 +272,13 @@ int main(int argc, char *argv[]) - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated { _isGameTop = [viewController isKindOfClass:[RAGameView class]]; + _isRomList = [viewController isKindOfClass:[RADirectoryList class]]; [[UIApplication sharedApplication] setStatusBarHidden:_isGameTop withAnimation:UIStatusBarAnimationNone]; [[UIApplication sharedApplication] setIdleTimerDisabled:_isGameTop]; self.navigationBarHidden = _isGameTop; + [self setToolbarHidden:!_isRomList animated:YES]; self.topViewController.navigationItem.rightBarButtonItem = [self createSettingsButton]; } diff --git a/apple/iOS/browser.m b/apple/iOS/browser.m index fc038996e1..13a9ea10b4 100644 --- a/apple/iOS/browser.m +++ b/apple/iOS/browser.m @@ -35,11 +35,7 @@ { NSString* rootPath = RetroArch_iOS.get.documentsDirectory; NSString* ragPath = [rootPath stringByAppendingPathComponent:@"RetroArchGames"]; - RADirectoryList* list = [RADirectoryList directoryListForPath:path_is_directory(ragPath.UTF8String) ? ragPath : rootPath]; - - list.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"New Folder" style:UIBarButtonItemStyleBordered target:list action:@selector(createNewFolder)]; - return list; } @@ -57,6 +53,22 @@ self = [super initWithStyle:UITableViewStylePlain]; self.title = path.lastPathComponent; self.hidesHeaders = YES; + + NSMutableArray *toolbarButtons = [[NSMutableArray alloc] initWithCapacity:3]; + + UIBarButtonItem *refreshButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(refresh)]; + refreshButton.style = UIBarButtonItemStyleBordered; + [toolbarButtons addObject:refreshButton]; + + UIBarButtonItem *flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil]; + [toolbarButtons addObject:flexibleSpace]; + + UIBarButtonItem *newFolderButton = [[UIBarButtonItem alloc] initWithTitle:@"New Folder" style:UIBarButtonItemStyleBordered target:self action:@selector(createNewFolder)]; + [toolbarButtons addObject:newFolderButton]; + + [[[RetroArch_iOS get] toolbar] setItems:toolbarButtons]; + [self setToolbarItems:toolbarButtons]; + [self refresh]; return self;