diff --git a/macosx/Controller.h b/macosx/Controller.h index c38e0ba6c..039d5155e 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -77,9 +77,8 @@ NSTimer * fAutoImportTimer; NSArray * fAutoImportedNames; - BOOL fHasGrowl; + BOOL fHasGrowl, fUpdateInProgress; Badger * fBadger; - BOOL fUpdateInProgress; } - (void) openShowSheet: (id) sender; @@ -113,7 +112,7 @@ - (void) copyTorrentFile: (id) sender; - (void) copyTorrentFileForTorrents: (NSMutableArray *) torrents; - (void) saveTorrentCopySheetClosed: (NSSavePanel *) panel returnCode: (int) code - contextInfo: (NSMutableArray *) torrents; + contextInfo: (NSMutableArray *) torrents; - (void) revealFile: (id) sender; @@ -126,7 +125,7 @@ - (void) updateTorrentHistory; - (void) sortTorrents; -- (void) sortTorrentsChangeSelected: (BOOL) changeSelected; +- (void) sortTorrentsRememberSelected: (BOOL) changeSelected; - (void) setSort: (id) sender; - (void) applyFilter; - (void) setFilter: (id) sender; diff --git a/macosx/Controller.m b/macosx/Controller.m index faf76ea36..8b96c5195 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -856,10 +856,10 @@ static void sleepCallBack(void * controller, io_service_t y, - (void) sortTorrents { - [self sortTorrentsChangeSelected: YES]; + [self sortTorrentsRememberSelected: YES]; } -- (void) sortTorrentsChangeSelected: (BOOL) changeSelected +- (void) sortTorrentsRememberSelected: (BOOL) changeSelected { //remember selected rows if needed NSArray * selectedTorrents = nil; @@ -965,10 +965,8 @@ static void sleepCallBack(void * controller, io_service_t y, - (void) applyFilter { //remember selected rows if needed - NSArray * selectedTorrents = nil; - int numSelected = [fTableView numberOfSelectedRows]; - if (numSelected > 0 && numSelected < [fFilteredTorrents count]) - selectedTorrents = [self torrentsAtIndexes: [fTableView selectedRowIndexes]]; + NSArray * selectedTorrents = [fTableView numberOfSelectedRows] > 0 + ? [self torrentsAtIndexes: [fTableView selectedRowIndexes]] : nil; NSMutableArray * tempTorrents = [[NSMutableArray alloc] initWithCapacity: [fTorrents count]]; @@ -1002,9 +1000,9 @@ static void sleepCallBack(void * controller, io_service_t y, [fFilteredTorrents setArray: tempTorrents]; [tempTorrents release]; - [self sortTorrentsChangeSelected: NO]; + [self sortTorrentsRememberSelected: NO]; - //set selected rows if needed...this selecting is more accurate than sort's + //set selected rows if needed if (selectedTorrents) { Torrent * torrent;