From 72a733726670f2875976dca7cb0e10b825a19f69 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Fri, 26 Mar 2010 02:28:41 +0000 Subject: [PATCH] #1295 Sync "Start when added" with libtransmission --- macosx/Controller.m | 2 ++ macosx/PrefsController.h | 2 ++ macosx/PrefsController.m | 9 +++++++ macosx/en.lproj/PrefsWindow.xib | 43 ++++++++++++--------------------- 4 files changed, 29 insertions(+), 27 deletions(-) diff --git a/macosx/Controller.m b/macosx/Controller.m index 1e58b03c0..76d80ae4b 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -281,6 +281,8 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy [fDefaults objectForKey: @"SpeedLimitAutoOffDate"]]); tr_bencDictAddInt(&settings, TR_PREFS_KEY_ALT_SPEED_TIME_DAY, [fDefaults integerForKey: @"SpeedLimitAutoDay"]); + tr_bencDictAddBool(&settings, TR_PREFS_KEY_START, [fDefaults boolForKey: @"AutoStartDownload"]); + tr_bencDictAddInt(&settings, TR_PREFS_KEY_DSPEED, [fDefaults integerForKey: @"DownloadLimit"]); tr_bencDictAddBool(&settings, TR_PREFS_KEY_DSPEED_ENABLED, [fDefaults boolForKey: @"CheckDownload"]); tr_bencDictAddInt(&settings, TR_PREFS_KEY_USPEED, [fDefaults integerForKey: @"UploadLimit"]); diff --git a/macosx/PrefsController.h b/macosx/PrefsController.h index 834ee2fb3..ae2aafd2c 100644 --- a/macosx/PrefsController.h +++ b/macosx/PrefsController.h @@ -92,6 +92,8 @@ - (void) setBlocklistAutoUpdate: (id) sender; - (void) updateBlocklistFields; +- (void) setAutoStartDownloads: (id) sender; + - (void) setBadge: (id) sender; - (void) resetWarnings: (id) sender; diff --git a/macosx/PrefsController.m b/macosx/PrefsController.m index f4cc66b64..7afb7d769 100644 --- a/macosx/PrefsController.m +++ b/macosx/PrefsController.m @@ -556,6 +556,11 @@ tr_session * fHandle; NSLocalizedString(@"Last updated", "Prefs -> blocklist -> message"), updatedDateString]]; } +- (void) setAutoStartDownloads: (id) sender +{ + tr_sessionSetPaused(fHandle, ![fDefaults boolForKey: @"AutoStartDownload"]); +} + - (void) applySpeedSettings: (id) sender { tr_sessionLimitSpeed(fHandle, TR_UP, [fDefaults boolForKey: @"CheckUpload"]); @@ -1142,6 +1147,10 @@ tr_session * fHandle; const BOOL dht = tr_sessionIsDHTEnabled(fHandle); [fDefaults setBool: dht forKey: @"DHTGlobal"]; + //auto start + const BOOL autoStart = !tr_sessionGetPaused(fHandle); + [fDefaults setBool: autoStart forKey: @"AutoStartDownload"]; + //port const tr_port port = tr_sessionGetPeerPort(fHandle); [fDefaults setInteger: port forKey: @"BindPort"]; diff --git a/macosx/en.lproj/PrefsWindow.xib b/macosx/en.lproj/PrefsWindow.xib index 4af32d10e..1627309e5 100644 --- a/macosx/en.lproj/PrefsWindow.xib +++ b/macosx/en.lproj/PrefsWindow.xib @@ -12,7 +12,7 @@ YES - + YES @@ -1944,6 +1944,7 @@ AAC/05GAAAAAAAAAAAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlLCBJbmMuLCAyMDEwAA {{1, 1}, {141, 169}} + 4 @@ -1971,6 +1972,7 @@ AAC/05GAAAAAAAAAAAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlLCBJbmMuLCAyMDEwAA {{20, 49}, {143, 171}} + 530 @@ -2240,7 +2242,7 @@ AAC/05GAAAAAAAAAAAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlLCBJbmMuLCAyMDEwAANSView - + 256 YES @@ -2249,7 +2251,6 @@ AAC/05GAAAAAAAAAAAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlLCBJbmMuLCAyMDEwAA256 {{302, 185}, {50, 22}} - YES -1804468671 @@ -2312,7 +2313,6 @@ AAC/05GAAAAAAAAAAAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlLCBJbmMuLCAyMDEwAA256 {{178, 160}, {100, 18}} - YES 67239424 @@ -2335,7 +2335,6 @@ AAC/05GAAAAAAAAAAAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlLCBJbmMuLCAyMDEwAA256 {{302, 159}, {50, 22}} - YES -1804468671 @@ -2398,7 +2397,6 @@ AAC/05GAAAAAAAAAAAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlLCBJbmMuLCAyMDEwAA256 {{178, 186}, {118, 18}} - YES 67239424 @@ -2421,7 +2419,6 @@ AAC/05GAAAAAAAAAAAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlLCBJbmMuLCAyMDEwAA256 {{357, 186}, {34, 17}} - YES 67239424 @@ -2438,7 +2435,6 @@ AAC/05GAAAAAAAAAAAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlLCBJbmMuLCAyMDEwAA256 {{357, 160}, {34, 17}} - YES 67239424 @@ -2455,7 +2451,6 @@ AAC/05GAAAAAAAAAAAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlLCBJbmMuLCAyMDEwAA256 {{17, 187}, {158, 17}} - YES 67239424 @@ -2472,7 +2467,6 @@ AAC/05GAAAAAAAAAAAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlLCBJbmMuLCAyMDEwAA256 {{302, 117}, {50, 22}} - YES -1804468671 @@ -2535,7 +2529,6 @@ AAC/05GAAAAAAAAAAAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlLCBJbmMuLCAyMDEwAA256 {{302, 91}, {50, 22}} - YES -1804468671 @@ -2598,7 +2591,6 @@ AAC/05GAAAAAAAAAAAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlLCBJbmMuLCAyMDEwAA256 {{357, 118}, {34, 17}} - YES 67239424 @@ -2615,7 +2607,6 @@ AAC/05GAAAAAAAAAAAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlLCBJbmMuLCAyMDEwAA256 {{357, 92}, {34, 17}} - YES 67239424 @@ -2632,7 +2623,6 @@ AAC/05GAAAAAAAAAAAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlLCBJbmMuLCAyMDEwAA256 {{53, 119}, {122, 17}} - YES 67239424 @@ -2649,7 +2639,6 @@ AAC/05GAAAAAAAAAAAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlLCBJbmMuLCAyMDEwAA256 {{177, 93}, {82, 17}} - YES 67239424 @@ -2666,7 +2655,6 @@ AAC/05GAAAAAAAAAAAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlLCBJbmMuLCAyMDEwAA256 {{177, 119}, {100, 17}} - YES 67239424 @@ -2683,7 +2671,6 @@ AAC/05GAAAAAAAAAAAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlLCBJbmMuLCAyMDEwAA256 {{177, 73}, {348, 14}} - YES 67239424 @@ -2712,7 +2699,6 @@ AAC/05GAAAAAAAAAAAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlLCBJbmMuLCAyMDEwAA {{35, 119}, {20, 14}} - YES 130560 @@ -2733,7 +2719,6 @@ AAC/05GAAAAAAAAAAAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlLCBJbmMuLCAyMDEwAA256 {{178, 49}, {160, 18}} - YES 67239424 @@ -2756,7 +2741,6 @@ AAC/05GAAAAAAAAAAAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlLCBJbmMuLCAyMDEwAA256 {{402, 23}, {17, 17}} - YES 67239424 @@ -2773,7 +2757,6 @@ AAC/05GAAAAAAAAAAAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlLCBJbmMuLCAyMDEwAA256 {{314, 20}, {86, 27}} - YES 71433728 @@ -2822,7 +2805,6 @@ AAABAAAAAQ 256 {{424, 20}, {86, 27}} - YES 71433728 @@ -2845,7 +2827,6 @@ AAABAAAAAQ 256 {{196, 17}, {113, 26}} - YES -2076049856 @@ -3008,8 +2989,6 @@ AAABAAAAAQ {542, 227} - - NSView NSResponder @@ -7899,6 +7878,14 @@ AAABAAAAAQ 1944 + + + setAutoStartDownloads: + + + + 1946 + @@ -11796,7 +11783,7 @@ AAABAAAAAQ com.apple.InterfaceBuilder.CocoaPlugin - {{333, 387}, {542, 307}} + {{333, 401}, {542, 307}} com.apple.InterfaceBuilder.CocoaPlugin {{429, 310}, {539, 288}} @@ -11914,7 +11901,7 @@ AAABAAAAAQ - 1944 + 1946 @@ -12078,6 +12065,7 @@ AAABAAAAAQ setAutoSpeedLimit: setAutoSpeedLimitDay: setAutoSpeedLimitTime: + setAutoStartDownloads: setAutoUpdateToBeta: setBadge: setBlocklistAutoUpdate: @@ -12176,6 +12164,7 @@ AAABAAAAAQ id id id + id