aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPWindowController.m
diff options
context:
space:
mode:
authoravenjamin <avenjamin@gmail.com>2010-06-30 16:34:03 +0000
committeravenjamin <avenjamin@gmail.com>2010-06-30 16:34:03 +0000
commitba332e64c29622e0b69412cb2fea639182ac1d1c (patch)
tree23d990c97bc1c70fe4a26450b2ea0b579ddbe919 /Source/SPWindowController.m
parent92b97ba3f3ee634e101483f5129f25b4f8230117 (diff)
downloadsequelpro-ba332e64c29622e0b69412cb2fea639182ac1d1c.tar.gz
sequelpro-ba332e64c29622e0b69412cb2fea639182ac1d1c.tar.bz2
sequelpro-ba332e64c29622e0b69412cb2fea639182ac1d1c.zip
Add option to toggle the tab bar visibility.
- Only applies when one tab is present. - Saves last used state to preferences.
Diffstat (limited to 'Source/SPWindowController.m')
-rw-r--r--Source/SPWindowController.m19
1 files changed, 18 insertions, 1 deletions
diff --git a/Source/SPWindowController.m b/Source/SPWindowController.m
index 0cfe9e8e..5cd98870 100644
--- a/Source/SPWindowController.m
+++ b/Source/SPWindowController.m
@@ -53,7 +53,7 @@
// Set up the tab bar
[tabBar setStyleNamed:@"SequelPro"];
[tabBar setCanCloseOnlyTab:NO];
- [tabBar setHideForSingleTab:YES];
+ [tabBar setHideForSingleTab:![[NSUserDefaults standardUserDefaults] boolForKey:SPAlwaysShowWindowTabBar]];
[tabBar setShowAddTabButton:YES];
[tabBar setSizeCellsToFit:NO];
[tabBar setCellMinWidth:100];
@@ -260,6 +260,17 @@
}
/**
+ * Toggle Tab Bar Visibility
+ */
+
+- (IBAction)toggleTabBarShown:(id)sender
+{
+ [tabBar setHideForSingleTab:![tabBar isTabBarHidden]];
+ [[NSUserDefaults standardUserDefaults] setBool:![tabBar hideForSingleTab] forKey:SPAlwaysShowWindowTabBar];
+}
+
+
+/**
* Menu validation
*/
- (BOOL) validateMenuItem:(NSMenuItem *)menuItem
@@ -273,6 +284,12 @@
return ([tabView numberOfTabViewItems] != 1);
}
+ // Show/hide Tab bar
+ if ([menuItem action] == @selector(toggleTabBarShown:)) {
+ [menuItem setTitle:(![tabBar isTabBarHidden] ? NSLocalizedString(@"Hide Tab Bar", @"hide tab bar") : NSLocalizedString(@"Show Tab Bar", @"show tab bar"))];
+ return [[tabBar cells] count] <= 1;
+ }
+
// See if the front document blocks validation of this item
if (![selectedTableDocument validateMenuItem:menuItem]) return NO;