Undo my own fix for the lack of pinstripes on the iPad: pinstripes spread out when...
[cydia.git] / MobileCydia.mm
index 5d3c6523b2ca6d30dd4f5530faa1e9322562e085..139b55b8a15536d5ac32b8044f806baa4aabda60 100644 (file)
@@ -5754,25 +5754,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 
 /* }}} */
 
-/* Add Source Controller {{{ */
-@interface AddSourceController : CYViewController {
-    _transient Database *database_;
-}
-
-- (id) initWithDatabase:(Database *)database;
-
-@end
-
-@implementation AddSourceController
-
-- (id) initWithDatabase:(Database *)database {
-    if ((self = [super init]) != nil) {
-        database_ = database;
-    } return self;
-}
-
-@end
-/* }}} */
 /* Source Cell {{{ */
 @interface SourceCell : CYTableViewCell <
     ContentDelegate
@@ -5863,7 +5844,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 @end
 /* }}} */
 /* Source Table {{{ */
-@interface SourceTable : CYViewController <
+@interface SourceController : CYViewController <
     UITableViewDataSource,
     UITableViewDelegate
 > {
@@ -5891,7 +5872,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 
 @end
 
-@implementation SourceTable
+@implementation SourceController
 
 - (void) _releaseConnection:(NSURLConnection *)connection {
     if (connection != nil) {
@@ -7113,7 +7094,7 @@ freeing the view controllers on tab change */
 
 - (void) viewWillDisappear:(BOOL)animated {
     [super viewWillDisappear:animated];
-    [self setEditing:NO];
+    if (editing_) [self setEditing:NO];
 }
 
 - (Section *) sectionAtIndexPath:(NSIndexPath *)indexPath {
@@ -8026,7 +8007,7 @@ typedef enum {
     ChangesController *changes_;
     ManageController *manage_;
     SearchController *search_;
-    SourceTable *sources_;
+    SourceController *sources_;
     InstalledController *installed_;
     id queueDelegate_;
 
@@ -8058,10 +8039,6 @@ static _finline void _setHomePage(Cydia *self) {
     return [tabbar_ updating];
 }
 
-- (UIView *) rotatingContentViewForWindow:(UIWindow *)window {
-    return window_;
-}
-
 - (void) _loaded {
     if ([broken_ count] != 0) {
         int count = [broken_ count];
@@ -8117,15 +8094,25 @@ static _finline void _setHomePage(Cydia *self) {
 - (void) _updateData {
     [self _saveConfig];
 
-    /* XXX: this is just stupid */
-    if (tag_ != 1 && sections_ != nil)
-        [sections_ reloadData];
-    if (tag_ != 2 && changes_ != nil)
-        [changes_ reloadData];
-    if (tag_ != 4 && search_ != nil)
-        [search_ reloadData];
+    NSMutableSet *tabs([[[NSMutableSet alloc] initWithCapacity:10] autorelease]);
 
-    [(CYNavigationController *)[tabbar_ selectedViewController] reloadData];
+    [tabs addObject:[tabbar_ selectedViewController]];
+
+    if (sections_ != nil)
+        [tabs addObject:sections_];
+    if (changes_ != nil)
+        [tabs addObject:changes_];
+    if (manage_ != nil)
+        [tabs addObject:manage_];
+    if (search_ != nil)
+        [tabs addObject:search_];
+    if (sources_ != nil)
+        [tabs addObject:sources_];
+    if (installed_ != nil)
+        [tabs addObject:installed_];
+
+    for (CYNavigationController *tab in tabs)
+        [tab reloadData];
 
     [queueDelegate_ queueStatusDidChange];
     [[[self queueBadgeController] tabBarItem] setBadgeValue:(Queuing_ ? UCLocalize("Q_D") : nil)];
@@ -8298,10 +8285,6 @@ static _finline void _setHomePage(Cydia *self) {
         _error->Discard();
 }
 
-- (CGRect) popUpBounds {
-    return [[tabbar_ view] bounds];
-}
-
 - (bool) perform {
     if (![database_ prepare])
         return false;
@@ -8446,9 +8429,9 @@ static _finline void _setHomePage(Cydia *self) {
     return search_;
 }
 
-- (SourceTable *) sourcesController {
+- (SourceController *) sourcesController {
     if (sources_ == nil)
-        sources_ = [[SourceTable alloc] initWithDatabase:database_];
+        sources_ = [[SourceController alloc] initWithDatabase:database_];
     return sources_;
 }
 
@@ -8676,12 +8659,12 @@ static _finline void _setHomePage(Cydia *self) {
     if (![path hasPrefix:@"/"])
         path = [@"/" stringByAppendingString:path];
 
-    if ([path isEqualToString:@"/add-source"])
-        return [[[AddSourceController alloc] initWithDatabase:database_] autorelease];
-    else if ([path isEqualToString:@"/storage"])
+    if ([path isEqualToString:@"/storage"])
         return [self _pageForURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"storage" ofType:@"html"]] withClass:[CYBrowserController class]];
+    /*else if ([path isEqualToString:@"/add-source"])
+        return [[[AddSourceController alloc] initWithDatabase:database_] autorelease];*/
     else if ([path isEqualToString:@"/sources"])
-        return [[[SourceTable alloc] initWithDatabase:database_] autorelease];
+        return [[[SourceController alloc] initWithDatabase:database_] autorelease];
     else if ([path isEqualToString:@"/packages"])
         return [[[InstalledController alloc] initWithDatabase:database_] autorelease];
     else if ([path hasPrefix:@"/url/"])
@@ -8799,6 +8782,20 @@ static _finline void _setHomePage(Cydia *self) {
     [tabbar_ setViewControllers:controllers];
 }
 
+- (void)showFakeTabBarInView:(UIView *)view {
+    static UITabBar *fake = [[UITabBar alloc] initWithFrame:CGRectMake(0, 0, 0, 49.0f)];
+    if (view != nil) {
+        CGRect frame = [fake frame];
+        frame.origin.y = [view frame].size.height - frame.size.height;
+        frame.size.width = [view frame].size.width;
+        [fake setFrame:frame];
+        [fake setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin];
+        [view addSubview:fake];
+    } else {
+        [fake removeFromSuperview];
+    }
+}
+
 - (void) applicationDidFinishLaunching:(id)unused {
 _trace();
     CydiaApp = self;
@@ -8824,9 +8821,7 @@ _trace();
     essential_ = [[NSMutableArray alloc] initWithCapacity:4];
     broken_ = [[NSMutableArray alloc] initWithCapacity:4];
 
-    UIScreen *screen([UIScreen mainScreen]);
-
-    window_ = [[UIWindow alloc] initWithFrame:[screen bounds]];
+    window_ = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
     [window_ orderFront:self];
     [window_ makeKey:self];
     [window_ setHidden:NO];
@@ -8859,6 +8854,7 @@ _trace();
 
     // Show pinstripes while loading data.
     [[tabbar_ view] setBackgroundColor:[UIColor pinStripeColor]];
+    [self showFakeTabBarInView:[tabbar_ tabBar]];
 
     [self performSelector:@selector(loadData) withObject:nil afterDelay:0];
 _trace();
@@ -8921,6 +8917,8 @@ _trace();
         _setHomePage(self);
     }
 
+    [self showFakeTabBarInView:nil];
+
     [starturl_ release];
     starturl_ = nil;