Changeset 7596


Ignore:
Timestamp:
Jan 3, 2009, 6:06:21 AM (12 years ago)
Author:
livings124
Message:

fix dock badging

Location:
trunk/macosx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/BadgeView.h

    r7568 r7596  
    3838- (id) initWithFrame: (NSRect) frame lib: (tr_session *) lib;
    3939
    40 - (void) displayRatesWithDownload: (CGFloat) downloadRate upload: (CGFloat) uploadRate;
     40- (BOOL) setRatesWithDownload: (CGFloat) downloadRate upload: (CGFloat) uploadRate;
    4141- (void) setQuitting;
    4242
  • trunk/macosx/BadgeView.m

    r7568 r7596  
    5555}
    5656
    57 - (void) displayRatesWithDownload: (CGFloat) downloadRate upload: (CGFloat) uploadRate
     57- (BOOL) setRatesWithDownload: (CGFloat) downloadRate upload: (CGFloat) uploadRate
    5858{
    5959    //only needs update if the badges were displayed or are displayed now
    6060    if (fDownloadRate == downloadRate && fUploadRate == uploadRate)
    61         return;
     61        return NO;
    6262   
    6363    fDownloadRate = downloadRate;
    6464    fUploadRate = uploadRate;
    65     [self display];
     65    return YES;
    6666}
    6767
     
    8383    }
    8484   
    85     BOOL upload = fUploadRate >= 0.1f,
    86         download = fDownloadRate >= 0.1f;
     85    const BOOL upload = fUploadRate >= 0.1f,
     86            download = fDownloadRate >= 0.1f;
    8787    CGFloat bottom = 0.0f;
    8888    if (upload)
  • trunk/macosx/Badger.m

    r7568 r7596  
    5656- (void) updateBadge
    5757{
    58     float downloadRate = [[NSUserDefaults standardUserDefaults] boolForKey: @"BadgeDownloadRate"]
    59                             ? tr_sessionGetPieceSpeed(fLib, TR_DOWN) : 0.0;
    60     float uploadRate = [[NSUserDefaults standardUserDefaults] boolForKey: @"BadgeUploadRate"]
    61                         ? tr_sessionGetPieceSpeed(fLib, TR_UP) : 0.0;
     58    const float downloadRate = [[NSUserDefaults standardUserDefaults] boolForKey: @"BadgeDownloadRate"]
     59                                ? tr_sessionGetPieceSpeed(fLib, TR_DOWN) : 0.0;
     60    const float uploadRate = [[NSUserDefaults standardUserDefaults] boolForKey: @"BadgeUploadRate"]
     61                                ? tr_sessionGetPieceSpeed(fLib, TR_UP) : 0.0;
    6262   
    63     [(BadgeView *)[[NSApp dockTile] contentView] displayRatesWithDownload: downloadRate upload: uploadRate];
     63    //only update if the badged values change
     64    if ([(BadgeView *)[[NSApp dockTile] contentView] setRatesWithDownload: downloadRate upload: uploadRate])
     65        [[NSApp dockTile] display];
    6466}
    6567
Note: See TracChangeset for help on using the changeset viewer.