Skip to content

Commit c768f07

Browse files
Simone ManganelliSimone Manganelli
Simone Manganelli
authored and
Simone Manganelli
committed
if the user chooses not to restart the host app after installing the new version of ClickToFlash, the Sparkle update status window now goes away and stops hanging around on screen, annoying the user (fixes bug #191)
1 parent d8bb666 commit c768f07

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

Plugin/Sparkle/SUUIBasedUpdateDriver.m

+11-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,17 @@ - (void)installUpdate
141141
{
142142
[statusController beginActionWithTitle:SULocalizedString(@"Installing update...", @"Take care not to overflow the status window.") maxProgressValue:0 statusText:nil];
143143
[statusController setButtonEnabled:NO];
144-
[super installUpdate];
144+
[super installUpdate];
145+
146+
// modification by @simX, 2009-07-02; if a user chooses to not relaunch
147+
// the app, the status window still stays on the screen; with this fix,
148+
// it doesn't; unsure if this is the best place to do this, but it seems
149+
// to work
150+
if (statusController)
151+
{
152+
[statusController close];
153+
[statusController autorelease];
154+
}
145155
}
146156

147157
- (void)abortUpdateWithError:(NSError *)error

Plugin/SparkleManager.m

+24
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,30 @@ - (NSString*)pathToRelaunchForUpdater:(SUUpdater*)updater {
124124
return _pathToRelaunch;
125125
}
126126

127+
- (BOOL)updater:(SUUpdater *)updater
128+
shouldPostponeRelaunchForUpdate:(SUAppcastItem *)update
129+
untilInvoking:(NSInvocation *)invocation;
130+
{
131+
NSString *appNameString = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
132+
int relaunchResult = NSRunAlertPanel([NSString stringWithFormat:@"Relaunch %@ now?",appNameString],
133+
[NSString stringWithFormat:@"To use the new features of ClickToFlash, %@ needs to be relaunched.",appNameString],
134+
@"Relaunch",
135+
@"Do not relaunch",
136+
nil);
137+
138+
BOOL shouldPostpone = YES;
139+
if (relaunchResult == NSAlertDefaultReturn) {
140+
// we want to relaunch now, so don't postpone the relaunch
141+
142+
shouldPostpone = NO;
143+
} else {
144+
// we want to postpone the relaunch and let the user decide when to do so,
145+
// so we don't even bother with saving the invocation and reinvoking
146+
// it later
147+
}
148+
return shouldPostpone;
149+
}
150+
127151
- (NSString *)pathToRelaunch
128152
{
129153
return _pathToRelaunch;

0 commit comments

Comments
 (0)