- Timestamp:
- Sep 5, 2006, 4:28:07 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 10 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Transmission.xcodeproj/project.pbxproj
r835 r847 128 128 A2912C540A2956E80097A0CA /* PrefsWindow.nib in Resources */ = {isa = PBXBuildFile; fileRef = A2912C520A2956E80097A0CA /* PrefsWindow.nib */; }; 129 129 A29597350A72A9E10057248B /* StatusBarBackground.png in Resources */ = {isa = PBXBuildFile; fileRef = A29597340A72A9E10057248B /* StatusBarBackground.png */; }; 130 A2A3065B0AAD24A80049E2AC /* UKFileWatcher.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = A2A306530AAD24A80049E2AC /* UKFileWatcher.h */; }; 131 A2A3065C0AAD24A80049E2AC /* UKFileWatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = A2A306540AAD24A80049E2AC /* UKFileWatcher.m */; }; 132 A2A3065D0AAD24A80049E2AC /* UKFNSubscribeFileWatcher.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = A2A306550AAD24A80049E2AC /* UKFNSubscribeFileWatcher.h */; }; 133 A2A3065E0AAD24A80049E2AC /* UKFNSubscribeFileWatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = A2A306560AAD24A80049E2AC /* UKFNSubscribeFileWatcher.m */; }; 134 A2A3065F0AAD24A80049E2AC /* UKKQueue.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = A2A306570AAD24A80049E2AC /* UKKQueue.h */; }; 135 A2A306600AAD24A80049E2AC /* UKKQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = A2A306580AAD24A80049E2AC /* UKKQueue.m */; }; 136 A2A306610AAD24A80049E2AC /* UKMainThreadProxy.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = A2A306590AAD24A80049E2AC /* UKMainThreadProxy.h */; }; 137 A2A306620AAD24A80049E2AC /* UKMainThreadProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = A2A3065A0AAD24A80049E2AC /* UKMainThreadProxy.m */; }; 130 138 A2AF1C390A3D0F6200F1575D /* FileTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = A2AF1C370A3D0F6200F1575D /* FileTableView.m */; }; 131 139 A2BD40070A09BBEA008CCE96 /* bencode.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D1838B709DEC0430047D688 /* bencode.h */; }; … … 166 174 A24F19210A3A796800C9C145 /* Sparkle.framework in CopyFiles */, 167 175 A256588C0A9A695400E8A03B /* MessageWindowController.h in CopyFiles */, 176 A2A3065B0AAD24A80049E2AC /* UKFileWatcher.h in CopyFiles */, 177 A2A3065D0AAD24A80049E2AC /* UKFNSubscribeFileWatcher.h in CopyFiles */, 178 A2A3065F0AAD24A80049E2AC /* UKKQueue.h in CopyFiles */, 179 A2A306610AAD24A80049E2AC /* UKMainThreadProxy.h in CopyFiles */, 168 180 ); 169 181 runOnlyForDeploymentPostprocessing = 0; … … 337 349 A2912C530A2956E80097A0CA /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = macosx/English.lproj/PrefsWindow.nib; sourceTree = "<group>"; }; 338 350 A29597340A72A9E10057248B /* StatusBarBackground.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = StatusBarBackground.png; path = macosx/Images/StatusBarBackground.png; sourceTree = "<group>"; }; 351 A2A306530AAD24A80049E2AC /* UKFileWatcher.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = UKFileWatcher.h; path = macosx/UKKQueue/UKFileWatcher.h; sourceTree = "<group>"; }; 352 A2A306540AAD24A80049E2AC /* UKFileWatcher.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = UKFileWatcher.m; path = macosx/UKKQueue/UKFileWatcher.m; sourceTree = "<group>"; }; 353 A2A306550AAD24A80049E2AC /* UKFNSubscribeFileWatcher.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = UKFNSubscribeFileWatcher.h; path = macosx/UKKQueue/UKFNSubscribeFileWatcher.h; sourceTree = "<group>"; }; 354 A2A306560AAD24A80049E2AC /* UKFNSubscribeFileWatcher.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = UKFNSubscribeFileWatcher.m; path = macosx/UKKQueue/UKFNSubscribeFileWatcher.m; sourceTree = "<group>"; }; 355 A2A306570AAD24A80049E2AC /* UKKQueue.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = UKKQueue.h; path = macosx/UKKQueue/UKKQueue.h; sourceTree = "<group>"; }; 356 A2A306580AAD24A80049E2AC /* UKKQueue.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = UKKQueue.m; path = macosx/UKKQueue/UKKQueue.m; sourceTree = "<group>"; }; 357 A2A306590AAD24A80049E2AC /* UKMainThreadProxy.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = UKMainThreadProxy.h; path = macosx/UKKQueue/UKMainThreadProxy.h; sourceTree = "<group>"; }; 358 A2A3065A0AAD24A80049E2AC /* UKMainThreadProxy.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = UKMainThreadProxy.m; path = macosx/UKKQueue/UKMainThreadProxy.m; sourceTree = "<group>"; }; 339 359 A2A84AD20A04FCDC00C898D4 /* BottomBorder.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = BottomBorder.png; path = macosx/Images/BottomBorder.png; sourceTree = "<group>"; }; 340 360 A2AF1C360A3D0F6200F1575D /* FileTableView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = FileTableView.h; path = macosx/FileTableView.h; sourceTree = "<group>"; }; … … 384 404 isa = PBXGroup; 385 405 children = ( 406 A2A306530AAD24A80049E2AC /* UKFileWatcher.h */, 407 A2A306540AAD24A80049E2AC /* UKFileWatcher.m */, 408 A2A306550AAD24A80049E2AC /* UKFNSubscribeFileWatcher.h */, 409 A2A306560AAD24A80049E2AC /* UKFNSubscribeFileWatcher.m */, 410 A2A306570AAD24A80049E2AC /* UKKQueue.h */, 411 A2A306580AAD24A80049E2AC /* UKKQueue.m */, 412 A2A306590AAD24A80049E2AC /* UKMainThreadProxy.h */, 413 A2A3065A0AAD24A80049E2AC /* UKMainThreadProxy.m */, 386 414 A256588A0A9A695400E8A03B /* MessageWindowController.h */, 387 415 A256588B0A9A695400E8A03B /* MessageWindowController.m */, … … 837 865 A256588D0A9A695400E8A03B /* MessageWindowController.m in Sources */, 838 866 A23BBEB70A9BBE77003F7274 /* BarButton.m in Sources */, 867 A2A3065C0AAD24A80049E2AC /* UKFileWatcher.m in Sources */, 868 A2A3065E0AAD24A80049E2AC /* UKFNSubscribeFileWatcher.m in Sources */, 869 A2A306600AAD24A80049E2AC /* UKKQueue.m in Sources */, 870 A2A306620AAD24A80049E2AC /* UKMainThreadProxy.m in Sources */, 839 871 ); 840 872 runOnlyForDeploymentPostprocessing = 0; -
trunk/macosx/Controller.h
r807 r847 89 89 io_connect_t fRootPort; 90 90 NSTimer * fTimer; 91 92 NSTimer * fAutoImportTimer;93 NSMutableArray * fAutoImportedNames;94 91 95 92 BOOL fUpdateInProgress; … … 176 173 - (void) reloadInspectorSettings: (NSNotification *) notification; 177 174 178 - (void) checkAutoImportDirectory: (NSTimer *) timer; 179 - (void) autoImportChange: (NSNotification *) notification; 175 - (void) checkAutoImportDirectory; 180 176 181 177 - (void) sleepCallBack: (natural_t) messageType argument: (void *) messageArgument; -
trunk/macosx/Controller.m
r831 r847 30 30 #import "TorrentTableView.h" 31 31 #import "StringAdditions.h" 32 #import "UKKQueue.h" 32 33 33 34 #import <Sparkle/Sparkle.h> … … 91 92 fBadger = [[Badger alloc] init]; 92 93 93 fAutoImportedNames = [[NSMutableArray alloc] init];94 95 94 [GrowlApplicationBridge setGrowlDelegate: self]; 95 96 [[UKKQueue sharedFileWatcher] setDelegate: self]; 96 97 } 97 98 return self; … … 112 113 [fSortType release]; 113 114 [fFilterType release]; 114 [fAutoImportedNames release];115 115 116 116 tr_close(fLib); … … 318 318 name: @"AutoSpeedLimitChange" object: nil]; 319 319 320 [nc addObserver: self selector: @selector( autoImportChange:)320 [nc addObserver: self selector: @selector(checkAutoImportDirectory) 321 321 name: @"AutoImportSettingChange" object: nil]; 322 322 … … 367 367 fSpeedLimitTimer = [NSTimer scheduledTimerWithTimeInterval: AUTO_SPEED_LIMIT_SECONDS target: self 368 368 selector: @selector(autoSpeedLimit:) userInfo: nil repeats: YES]; 369 370 //timer to check for auto import every 15 seconds, must do after everything else is set up371 fAutoImportTimer = [NSTimer scheduledTimerWithTimeInterval: AUTO_IMPORT_SECONDS target: self372 selector: @selector(checkAutoImportDirectory:) userInfo: nil repeats: YES];373 [[NSRunLoop currentRunLoop] addTimer: fAutoImportTimer forMode: NSDefaultRunLoopMode];374 369 } 375 370 … … 420 415 { 421 416 //stop timers 422 [fAutoImportTimer invalidate];423 417 [fSpeedLimitTimer invalidate]; 424 418 [fTimer invalidate]; … … 1534 1528 } 1535 1529 1536 - (void) checkAutoImportDirectory: (NSTimer *) timer 1530 -(void) watcher: (id<UKFileWatcher>) kq receivedNotification: (NSString*) nm forPath: (NSString*) fpath 1531 { 1532 if ([nm isEqualToString: UKFileWatcherWriteNotification]) 1533 [self checkAutoImportDirectory]; 1534 } 1535 1536 - (void) checkAutoImportDirectory 1537 1537 { 1538 1538 if (![fDefaults boolForKey: @"AutoImport"]) … … 1541 1541 NSString * path = [[fDefaults stringForKey: @"AutoImportDirectory"] stringByExpandingTildeInPath]; 1542 1542 1543 //if folder cannot be found or the contents hasn't changed simply give up 1544 NSArray * allFileNames; 1545 if (!(allFileNames = [[NSFileManager defaultManager] directoryContentsAtPath: path]) 1546 || [allFileNames isEqualToArray: fAutoImportedNames]) 1543 NSArray * importedNames; 1544 if (!(importedNames = [[NSFileManager defaultManager] directoryContentsAtPath: path])) 1547 1545 return; 1548 1549 //try to add files that haven't already been added 1550 NSMutableArray * newFileNames = [NSMutableArray arrayWithArray: allFileNames]; 1551 [newFileNames removeObjectsInArray: fAutoImportedNames]; 1552 1553 //save the current list of files 1554 [fAutoImportedNames setArray: allFileNames]; 1555 1556 NSEnumerator * enumerator = [newFileNames objectEnumerator]; 1546 1547 NSEnumerator * enumerator = [importedNames objectEnumerator]; 1557 1548 NSString * file; 1558 1549 unsigned oldCount; … … 1568 1559 notificationName: GROWL_AUTO_ADD iconData: nil priority: 0 isSticky: NO clickContext: nil]; 1569 1560 } 1570 }1571 1572 - (void) autoImportChange: (NSNotification *) notification1573 {1574 [fAutoImportedNames removeAllObjects];1575 [self checkAutoImportDirectory: nil];1576 1561 } 1577 1562 -
trunk/macosx/PrefsController.m
r807 r847 25 25 #import "PrefsController.h" 26 26 #import "StringAdditions.h" 27 #import "UKKQueue.h" 27 28 28 29 #define MIN_PORT 1 … … 113 114 [fAutoImportCheck setState: autoImport]; 114 115 [fImportFolderPopUp setEnabled: autoImport]; 116 117 if (autoImport) 118 [[UKKQueue sharedFileWatcher] addPath: fImportFolder]; 115 119 116 120 //set auto size … … 751 755 [fImportFolderPopUp setEnabled: state]; 752 756 757 if (state == NSOnState) 758 [[UKKQueue sharedFileWatcher] addPath: fImportFolder]; 759 else 760 [[UKKQueue sharedFileWatcher] removePathFromQueue: fImportFolder]; 761 753 762 [[NSNotificationCenter defaultCenter] postNotificationName: @"AutoImportSettingChange" object: self]; 754 763 } … … 867 876 - (void) importFolderSheetClosed: (NSOpenPanel *) openPanel returnCode: (int) code contextInfo: (void *) info 868 877 { 869 if (code == NSOKButton) 870 { 871 [fImportFolder release]; 872 fImportFolder = [[[openPanel filenames] objectAtIndex: 0] retain]; 873 874 [fDefaults setObject: fImportFolder forKey: @"AutoImportDirectory"]; 875 876 [self updateImportPopUp]; 877 878 [[NSNotificationCenter defaultCenter] postNotificationName: @"AutoImportSettingChange" object: self]; 879 } 880 [fImportFolderPopUp selectItemAtIndex: 0]; 878 if (code == NSOKButton) 879 { 880 UKKQueue * sharedQueue = [UKKQueue sharedFileWatcher]; 881 [sharedQueue removePathFromQueue: fImportFolder]; 882 883 [fImportFolder release]; 884 fImportFolder = [[[openPanel filenames] objectAtIndex: 0] retain]; 885 886 [fDefaults setObject: fImportFolder forKey: @"AutoImportDirectory"]; 887 888 [self updateImportPopUp]; 889 890 [sharedQueue addPath: fImportFolder]; 891 892 [[NSNotificationCenter defaultCenter] postNotificationName: @"AutoImportSettingChange" object: self]; 893 } 894 [fImportFolderPopUp selectItemAtIndex: 0]; 881 895 } 882 896
Note: See TracChangeset
for help on using the changeset viewer.