Revision: 13788
http://sourceforge.net/p/skim-app/code/13788
Author: hofman
Date: 2023-11-20 23:07:25 +0000 (Mon, 20 Nov 2023)
Log Message:
-----------
No need to observe updater for changes, as we are the only ones making changes
Modified Paths:
--------------
trunk/SKGeneralPreferences.m
Modified: trunk/SKGeneralPreferences.m
===================================================================
--- trunk/SKGeneralPreferences.m 2023-11-20 15:41:12 UTC (rev 13787)
+++ trunk/SKGeneralPreferences.m 2023-11-20 23:07:25 UTC (rev 13788)
@@ -53,8 +53,6 @@
#define SUScheduledCheckIntervalKey @"SUScheduledCheckInterval"
-static char SKGeneralPreferencesUpdaterObservationContext;
-
@interface SKGeneralPreferences ()
@property (nonatomic, readonly) SPUUpdater *updater;
- (void)synchronizeUpdateInterval;
@@ -66,11 +64,6 @@
@dynamic updater;
- (void)dealloc {
- @try {
- [[self updater] removeObserver:self
forKeyPath:AUTOMATICALLYCHECKSFORUPDATES_KEY
context:&SKGeneralPreferencesUpdaterObservationContext];
- [[self updater] removeObserver:self forKeyPath:UPDATECHECKINTERVAL_KEY
context:&SKGeneralPreferencesUpdaterObservationContext];
- }
- @catch(id e) {}
SKDESTROY(updateIntervalPopUpButton);
[super dealloc];
}
@@ -83,9 +76,6 @@
[super viewDidLoad];
[self synchronizeUpdateInterval];
-
- [[self updater] addObserver:self
forKeyPath:AUTOMATICALLYCHECKSFORUPDATES_KEY options:0
context:&SKGeneralPreferencesUpdaterObservationContext];
- [[self updater] addObserver:self forKeyPath:UPDATECHECKINTERVAL_KEY
options:0 context:&SKGeneralPreferencesUpdaterObservationContext];
}
#pragma mark Accessors
@@ -96,7 +86,9 @@
if (interval > 0)
[[self updater] setUpdateCheckInterval:interval];
[[self updater] setAutomaticallyChecksForUpdates:interval > 0];
+ [self willChangeValueForKey:UPDATEINTERVAL_KEY];
updateInterval = interval;
+ [self didChangeValueForKey:UPDATEINTERVAL_KEY];
}
- (SPUUpdater *)updater {
@@ -122,20 +114,11 @@
}];
}
-#pragma mark KVO
-
-- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object
change:(NSDictionary *)change context:(void *)context {
- if (context == &SKGeneralPreferencesUpdaterObservationContext)
- [self synchronizeUpdateInterval];
- else
- [super observeValueForKeyPath:keyPath ofObject:object change:change
context:context];
-}
-
#pragma mark Private
- (void)synchronizeUpdateInterval {
[self willChangeValueForKey:UPDATEINTERVAL_KEY];
- updateInterval = (NSInteger)[[self updater] automaticallyChecksForUpdates]
? (NSInteger)[[self updater] updateCheckInterval] : 0;
+ updateInterval = [[self updater] automaticallyChecksForUpdates] ?
(NSInteger)[[self updater] updateCheckInterval] : 0;
[self didChangeValueForKey:UPDATEINTERVAL_KEY];
}
@@ -145,6 +128,7 @@
NSTimeInterval interval = [[[NSBundle mainBundle]
objectForInfoDictionaryKey:SUScheduledCheckIntervalKey] doubleValue];
[[self updater] setUpdateCheckInterval:interval];
[[self updater] setAutomaticallyChecksForUpdates:interval > 0.0];
+ [self synchronizeUpdateInterval];
}
@end
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit