Skip to content

Commit

Permalink
finish_installation doesn't show any UI if it's not relaunching, sinc…
Browse files Browse the repository at this point in the history
…e those installations were not kicked off by user action.
  • Loading branch information
andymatuschak committed Oct 5, 2011
1 parent 7152bd0 commit 01e8cf9
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions finish_installation.m
Expand Up @@ -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
Expand All @@ -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);
}

Expand Down

0 comments on commit 01e8cf9

Please sign in to comment.