Skip to content

Commit

Permalink
Merge branch 'master' of github.com:shpakovski/MASPreferences
Browse files Browse the repository at this point in the history
  • Loading branch information
Vadim Shpakovski committed Nov 16, 2012
2 parents caa0fcc + 29bfb27 commit d5aa8ae
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions MASPreferencesWindowController.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#import "MASPreferencesWindowController.h"

NSString *const kMASPreferencesWindowControllerDidChangeViewNotification = @"MASPreferencesWindowControllerDidChangeViewNotification";
Expand Down Expand Up @@ -67,7 +66,7 @@ - (void)windowDidLoad
[[self window] setTitle:self.title];

if ([self.viewControllers count])
self.selectedViewController = [self viewControllerForIdentifier:[[NSUserDefaults standardUserDefaults] stringForKey:kMASPreferencesSelectedViewKey]] ?: [self.viewControllers objectAtIndex:0];
self.selectedViewController = [self viewControllerForIdentifier:[[NSUserDefaults standardUserDefaults] stringForKey:kMASPreferencesSelectedViewKey]] ?: [self firstViewController];

NSString *origin = [[NSUserDefaults standardUserDefaults] stringForKey:kMASPreferencesFrameTopLeftKey];
if (origin)
Expand All @@ -77,6 +76,14 @@ - (void)windowDidLoad
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidResize:) name:NSWindowDidResizeNotification object:self.window];
}

- (NSViewController <MASPreferencesViewController> *)firstViewController {
for (id viewController in self.viewControllers)
if ([viewController isKindOfClass:[NSViewController class]])
return viewController;

return nil;
}

#pragma mark -
#pragma mark NSWindowDelegate

Expand Down

0 comments on commit d5aa8ae

Please sign in to comment.