Skip to content

Commit

Permalink
if the user chooses not to restart the host app after installing the …
Browse files Browse the repository at this point in the history
…new version of ClickToFlash, the Sparkle update status window now goes away and stops hanging around on screen, annoying the user (fixes bug #191)
  • Loading branch information
Simone Manganelli authored and Simone Manganelli committed Jul 2, 2009
1 parent d8bb666 commit c768f07
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Plugin/Sparkle/SUUIBasedUpdateDriver.m
Expand Up @@ -141,7 +141,17 @@ - (void)installUpdate
{
[statusController beginActionWithTitle:SULocalizedString(@"Installing update...", @"Take care not to overflow the status window.") maxProgressValue:0 statusText:nil];
[statusController setButtonEnabled:NO];
[super installUpdate];
[super installUpdate];

// modification by @simX, 2009-07-02; if a user chooses to not relaunch
// the app, the status window still stays on the screen; with this fix,
// it doesn't; unsure if this is the best place to do this, but it seems
// to work
if (statusController)
{
[statusController close];
[statusController autorelease];
}
}

- (void)abortUpdateWithError:(NSError *)error
Expand Down
24 changes: 24 additions & 0 deletions Plugin/SparkleManager.m
Expand Up @@ -124,6 +124,30 @@ - (NSString*)pathToRelaunchForUpdater:(SUUpdater*)updater {
return _pathToRelaunch;
}

- (BOOL)updater:(SUUpdater *)updater
shouldPostponeRelaunchForUpdate:(SUAppcastItem *)update
untilInvoking:(NSInvocation *)invocation;
{
NSString *appNameString = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
int relaunchResult = NSRunAlertPanel([NSString stringWithFormat:@"Relaunch %@ now?",appNameString],
[NSString stringWithFormat:@"To use the new features of ClickToFlash, %@ needs to be relaunched.",appNameString],
@"Relaunch",
@"Do not relaunch",
nil);

BOOL shouldPostpone = YES;
if (relaunchResult == NSAlertDefaultReturn) {
// we want to relaunch now, so don't postpone the relaunch

shouldPostpone = NO;
} else {
// we want to postpone the relaunch and let the user decide when to do so,
// so we don't even bother with saving the invocation and reinvoking
// it later
}
return shouldPostpone;
}

- (NSString *)pathToRelaunch
{
return _pathToRelaunch;
Expand Down

0 comments on commit c768f07

Please sign in to comment.