#77 SUIgnoreChecks to ignore update, needed for Sparkle in large deployments

This commit is contained in:
catlan committed 2007-11-11 01:12:47 +00:00
1 parent 938336b335
commit 1c1bb3a142
5 files changed
+46 -5

No files matched your search

+4 -2
View File
@@ -28,10 +28,12 @@
/*
- (int)integerForKey:(NSString *)defaultName;
- (float)floatForKey:(NSString *)defaultName;
*/
- (BOOL)boolForKey:(NSString *)defaultName;
/*
- (void)setInteger:(int)value forKey:(NSString *)defaultName;
- (void)setFloat:(float)value forKey:(NSString *)defaultName;
- (void)setBool:(BOOL)value forKey:(NSString *)defaultName;
*/
- (void)setBool:(BOOL)value forKey:(NSString *)defaultName;
@end
+18 -2
View File
@@ -70,13 +70,29 @@
{
return (NSArray *)CFPreferencesCopyValue((CFStringRef)defaultName, (CFStringRef)applicationID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
}
/*
- (int)integerForKey:(NSString *)defaultName;
- (float)floatForKey:(NSString *)defaultName;
- (BOOL)boolForKey:(NSString *)defaultName;
*/
- (BOOL)boolForKey:(NSString *)defaultName
{
CFPropertyListRef plr = (CFPropertyListRef)CFPreferencesCopyValue((CFStringRef)defaultName, (CFStringRef)applicationID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
if (plr == NULL)
return NO;
return CFBooleanGetValue((CFBooleanRef)plr);
}
/*
- (void)setInteger:(int)value forKey:(NSString *)defaultName;
- (void)setFloat:(float)value forKey:(NSString *)defaultName;
- (void)setBool:(BOOL)value forKey:(NSString *)defaultName;
*/
- (void)setBool:(BOOL)value forKey:(NSString *)defaultName
{
CFPreferencesSetValue((CFStringRef)defaultName, (CFBooleanRef)[NSNumber numberWithBool:value], (CFStringRef)applicationID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
CFPreferencesSynchronize((CFStringRef)applicationID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
}
@end
+1
View File
@@ -18,3 +18,4 @@ extern NSString *SUExpectsDSASignatureKey;
extern NSString *SUPublicDSAKeyKey;
extern NSString *SUAutomaticallyUpdateKey;
extern NSString *SUAllowsAutomaticUpdatesKey;
extern NSString *SUIgnoreChecksKey;
+2 -1
View File
@@ -17,4 +17,5 @@ NSString *SULastCheckTimeKey = @"SULastCheckTime";
NSString *SUExpectsDSASignatureKey = @"SUExpectsDSASignature";
NSString *SUPublicDSAKeyKey = @"SUPublicDSAKey";
NSString *SUAutomaticallyUpdateKey = @"SUAutomaticallyUpdate";
NSString *SUAllowsAutomaticUpdatesKey = @"SUAllowsAutomaticUpdates";
NSString *SUAllowsAutomaticUpdatesKey = @"SUAllowsAutomaticUpdates";
NSString *SUIgnoreChecksKey = @"SUIgnoreChecks";
+21
View File
@@ -101,6 +101,9 @@
- (void)applicationDidFinishLaunching:(NSNotification *)note
{
if ([[utilities standardBundleDefaults] boolForKey:SUIgnoreChecksKey])
return;
// If there's a scheduled interval, we see if it's been longer than that interval since the last
// check. If so, we perform a startup check; if not, we don't.
if ([self storedCheckInterval])
@@ -188,10 +191,28 @@
[self checkForUpdatesAndNotify:YES]; // if we're coming from IB, then we want to be more verbose.
}
- (BOOL)validateMenuItem:(NSMenuItem *)item {
if ([item action] == @selector(checkForUpdates:)) {
if (![[utilities standardBundleDefaults] boolForKey:SUIgnoreChecksKey])
{
if (updateInProgress)
return NO;
else
return YES;
} else {
return NO;
}
}
return NO;
}
// If the verbosity flag is YES, Sparkle will say when it can't reach the server and when there's no new update.
// This is generally useful for a menu item--when the check is explicitly invoked.
- (void)checkForUpdatesAndNotify:(BOOL)verbosity
{
if ([[utilities standardBundleDefaults] boolForKey:SUIgnoreChecksKey])
return;
if (updateInProgress)
{
if (verbosity)