From 3357a5bac66e103dcb125e829fcf92115c4b72c0 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Thu, 13 Jul 2006 11:30:38 +0000 Subject: [PATCH] Use a mutable array for autoimport. --- macosx/Controller.h | 4 ++-- macosx/Controller.m | 13 +++++-------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/macosx/Controller.h b/macosx/Controller.h index 039d5155e..43e7e5f2d 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -75,7 +75,7 @@ NSTimer * fTimer; NSTimer * fAutoImportTimer; - NSArray * fAutoImportedNames; + NSMutableArray * fAutoImportedNames; BOOL fHasGrowl, fUpdateInProgress; Badger * fBadger; @@ -125,7 +125,7 @@ - (void) updateTorrentHistory; - (void) sortTorrents; -- (void) sortTorrentsRememberSelected: (BOOL) changeSelected; +- (void) sortTorrentsRememberSelected: (BOOL) rememberSelected; - (void) setSort: (id) sender; - (void) applyFilter; - (void) setFilter: (id) sender; diff --git a/macosx/Controller.m b/macosx/Controller.m index 7defcd809..7d6facd7b 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -282,7 +282,7 @@ static void sleepCallBack(void * controller, io_service_t y, [[NSRunLoop currentRunLoop] addTimer: fTimer forMode: NSEventTrackingRunLoopMode]; //timer for auto import, will check every 15 seconds - fAutoImportedNames = [[NSArray alloc] init]; + fAutoImportedNames = [[NSMutableArray alloc] init]; [self checkAutoImportDirectory: nil]; fAutoImportTimer = [NSTimer scheduledTimerWithTimeInterval: 15.0 target: self @@ -858,11 +858,11 @@ static void sleepCallBack(void * controller, io_service_t y, [self sortTorrentsRememberSelected: YES]; } -- (void) sortTorrentsRememberSelected: (BOOL) changeSelected +- (void) sortTorrentsRememberSelected: (BOOL) rememberSelected { //remember selected rows if needed NSArray * selectedTorrents = nil; - if (changeSelected) + if (rememberSelected) { int numSelected = [fTableView numberOfSelectedRows]; if (numSelected > 0 && numSelected < [fFilteredTorrents count]) @@ -1295,8 +1295,7 @@ static void sleepCallBack(void * controller, io_service_t y, [newFileNames removeObjectsInArray: fAutoImportedNames]; //save the current list of files - [fAutoImportedNames release]; - fAutoImportedNames = [allFileNames retain]; + [fAutoImportedNames setArray: allFileNames]; NSEnumerator * enumerator = [newFileNames objectEnumerator]; NSString * file; @@ -1316,9 +1315,7 @@ static void sleepCallBack(void * controller, io_service_t y, - (void) autoImportChange: (NSNotification *) notification { - [fAutoImportedNames release]; - fAutoImportedNames = [[NSArray alloc] init]; - + [fAutoImportedNames removeAllObjects]; [self checkAutoImportDirectory: nil]; }