Removed unnecessary toolbar property

Signed-off-by: michael starke <michael.starke@hicknhack-software.com>
This commit is contained in:
michael starke
2015-11-03 15:46:18 +01:00
parent a322ba8eae
commit ada956e325

View File

@@ -16,7 +16,6 @@
NSString *lastIdentifier; NSString *lastIdentifier;
} }
@property (strong, nonatomic) NSToolbar *toolbar;
@property (strong, nonatomic) NSMutableDictionary *settingsController; @property (strong, nonatomic) NSMutableDictionary *settingsController;
@property (strong, nonatomic) NSMutableDictionary *toolbarItems; @property (strong, nonatomic) NSMutableDictionary *toolbarItems;
@property (strong) NSArray *defaultToolbarItems; @property (strong) NSArray *defaultToolbarItems;
@@ -32,24 +31,24 @@
-(id)init { -(id)init {
self = [super initWithWindow:nil]; self = [super initWithWindow:nil];
if(self) { if(self) {
_toolbar = [[NSToolbar alloc] initWithIdentifier:@"SettingsToolBar"]; NSToolbar *tb = [[NSToolbar alloc] initWithIdentifier:@"SettingsToolBar"];
[self.toolbar setAllowsUserCustomization:NO]; tb.allowsUserCustomization = NO;
[self.toolbar setDisplayMode:NSToolbarDisplayModeIconAndLabel]; tb.displayMode = NSToolbarDisplayModeIconAndLabel;
_settingsController = [[NSMutableDictionary alloc] initWithCapacity:5]; _settingsController = [[NSMutableDictionary alloc] initWithCapacity:5];
_toolbarItems = [[NSMutableDictionary alloc] initWithCapacity:5]; _toolbarItems = [[NSMutableDictionary alloc] initWithCapacity:5];
lastIdentifier = nil; lastIdentifier = nil;
[self _setupDefaultSettingsTabs]; [self _setupDefaultSettingsTabs];
[self.toolbar setDelegate:self]; tb.delegate = self;
[[self window] setToolbar:self.toolbar]; self.window.toolbar = tb;
} }
return self; return self;
} }
- (void)showSettings { - (void)showSettings {
if([self.defaultToolbarItems count] > 0) { if(self.defaultToolbarItems.count > 0) {
[self showSettingsTabWithIdentifier:self.defaultToolbarItems[0]]; [self showSettingsTabWithIdentifier:self.defaultToolbarItems[0]];
} }
} }
@@ -63,12 +62,12 @@
NSLog(@"Warning. Unknown settingscontroller for identifier: %@. Did you miss to add the controller?", identifier); NSLog(@"Warning. Unknown settingscontroller for identifier: %@. Did you miss to add the controller?", identifier);
return; return;
} }
[self.toolbar setSelectedItemIdentifier:identifier]; self.window.toolbar.selectedItemIdentifier = identifier;
if([tab respondsToSelector:@selector(label)]) { if([tab respondsToSelector:@selector(label)]) {
[[self window] setTitle:[tab label]]; self.window.title = [tab label];
} }
else { else {
[[self window] setTitle:[tab identifier]]; self.window.title = [tab identifier];
} }
/* Access the view before calling the willShoTab to make sure the view is fully loaded */ /* Access the view before calling the willShoTab to make sure the view is fully loaded */
NSView *tabView = [(NSViewController *)tab view]; NSView *tabView = [(NSViewController *)tab view];