Change setup of PrefsController a little.

This commit is contained in:
Mitchell Livingston
2006-07-30 22:11:08 +00:00
parent 25045ca3d6
commit e8f77bb80f
3 changed files with 14 additions and 9 deletions

View File

@@ -73,7 +73,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
fDefaults = [NSUserDefaults standardUserDefaults]; fDefaults = [NSUserDefaults standardUserDefaults];
fInfoController = [[InfoWindowController alloc] initWithWindowNibName: @"InfoWindow"]; fInfoController = [[InfoWindowController alloc] initWithWindowNibName: @"InfoWindow"];
fPrefsController = [[PrefsController alloc] initWithWindowNibName: @"PrefsWindow"]; fPrefsController = [[PrefsController alloc] initWithWindowNibName: @"PrefsWindow" handle: fLib];
fBadger = [[Badger alloc] init]; fBadger = [[Badger alloc] init];
fAutoImportedNames = [[NSMutableArray alloc] init]; fAutoImportedNames = [[NSMutableArray alloc] init];
@@ -105,8 +105,6 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
- (void) awakeFromNib - (void) awakeFromNib
{ {
[fPrefsController setPrefs: fLib];
[fStatusBar setBackgroundImage: [NSImage imageNamed: @"StatusBarBackground.png"]]; [fStatusBar setBackgroundImage: [NSImage imageNamed: @"StatusBarBackground.png"]];
[fFilterBar setBackgroundImage: [NSImage imageNamed: @"FilterBarBackground.png"]]; [fFilterBar setBackgroundImage: [NSImage imageNamed: @"FilterBarBackground.png"]];

View File

@@ -60,7 +60,7 @@
NSUserDefaults * fDefaults; NSUserDefaults * fDefaults;
} }
- (void) setPrefs: (tr_handle_t *) handle; - (id) initWithWindowNibName: (NSString *) name handle: (tr_handle_t *) handle;
- (void) setShowMessage: (id) sender; - (void) setShowMessage: (id) sender;
- (void) setBadge: (id) sender; - (void) setBadge: (id) sender;

View File

@@ -70,13 +70,23 @@
[[NSBundle mainBundle] pathForResource: @"Defaults" ofType: @"plist"]]]; [[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 - (void) dealloc
{ {
[fDownloadFolder release]; [fDownloadFolder release];
[super dealloc]; [super dealloc];
} }
- (void) setPrefs: (tr_handle_t *) handle - (void) awakeFromNib
{ {
fToolbar = [[NSToolbar alloc] initWithIdentifier: @"Preferences Toolbar"]; fToolbar = [[NSToolbar alloc] initWithIdentifier: @"Preferences Toolbar"];
[fToolbar setDelegate: self]; [fToolbar setDelegate: self];
@@ -87,9 +97,6 @@
[fToolbar setSelectedItemIdentifier: TOOLBAR_GENERAL]; [fToolbar setSelectedItemIdentifier: TOOLBAR_GENERAL];
[self showGeneralPref: nil]; [self showGeneralPref: nil];
fDefaults = [NSUserDefaults standardUserDefaults];
fHandle = handle;
//set download folder //set download folder
NSString * downloadChoice = [fDefaults stringForKey: @"DownloadChoice"]; NSString * downloadChoice = [fDefaults stringForKey: @"DownloadChoice"];
@@ -285,7 +292,7 @@
} }
else else
{ {
tr_setBindPort( fHandle, bindPort ); tr_setBindPort(fHandle, bindPort);
[fDefaults setInteger: bindPort forKey: @"BindPort"]; [fDefaults setInteger: bindPort forKey: @"BindPort"];
} }
} }