From 6031ba021a9aabf062053e345d0da952c17d7ae7 Mon Sep 17 00:00:00 2001 From: michael starke Date: Fri, 23 Oct 2015 19:41:44 +0200 Subject: [PATCH] Using properties Signed-off-by: michael starke --- MacPass/MPLockDaemon.m | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/MacPass/MPLockDaemon.m b/MacPass/MPLockDaemon.m index 164af68b..fc3a036b 100644 --- a/MacPass/MPLockDaemon.m +++ b/MacPass/MPLockDaemon.m @@ -43,7 +43,7 @@ - (void)dealloc { /* Notifications */ - [[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver:self]; + [[NSWorkspace sharedWorkspace].notificationCenter removeObserver:self]; /* Timer */ [NSEvent removeMonitor:self.eventHandler]; @@ -53,12 +53,11 @@ - (void)setLockOnSleep:(BOOL)lockOnSleep { if(_lockOnSleep != lockOnSleep) { _lockOnSleep = lockOnSleep; - NSNotificationCenter *notificationCenter = [[NSWorkspace sharedWorkspace] notificationCenter]; if(_lockOnSleep) { - [notificationCenter addObserver:self selector:@selector(_willSleepNotification:) name:NSWorkspaceWillSleepNotification object:nil]; + [[NSWorkspace sharedWorkspace].notificationCenter addObserver:self selector:@selector(_willSleepNotification:) name:NSWorkspaceWillSleepNotification object:nil]; } else { - [notificationCenter removeObserver:self]; + [[NSWorkspace sharedWorkspace].notificationCenter removeObserver:self]; } } } @@ -105,7 +104,7 @@ /* update or create Timer */ if( self.idleCheckTimer ) { NSAssert([self.idleCheckTimer isValid], @"Timer needs to be valid"); - [self.idleCheckTimer setFireDate:[NSDate dateWithTimeIntervalSinceNow:self.idleLockTime ]]; + self.idleCheckTimer.fireDate = [NSDate dateWithTimeIntervalSinceNow:self.idleLockTime]; } else { self.idleCheckTimer = [NSTimer timerWithTimeInterval:self.idleLockTime target:self selector:@selector(_checkIdleTime:) userInfo:nil repeats:YES];