From: Mitchell Livingston Date: Sun, 13 Feb 2011 02:02:13 +0000 (+0000) Subject: Add option to remove completed transfers X-Git-Tag: 2.30b1~370 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9348605f03abbdf8853d4f9d69e57e81f346e828;p=transmission Add option to remove completed transfers --- diff --git a/macosx/Controller.h b/macosx/Controller.h index ef130c3e6..edcd744ba 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -156,6 +156,8 @@ typedef enum - (void) removeNoDelete: (id) sender; - (void) removeDeleteData: (id) sender; +- (void) clearCompleted: (id) sender; + - (void) moveDataFilesSelected: (id) sender; - (void) moveDataFiles: (NSArray *) torrents; - (void) moveDataFileChoiceClosed: (NSOpenPanel *) panel returnCode: (NSInteger) code contextInfo: (NSArray *) torrents; diff --git a/macosx/Controller.m b/macosx/Controller.m index 9b72d4c03..c8ecc90ee 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -1324,10 +1324,10 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy - (void) removeTorrents: (NSArray *) torrents deleteData: (BOOL) deleteData { [torrents retain]; - NSInteger active = 0, downloading = 0; if ([fDefaults boolForKey: @"CheckRemove"]) { + NSInteger active = 0, downloading = 0; for (Torrent * torrent in torrents) if ([torrent isActive]) { @@ -1433,6 +1433,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy [torrent closeRemoveTorrent: deleteData]; } + #warning why do we need them retained? [torrents release]; [fTableView deselectAll: nil]; @@ -1450,6 +1451,17 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy [self removeTorrents: [fTableView selectedTorrents] deleteData: YES]; } +- (void) clearCompleted: (id) sender +{ + NSMutableArray * torrents = [[NSMutableArray alloc] init]; + + for (Torrent * torrent in fTorrents) + if ([torrent isFinishedSeeding]) + [torrents addObject: torrent]; + + [self confirmRemoveTorrents: torrents deleteData: NO]; +} + - (void) moveDataFilesSelected: (id) sender { [self moveDataFiles: [fTableView selectedTorrents]]; @@ -3902,6 +3914,15 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy return canUseTable && [fTableView numberOfSelectedRows] > 0; } + + //clear completed transfers item + if (action == @selector(clearCompleted:)) + { + for (Torrent * torrent in fTorrents) + if ([torrent isFinishedSeeding]) + return YES; + return NO; + } //enable pause all item if (action == @selector(stopAllTorrents:)) diff --git a/macosx/en.lproj/MainMenu.xib b/macosx/en.lproj/MainMenu.xib index 32149c210..488379e62 100644 --- a/macosx/en.lproj/MainMenu.xib +++ b/macosx/en.lproj/MainMenu.xib @@ -12,6 +12,9 @@ YES + + + YES @@ -45,7 +48,7 @@ {1.79769e+308, 1.79769e+308} {350, 5} - + 256 YES @@ -738,6 +741,7 @@ AAAAAAAAAAAAAAAAA {515, 248} + {{0, 0}, {1680, 1028}} {350, 27} @@ -1611,7 +1615,7 @@ AAAAAAAAAAAAAAAAA - + YES YES @@ -1640,6 +1644,25 @@ AAAAAAAAAAAAAAAAA + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Clear Completed + + 2147483647 + + + @@ -4870,6 +4893,14 @@ AAAAAAAAAAAAAAAAA 3406 + + + clearCompleted: + + + + 3409 + @@ -5442,12 +5473,14 @@ AAAAAAAAAAAAAAAAA - + + + @@ -5521,11 +5554,6 @@ AAAAAAAAAAAAAAAAA - - 1805 - - - 1860 @@ -6877,6 +6905,21 @@ AAAAAAAAAAAAAAAAA + + 3407 + + + + + 3408 + + + + + 1805 + + + @@ -7424,6 +7467,9 @@ AAAAAAAAAAAAAAAAA 3403.ImportedFromIB2 3405.IBPluginDependency 3405.ImportedFromIB2 + 3407.IBPluginDependency + 3408.IBPluginDependency + 3408.ImportedFromIB2 418.IBPluginDependency 418.ImportedFromIB2 456.IBEditorWindowLastContentRect @@ -7453,6 +7499,7 @@ AAAAAAAAAAAAAAAAA 582.ImportedFromIB2 583.IBPluginDependency 583.ImportedFromIB2 + 589.IBEditorWindowLastContentRect 589.IBPluginDependency 589.ImportedFromIB2 589.editorWindowContentRectSynchronizationRect @@ -7554,7 +7601,7 @@ AAAAAAAAAAAAAAAAA com.apple.InterfaceBuilder.CocoaPlugin - {{637, 548}, {290, 333}} + {{468, 378}, {290, 363}} com.apple.InterfaceBuilder.CocoaPlugin {{446, 528}, {293, 373}} @@ -7908,7 +7955,7 @@ AAAAAAAAAAAAAAAAA com.apple.InterfaceBuilder.CocoaPlugin - {{71, 664}, {479, 20}} + {{203, 741}, {479, 20}} com.apple.InterfaceBuilder.CocoaPlugin {{468, 888}, {479, 20}} @@ -8023,6 +8070,9 @@ AAAAAAAAAAAAAAAAA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin {{586, 242}, {291, 313}} com.apple.InterfaceBuilder.CocoaPlugin @@ -8051,6 +8101,7 @@ AAAAAAAAAAAAAAAAA com.apple.InterfaceBuilder.CocoaPlugin + {{0, 902}, {231, 93}} com.apple.InterfaceBuilder.CocoaPlugin {{0, 902}, {234, 93}} @@ -8092,7 +8143,7 @@ AAAAAAAAAAAAAAAAA - 3406 + 3409 @@ -8107,6 +8158,7 @@ AAAAAAAAAAAAAAAAA allToolbarClicked: announceSelectedTorrents: applyFilter: + clearCompleted: copyMagnetLinks: copyTorrentFiles: createFile: @@ -8213,6 +8265,7 @@ AAAAAAAAAAAAAAAAA id id id + id @@ -8222,6 +8275,7 @@ AAAAAAAAAAAAAAAAA allToolbarClicked: announceSelectedTorrents: applyFilter: + clearCompleted: copyMagnetLinks: copyTorrentFiles: createFile: @@ -8287,6 +8341,10 @@ AAAAAAAAAAAAAAAAA applyFilter: id + + clearCompleted: + id + copyMagnetLinks: id