~ubuntu-branches/ubuntu/jaunty/transmission/jaunty-security

« back to all changes in this revision

Viewing changes to macosx/Badger.m

  • Committer: Bazaar Package Importer
  • Author(s): Chris Coulson
  • Date: 2008-11-28 15:33:48 UTC
  • mfrom: (1.1.19 upstream)
  • Revision ID: james.westby@ubuntu.com-20081128153348-it70trfnxiroblmc
Tags: 1.40-0ubuntu1
* New upstream release (LP: #302672)
  - Tracker communication uses fewer resources
  - More accurate bandwidth limits
  - Reduce disk fragmentation by preallocating files (LP: #287726)
  - Stability, security and performance improvements to the RPC /
    Web UI server (closes LP: #290423)
  - Support compression when serving Web UI and RPC responses
  - Simplify the RPC whitelist
  - Fix bug that prevented handshakes with encrypted BitComet peers
  - Fix 1.3x bug that could re-download some data unnecessarily
    (LP: #295040)
  - Option to automatically update the blocklist weekly
  - Added off-hour bandwidth scheduling
  - Simplify file/priority selection in the details dialog
  - Fix a couple of crashes
  - New / updated translations
  - Don't inhibit hibernation by default (LP: #292929)
  - Use "close" animation when sending to notification area (LP: #130811)
  - Fix resize problems (LP: #269872)
  - Support "--version" option when launching from command line
    (LP: #292011)
  - Correctly parse announce URLs that have leading or trailing
    spaces (LP: #262411)
  - Display an error when "Open Torrent" fails (LP: #281463)
* Dropped 10_fix_crasher_from_upstream.dpatch: Fix is in this
  upstream release.
* debian/control: Don't just build-depend on libcurl-dev, which is
  a virtual package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/******************************************************************************
2
 
 * $Id: Badger.m 5975 2008-05-30 15:19:07Z charles $
 
2
 * $Id: Badger.m 7077 2008-11-08 22:13:00Z livings124 $
3
3
 *
4
4
 * Copyright (c) 2006-2008 Transmission authors and contributors
5
5
 *
26
26
#import "BadgeView.h"
27
27
#import "NSApplicationAdditions.h"
28
28
#import "NSStringAdditions.h"
29
 
#import "NSBezierPathAdditions.h"
30
29
 
31
30
#define COMPLETED_BOTTOM_PADDING 5.0
32
31
#define SPEED_BOTTOM_PADDING 2.0
86
85
{
87
86
    if ([NSApp isOnLeopardOrBetter])
88
87
    {
89
 
        float downloadRate = 0.0, uploadRate = 0.0;
90
 
        BOOL badgeDownload = [[NSUserDefaults standardUserDefaults] boolForKey: @"BadgeDownloadRate"],
91
 
            badgeUpload = [[NSUserDefaults standardUserDefaults] boolForKey: @"BadgeUploadRate"];
92
 
        if (badgeDownload || badgeUpload)
93
 
            tr_sessionGetSpeed(fLib, badgeDownload ? &downloadRate : NULL, badgeUpload ? &uploadRate : NULL);
 
88
        float downloadRate = [[NSUserDefaults standardUserDefaults] boolForKey: @"BadgeDownloadRate"]
 
89
                                ? tr_sessionGetPieceSpeed(fLib, TR_DOWN) : 0.0f;
 
90
        float uploadRate = [[NSUserDefaults standardUserDefaults] boolForKey: @"BadgeUploadRate"]
 
91
                            ? tr_sessionGetPieceSpeed(fLib, TR_UP) : 0.0f;
94
92
        
95
93
        //only update if the badged values change
96
94
        if ([(BadgeView *)[[NSApp dockTile] contentView] setRatesWithDownload: downloadRate upload: uploadRate])
98
96
        
99
97
        return;
100
98
    }
101
 
    else if (fQuittingTiger)
 
99
    
 
100
    if (fQuittingTiger)
102
101
        return;
103
 
    else;
104
102
    
105
103
    //set completed badge to top right
106
104
    BOOL completedChange = fCompleted != fCompletedBadged;
153
151
        //set upload and download rate badges
154
152
        NSString * downloadRateString = nil, * uploadRateString = nil;
155
153
        
156
 
        float downloadRate, uploadRate;
157
 
        tr_sessionGetSpeed(fLib, &downloadRate, &uploadRate);
 
154
        float downloadRate = checkDownload ? tr_sessionGetPieceSpeed(fLib, TR_DOWN) : 0.0f;
 
155
        float uploadRate = checkUpload ? tr_sessionGetPieceSpeed(fLib, TR_UP) : 0.0f;
158
156
        
159
157
        if (checkDownload && downloadRate >= 0.1)
160
158
            downloadRateString = [NSString stringForSpeedAbbrev: downloadRate];