Split -synchronizeLastEventId in two methods.

The first method (updateUserDefaultsWithLastEventId) just
sets the default while the other (synchronizeUserDefaultsWithDisk)
forces a synchronization with the disk.
This commit is contained in:
Malte Tancred committed 2012-06-14 11:43:52 +02:00
1 parent 0018be6fd8
commit 1fd021770e
3 files changed
+17 -8

No files matched your search

+1 -1
View File
@@ -139,5 +139,5 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
}
}
[xcc synchronizeLastEventId];
[xcc updateUserDefaultsWithLastEventId];
}
+2 -1
View File
@@ -80,7 +80,8 @@ extern NSString * const XCCListeningStartNotification;
- (void)initializeEventStreamWithPath:(NSString*)aPath;
- (void)stopEventStream;
- (void)updateLastEventId:(uint64_t)eventId;
- (void)synchronizeLastEventId;
- (void)updateUserDefaultsWithLastEventId;
- (void)synchronizeUserDefaultsWithDisk;
- (void)listenProjectAtPath:(NSString *)path;
- (void)clear;
- (void)start;
+14 -6
View File
@@ -195,7 +195,8 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification
*/
- (void)clear
{
[self synchronizeLastEventId];
[self updateUserDefaultsWithLastEventId];
[self synchronizeUserDefaultsWithDisk];
currentProjectURL = nil;
currentProjectName = nil;
[ignoredFilePaths removeAllObjects];
@@ -254,17 +255,24 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification
}
/*!
Synchronizes the last recorded event ID with the user defaults.
Updates the user defaults with the last recorded event Id.
*/
- (void)synchronizeLastEventId {
- (void)updateUserDefaultsWithLastEventId
{
if (lastEventId && [lastEventId longLongValue] != 0)
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:lastEventId forKey:@"lastEventId"];
[defaults synchronize];
[[NSUserDefaults standardUserDefaults] setObject:lastEventId forKey:@"lastEventId"];
}
}
/*!
Tells the standard user defaults to synchronize with disk.
*/
- (void)synchronizeUserDefaultsWithDisk
{
[[NSUserDefaults standardUserDefaults] synchronize];
}
/*!
Run a NSTask with the given arguments
@param arguments NSArray containing the NSTask arguments