]> git.saurik.com Git - cydia.git/blobdiff - UICaboodle/BrowserView.mm
Use a much more reasonable capacity for cydia.getInstalledPackages().
[cydia.git] / UICaboodle / BrowserView.mm
index 769aaed925aa3cf8b3f4eb3775212c35d841e9b6..705c7e176d7f11c85866e069e6f8450f1992b196 100644 (file)
@@ -376,6 +376,14 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
 }
 // }}}
 
+- (void) _updateViewSettings {
+    [super _updateViewSettings];
+
+    id<CYWebViewDelegate> delegate([self delegate]);
+    if ([delegate respondsToSelector:@selector(webViewUpdateViewSettings:)])
+        [delegate webViewUpdateViewSettings:self];
+}
+
 + (void) initialize {
     if (Class $UIWebViewWebViewDelegate = objc_getClass("UIWebViewWebViewDelegate")) {
         class_addMethod($UIWebViewWebViewDelegate, @selector(webView:decidePolicyForNewWindowAction:request:newFrameName:decisionListener:), (IMP) &$UIWebViewWebViewDelegate$webView$decidePolicyForNewWindowAction$request$newFrameName$decisionListener$, "v28@0:4@8@12@16@20@24");
@@ -389,7 +397,7 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
 @end
 
 #define ShowInternals 0
-#define LogBrowser 1
+#define LogBrowser 0
 
 #define lprintf(args...) fprintf(stderr, args)
 
@@ -421,6 +429,9 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
     if (challenge_ != nil)
         [challenge_ release];
 
+    if (request_ != nil)
+        [request_ release];
+
     //NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
 
     if (custom_ != nil)
@@ -433,11 +444,11 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
     if (closer_ != nil)
         [closer_ release];
 
-    if (sensitive_ != nil)
-        [sensitive_ release];
     if (title_ != nil)
         [title_ release];
 
+    [loading_ release];
+
     [reloaditem_ release];
     [loadingitem_ release];
 
@@ -493,15 +504,24 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
 - (void) setButtonImage:(NSString *)button withStyle:(NSString *)style toFunction:(id)function {
     if (custom_ != nil)
         [custom_ autorelease];
-    custom_ = button == nil ? nil : [[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:button]]] retain];
+    if (button == nil)
+        custom_ = nil;
+    else
+        custom_ = [[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:button]]] retain];
 
     if (style_ != nil)
         [style_ autorelease];
-    style_ = style == nil ? nil : [style retain];
+    if (style == nil)
+        style_ = nil;
+    else
+        style_ = [style retain];
 
     if (function_ != nil)
         [function_ autorelease];
-    function_ = function == nil ? nil : [function retain];
+    if (function == nil)
+        function_ = nil;
+    else
+        function_ = [function retain];
 
     [self applyRightButton];
 }
@@ -509,15 +529,24 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
 - (void) setButtonTitle:(NSString *)button withStyle:(NSString *)style toFunction:(id)function {
     if (custom_ != nil)
         [custom_ autorelease];
-    custom_ = button == nil ? nil : [button retain];
+    if (button == nil)
+        custom_ = nil;
+    else
+        custom_ = [button retain];
 
     if (style_ != nil)
         [style_ autorelease];
-    style_ = style == nil ? nil : [style retain];
+    if (style == nil)
+        style_ = nil;
+    else
+        style_ = [style retain];
 
     if (function_ != nil)
         [function_ autorelease];
-    function_ = function == nil ? nil : [function retain];
+    if (function == nil)
+        function_ = nil;
+    else
+        function_ = [function retain];
 
     [self applyRightButton];
 }
@@ -525,12 +554,23 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
 - (void) setPopupHook:(id)function {
     if (closer_ != nil)
         [closer_ autorelease];
-    closer_ = function == nil ? nil : [function retain];
+    if (function == nil)
+        closer_ = nil;
+    else
+        closer_ = [function retain];
+}
+
+- (void) _setViewportWidth {
+    [[webview_ _documentView] setViewportSize:CGSizeMake(width_, UIWebViewGrowsAndShrinksToFitHeight) forDocumentTypes:0x10];
 }
 
 - (void) setViewportWidth:(float)width {
     width_ = width != 0 ? width : [[self class] defaultWidth];
-    [[webview_ _documentView] setViewportSize:CGSizeMake(width_, UIWebViewGrowsAndShrinksToFitHeight) forDocumentTypes:0x10];
+    [self _setViewportWidth];
+}
+
+- (void) webViewUpdateViewSettings:(UIWebView *)view {
+    [self _setViewportWidth];
 }
 
 - (void) _openMailToURL:(NSURL *)url {
@@ -698,7 +738,10 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
     if ([frame parentFrame] != nil)
         return;
 
+    if (title_ != nil)
+        [title_ autorelease];
     title_ = [title retain];
+
     [[self navigationItem] setTitle:title_];
 }
 
@@ -837,7 +880,7 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
 - (void) applyRightButton {
     if ([self isLoading]) {
         [[self navigationItem] setRightBarButtonItem:loadingitem_ animated:YES];
-        // XXX: why do we do this again here?
+        // XXX: why do we do this again here? (if we don't, just remove indicator_)
         [[loadingitem_ view] addSubview:indicator_];
         [self applyLoadingTitle];
     } else if (custom_ != nil) {