]> git.saurik.com Git - cydia.git/commitdiff
Fit ManageController to CyteWebViewController {custom,right}Button API.
authorJay Freeman (saurik) <saurik@saurik.com>
Wed, 2 Mar 2011 16:46:28 +0000 (08:46 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Mon, 7 Mar 2011 10:41:34 +0000 (02:41 -0800)
CyteKit/WebViewController.h
CyteKit/WebViewController.mm
MobileCydia.mm

index d2f9fb5a8c77515ffe31ade5544f48c49fa4b71d..db40a1c1352ae60838e45c24f2560448f127b972 100644 (file)
 - (void) customButtonClicked;
 
 - (void) applyRightButton;
+- (UIBarButtonItem *) customButton;
 - (UIBarButtonItem *) rightButton;
 
 - (void) _didStartLoading;
index b954b8ea9821b95b0aea6cf37eee417471bff1e6..b59d83028643c61cd10ee15ac97007c15cadaef3 100644 (file)
@@ -598,7 +598,12 @@ float CYScrollViewDecelerationRateNormal;
 }
 
 - (UIBarButtonItem *) customButton {
-    return custom_ == [NSNull null] ? nil : [[[UIBarButtonItem alloc]
+    if (custom_ == nil)
+        return nil;
+    else if (custom_ == [NSNull null])
+        return (UIBarButtonItem *) [NSNull null];
+
+    return [[[UIBarButtonItem alloc]
         initWithTitle:static_cast<NSString *>(custom_.operator NSObject *())
         style:[self rightButtonStyle]
         target:self
@@ -629,9 +634,13 @@ float CYScrollViewDecelerationRateNormal;
     } else {
         [indicator_ stopAnimating];
 
-        [[self navigationItem] setRightBarButtonItem:(
-            custom_ != nil ? [self customButton] : [self rightButton]
-        ) animated:YES];
+        UIBarButtonItem *button([self customButton]);
+        if (button == nil)
+            button = [self rightButton];
+        else if (button == (UIBarButtonItem *) [NSNull null])
+            button = nil;
+
+        [[self navigationItem] setRightBarButtonItem:button];
     }
 }
 
index 52081b21654aaef2031d124850346fe0a938ab54..2257a19c0093e98b5ffe7c9b581c417c916d2d7e 100644 (file)
@@ -6459,46 +6459,31 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
         target:self
         action:@selector(settingsButtonClicked)
     ] autorelease]];
-
-    [self queueStatusDidChange];
 }
 
 - (void) settingsButtonClicked {
     [delegate_ showSettings];
 }
 
-#if !AlwaysReload
 - (void) queueButtonClicked {
     [delegate_ queue];
 }
 
-- (void) applyLoadingTitle {
-    // Disable "Loading" title.
-}
-
-- (void) applyRightButton {
-    // Disable right button.
+- (UIBarButtonItem *) customButton {
+    return Queuing_ ? [[[UIBarButtonItem alloc]
+        initWithTitle:UCLocalize("QUEUE")
+        style:UIBarButtonItemStyleDone
+        target:self
+        action:@selector(queueButtonClicked)
+    ] autorelease] : [super customButton];
 }
-#endif
 
 - (void) queueStatusDidChange {
-#if !AlwaysReload
-    if (!IsWildcat_ && Queuing_) {
-        [[self navigationItem] setRightBarButtonItem:[[[UIBarButtonItem alloc]
-            initWithTitle:UCLocalize("QUEUE")
-            style:UIBarButtonItemStyleDone
-            target:self
-            action:@selector(queueButtonClicked)
-        ] autorelease]];
-    } else {
-        [[self navigationItem] setRightBarButtonItem:nil];
-    }
-#endif
+    [self applyRightButton];
 }
 
 - (bool) isLoading {
-    // Never show as loading.
-    return false;
+    return !Queuing_ && [super isLoading];
 }
 
 @end