1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 01:27:28 +00:00

Use a mutable array for autoimport.

This commit is contained in:
Mitchell Livingston 2006-07-13 11:30:38 +00:00
parent 056b9c43c2
commit 3357a5bac6
2 changed files with 7 additions and 10 deletions

View file

@ -75,7 +75,7 @@
NSTimer * fTimer; NSTimer * fTimer;
NSTimer * fAutoImportTimer; NSTimer * fAutoImportTimer;
NSArray * fAutoImportedNames; NSMutableArray * fAutoImportedNames;
BOOL fHasGrowl, fUpdateInProgress; BOOL fHasGrowl, fUpdateInProgress;
Badger * fBadger; Badger * fBadger;
@ -125,7 +125,7 @@
- (void) updateTorrentHistory; - (void) updateTorrentHistory;
- (void) sortTorrents; - (void) sortTorrents;
- (void) sortTorrentsRememberSelected: (BOOL) changeSelected; - (void) sortTorrentsRememberSelected: (BOOL) rememberSelected;
- (void) setSort: (id) sender; - (void) setSort: (id) sender;
- (void) applyFilter; - (void) applyFilter;
- (void) setFilter: (id) sender; - (void) setFilter: (id) sender;

View file

@ -282,7 +282,7 @@ static void sleepCallBack(void * controller, io_service_t y,
[[NSRunLoop currentRunLoop] addTimer: fTimer forMode: NSEventTrackingRunLoopMode]; [[NSRunLoop currentRunLoop] addTimer: fTimer forMode: NSEventTrackingRunLoopMode];
//timer for auto import, will check every 15 seconds //timer for auto import, will check every 15 seconds
fAutoImportedNames = [[NSArray alloc] init]; fAutoImportedNames = [[NSMutableArray alloc] init];
[self checkAutoImportDirectory: nil]; [self checkAutoImportDirectory: nil];
fAutoImportTimer = [NSTimer scheduledTimerWithTimeInterval: 15.0 target: self fAutoImportTimer = [NSTimer scheduledTimerWithTimeInterval: 15.0 target: self
@ -858,11 +858,11 @@ static void sleepCallBack(void * controller, io_service_t y,
[self sortTorrentsRememberSelected: YES]; [self sortTorrentsRememberSelected: YES];
} }
- (void) sortTorrentsRememberSelected: (BOOL) changeSelected - (void) sortTorrentsRememberSelected: (BOOL) rememberSelected
{ {
//remember selected rows if needed //remember selected rows if needed
NSArray * selectedTorrents = nil; NSArray * selectedTorrents = nil;
if (changeSelected) if (rememberSelected)
{ {
int numSelected = [fTableView numberOfSelectedRows]; int numSelected = [fTableView numberOfSelectedRows];
if (numSelected > 0 && numSelected < [fFilteredTorrents count]) if (numSelected > 0 && numSelected < [fFilteredTorrents count])
@ -1295,8 +1295,7 @@ static void sleepCallBack(void * controller, io_service_t y,
[newFileNames removeObjectsInArray: fAutoImportedNames]; [newFileNames removeObjectsInArray: fAutoImportedNames];
//save the current list of files //save the current list of files
[fAutoImportedNames release]; [fAutoImportedNames setArray: allFileNames];
fAutoImportedNames = [allFileNames retain];
NSEnumerator * enumerator = [newFileNames objectEnumerator]; NSEnumerator * enumerator = [newFileNames objectEnumerator];
NSString * file; NSString * file;
@ -1316,9 +1315,7 @@ static void sleepCallBack(void * controller, io_service_t y,
- (void) autoImportChange: (NSNotification *) notification - (void) autoImportChange: (NSNotification *) notification
{ {
[fAutoImportedNames release]; [fAutoImportedNames removeAllObjects];
fAutoImportedNames = [[NSArray alloc] init];
[self checkAutoImportDirectory: nil]; [self checkAutoImportDirectory: nil];
} }