1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 09:37:56 +00:00

if on Leopard use the built in badging for the number of completed downloads

This commit is contained in:
Mitchell Livingston 2007-10-29 04:31:44 +00:00
parent a0a9c8b2aa
commit 2c3dc63569
2 changed files with 15 additions and 4 deletions

View file

@ -30,6 +30,7 @@
tr_handle * fLib;
NSImage * fDockIcon, * fBadge, * fUploadBadge, * fDownloadBadge;
NSDictionary * fAttributes;
int fCompleted, fCompletedBadged;
BOOL fSpeedBadge;

View file

@ -23,6 +23,7 @@
*****************************************************************************/
#import "Badger.h"
#import "NSApplicationAdditions.h"
#import "NSStringAdditions.h"
#define COMPLETED_BOTTOM_PADDING 5.0
@ -62,7 +63,7 @@
- (void) updateBadge
{
//set completed badge to top right
BOOL completedChange = fCompleted != fCompletedBadged;
BOOL completedChange = [NSApp isOnLeopardOrBetter] && fCompleted != fCompletedBadged;
if (completedChange)
{
fCompletedBadged = fCompleted;
@ -183,6 +184,10 @@
- (void) incrementCompleted
{
fCompleted++;
if ([NSApp isOnLeopardOrBetter])
[[NSApp dockTile] setBadgeLabel: [NSString stringWithFormat: @"%d", fCompleted]];
else
[self updateBadge];
}
@ -191,6 +196,9 @@
if (fCompleted != 0)
{
fCompleted = 0;
if ([NSApp isOnLeopardOrBetter])
[[NSApp dockTile] setBadgeLabel: @""];
else
[self updateBadge];
}
}
@ -201,6 +209,8 @@
fCompletedBadged = 0;
fSpeedBadge = NO;
[NSApp setApplicationIconImage: [NSImage imageNamed: @"NSApplicationIcon"]];
if ([NSApp isOnLeopardOrBetter])
[[NSApp dockTile] setBadgeLabel: @""];
}
@end