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
2012-06-14 11:43:52 +02:00
parent 0018be6fd8
commit 1fd021770e
3 changed files with 17 additions and 8 deletions
+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