diff options
author | ritsuka <[email protected]> | 2015-01-22 10:47:23 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2015-01-22 10:47:23 +0000 |
commit | a6336a4841332056a538c4488ca7a410b6444ec7 (patch) | |
tree | d5f48f7a287add23cfdf1aaee5f7a10d860bb018 | |
parent | 2c6880d133a3cd720369bc9164609dab645ba23f (diff) |
MacGui: center the prefs window in the showWindow: method.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6786 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | macosx/HBAppDelegate.m | 8 | ||||
-rw-r--r-- | macosx/HBPreferencesController.m | 13 |
2 files changed, 12 insertions, 9 deletions
diff --git a/macosx/HBAppDelegate.m b/macosx/HBAppDelegate.m index 868f4ef40..77adfd857 100644 --- a/macosx/HBAppDelegate.m +++ b/macosx/HBAppDelegate.m @@ -419,13 +419,7 @@ static void hb_error_handler(const char *errmsg) _preferencesController = [[HBPreferencesController alloc] init]; } - NSWindow *window = [_preferencesController window]; - if (![window isVisible]) - { - [window center]; - } - - [window makeKeyAndOrderFront:nil]; + [self.preferencesController showWindow:self]; } /** diff --git a/macosx/HBPreferencesController.m b/macosx/HBPreferencesController.m index e53878cca..22d9fcab8 100644 --- a/macosx/HBPreferencesController.m +++ b/macosx/HBPreferencesController.m @@ -90,12 +90,11 @@ * Initializes the preferences controller by loading Preferences.nib file. * */ -- (id)init +- (instancetype)init { if (self = [super initWithWindowNibName:@"Preferences"]) { _languages = [[HBLanguagesSelection alloc] init]; - NSAssert([self window], @"[HBPreferencesController init] window outlet is not connected in Preferences.nib"); } return self; } @@ -106,6 +105,16 @@ [super dealloc]; } +- (void)showWindow:(id)sender +{ + if (!self.window.isVisible) + { + [self.window center]; + } + + [super showWindow:sender]; +} + /** * -[HBPreferencesController awakeFromNib] * |