From 93caebd82f7f9f39c51a36099d34c86f3822397e Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Wed, 31 Oct 2007 19:28:22 +0000 Subject: [PATCH] trunk: Leopard: Time Machine will ignore incomplete files --- NEWS | 1 + macosx/Controller.m | 1 - macosx/Torrent.m | 22 ++++++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 3bf9bd2e8..302d87113 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,7 @@ NEWS file for Transmission 0.92 (2007/xx/yy) - OS X: + + Leopard: Time Machine will ignore incomplete files + Leopard: Fix bug with typing values in Inspector->Options + Leopard: Fix bug with toggling Minimal View diff --git a/macosx/Controller.m b/macosx/Controller.m index 4d436f8be..a2fdfe4a8 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -2253,7 +2253,6 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi return [fDisplayedTorrents count]; } -#warning need? - (id) tableView: (NSTableView *) tableView objectValueForTableColumn: (NSTableColumn *) tableColumn row: (int) row { return nil; diff --git a/macosx/Torrent.m b/macosx/Torrent.m index 27ae878b7..c6b9a0e9e 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -1475,6 +1475,14 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void * [self createFileList]; [self update]; + + //mark incomplete files to be ignored by Time Machine + if ([NSApp isOnLeopardOrBetter]) + { + NSURL *url = [NSURL fileURLWithPath: [[self downloadFolder] stringByAppendingPathComponent: [self name]]]; + CSBackupSetItemExcluded((CFURLRef)url, ![self allDownloaded], false); + } + return self; } @@ -1609,11 +1617,25 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void * [fDateCompleted release]; fDateCompleted = [[NSDate alloc] init]; + //allow to be backed up by Time Machine + if ([NSApp isOnLeopardOrBetter]) + { + NSURL *url = [NSURL fileURLWithPath: [[self downloadFolder] stringByAppendingPathComponent: [self name]]]; + CSBackupSetItemExcluded((CFURLRef)url, false, false); + } + fStat = tr_torrentStat(fHandle); [[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentFinishedDownloading" object: self]; break; case TR_CP_INCOMPLETE: + //do not allow to be backed up by Time Machine + if ([NSApp isOnLeopardOrBetter]) + { + NSURL *url = [NSURL fileURLWithPath: [[self downloadFolder] stringByAppendingPathComponent: [self name]]]; + CSBackupSetItemExcluded((CFURLRef)url, true, false); + } + [[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentRestartedDownloading" object: self]; break; }