diff --git a/macosx/Controller.m b/macosx/Controller.m
index 491808722..98502c771 100644
--- a/macosx/Controller.m
+++ b/macosx/Controller.m
@@ -1881,15 +1881,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
- (void) torrentFinishedSeeding: (NSNotification *) notification
{
- Torrent * torrent = [notification object];
-
- [self fullUpdateUI];
-
- if ([[fTableView selectedTorrents] containsObject: torrent])
- {
- [fInfoController updateInfoStats];
- [fInfoController updateOptions];
- }
+ Torrent * torrent = [[notification object] retain];
if (!fSoundPlaying && [fDefaults boolForKey: @"PlaySeedingSound"])
{
@@ -1909,8 +1901,24 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[clickContext setObject: location forKey: @"Location"];
[GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Seeding Complete", "Growl notification title")
- description: [torrent name] notificationName: GROWL_SEEDING_COMPLETE
- iconData: nil priority: 0 isSticky: NO clickContext: clickContext];
+ description: [torrent name] notificationName: GROWL_SEEDING_COMPLETE
+ iconData: nil priority: 0 isSticky: NO clickContext: clickContext];
+
+ //removing for the list calls fullUpdateUI
+ if ([torrent removeWhenFinishSeeding])
+ [self confirmRemoveTorrents: [[NSArray arrayWithObject: torrent] retain] deleteData: NO];
+ else
+ {
+ [self fullUpdateUI];
+
+ if ([[fTableView selectedTorrents] containsObject: torrent])
+ {
+ [fInfoController updateInfoStats];
+ [fInfoController updateOptions];
+ }
+ }
+
+ [torrent release];
}
- (void) updateTorrentHistory
diff --git a/macosx/Defaults.plist b/macosx/Defaults.plist
index 396178673..bb95ad603 100644
--- a/macosx/Defaults.plist
+++ b/macosx/Defaults.plist
@@ -128,6 +128,8 @@
RatioLimit
2
+ RemoveWhenFinishSeeding
+
RenamePartialFiles
RPC
diff --git a/macosx/InfoOptionsViewController.h b/macosx/InfoOptionsViewController.h
index bfd22c490..7ad51638a 100644
--- a/macosx/InfoOptionsViewController.h
+++ b/macosx/InfoOptionsViewController.h
@@ -32,7 +32,7 @@
BOOL fSet;
IBOutlet NSPopUpButton * fPriorityPopUp, * fRatioPopUp, * fIdlePopUp;
- IBOutlet NSButton * fUploadLimitCheck, * fDownloadLimitCheck, * fGlobalLimitCheck;
+ IBOutlet NSButton * fUploadLimitCheck, * fDownloadLimitCheck, * fGlobalLimitCheck, * fRemoveSeedingCompleteCheck;
IBOutlet NSTextField * fUploadLimitField, * fDownloadLimitField, * fRatioLimitField, * fIdleLimitField,
* fUploadLimitLabel, * fDownloadLimitLabel, * fIdleLimitLabel,
* fRatioLimitGlobalLabel, * fIdleLimitGlobalLabel,
@@ -45,18 +45,20 @@
- (void) updateInfo;
- (void) updateOptions;
-- (void) setUseSpeedLimit: (id) sender;
-- (void) setSpeedLimit: (id) sender;
-- (void) setUseGlobalSpeedLimit: (id) sender;
+- (IBAction) setUseSpeedLimit: (id) sender;
+- (IBAction) setSpeedLimit: (id) sender;
+- (IBAction) setUseGlobalSpeedLimit: (id) sender;
-- (void) setRatioSetting: (id) sender;
-- (void) setRatioLimit: (id) sender;
+- (IBAction) setRatioSetting: (id) sender;
+- (IBAction) setRatioLimit: (id) sender;
-- (void) setIdleSetting: (id) sender;
-- (void) setIdleLimit: (id) sender;
+- (IBAction) setIdleSetting: (id) sender;
+- (IBAction) setIdleLimit: (id) sender;
-- (void) setPriority: (id) sender;
+- (IBAction) setRemoveWhenSeedingCompletes: (id) sender;
-- (void) setPeersConnectLimit: (id) sender;
+- (IBAction) setPriority: (id) sender;
+
+- (IBAction) setPeersConnectLimit: (id) sender;
@end
diff --git a/macosx/InfoOptionsViewController.m b/macosx/InfoOptionsViewController.m
index f8ec8bd3f..3a7836a68 100644
--- a/macosx/InfoOptionsViewController.m
+++ b/macosx/InfoOptionsViewController.m
@@ -156,7 +156,8 @@
enumerator = [fTorrents objectEnumerator];
torrent = [enumerator nextObject]; //first torrent
- NSInteger checkRatio = [torrent ratioSetting], checkIdle = [torrent idleSetting];
+ NSInteger checkRatio = [torrent ratioSetting], checkIdle = [torrent idleSetting],
+ removeWhenFinishSeeding = [torrent removeWhenFinishSeeding] ? NSOnState : NSOffState;
CGFloat ratioLimit = [torrent ratioLimit];
NSUInteger idleLimit = [torrent idleLimitMinutes];
@@ -174,6 +175,9 @@
if (idleLimit != INVALID && idleLimit != [torrent idleLimitMinutes])
idleLimit = INVALID;
+
+ if (removeWhenFinishSeeding != NSMixedState && removeWhenFinishSeeding != ([torrent removeWhenFinishSeeding] ? NSOnState : NSOffState))
+ removeWhenFinishSeeding = NSMixedState;
}
//set ratio view
@@ -218,6 +222,10 @@
[fIdleLimitGlobalLabel setHidden: checkIdle != TR_IDLELIMIT_GLOBAL];
+ //set remove transfer when seeding finishes
+ [fRemoveSeedingCompleteCheck setState: removeWhenFinishSeeding];
+ [fRemoveSeedingCompleteCheck setEnabled: YES];
+
//get priority info
enumerator = [fTorrents objectEnumerator];
torrent = [enumerator nextObject]; //first torrent
@@ -407,6 +415,18 @@
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateOptionsNotification" object: self];
}
+- (IBAction) setRemoveWhenSeedingCompletes: (id) sender
+{
+ if ([(NSButton *)sender state] == NSMixedState)
+ [sender setState: NSOnState];
+ const BOOL enable = [(NSButton *)sender state] == NSOnState;
+
+ for (Torrent * torrent in fTorrents)
+ [torrent setRemoveWhenFinishSeeding: enable];
+
+ [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateOptionsNotification" object: self];
+}
+
- (void) setPriority: (id) sender
{
tr_priority_t priority;
@@ -503,6 +523,9 @@
[fIdleLimitLabel setHidden: YES];
[fIdleLimitGlobalLabel setHidden: YES];
+ [fRemoveSeedingCompleteCheck setEnabled: NO];
+ [fRemoveSeedingCompleteCheck setState: NSOffState];
+
[fPeersConnectField setEnabled: NO];
[fPeersConnectField setStringValue: @""];
[fPeersConnectLabel setEnabled: NO];
diff --git a/macosx/Torrent.h b/macosx/Torrent.h
index 93567b6d4..8db59584f 100644
--- a/macosx/Torrent.h
+++ b/macosx/Torrent.h
@@ -114,6 +114,8 @@
- (void) setMaxPeerConnect: (uint16_t) count;
- (uint16_t) maxPeerConnect;
+@property (nonatomic) BOOL removeWhenFinishSeeding;
+
- (BOOL) waitingToStart;
- (tr_priority_t) priority;
diff --git a/macosx/Torrent.m b/macosx/Torrent.m
index 99c1cce87..53b38c4e3 100644
--- a/macosx/Torrent.m
+++ b/macosx/Torrent.m
@@ -38,6 +38,7 @@
- (id) initWithPath: (NSString *) path hash: (NSString *) hashString torrentStruct: (tr_torrent *) torrentStruct
magnetAddress: (NSString *) magnetAddress lib: (tr_session *) lib
groupValue: (NSNumber *) groupValue
+ removeWhenFinishSeeding: (NSNumber *) removeWhenFinishSeeding
timeMachineExcludeLocation: (NSString *) timeMachineExclude
downloadFolder: (NSString *) downloadFolder
legacyIncompleteFolder: (NSString *) incompleteFolder;
@@ -102,11 +103,14 @@ int trashDataFile(const char * filename)
@implementation Torrent
+@synthesize removeWhenFinishSeeding = fRemoveWhenFinishSeeding;
+
- (id) initWithPath: (NSString *) path location: (NSString *) location deleteTorrentFile: (BOOL) torrentDelete
lib: (tr_session *) lib
{
self = [self initWithPath: path hash: nil torrentStruct: NULL magnetAddress: nil lib: lib
groupValue: nil
+ removeWhenFinishSeeding: nil
timeMachineExcludeLocation: nil
downloadFolder: location
legacyIncompleteFolder: nil];
@@ -123,6 +127,7 @@ int trashDataFile(const char * filename)
{
self = [self initWithPath: nil hash: nil torrentStruct: torrentStruct magnetAddress: nil lib: lib
groupValue: nil
+ removeWhenFinishSeeding: nil
timeMachineExcludeLocation: nil
downloadFolder: location
legacyIncompleteFolder: nil];
@@ -134,6 +139,7 @@ int trashDataFile(const char * filename)
{
self = [self initWithPath: nil hash: nil torrentStruct: nil magnetAddress: address
lib: lib groupValue: nil
+ removeWhenFinishSeeding: nil
timeMachineExcludeLocation: nil
downloadFolder: location legacyIncompleteFolder: nil];
@@ -148,6 +154,7 @@ int trashDataFile(const char * filename)
magnetAddress: nil
lib: lib
groupValue: [history objectForKey: @"GroupValue"]
+ removeWhenFinishSeeding: [history objectForKey: @"RemoveWhenFinishSeeding"]
timeMachineExcludeLocation: [history objectForKey: @"TimeMachineExcludeLocation"]
downloadFolder: [history objectForKey: @"DownloadFolder"] //upgrading from versions < 1.80
legacyIncompleteFolder: [[history objectForKey: @"UseIncompleteFolder"] boolValue] //upgrading from versions < 1.80
@@ -197,7 +204,8 @@ int trashDataFile(const char * filename)
[self hashString], @"TorrentHash",
[NSNumber numberWithBool: [self isActive]], @"Active",
[NSNumber numberWithBool: [self waitingToStart]], @"WaitToStart",
- [NSNumber numberWithInt: fGroupValue], @"GroupValue", nil];
+ [NSNumber numberWithInt: fGroupValue], @"GroupValue",
+ [NSNumber numberWithBool: fRemoveWhenFinishSeeding], @"RemoveWhenFinishSeeding", nil];
if (fTimeMachineExclude)
[history setObject: fTimeMachineExclude forKey: @"TimeMachineExcludeLocation"];
@@ -1611,6 +1619,7 @@ int trashDataFile(const char * filename)
- (id) initWithPath: (NSString *) path hash: (NSString *) hashString torrentStruct: (tr_torrent *) torrentStruct
magnetAddress: (NSString *) magnetAddress lib: (tr_session *) lib
groupValue: (NSNumber *) groupValue
+ removeWhenFinishSeeding: (NSNumber *) removeWhenFinishSeeding
timeMachineExcludeLocation: (NSString *) timeMachineExclude
downloadFolder: (NSString *) downloadFolder
legacyIncompleteFolder: (NSString *) incompleteFolder
@@ -1674,6 +1683,8 @@ int trashDataFile(const char * filename)
fGroupValue = groupValue ? [groupValue intValue] : [[GroupsController groups] groupIndexForTorrent: self];
+ fRemoveWhenFinishSeeding = removeWhenFinishSeeding ? [removeWhenFinishSeeding boolValue] : [fDefaults boolForKey: @"RemoveWhenFinishSeeding"];
+
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(checkGroupValueForRemoval:)
name: @"GroupValueRemoved" object: nil];
diff --git a/macosx/en.lproj/InfoOptionsView.xib b/macosx/en.lproj/InfoOptionsView.xib
index e5ba0c20f..aa41962f3 100644
--- a/macosx/en.lproj/InfoOptionsView.xib
+++ b/macosx/en.lproj/InfoOptionsView.xib
@@ -2,13 +2,13 @@
1060
- 11D50
- 2177
- 1138.32
- 568.00
+ 11E53
+ 2182
+ 1138.47
+ 569.00
NSTextField
@@ -47,7 +47,7 @@
- {321, 241}
+ {321, 258}
@@ -1160,6 +1183,30 @@
112
+
+
+
+ fRemoveSeedingCompleteCheck
+
+
+
+ 118
+
+
+
+ setRemoveWhenSeedingCompletes:
+
+
+
+ 119
+
delegate
@@ -1256,6 +1303,7 @@
+
Options
@@ -1709,6 +1757,19 @@
+
+ 113
+
+
+
+
+
+
+
+ 114
+
+
+
@@ -1722,6 +1783,8 @@
ColorTextField
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
+ com.apple.InterfaceBuilder.CocoaPlugin
+ com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
@@ -1797,7 +1860,7 @@
- 112
+ 119
@@ -1812,6 +1875,60 @@
InfoOptionsViewController
NSViewController
+
+ id
+ id
+ id
+ id
+ id
+ id
+ id
+ id
+ id
+ id
+
+
+
+ setIdleLimit:
+ id
+
+
+ setIdleSetting:
+ id
+
+
+ setPeersConnectLimit:
+ id
+
+
+ setPriority:
+ id
+
+
+ setRatioLimit:
+ id
+
+
+ setRatioSetting:
+ id
+
+
+ setRemoveWhenSeedingCompletes:
+ id
+
+
+ setSpeedLimit:
+ id
+
+
+ setUseGlobalSpeedLimit:
+ id
+
+
+ setUseSpeedLimit:
+ id
+
+
NSButton
NSTextField
@@ -1827,6 +1944,7 @@
NSTextField
NSTextField
NSPopUpButton
+ NSButton
NSButton
NSTextField
NSTextField
@@ -1888,6 +2006,10 @@
fRatioPopUp
NSPopUpButton
+
+ fRemoveSeedingCompleteCheck
+ NSButton
+
fUploadLimitCheck
NSButton