Changeset 12685


Ignore:
Timestamp:
Aug 15, 2011, 12:17:18 AM (10 years ago)
Author:
livings124
Message:

#4420 The StatusBar? updates itself a bit too much

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/StatusBarController.h

    r12152 r12685  
    3434   
    3535    tr_session * fLib;
     36   
     37    CGFloat fPreviousDownloadRate, fPreviousUploadRate;
    3638}
    3739
  • trunk/macosx/StatusBarController.m

    r12534 r12685  
    5454    {
    5555        fLib = lib;
     56       
     57        fPreviousDownloadRate = -1.0;
     58        fPreviousUploadRate = -1.0;
    5659    }
    5760   
     
    9497{
    9598    //set rates
    96     [fTotalDLField setStringValue: [NSString stringForSpeed: dlRate]];
    97     [fTotalULField setStringValue: [NSString stringForSpeed: ulRate]];
     99    if (dlRate != fPreviousDownloadRate)
     100    {
     101        [fTotalDLField setStringValue: [NSString stringForSpeed: dlRate]];
     102        fPreviousDownloadRate = dlRate;
     103    }
     104   
     105    if (ulRate != fPreviousUploadRate)
     106    {
     107        [fTotalULField setStringValue: [NSString stringForSpeed: ulRate]];
     108        fPreviousUploadRate = ulRate;
     109    }
    98110   
    99111    //set status button text
     
    126138    }
    127139   
    128     [fStatusButton setTitle: statusString];
    129     [self resizeStatusButton];
     140   
     141    if (![[fStatusButton title] isEqualToString:statusString]) {
     142        [fStatusButton setTitle: statusString];
     143        [self resizeStatusButton];
     144    }
    130145}
    131146
Note: See TracChangeset for help on using the changeset viewer.