clicking on download/seeding complete growl notifications will reveal in finder

This commit is contained in:
Mitchell Livingston 2007-02-11 23:38:36 +00:00
parent c9d2f7005c
commit 595763c344
2 changed files with 23 additions and 6 deletions

View File

@ -1306,9 +1306,11 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
[sound play];
}
NSDictionary * clickContext = [NSDictionary dictionaryWithObjectsAndKeys: GROWL_DOWNLOAD_COMPLETE, @"Type",
[torrent dataLocation] , @"Location", nil];
[GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Download Complete", "Growl notification title")
description: [torrent name]
notificationName: GROWL_DOWNLOAD_COMPLETE iconData: nil priority: 0 isSticky: NO clickContext: nil];
description: [torrent name] notificationName: GROWL_DOWNLOAD_COMPLETE
iconData: nil priority: 0 isSticky: NO clickContext: clickContext];
if (![fWindow isKeyWindow])
fCompleted++;
@ -1731,6 +1733,8 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
- (void) torrentStoppedForRatio: (NSNotification *) notification
{
Torrent * torrent = [notification object];
[self updateTorrentsInQueue];
[fInfoController updateInfoStats];
@ -1741,9 +1745,11 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
[sound play];
}
NSDictionary * clickContext = [NSDictionary dictionaryWithObjectsAndKeys: GROWL_SEEDING_COMPLETE, @"Type",
[torrent dataLocation], @"Location", nil];
[GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Seeding Complete", "Growl notification title")
description: [[notification object] name]
notificationName: GROWL_SEEDING_COMPLETE iconData: nil priority: 0 isSticky: NO clickContext: nil];
description: [torrent name] notificationName: GROWL_SEEDING_COMPLETE
iconData: nil priority: 0 isSticky: NO clickContext: clickContext];
}
-(void) watcher: (id<UKFileWatcher>) watcher receivedNotification: (NSString *) notification forPath: (NSString *) path
@ -2742,4 +2748,15 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
notifications, GROWL_NOTIFICATIONS_DEFAULT, nil];
}
- (void) growlNotificationWasClicked: (id) clickContext
{
if (!clickContext || ![clickContext isKindOfClass: [NSDictionary class]])
return;
NSString * type = [clickContext objectForKey: @"Type"], * location;
if (([type isEqualToString: GROWL_DOWNLOAD_COMPLETE] || [type isEqualToString: GROWL_SEEDING_COMPLETE])
&& (location = [clickContext objectForKey: @"Location"]))
[[NSWorkspace sharedWorkspace] selectFile: location inFileViewerRootedAtPath: nil];
}
@end

View File

@ -325,8 +325,8 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
[fStatusString appendFormat: NSLocalizedString(@"Downloading from %d of %d peers",
"Torrent -> status string"), [self peersUploading], [self totalPeers]];
else
[fStatusString appendFormat: NSLocalizedString(@"Downloading from %d of %d peer",
"Torrent -> status string"), [self peersUploading], [self totalPeers]];
[fStatusString appendFormat: NSLocalizedString(@"Downloading from %d of 1 peer",
"Torrent -> status string"), [self peersUploading]];
[fRemainingTimeString setString: @""];
int eta = [self eta];