diff --git a/Source/AppDelegate.h b/Source/AppDelegate.h index 19796d7e..eb216be0 100644 --- a/Source/AppDelegate.h +++ b/Source/AppDelegate.h @@ -34,6 +34,7 @@ #import +@class PreferencesWindowController; @class UpdateNotificationController; @interface AppDelegate : NSObject @@ -42,11 +43,13 @@ NSWindow *_window; NSURLConnection *_updateCheckConnection; NSMutableData *_receivingData; + PreferencesWindowController *_preferencesWindowController; UpdateNotificationController *_updateNotificationController; } - (void)checkForUpdate; - (void)checkForUpdateForced:(BOOL)forced; +- (void)showPreferences; @property (assign, nonatomic) IBOutlet NSWindow *window; @end diff --git a/Source/AppDelegate.m b/Source/AppDelegate.m index 8989d537..02b4270c 100644 --- a/Source/AppDelegate.m +++ b/Source/AppDelegate.m @@ -52,6 +52,7 @@ @implementation AppDelegate - (void)dealloc { + [_preferencesWindowController release]; [_updateCheckConnection release]; [_updateNotificationController release]; [super dealloc]; @@ -122,6 +123,15 @@ - (void)checkForUpdateForced:(BOOL)forced [_updateCheckConnection start]; } +- (void)showPreferences +{ + if (!_preferencesWindowController) { + _preferencesWindowController = [[PreferencesWindowController alloc] initWithWindowNibName:@"preferences"]; + } + [[_preferencesWindowController window] center]; + [[_preferencesWindowController window] orderFront:self]; +} + - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { [_receivingData release]; diff --git a/Source/InputMethodController.mm b/Source/InputMethodController.mm index 199cd044..5e207827 100644 --- a/Source/InputMethodController.mm +++ b/Source/InputMethodController.mm @@ -1385,7 +1385,11 @@ - (void)_showCandidateWindowUsingVerticalMode:(BOOL)useVerticalMode client:(id)c - (void)showPreferences:(id)sender { // show the preferences panel, and also make the IME app itself the focus - [super showPreferences:sender]; + if ([IMKInputController instancesRespondToSelector:@selector(showPreferences:)]) { + [super showPreferences:sender]; + } else { + [(AppDelegate *)[NSApp delegate] showPreferences]; + } [[NSApplication sharedApplication] activateIgnoringOtherApps:YES]; }