]> git.saurik.com Git - cydia.git/commitdiff
actually add files
authorGrant Paul <chpwn@chpwn.com>
Thu, 23 Sep 2010 23:32:04 +0000 (16:32 -0700)
committerJay Freeman <saurik@Jay-Freemans-MacBook-Pro.local>
Mon, 4 Oct 2010 07:12:20 +0000 (00:12 -0700)
Cydia.mm
UICaboodle/BrowserView.h
UICaboodle/BrowserView.mm

index 36d65eda9f0eb4ddd8ced673376f83f05589ab05..02c2ae9a178573cdbf526fe09ebafd82ed674460 100644 (file)
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -5258,11 +5258,14 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 }
 
 - (void) actionButtonClicked {
-       // Never reload, that's bad. However, do nothing unless we are loaded.
-       // (Because free packages are never loading, their button will always work.)
+       // Wait until it's done loading.
     if (![self isLoading])
         [self _actionButtonClicked];
 }
+
+- (void) reloadButtonClicked {
+    // You don't reload a package view by clicking the button.
+}
 #endif
 
 - (id) initWithDatabase:(Database *)database {
index 69d0bfc874145f45ce81de183f1aa700f3a52511..69fd35cfcbde8ed44f90ac1c70f20b6a3bef06ff 100644 (file)
 - (id) objectAtIndex:(unsigned)index;
 @end
 
-@protocol BrowserViewDelegate
+@protocol BrowserControllerDelegate
 - (UCViewController *) pageForURL:(NSURL *)url hasTag:(int *)tag;
 @end
 
-@interface BrowserView : UCViewController {
+@interface BrowserController : UCViewController {
     UIScroller *scroller_;
     UIWebDocumentView *document_;
     UIProgressIndicator *indicator_;
@@ -76,6 +76,9 @@
     bool editing_;
 
     Class class_;
+    
+    id reloaditem_;
+    id loadingitem_;
 }
 
 + (void) _initialize;
 - (void) setFinishHook:(id)function;
 - (void) setPopupHook:(id)function;
 
-- (id) _rightButtonTitle;
-
 - (bool) promptForSensitive:(NSString *)name;
 - (bool) allowSensitiveRequests;
 
index 1adf247b24333fd73e612d8a3eecea8951459df8..793fe5d09f9fbe310e4f075ae5e1f2f947d47f09 100644 (file)
@@ -279,6 +279,11 @@ static Class $UIWebBrowserView;
         [sensitive_ release];
     if (title_ != nil)
         [title_ release];
+    if (reloaditem_ != nil)
+        [reloaditem_ release];
+    if (loadingitem_ != nil)
+        [loadingitem_ release];
+        
     [super dealloc];
 }
 
@@ -1034,27 +1039,39 @@ static Class $UIWebBrowserView;
        [self _startLoading];
 }
 
+- (UINavigationButtonStyle) rightButtonStyle {
+    if (style_ == nil) normal:
+        return UINavigationButtonStyleNormal;
+    else if ([style_ isEqualToString:@"Normal"])
+        return UINavigationButtonStyleNormal;
+    else if ([style_ isEqualToString:@"Back"])
+        return UINavigationButtonStyleBack;
+    else if ([style_ isEqualToString:@"Highlighted"])
+        return UINavigationButtonStyleHighlighted;
+    else if ([style_ isEqualToString:@"Destructive"])
+        return UINavigationButtonStyleDestructive;
+    else goto normal;
+}
+
+- (UIBarButtonItem *) customButton {
+    UIBarButtonItem *customItem = [[UIBarButtonItem alloc]
+               initWithTitle:button_
+               style:[self rightButtonStyle]
+               target:self
+               action:@selector(customButtonClicked)
+       ];
+       
+    return [customItem autorelease];
+}
+
 - (void) applyRightButton {
        if ([self isLoading]) {
-        UIBarButtonItem *reloadItem = [[UIBarButtonItem alloc]
-               initWithTitle:@" "
-               style:UIBarButtonItemStylePlain
-               target:self
-               action:@selector(reloadButtonClicked)
-           ];
-           [[self navigationItem] setRightBarButtonItem:reloadItem];
-               [[reloadItem view] addSubview:indicator_];
-               [[self navigationItem] setTitle:UCLocalize("LOADING")];
-           [reloadItem release];
+           [[self navigationItem] setRightBarButtonItem:loadingitem_ animated:YES];
+           [[self navigationItem] setTitle:UCLocalize("LOADING")];
+    } else if (button_) {
+        [[self navigationItem] setRightBarButtonItem:[self customButton] animated:YES];
     } else {
-               UIBarButtonItem *reloadItem = [[UIBarButtonItem alloc]
-                       initWithTitle:button_ ?: UCLocalize("RELOAD")
-                       style:[self rightButtonStyle]
-                       target:self
-                       action:button_ ? @selector(customButtonClicked) : @selector(reloadButtonClicked)
-               ];
-               [[self navigationItem] setRightBarButtonItem:reloadItem animated:YES];
-               [reloadItem release];
+        [[self navigationItem] setRightBarButtonItem:reloaditem_ animated:YES];
        }
 }
 
@@ -1465,6 +1482,21 @@ static Class $UIWebBrowserView;
         indicator_ = [[UIProgressIndicator alloc] initWithFrame:CGRectMake(15, 5, indsize.width, indsize.height)];
         [indicator_ setStyle:UIProgressIndicatorStyleMediumWhite];
                [indicator_ startAnimation];
+               
+               reloaditem_ = [[UIBarButtonItem alloc]
+                       initWithTitle:UCLocalize("RELOAD")
+                       style:[self rightButtonStyle]
+                       target:self
+                       action:@selector(reloadButtonClicked)
+               ];
+               
+           loadingitem_ = [[UIBarButtonItem alloc]
+               initWithTitle:@" "
+               style:UIBarButtonItemStylePlain
+               target:self
+               action:@selector(reloadButtonClicked)
+           ];
+               [[loadingitem_ view] addSubview:indicator_];
 
         [scroller_ setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
         [indicator_ setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin];
@@ -1543,20 +1575,6 @@ static Class $UIWebBrowserView;
                [self reloadButtonClicked];
 }
 
-- (UINavigationButtonStyle) rightButtonStyle {
-    if (style_ == nil) normal:
-        return UINavigationButtonStyleNormal;
-    else if ([style_ isEqualToString:@"Normal"])
-        return UINavigationButtonStyleNormal;
-    else if ([style_ isEqualToString:@"Back"])
-        return UINavigationButtonStyleBack;
-    else if ([style_ isEqualToString:@"Highlighted"])
-        return UINavigationButtonStyleHighlighted;
-    else if ([style_ isEqualToString:@"Destructive"])
-        return UINavigationButtonStyleDestructive;
-    else goto normal;
-}
-
 - (void) setPageActive:(BOOL)active {
     if (!active)
         [indicator_ removeFromSuperview];