summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--macosx/HBAppDelegate.m8
-rw-r--r--macosx/HBPreferencesController.m13
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]
*