diff --git a/SUStatusController.h b/SUStatusController.h index dc0c197f..e56dc8e7 100644 --- a/SUStatusController.h +++ b/SUStatusController.h @@ -28,7 +28,6 @@ // If isDefault is YES, the button's key equivalent will be \r. - (void)setButtonTitle:(NSString *)buttonTitle target:target action:(SEL)action isDefault:(BOOL)isDefault; - (void)setButtonEnabled:(BOOL)enabled; -- (void)setButtonHidden:(BOOL)hidden; - (double)progressValue; - (void)setProgressValue:(double)value; diff --git a/SUStatusController.m b/SUStatusController.m index cd44910a..cea7a52d 100644 --- a/SUStatusController.m +++ b/SUStatusController.m @@ -87,12 +87,6 @@ [actionButton setEnabled:enabled]; } -- (void)setButtonHidden:(BOOL)hidden -{ - [actionButton setHidden:hidden]; - [[actionButton superview] display]; -} - - (double)progressValue { return progressValue; diff --git a/SUUserInitiatedUpdateDriver.h b/SUUserInitiatedUpdateDriver.h index 6849c91d..9d9a3041 100644 --- a/SUUserInitiatedUpdateDriver.h +++ b/SUUserInitiatedUpdateDriver.h @@ -14,6 +14,7 @@ @interface SUUserInitiatedUpdateDriver : SUUIBasedUpdateDriver { SUStatusController *checkingController; + BOOL isCanceled; } @end diff --git a/SUUserInitiatedUpdateDriver.m b/SUUserInitiatedUpdateDriver.m index edd51afc..667dd631 100644 --- a/SUUserInitiatedUpdateDriver.m +++ b/SUUserInitiatedUpdateDriver.m @@ -17,7 +17,7 @@ checkingController = [[SUStatusController alloc] initWithHostBundle:hb]; [checkingController window]; // Force the checking controller to load its window. [checkingController beginActionWithTitle:SULocalizedString(@"Checking for updates\u2026", nil) maxProgressValue:0 statusText:nil]; - [checkingController setButtonHidden:YES]; + [checkingController setButtonTitle:SULocalizedString(@"Cancel", nil) target:self action:@selector(cancelCheckForUpdates:) isDefault:NO]; [checkingController showWindow:self]; } @@ -31,14 +31,30 @@ } } +- (void)cancelCheckForUpdates:sender +{ + [self closeCheckingWindow]; + isCanceled = YES; +} + - (void)appcastDidFinishLoading:(SUAppcast *)ac { + if (isCanceled) + { + [self abortUpdate]; + return; + } [self closeCheckingWindow]; [super appcastDidFinishLoading:ac]; } - (void)appcast:(SUAppcast *)ac failedToLoadWithError:(NSError *)error { + if (isCanceled) + { + [self abortUpdate]; + return; + } [self closeCheckingWindow]; [super appcast:ac failedToLoadWithError:error]; }