[sparkleplus commit] r109 - trunk

1 view
Skip to first unread message

codesite...@google.com

unread,
Jan 7, 2008, 8:04:56 PM1/7/08
to spark...@googlegroups.com
Author: atomicbird
Date: Mon Jan 7 17:01:42 2008
New Revision: 109

Modified:
trunk/SUUpdater.m

Log:
Modify idle-time checking to take remaining time on force threshold into
account when setting up the idle-time alert timer. Contributed by Paul
Kim.

Modified: trunk/SUUpdater.m
==============================================================================
--- trunk/SUUpdater.m (original)
+++ trunk/SUUpdater.m Mon Jan 7 17:01:42 2008
@@ -528,7 +528,7 @@
{
NSDate *lastCheck = [[NSUserDefaults standardUserDefaults] objectForKey:SULastCheckTimeKey];
NSNumber *value;
- NSTimeInterval forceThreshold;
+ NSTimeInterval forceThreshold, timeSinceLastCheck;

value = [[NSUserDefaults standardUserDefaults] objectForKey:SUForceAlertThreshold];
if (value == nil)
@@ -543,9 +543,11 @@
{
forceThreshold = DEFAULT_FORCE_ALERT_THRESHOLD;
}
-
+
+ timeSinceLastCheck = [[NSDate date] timeIntervalSinceDate:lastCheck];
+
// After the threshold, we force display of the panel.
- if ([[NSDate date] timeIntervalSinceDate:lastCheck] < forceThreshold)
+ if (timeSinceLastCheck < forceThreshold)
{
CFTimeInterval idleTime, idleLimit;

@@ -567,8 +569,12 @@

if (idleTime < idleLimit)
{
+ NSTimeInterval fireTime;
+
+ fireTime = MIN(idleLimit - idleTime, forceThreshold - timeSinceLastCheck);
+
// Not idle for long enough. Set a timer and check back later
- idleAlertTimer = [NSTimer
scheduledTimerWithTimeInterval:(idleLimit - idleTime) target:self
selector:@selector(showUpdatePanel) userInfo:nil repeats:NO];
+ idleAlertTimer = [NSTimer scheduledTimerWithTimeInterval:fireTime
target:self selector:@selector(showUpdatePanel) userInfo:nil repeats:NO];
return;
}
}

Reply all
Reply to author
Forward
0 new messages