Changeset 10861 for trunk/macosx/Torrent.m
- Timestamp:
- Jun 25, 2010, 10:19:28 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/Torrent.m
r10832 r10861 44 44 index: (NSInteger) index flatList: (NSMutableArray *) flatFileList; 45 45 46 - (void) completenessChange: (NS Number *) status;46 - (void) completenessChange: (NSDictionary *) statusInfo; 47 47 - (void) ratioLimitHit; 48 48 - (void) metadataRetrieved; … … 54 54 @end 55 55 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]; 56 void 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]; 60 61 } 61 62 … … 1744 1745 1745 1746 //status has been retained 1746 - (void) completenessChange: (NS Number *) status1747 - (void) completenessChange: (NSDictionary *) statusInfo 1747 1748 { 1748 1749 fStat = tr_torrentStat(fHandle); //don't call update yet to avoid auto-stop 1749 1750 1750 switch ([ statusintValue])1751 switch ([[statusInfo objectForKey: @"Status"] intValue]) 1751 1752 { 1752 1753 case TR_SEED: 1753 1754 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"]]; 1755 1758 break; 1756 1759 … … 1759 1762 break; 1760 1763 } 1761 [status release];1764 [statusInfo release]; 1762 1765 1763 1766 [self update];
Note: See TracChangeset
for help on using the changeset viewer.