From: Mitchell Livingston Date: Sun, 31 Oct 2010 19:24:26 +0000 (+0000) Subject: use the last attempted update of the blocklist for scheduling weekly updates X-Git-Tag: 2.12~40 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c124077ccef0f43cf1af0a0d2e482e30c7c800ab;p=transmission use the last attempted update of the blocklist for scheduling weekly updates --- diff --git a/macosx/BlocklistDownloader.m b/macosx/BlocklistDownloader.m index 31ab833a0..e7311cabc 100644 --- a/macosx/BlocklistDownloader.m +++ b/macosx/BlocklistDownloader.m @@ -119,6 +119,7 @@ BlocklistDownloader * fDownloader = nil; { [fViewController setFailed: [error localizedDescription]]; + [[NSUserDefaults standardUserDefaults] setObject: [NSDate date] forKey: @"BlocklistNewLastUpdate"]; [[BlocklistScheduler scheduler] updateSchedule]; fDownloader = nil; @@ -171,7 +172,9 @@ BlocklistDownloader * fDownloader = nil; "blocklist fail message")]; //update last updated date for schedule - [[NSUserDefaults standardUserDefaults] setObject: [NSDate date] forKey: @"BlocklistLastUpdate"]; + NSDate * date = [NSDate date]; + [[NSUserDefaults standardUserDefaults] setObject: date forKey: @"BlocklistNewLastUpdate"]; + [[NSUserDefaults standardUserDefaults] setObject: date forKey: @"BlocklistNewLastUpdateSuccess"]; [[BlocklistScheduler scheduler] updateSchedule]; [[NSNotificationCenter defaultCenter] postNotificationName: @"BlocklistUpdated" object: nil]; diff --git a/macosx/BlocklistScheduler.m b/macosx/BlocklistScheduler.m index efbe1c92b..40a8eeeff 100644 --- a/macosx/BlocklistScheduler.m +++ b/macosx/BlocklistScheduler.m @@ -59,7 +59,7 @@ BlocklistScheduler * fScheduler = nil; || ![[NSUserDefaults standardUserDefaults] boolForKey: @"BlocklistAutoUpdate"]) return; - NSDate * lastUpdateDate = [[NSUserDefaults standardUserDefaults] objectForKey: @"BlocklistLastUpdate"]; + NSDate * lastUpdateDate = [[NSUserDefaults standardUserDefaults] objectForKey: @"BlocklistNewLastUpdate"]; if (lastUpdateDate) lastUpdateDate = [lastUpdateDate dateByAddingTimeInterval: FULL_WAIT]; NSDate * closeDate = [NSDate dateWithTimeIntervalSinceNow: SMALL_DELAY]; diff --git a/macosx/PrefsController.m b/macosx/PrefsController.m index befcd1539..0d84073e7 100644 --- a/macosx/PrefsController.m +++ b/macosx/PrefsController.m @@ -504,7 +504,15 @@ tr_session * fHandle; NSString * updatedDateString; if (exists) { - NSDate * updatedDate = [fDefaults objectForKey: @"BlocklistLastUpdate"]; + NSDate * updatedDate = [fDefaults objectForKey: @"BlocklistNewLastUpdateSuccess"]; + //old format for update date pre-2.12 + if (!updatedDate) + { + updatedDate = [fDefaults objectForKey: @"BlocklistLastUpdate"]; + [fDefaults setObject: updatedDate forKey: @"BlocklistNewLastUpdateSuccess"]; + [fDefaults removeObjectForKey: @"BlocklistLastUpdate"]; + } + if (updatedDate) { if ([NSApp isOnSnowLeopardOrBetter]) diff --git a/macosx/en.lproj/PrefsWindow.xib b/macosx/en.lproj/PrefsWindow.xib index 0597bf975..90bd9570d 100644 --- a/macosx/en.lproj/PrefsWindow.xib +++ b/macosx/en.lproj/PrefsWindow.xib @@ -434,7 +434,7 @@ NSResponder - + 256 YES @@ -443,7 +443,6 @@ 256 {{13, 10}, {516, 318}} - YES @@ -979,7 +978,6 @@ 256 {{319, 154}, {35, 22}} - YES -1804468671 @@ -1063,7 +1061,6 @@ 256 {{49, 156}, {56, 17}} - YES 67239424 @@ -1080,7 +1077,6 @@ 256 {{359, 156}, {101, 17}} - YES 67239424 @@ -1097,7 +1093,6 @@ 256 {{108, 241}, {157, 18}} - YES 67239424 @@ -1120,7 +1115,6 @@ 256 {{271, 240}, {50, 22}} - YES -1804468671 @@ -1187,7 +1181,6 @@ 256 {{108, 197}, {220, 18}} - YES 67239424 @@ -1210,7 +1203,6 @@ 256 {{334, 196}, {41, 22}} - YES -1804468671 @@ -1283,7 +1275,6 @@ 256 {{58, 242}, {47, 17}} - YES 67239424 @@ -1300,7 +1291,6 @@ 256 {{126, 222}, {269, 14}} - YES 67239424 @@ -1329,7 +1319,6 @@ 256 {{108, 155}, {205, 18}} - YES 67239424 @@ -1352,7 +1341,6 @@ 256 {{305, 128}, {35, 22}} - YES -1804468671 @@ -1416,7 +1404,6 @@ 256 {{345, 130}, {101, 17}} - YES 67239424 @@ -1433,7 +1420,6 @@ 256 {{108, 129}, {191, 18}} - YES 67239424 @@ -1456,7 +1442,6 @@ 256 {{366, 102}, {41, 22}} - YES -1804468671 @@ -1529,7 +1514,6 @@ 256 {{412, 104}, {55, 17}} - YES 67239424 @@ -1546,7 +1530,6 @@ 256 {{108, 103}, {252, 18}} - YES 67239424 @@ -1569,7 +1552,6 @@ 256 {{28, 64}, {77, 17}} - YES 67239424 @@ -1586,7 +1568,6 @@ 256 {{306, 58}, {130, 26}} - YES -2076049856 @@ -1639,7 +1620,6 @@ 256 {{108, 38}, {183, 18}} - YES 67239424 @@ -1662,7 +1642,6 @@ 256 {{306, 33}, {130, 26}} - YES -2076049856 @@ -1711,7 +1690,6 @@ 256 {{108, 63}, {195, 18}} - YES 67239424 @@ -1734,7 +1712,6 @@ 256 {{380, 198}, {55, 17}} - YES 67239424 @@ -1749,7 +1726,6 @@ {{10, 33}, {496, 272}} - Management @@ -1768,8 +1744,6 @@ {542, 331} - - NSView NSResponder @@ -2046,6 +2020,7 @@ AAAAAAAAA {{1, 1}, {141, 169}} + 4 @@ -2073,6 +2048,7 @@ AAAAAAAAA {{20, 49}, {143, 171}} + 530 @@ -3105,13 +3081,17 @@ AAABAAAAAQ YES -1804468671 - 272630784 + 272634880 YES + + YES + NSAllRomanInputSourcesLocaleIdentifier + @@ -3625,7 +3605,7 @@ AAABAAAAAQ NSResponder - + 256 YES @@ -3634,7 +3614,6 @@ AAABAAAAAQ 289 {{504, 12}, {21, 23}} - YES 67239424 @@ -3658,7 +3637,6 @@ AAABAAAAAQ 256 {{45, 34}, {90, 17}} - YES 67239424 @@ -3675,7 +3653,6 @@ AAABAAAAAQ 256 {{138, 33}, {357, 18}} - YES 67239424 @@ -3699,7 +3676,6 @@ AAABAAAAAQ {{322, 137}, {16, 16}} - 28938 100 @@ -3720,7 +3696,6 @@ AAABAAAAAQ {{323, 138}, {14, 14}} - YES 130560 @@ -3741,7 +3716,6 @@ AAABAAAAAQ 256 {{137, 137}, {124, 17}} - YES 67239424 @@ -3758,7 +3732,6 @@ AAABAAAAAQ 256 {{138, 87}, {171, 18}} - YES 67239424 @@ -3781,7 +3754,6 @@ AAABAAAAAQ 256 {{138, 111}, {189, 18}} - YES 67239424 @@ -3804,7 +3776,6 @@ AAABAAAAAQ 256 {{266, 135}, {50, 22}} - YES -1804468671 @@ -3869,7 +3840,6 @@ AAABAAAAAQ 256 {{156, 71}, {238, 14}} - YES 67239424 @@ -3886,7 +3856,6 @@ AAABAAAAAQ 256 {{342, 137}, {183, 17}} - YES 67239424 @@ -3903,7 +3872,6 @@ AAABAAAAAQ 256 {{74, 137}, {61, 17}} - YES 67239424 @@ -3920,7 +3888,6 @@ AAABAAAAAQ 256 {{327, 101}, {111, 32}} - YES 67239424 @@ -3941,8 +3908,6 @@ AAABAAAAAQ {542, 177} - - NSView NSResponder @@ -4406,11 +4371,6 @@ AAABAAAAAQ NSResponder - - YES - BlocklistNew - BlocklistURL - YES