Skip to content
Browse files

finish_installation doesn't show any UI if it's not relaunching, sinc…

…e those installations were not kicked off by user action.
  • Loading branch information...
1 parent 7152bd0 commit 01e8cf90c65a81d6d2298754c59063e5ddf12c81 @andymatuschak andymatuschak committed Oct 4, 2011
Showing with 11 additions and 6 deletions.
  1. +11 −6 finish_installation.m
View
17 finish_installation.m
@@ -137,11 +137,14 @@ - (void) install
NSBundle *theBundle = [NSBundle bundleWithPath: [[NSFileManager defaultManager] stringWithFileSystemRepresentation: executablepath length:strlen(executablepath)]];
host = [[SUHost alloc] initWithBundle: theBundle];
- SUStatusController* statusCtl = [[SUStatusController alloc] initWithHost: host]; // We quit anyway after we've installed, so leak this for now.
- [statusCtl setButtonTitle: SULocalizedString(@"Cancel Update",@"") target: nil action: Nil isDefault: NO];
- [statusCtl beginActionWithTitle: SULocalizedString(@"Installing update...",@"")
- maxProgressValue: 0 statusText: @""];
- [statusCtl showWindow: self];
+ // Perhaps a poor assumption but: if we're not relaunching, we assume we shouldn't be showing any UI either. Because non-relaunching installations are kicked off without any user interaction, we shouldn't be interrupting them.
+ if (shouldRelaunch) {
+ SUStatusController* statusCtl = [[SUStatusController alloc] initWithHost: host]; // We quit anyway after we've installed, so leak this for now.
+ [statusCtl setButtonTitle: SULocalizedString(@"Cancel Update",@"") target: nil action: Nil isDefault: NO];
+ [statusCtl beginActionWithTitle: SULocalizedString(@"Installing update...",@"")
+ maxProgressValue: 0 statusText: @""];
+ [statusCtl showWindow: self];
+ }
[SUInstaller installFromUpdateFolder: [[NSFileManager defaultManager] stringWithFileSystemRepresentation: folderpath length: strlen(folderpath)]
overHost: host
@@ -156,7 +159,9 @@ - (void) installerFinishedForHost:(SUHost *)aHost
- (void) installerForHost:(SUHost *)host failedWithError:(NSError *)error
{
- NSRunAlertPanel( @"", @"%@", @"OK", @"", @"", [error localizedDescription] );
+ // Perhaps a poor assumption but: if we're not relaunching, we assume we shouldn't be showing any UI either. Because non-relaunching installations are kicked off without any user interaction, we shouldn't be interrupting them.
+ if (shouldRelaunch)
+ NSRunAlertPanel( @"", @"%@", @"OK", @"", @"", [error localizedDescription] );
exit(EXIT_FAILURE);
}

0 comments on commit 01e8cf9

Please sign in to comment.
Something went wrong with that request. Please try again.