Ignore:
Timestamp:
Jun 25, 2010, 10:19:28 PM (12 years ago)
Author:
livings124
Message:

#3320 When a download completes at the same time seeding completes, still show a Growl notification and play a sound

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Torrent.m

    r10832 r10861  
    4444    index: (NSInteger) index flatList: (NSMutableArray *) flatFileList;
    4545
    46 - (void) completenessChange: (NSNumber *) status;
     46- (void) completenessChange: (NSDictionary *) statusInfo;
    4747- (void) ratioLimitHit;
    4848- (void) metadataRetrieved;
     
    5454@end
    5555
    56 void completenessChangeCallback(tr_torrent * torrent, tr_completeness status, void * torrentData)
    57 {
    58     [(Torrent *)torrentData performSelectorOnMainThread: @selector(completenessChange:)
    59         withObject: [[NSNumber alloc] initWithInt: status] waitUntilDone: NO];
     56void completenessChangeCallback(tr_torrent * torrent, tr_completeness status, tr_bool wasRunning, void * torrentData)
     57{
     58    NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithInt: status], @"Status",
     59                            [NSNumber numberWithBool: wasRunning], @"WasRunning", nil];
     60    [(Torrent *)torrentData performSelectorOnMainThread: @selector(completenessChange:) withObject: dict waitUntilDone: NO];
    6061}
    6162
     
    17441745
    17451746//status has been retained
    1746 - (void) completenessChange: (NSNumber *) status
     1747- (void) completenessChange: (NSDictionary *) statusInfo
    17471748{
    17481749    fStat = tr_torrentStat(fHandle); //don't call update yet to avoid auto-stop
    17491750   
    1750     switch ([status intValue])
     1751    switch ([[statusInfo objectForKey: @"Status"] intValue])
    17511752    {
    17521753        case TR_SEED:
    17531754        case TR_PARTIAL_SEED:
    1754             [[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentFinishedDownloading" object: self];
     1755            //simpler to create a new dictionary than to use statusInfo - avoids retention chicanery
     1756            [[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentFinishedDownloading" object: self
     1757                userInfo: [NSDictionary dictionaryWithObject: [statusInfo objectForKey: @"WasRunning"] forKey: @"WasRunning"]];
    17551758            break;
    17561759       
     
    17591762            break;
    17601763    }
    1761     [status release];
     1764    [statusInfo release];
    17621765   
    17631766    [self update];
Note: See TracChangeset for help on using the changeset viewer.