From f12b95bb7b3dda011dea4bb3e0edff1428a38209 Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 31 Dec 2014 03:00:10 +0100 Subject: Remove some duplicate code by adding abstraction --- Source/SPPreferenceController.m | 39 ++++----------------------------------- 1 file changed, 4 insertions(+), 35 deletions(-) (limited to 'Source/SPPreferenceController.m') diff --git a/Source/SPPreferenceController.m b/Source/SPPreferenceController.m index 3a67ae80..d28dfcb9 100644 --- a/Source/SPPreferenceController.m +++ b/Source/SPPreferenceController.m @@ -105,40 +105,9 @@ [toolbar setSelectedItemIdentifier:[preferencePane preferencePaneIdentifier]]; - [self _resizeWindowForContentView:[preferencePane preferencePaneView]]; -} - -/** - * Displays the table preferences pane. - */ -- (IBAction)displayTablePreferences:(id)sender -{ - [[self window] setMinSize:NSMakeSize(0, 0)]; - [[self window] setShowsResizeIndicator:[tablesPreferencePane preferencePaneAllowsResizing]]; - - [toolbar setSelectedItemIdentifier:[tablesPreferencePane preferencePaneIdentifier]]; - - [(SPTablesPreferencePane *)tablesPreferencePane updateDisplayedTableFontName]; - - [self _resizeWindowForContentView:[tablesPreferencePane preferencePaneView]]; -} - -/** - * Displays the editor preferences pane. - */ -- (IBAction)displayEditorPreferences:(id)sender -{ - [(SPEditorPreferencePane *)editorPreferencePane updateColorSchemeSelectionMenu]; - [(SPEditorPreferencePane *)editorPreferencePane updateDisplayColorThemeName]; + [preferencePane preferencePaneWillBeShown]; - [[self window] setMinSize:NSMakeSize(0, 0)]; - [[self window] setShowsResizeIndicator:[editorPreferencePane preferencePaneAllowsResizing]]; - - [toolbar setSelectedItemIdentifier:[editorPreferencePane preferencePaneIdentifier]]; - - [(SPEditorPreferencePane *)editorPreferencePane updateDisplayedEditorFontName]; - - [self _resizeWindowForContentView:[editorPreferencePane preferencePaneView]]; + [self _resizeWindowForContentView:[preferencePane preferencePaneView]]; } #pragma mark - @@ -198,7 +167,7 @@ [tablesItem setLabel:[tablesPreferencePane preferencePaneName]]; [tablesItem setImage:[tablesPreferencePane preferencePaneIcon]]; [tablesItem setTarget:self]; - [tablesItem setAction:@selector(displayTablePreferences:)]; + [tablesItem setAction:@selector(displayPreferencePane:)]; // Notification preferences notificationsItem = [[NSToolbarItem alloc] initWithItemIdentifier:[notificationsPreferencePane preferencePaneIdentifier]]; @@ -214,7 +183,7 @@ [editorItem setLabel:[editorPreferencePane preferencePaneName]]; [editorItem setImage:[editorPreferencePane preferencePaneIcon]]; [editorItem setTarget:self]; - [editorItem setAction:@selector(displayEditorPreferences:)]; + [editorItem setAction:@selector(displayPreferencePane:)]; // AutoUpdate preferences autoUpdateItem = [[NSToolbarItem alloc] initWithItemIdentifier:[autoUpdatePreferencePane preferencePaneIdentifier]]; -- cgit v1.2.3