From 0fd3c80c7f7b8491cb1d58a7f4a5df280cffb2a4 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Sun, 1 Jul 2007 18:02:10 +0000 Subject: [PATCH] same as last commit, with different objects --- macosx/Controller.m | 13 +++++++++---- macosx/PrefsController.h | 1 - macosx/PrefsController.m | 20 +++++++++++--------- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/macosx/Controller.m b/macosx/Controller.m index f7fd44c49..9bfdb1a86 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -198,7 +198,8 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy [fOverlayWindow release]; [fIPCController release]; - [fAutoImportedNames release]; + if (fAutoImportedNames) + [fAutoImportedNames release]; if (fPendingTorrentDownloads) [fPendingTorrentDownloads release]; @@ -442,7 +443,6 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy selector: @selector(autoSpeedLimit) userInfo: nil repeats: YES]; //auto importing - fAutoImportedNames = [[NSMutableArray alloc] init]; [self checkAutoImportDirectory]; } @@ -2022,7 +2022,8 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy fAutoImportTimer = nil; } - [fAutoImportedNames removeAllObjects]; + if (fAutoImportedNames) + [fAutoImportedNames removeAllObjects]; [self checkAutoImportDirectory]; } @@ -2040,7 +2041,11 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy //only check files that have not been checked yet NSMutableArray * newNames = [importedNames mutableCopy]; - [newNames removeObjectsInArray: fAutoImportedNames]; + + if (fAutoImportedNames) + [newNames removeObjectsInArray: fAutoImportedNames]; + else + fAutoImportedNames = [[NSMutableArray alloc] init]; [fAutoImportedNames setArray: importedNames]; NSString * file; diff --git a/macosx/PrefsController.h b/macosx/PrefsController.h index d67c69af2..e2d08c2bb 100644 --- a/macosx/PrefsController.h +++ b/macosx/PrefsController.h @@ -34,7 +34,6 @@ NSUserDefaults * fDefaults; BOOL fHasLoaded; - NSToolbar * fToolbar; IBOutlet NSView * fGeneralView, * fTransfersView, * fBandwidthView, * fNetworkView; IBOutlet NSPopUpButton * fFolderPopUp, * fIncompleteFolderPopUp, * fImportFolderPopUp, diff --git a/macosx/PrefsController.m b/macosx/PrefsController.m index f832424b0..a32840a4c 100644 --- a/macosx/PrefsController.m +++ b/macosx/PrefsController.m @@ -114,14 +114,14 @@ { fHasLoaded = YES; - fToolbar = [[NSToolbar alloc] initWithIdentifier: @"Preferences Toolbar"]; - [fToolbar setDelegate: self]; - [fToolbar setAllowsUserCustomization: NO]; - [[self window] setToolbar: fToolbar]; - [fToolbar setDisplayMode: NSToolbarDisplayModeIconAndLabel]; - [fToolbar setSizeMode: NSToolbarSizeModeRegular]; + NSToolbar * toolbar = [[NSToolbar alloc] initWithIdentifier: @"Preferences Toolbar"]; + [toolbar setDelegate: self]; + [toolbar setAllowsUserCustomization: NO]; + [toolbar setDisplayMode: NSToolbarDisplayModeIconAndLabel]; + [toolbar setSizeMode: NSToolbarSizeModeRegular]; + [[self window] setToolbar: toolbar]; - [fToolbar setSelectedItemIdentifier: TOOLBAR_GENERAL]; + [toolbar setSelectedItemIdentifier: TOOLBAR_GENERAL]; [self setPrefView: nil]; //set download folder @@ -637,10 +637,12 @@ [window setTitle: [sender label]]; else { + NSToolbar * toolbar = [window toolbar]; + NSString * itemIdentifier = [toolbar selectedItemIdentifier]; + NSEnumerator * enumerator = [[toolbar items] objectEnumerator]; NSToolbarItem * item; - NSEnumerator * enumerator = [[fToolbar items] objectEnumerator]; while ((item = [enumerator nextObject])) - if ([[item itemIdentifier] isEqualToString: [fToolbar selectedItemIdentifier]]) + if ([[item itemIdentifier] isEqualToString: itemIdentifier]) { [window setTitle: [item label]]; break;