From: Jay Freeman (saurik) Date: Wed, 23 Feb 2011 10:48:22 +0000 (-0800) Subject: Add cydia.removeButton(). X-Git-Tag: v1.1.0%b1~248 X-Git-Url: https://git.saurik.com/cydia.git/commitdiff_plain/ed5566c758424fffb2204d93d93998d7fbc744b6 Add cydia.removeButton(). --- diff --git a/MobileCydia.mm b/MobileCydia.mm index 3b09f6a6..51843a76 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -3999,6 +3999,8 @@ static NSString *Warning_; return @"localize"; else if (selector == @selector(refreshSources)) return @"refreshSources"; + else if (selector == @selector(removeButton)) + return @"removeButton"; else if (selector == @selector(setButtonImage:withStyle:toFunction:)) return @"setButtonImage"; else if (selector == @selector(setButtonTitle:withStyle:toFunction:)) @@ -4153,6 +4155,10 @@ static NSString *Warning_; [delegate_ performSelectorOnMainThread:@selector(installPackages:) withObject:packages waitUntilDone:NO]; } +- (void) removeButton { + [indirect_ removeButton]; +} + - (void) setButtonImage:(NSString *)button withStyle:(NSString *)style toFunction:(id)function { [indirect_ setButtonImage:button withStyle:style toFunction:function]; } diff --git a/UICaboodle/BrowserView.mm b/UICaboodle/BrowserView.mm index b5a7b903..07a92eec 100644 --- a/UICaboodle/BrowserView.mm +++ b/UICaboodle/BrowserView.mm @@ -584,7 +584,11 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se style_ = style; function_ = function; + [self performSelectorOnMainThread:@selector(applyRightButton) withObject:nil waitUntilDone:NO]; +} +- (void) removeButton { + custom_ = [NSNull null]; [self performSelectorOnMainThread:@selector(applyRightButton) withObject:nil waitUntilDone:NO]; } @@ -904,8 +908,8 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se } - (UIBarButtonItem *) customButton { - return [[[UIBarButtonItem alloc] - initWithTitle:custom_ + return custom_ == [NSNull null] ? nil : [[[UIBarButtonItem alloc] + initWithTitle:static_cast(custom_.operator NSObject *()) style:[self rightButtonStyle] target:self action:@selector(customButtonClicked)