From bc547d0c364bbd2421bda8c6e9754e21278f020f Mon Sep 17 00:00:00 2001 From: Matthieu Lalonde Date: Sat, 4 Jun 2011 11:40:14 -0400 Subject: [PATCH] Stopping of refresh timer while the menu is updating --- DDWRT_MonitorAppDelegate.m | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/DDWRT_MonitorAppDelegate.m b/DDWRT_MonitorAppDelegate.m index 928d511..bb9c64a 100644 --- a/DDWRT_MonitorAppDelegate.m +++ b/DDWRT_MonitorAppDelegate.m @@ -166,9 +166,9 @@ - (void) setMenubarText:(NSString *)menubarText { - // Todo set proper line height + // TODO set proper line height and proper right align NSFontManager *fontManager = [NSFontManager sharedFontManager]; - NSFont *menuFont = [fontManager fontWithFamily:@"Lucida Grande" traits:NSBoldFontMask weight:10 size:8]; + NSFont *menuFont = [fontManager fontWithFamily:@"Lucida Grande" traits:NSBoldFontMask weight:10 size:8 ]; NSDictionary *titleAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:menuFont, NSFontAttributeName, [NSColor blackColor], NSForegroundColorAttributeName, nil]; @@ -415,6 +415,8 @@ - (void) refreshMenu:(id)sender { NSLog(@"Refresh Menu"); + [_readTimer invalidate]; + _readTimer = nil; [wrt_client getStatusUpdate:@"Status_Router.live.asp" delegate:self callback:@selector(doUpdateStatus:)]; @@ -605,6 +607,9 @@ } [_appMenu popUpStatusItemMenu:AppMenu]; + _readTimer = [NSTimer scheduledTimerWithTimeInterval:refreshTime+1 target:self selector:@selector(updateThroughput:) userInfo:nil repeats:YES]; + + [_readTimer fire]; } - (IBAction) copyParentMenuTitle:(id)sender