X-Git-Url: https://git.saurik.com/cydia.git/blobdiff_plain/f8c9fd4c9a853ca14ac1d1fb123e2e6200879bb4..2e362598168e73f935146b3b7ec4318390651cc6:/CyteKit/TabBarController.mm diff --git a/CyteKit/TabBarController.mm b/CyteKit/TabBarController.mm index 7a4ead30..a6cd088b 100644 --- a/CyteKit/TabBarController.mm +++ b/CyteKit/TabBarController.mm @@ -26,15 +26,53 @@ #include "iPhonePrivate.h" #include -@implementation UITabBarController (Cydia) - -@end - @implementation CyteTabBarController { _transient UIViewController *transient_; _H remembered_; } +- (NSArray *) navigationURLCollection { + NSMutableArray *items([NSMutableArray array]); + + // XXX: Should this deal with transient view controllers? + for (id navigation in [self viewControllers]) { + NSArray *stack = [navigation performSelector:@selector(navigationURLCollection)]; + if (stack != nil) + [items addObject:stack]; + } + + return items; +} + +- (void) addViewControllers:(id)no, ... { + va_list args; + va_start(args, no); + + NSMutableArray *controllers([NSMutableArray array]); + + for (;;) { + auto title(va_arg(args, NSString *)); + if (title == nil) + break; + + UINavigationController *controller([[[UINavigationController alloc] init] autorelease]); + [controllers addObject:controller]; + + auto legacy(va_arg(args, NSString *)); + auto normal(va_arg(args, NSString *)); + auto select(va_arg(args, NSString *)); + + if (kCFCoreFoundationVersionNumber < 800) + [controller setTabBarItem:[[[UITabBarItem alloc] initWithTitle:title image:[UIImage imageNamed:legacy] tag:0] autorelease]]; + else + [controller setTabBarItem:[[[UITabBarItem alloc] initWithTitle:title image:[UIImage imageNamed:normal] selectedImage:[UIImage imageNamed:select]] autorelease]]; + } + + va_end(args); + + [self setViewControllers:controllers]; +} + - (void) didReceiveMemoryWarning { [super didReceiveMemoryWarning];