From a975fad0c754d435cc85504da7cea5f82ed5ffd6 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Mon, 8 Aug 2011 03:24:23 +0000 Subject: [PATCH] The Mac UI's "check for stalled transfers" feature now uses the libtransmission hooks --- macosx/Controller.m | 1 + macosx/PrefsController.m | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/macosx/Controller.m b/macosx/Controller.m index 09bc0bf4d..976bd52b9 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -306,6 +306,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy tr_bencDictAddBool(&settings, TR_PREFS_KEY_PEX_ENABLED, [fDefaults boolForKey: @"PEXGlobal"]); tr_bencDictAddBool(&settings, TR_PREFS_KEY_PORT_FORWARDING, [fDefaults boolForKey: @"NatTraversal"]); + tr_bencDictAddBool(&settings, TR_PREFS_KEY_QUEUE_STALLED_ENABLED, [fDefaults boolForKey: @"CheckStalled"]); tr_bencDictAddInt(&settings, TR_PREFS_KEY_QUEUE_STALLED_MINUTES, [fDefaults integerForKey: @"StalledMinutes"]); tr_bencDictAddReal(&settings, TR_PREFS_KEY_RATIO, [fDefaults floatForKey: @"RatioLimit"]); tr_bencDictAddBool(&settings, TR_PREFS_KEY_RATIO_ENABLED, [fDefaults boolForKey: @"RatioCheck"]); diff --git a/macosx/PrefsController.m b/macosx/PrefsController.m index a3443ccd6..a8fd72604 100644 --- a/macosx/PrefsController.m +++ b/macosx/PrefsController.m @@ -772,6 +772,7 @@ tr_session * fHandle; tr_sessionSetQueueEnabled(fHandle, TR_DOWN, [fDefaults boolForKey: @"Queue"]); tr_sessionSetQueueEnabled(fHandle, TR_UP, [fDefaults boolForKey: @"QueueSeed"]); + #warning any of these "UpdateQueue" needed? [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateQueue" object: self]; } @@ -789,7 +790,11 @@ tr_session * fHandle; - (void) setStalled: (id) sender { -#warning do something here + tr_sessionSetQueueStalledEnabled(fHandle, [fDefaults boolForKey: @"CheckStalled"]); + + //reload main table for stalled status + #warning redundant? + [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateUI" object: nil]; [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateQueue" object: self]; } @@ -1255,6 +1260,9 @@ tr_session * fHandle; const int seedQueueNum = tr_sessionGetQueueSize(fHandle, TR_UP); [fDefaults setInteger: seedQueueNum forKey: @"QueueSeedNumber"]; + const BOOL checkStalled = tr_sessionGetQueueStalledEnabled(fHandle); + [fDefaults setBool: checkStalled forKey: @"CheckStalled"]; + const int stalledMinutes = tr_sessionGetQueueStalledMinutes(fHandle); [fDefaults setInteger: stalledMinutes forKey: @"StalledMinutes"]; @@ -1315,6 +1323,7 @@ tr_session * fHandle; [fQueueDownloadField setIntValue: downloadQueueNum]; [fQueueSeedField setIntValue: seedQueueNum]; + //check stalled handled by bindings [fStalledField setIntValue: stalledMinutes]; }