diff --git a/macosx/Controller.m b/macosx/Controller.m index 83b3d2715..19574185f 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -73,7 +73,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy fDefaults = [NSUserDefaults standardUserDefaults]; fInfoController = [[InfoWindowController alloc] initWithWindowNibName: @"InfoWindow"]; - fPrefsController = [[PrefsController alloc] initWithWindowNibName: @"PrefsWindow"]; + fPrefsController = [[PrefsController alloc] initWithWindowNibName: @"PrefsWindow" handle: fLib]; fBadger = [[Badger alloc] init]; fAutoImportedNames = [[NSMutableArray alloc] init]; @@ -105,8 +105,6 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy - (void) awakeFromNib { - [fPrefsController setPrefs: fLib]; - [fStatusBar setBackgroundImage: [NSImage imageNamed: @"StatusBarBackground.png"]]; [fFilterBar setBackgroundImage: [NSImage imageNamed: @"FilterBarBackground.png"]]; diff --git a/macosx/PrefsController.h b/macosx/PrefsController.h index e3049b6db..37a7e72e4 100644 --- a/macosx/PrefsController.h +++ b/macosx/PrefsController.h @@ -60,7 +60,7 @@ NSUserDefaults * fDefaults; } -- (void) setPrefs: (tr_handle_t *) handle; +- (id) initWithWindowNibName: (NSString *) name handle: (tr_handle_t *) handle; - (void) setShowMessage: (id) sender; - (void) setBadge: (id) sender; diff --git a/macosx/PrefsController.m b/macosx/PrefsController.m index 6bfa61728..44f0005a9 100644 --- a/macosx/PrefsController.m +++ b/macosx/PrefsController.m @@ -70,13 +70,23 @@ [[NSBundle mainBundle] pathForResource: @"Defaults" ofType: @"plist"]]]; } +- (id) initWithWindowNibName: (NSString *) name handle: (tr_handle_t *) handle +{ + if ((self = [super initWithWindowNibName: name])) + { + fDefaults = [NSUserDefaults standardUserDefaults]; + fHandle = handle; + } + return self; +} + - (void) dealloc { [fDownloadFolder release]; [super dealloc]; } -- (void) setPrefs: (tr_handle_t *) handle +- (void) awakeFromNib { fToolbar = [[NSToolbar alloc] initWithIdentifier: @"Preferences Toolbar"]; [fToolbar setDelegate: self]; @@ -87,9 +97,6 @@ [fToolbar setSelectedItemIdentifier: TOOLBAR_GENERAL]; [self showGeneralPref: nil]; - - fDefaults = [NSUserDefaults standardUserDefaults]; - fHandle = handle; //set download folder NSString * downloadChoice = [fDefaults stringForKey: @"DownloadChoice"]; @@ -285,7 +292,7 @@ } else { - tr_setBindPort( fHandle, bindPort ); + tr_setBindPort(fHandle, bindPort); [fDefaults setInteger: bindPort forKey: @"BindPort"]; } }