1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 17:17:31 +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

@ -28,8 +28,9 @@
@interface Badger : NSObject
{
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,7 +184,11 @@
- (void) incrementCompleted
{
fCompleted++;
[self updateBadge];
if ([NSApp isOnLeopardOrBetter])
[[NSApp dockTile] setBadgeLabel: [NSString stringWithFormat: @"%d", fCompleted]];
else
[self updateBadge];
}
- (void) clearCompleted
@ -191,7 +196,10 @@
if (fCompleted != 0)
{
fCompleted = 0;
[self updateBadge];
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