mirror of
https://github.com/transmission/transmission
synced 2024-12-27 01:57:52 +00:00
if on Leopard use the built in badging for the number of completed downloads
This commit is contained in:
parent
a0a9c8b2aa
commit
2c3dc63569
2 changed files with 15 additions and 4 deletions
|
@ -30,6 +30,7 @@
|
||||||
tr_handle * fLib;
|
tr_handle * fLib;
|
||||||
|
|
||||||
NSImage * fDockIcon, * fBadge, * fUploadBadge, * fDownloadBadge;
|
NSImage * fDockIcon, * fBadge, * fUploadBadge, * fDownloadBadge;
|
||||||
|
|
||||||
NSDictionary * fAttributes;
|
NSDictionary * fAttributes;
|
||||||
int fCompleted, fCompletedBadged;
|
int fCompleted, fCompletedBadged;
|
||||||
BOOL fSpeedBadge;
|
BOOL fSpeedBadge;
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#import "Badger.h"
|
#import "Badger.h"
|
||||||
|
#import "NSApplicationAdditions.h"
|
||||||
#import "NSStringAdditions.h"
|
#import "NSStringAdditions.h"
|
||||||
|
|
||||||
#define COMPLETED_BOTTOM_PADDING 5.0
|
#define COMPLETED_BOTTOM_PADDING 5.0
|
||||||
|
@ -62,7 +63,7 @@
|
||||||
- (void) updateBadge
|
- (void) updateBadge
|
||||||
{
|
{
|
||||||
//set completed badge to top right
|
//set completed badge to top right
|
||||||
BOOL completedChange = fCompleted != fCompletedBadged;
|
BOOL completedChange = [NSApp isOnLeopardOrBetter] && fCompleted != fCompletedBadged;
|
||||||
if (completedChange)
|
if (completedChange)
|
||||||
{
|
{
|
||||||
fCompletedBadged = fCompleted;
|
fCompletedBadged = fCompleted;
|
||||||
|
@ -183,6 +184,10 @@
|
||||||
- (void) incrementCompleted
|
- (void) incrementCompleted
|
||||||
{
|
{
|
||||||
fCompleted++;
|
fCompleted++;
|
||||||
|
|
||||||
|
if ([NSApp isOnLeopardOrBetter])
|
||||||
|
[[NSApp dockTile] setBadgeLabel: [NSString stringWithFormat: @"%d", fCompleted]];
|
||||||
|
else
|
||||||
[self updateBadge];
|
[self updateBadge];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,6 +196,9 @@
|
||||||
if (fCompleted != 0)
|
if (fCompleted != 0)
|
||||||
{
|
{
|
||||||
fCompleted = 0;
|
fCompleted = 0;
|
||||||
|
if ([NSApp isOnLeopardOrBetter])
|
||||||
|
[[NSApp dockTile] setBadgeLabel: @""];
|
||||||
|
else
|
||||||
[self updateBadge];
|
[self updateBadge];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -201,6 +209,8 @@
|
||||||
fCompletedBadged = 0;
|
fCompletedBadged = 0;
|
||||||
fSpeedBadge = NO;
|
fSpeedBadge = NO;
|
||||||
[NSApp setApplicationIconImage: [NSImage imageNamed: @"NSApplicationIcon"]];
|
[NSApp setApplicationIconImage: [NSImage imageNamed: @"NSApplicationIcon"]];
|
||||||
|
if ([NSApp isOnLeopardOrBetter])
|
||||||
|
[[NSApp dockTile] setBadgeLabel: @""];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Reference in a new issue