From 8075c388c2f854318cf5a7ebfe62c95b2f9275f2 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Thu, 5 Jul 2007 01:44:01 +0000 Subject: [PATCH] don't autoimport created torrents --- NEWS | 2 +- macosx/Controller.h | 2 ++ macosx/Controller.m | 17 +++++++++++++++++ macosx/CreatorWindowController.m | 1 + 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 90694c7de..1744e04c5 100644 --- a/NEWS +++ b/NEWS @@ -11,7 +11,7 @@ NEWS file for Transmission - OS X: + Overlay when dragging torrent files, URLs, and data files onto window + Ability to set an amount of time to consider a transfer stalled - + Progress bar displays more information + + More progress bar colors + Various smaller interface improvements - GTK: + Interface significantly reworked to closer match the Mac version diff --git a/macosx/Controller.h b/macosx/Controller.h index 0f42317a9..d501d88d9 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -199,6 +199,8 @@ - (void) changeAutoImport; - (void) checkAutoImportDirectory; +- (void) beginCreateFile: (NSNotification *) notification; + - (void) sleepCallBack: (natural_t) messageType argument: (void *) messageArgument; - (void) toggleSmallView: (id) sender; diff --git a/macosx/Controller.m b/macosx/Controller.m index 45231cd91..59f3b3f3c 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -421,6 +421,10 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy [nc addObserver: self selector: @selector(updateDockBadge:) name: @"DockBadgeChange" object: nil]; + //open newly created torrent file + [nc addObserver: self selector: @selector(beginCreateFile:) + name: @"BeginCreateTorrentFile" object: nil]; + //open newly created torrent file [nc addObserver: self selector: @selector(openCreatedFile:) name: @"OpenCreatedTorrentFile" object: nil]; @@ -2086,6 +2090,19 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy [newNames release]; } +- (void) beginCreateFile: (NSNotification *) notification +{ + if (![fDefaults boolForKey: @"AutoImport"]) + return; + + NSString * location = [notification object], + * path = [fDefaults stringForKey: @"AutoImportDirectory"]; + + if (location && path && [[[location stringByDeletingLastPathComponent] stringByExpandingTildeInPath] + isEqualToString: [path stringByExpandingTildeInPath]]) + [fAutoImportedNames addObject: [location lastPathComponent]]; +} + - (int) numberOfRowsInTableView: (NSTableView *) tableview { return [fDisplayedTorrents count]; diff --git a/macosx/CreatorWindowController.m b/macosx/CreatorWindowController.m index 367ea28ea..5db54d7a9 100644 --- a/macosx/CreatorWindowController.m +++ b/macosx/CreatorWindowController.m @@ -233,6 +233,7 @@ [fDefaults setBool: fOpenTorrent forKey: @"CreatorOpen"]; [fDefaults setObject: [fLocation stringByDeletingLastPathComponent] forKey: @"CreatorLocation"]; + [[NSNotificationCenter defaultCenter] postNotificationName: @"BeginCreateTorrentFile" object: fLocation userInfo: nil]; tr_makeMetaInfo(fInfo, [fLocation UTF8String], [trackerString UTF8String], [[fCommentView string] UTF8String], [fPrivateCheck state] == NSOnState);