Changeset 1043 for trunk/macosx


Ignore:
Timestamp:
Oct 30, 2006, 11:54:14 PM (15 years ago)
Author:
livings124
Message:

get rid of a variable

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.h

    r1035 r1043  
    6161                                    * fSpeedLimitItem, * fSpeedLimitDockItem;
    6262    IBOutlet NSButton               * fActionButton, * fSpeedLimitButton;
    63     BOOL                            fSpeedLimitEnabled;
    6463    NSImage                         * fSpeedLimitNormalImage, * fSpeedLimitBlueImage, * fSpeedLimitGraphiteImage;
    6564    NSTimer                         * fSpeedLimitTimer;
  • trunk/macosx/Controller.m

    r1042 r1043  
    214214    [self updateControlTint: nil];
    215215   
    216     if ((fSpeedLimitEnabled = [fDefaults boolForKey: @"SpeedLimit"]))
     216    if ([fDefaults boolForKey: @"SpeedLimit"])
    217217    {
    218218        #warning get rid of
     
    948948- (void) updateControlTint: (NSNotification *) notification
    949949{
    950     if (fSpeedLimitEnabled)
     950    if ([fDefaults boolForKey: @"SpeedLimit"])
    951951        [fSpeedLimitButton setImage: [NSColor currentControlTint] == NSBlueControlTint
    952952                                        ? fSpeedLimitBlueImage : fSpeedLimitGraphiteImage];
     
    13021302- (void) toggleSpeedLimit: (id) sender
    13031303{
    1304     fSpeedLimitEnabled = !fSpeedLimitEnabled;
    1305     int state = fSpeedLimitEnabled ? NSOnState : NSOffState;
    1306    
    1307     [fDefaults setBool: fSpeedLimitEnabled forKey: @"SpeedLimit"];
     1304    BOOL setEnabled = ![fDefaults boolForKey: @"SpeedLimit"];
     1305    int state = setEnabled ? NSOnState : NSOffState;
     1306   
     1307    [fDefaults setBool: setEnabled forKey: @"SpeedLimit"];
    13081308
    13091309    #warning get rid of
     
    13111311    [fSpeedLimitDockItem setState: state];
    13121312   
    1313     [fSpeedLimitButton setImage: !fSpeedLimitEnabled ? fSpeedLimitNormalImage
     1313    [fSpeedLimitButton setImage: !setEnabled ? fSpeedLimitNormalImage
    13141314        : ([NSColor currentControlTint] == NSBlueControlTint ? fSpeedLimitBlueImage : fSpeedLimitGraphiteImage)];
    13151315   
     
    13361336        shouldBeOn = hour < offHour || hour >= onHour;
    13371337   
    1338     if (fSpeedLimitEnabled != shouldBeOn)
     1338    if ([fDefaults boolForKey: @"SpeedLimit"] != shouldBeOn)
    13391339        [self toggleSpeedLimit: nil];
    13401340}
     
    13441344    if (![fDefaults boolForKey: @"SpeedLimitAuto"])
    13451345        return;
    1346  
     1346
     1347    BOOL limited = [fDefaults boolForKey: @"SpeedLimit"];
     1348   
    13471349    //toggle if within first few seconds of hour
    13481350    NSCalendarDate * currentDate = [NSCalendarDate calendarDate];
    13491351    if ([currentDate minuteOfHour] == 0 && [currentDate secondOfMinute] < AUTO_SPEED_LIMIT_SECONDS
    1350         && [currentDate hourOfDay] == [fDefaults integerForKey: fSpeedLimitEnabled
     1352        && [currentDate hourOfDay] == [fDefaults integerForKey: limited
    13511353                                        ? @"SpeedLimitAutoOffHour" : @"SpeedLimitAutoOnHour"]
    1352         && (fSpeedLimitEnabled || [fDefaults integerForKey: @"SpeedLimitAutoOnHour"]
     1354        && (limited || [fDefaults integerForKey: @"SpeedLimitAutoOnHour"]
    13531355                                    != [fDefaults integerForKey: @"SpeedLimitAutoOffHour"]))
    13541356    {
    13551357        [self toggleSpeedLimit: nil];
    13561358       
    1357         [GrowlApplicationBridge notifyWithTitle: fSpeedLimitEnabled
     1359        [GrowlApplicationBridge notifyWithTitle: limited
    13581360                ? NSLocalizedString(@"Speed Limit Auto Enabled", "Growl notification title")
    13591361                : NSLocalizedString(@"Speed Limit Auto Disabled", "Growl notification title")
Note: See TracChangeset for help on using the changeset viewer.