mirror of
https://github.com/transmission/transmission
synced 2025-03-16 16:55:36 +00:00
#3320 When a download completes at the same time seeding completes, still show a Growl notification and play a sound
This commit is contained in:
parent
4094dc2544
commit
746f02fc02
2 changed files with 16 additions and 16 deletions
|
@ -1888,7 +1888,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
{
|
||||
Torrent * torrent = [notification object];
|
||||
|
||||
if ([torrent isActive])
|
||||
if ([[[notification userInfo] objectForKey: @"WasRunning"] boolValue])
|
||||
{
|
||||
if (!fSoundPlaying && [fDefaults boolForKey: @"PlayDownloadSound"])
|
||||
{
|
||||
|
@ -1918,7 +1918,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
[[NSDistributedNotificationCenter defaultCenter] postNotificationName: @"com.apple.DownloadFileFinished"
|
||||
object: [torrent dataLocation]];
|
||||
|
||||
if ([fDefaults boolForKey: @"QueueSeed"] && [self numToStartFromQueue: NO] == 0)
|
||||
if ([torrent isActive] && [fDefaults boolForKey: @"QueueSeed"] && [self numToStartFromQueue: NO] == 0)
|
||||
{
|
||||
[torrent stopTransfer];
|
||||
[torrent setWaitToStart: YES];
|
||||
|
@ -1931,13 +1931,10 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
- (void) torrentRestartedDownloading: (NSNotification *) notification
|
||||
{
|
||||
Torrent * torrent = [notification object];
|
||||
if ([torrent isActive])
|
||||
if ([torrent isActive] && [fDefaults boolForKey: @"Queue"] && [self numToStartFromQueue: YES] == 0)
|
||||
{
|
||||
if ([fDefaults boolForKey: @"Queue"] && [self numToStartFromQueue: YES] == 0)
|
||||
{
|
||||
[torrent stopTransfer];
|
||||
[torrent setWaitToStart: YES];
|
||||
}
|
||||
[torrent stopTransfer];
|
||||
[torrent setWaitToStart: YES];
|
||||
}
|
||||
|
||||
[self updateTorrentsInQueue];
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
- (void) insertPath: (NSMutableArray *) components forParent: (FileListNode *) parent fileSize: (uint64_t) size
|
||||
index: (NSInteger) index flatList: (NSMutableArray *) flatFileList;
|
||||
|
||||
- (void) completenessChange: (NSNumber *) status;
|
||||
- (void) completenessChange: (NSDictionary *) statusInfo;
|
||||
- (void) ratioLimitHit;
|
||||
- (void) metadataRetrieved;
|
||||
|
||||
|
@ -53,10 +53,11 @@
|
|||
|
||||
@end
|
||||
|
||||
void completenessChangeCallback(tr_torrent * torrent, tr_completeness status, void * torrentData)
|
||||
void completenessChangeCallback(tr_torrent * torrent, tr_completeness status, tr_bool wasRunning, void * torrentData)
|
||||
{
|
||||
[(Torrent *)torrentData performSelectorOnMainThread: @selector(completenessChange:)
|
||||
withObject: [[NSNumber alloc] initWithInt: status] waitUntilDone: NO];
|
||||
NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithInt: status], @"Status",
|
||||
[NSNumber numberWithBool: wasRunning], @"WasRunning", nil];
|
||||
[(Torrent *)torrentData performSelectorOnMainThread: @selector(completenessChange:) withObject: dict waitUntilDone: NO];
|
||||
}
|
||||
|
||||
void ratioLimitHitCallback(tr_torrent * torrent, void * torrentData)
|
||||
|
@ -1743,22 +1744,24 @@ int trashDataFile(const char * filename)
|
|||
}
|
||||
|
||||
//status has been retained
|
||||
- (void) completenessChange: (NSNumber *) status
|
||||
- (void) completenessChange: (NSDictionary *) statusInfo
|
||||
{
|
||||
fStat = tr_torrentStat(fHandle); //don't call update yet to avoid auto-stop
|
||||
|
||||
switch ([status intValue])
|
||||
switch ([[statusInfo objectForKey: @"Status"] intValue])
|
||||
{
|
||||
case TR_SEED:
|
||||
case TR_PARTIAL_SEED:
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentFinishedDownloading" object: self];
|
||||
//simpler to create a new dictionary than to use statusInfo - avoids retention chicanery
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentFinishedDownloading" object: self
|
||||
userInfo: [NSDictionary dictionaryWithObject: [statusInfo objectForKey: @"WasRunning"] forKey: @"WasRunning"]];
|
||||
break;
|
||||
|
||||
case TR_LEECH:
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentRestartedDownloading" object: self];
|
||||
break;
|
||||
}
|
||||
[status release];
|
||||
[statusInfo release];
|
||||
|
||||
[self update];
|
||||
[self updateTimeMachineExclude];
|
||||
|
|
Loading…
Add table
Reference in a new issue