aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPAppController.m2
-rw-r--r--Source/SPBundleEditorController.m3
-rw-r--r--Source/SPCategoryAdditions.h1
-rw-r--r--Source/SPDatabaseDocument.m2
-rw-r--r--Source/SPEditorPreferencePane.m3
-rw-r--r--Source/SPFieldMapperController.m3
-rw-r--r--Source/SPMenuAdditions.h33
-rw-r--r--Source/SPMenuAdditions.m40
-rw-r--r--Source/SPTablesList.m3
9 files changed, 85 insertions, 5 deletions
diff --git a/Source/SPAppController.m b/Source/SPAppController.m
index 04bb07ab..55eb4e17 100644
--- a/Source/SPAppController.m
+++ b/Source/SPAppController.m
@@ -1145,7 +1145,7 @@
NSMenu *menu = [[[NSApp mainMenu] itemWithTag:SPMainMenuBundles] submenu];
// Clean menu
- [menu removeAllItems];
+ [menu compatibleRemoveAllItems];
NSString *bundlePath = [[NSFileManager defaultManager] applicationSupportDirectoryForSubDirectory:SPBundleSupportFolder createIfNotExists:NO error:nil];
diff --git a/Source/SPBundleEditorController.m b/Source/SPBundleEditorController.m
index bddc7a22..71f036e4 100644
--- a/Source/SPBundleEditorController.m
+++ b/Source/SPBundleEditorController.m
@@ -24,6 +24,7 @@
#import "SPBundleEditorController.h"
#import "SPArrayAdditions.h"
+#import "SPMenuAdditions.h"
#define kBundleNameKey @"bundleName"
#define kChildrenKey @"_children_"
@@ -223,7 +224,7 @@
[inputNonePopUpMenu addItem:anItem];
[anItem release];
- [inputGeneralScopePopUpMenu removeAllItems];
+ [inputGeneralScopePopUpMenu compatibleRemoveAllItems];
anItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"General", @"general scope menu label") action:@selector(scopeButtonChanged:) keyEquivalent:@""];
[anItem setTag:kGeneralScopeArrayIndex];
[inputGeneralScopePopUpMenu addItem:anItem];
diff --git a/Source/SPCategoryAdditions.h b/Source/SPCategoryAdditions.h
index f1d6b6a2..347dd957 100644
--- a/Source/SPCategoryAdditions.h
+++ b/Source/SPCategoryAdditions.h
@@ -34,6 +34,7 @@
#import "SPTextViewAdditions.h"
#import "SPWindowAdditions.h"
#import "SPDataAdditions.h"
+#import "SPMenuAdditions.h"
#import "SPNotLoaded.h"
#import "SPMainThreadTrampoline.h"
#import "SPColorAdditions.h"
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index be5f1155..4b52b39d 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -5220,7 +5220,7 @@
SPBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, parentWindow, self, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"Unable to connect to database %@.\nBe sure that you have the necessary privileges.", @"message of panel when connection to db failed after selecting from popupbutton"), targetDatabaseName]);
// Update the database list
- [self setDatabases:self];
+ [[self onMainThread] setDatabases:self];
}
[self endTask];
diff --git a/Source/SPEditorPreferencePane.m b/Source/SPEditorPreferencePane.m
index a57980be..6176c742 100644
--- a/Source/SPEditorPreferencePane.m
+++ b/Source/SPEditorPreferencePane.m
@@ -27,6 +27,7 @@
#import "SPPreferenceController.h"
#import "SPColorWellCell.h"
#import "SPAlertSheets.h"
+#import "SPCategoryAdditions.h"
@interface SPEditorPreferencePane (PrivateAPI)
@@ -334,7 +335,7 @@
[defaultItem setTarget:self];
// Build theme selection submenu
- [themeSelectionMenu removeAllItems];
+ [themeSelectionMenu compatibleRemoveAllItems];
[themeSelectionMenu addItem:defaultItem];
[themeSelectionMenu addItem:[NSMenuItem separatorItem]];
diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m
index 0be1c4d4..e70a7c25 100644
--- a/Source/SPFieldMapperController.m
+++ b/Source/SPFieldMapperController.m
@@ -28,6 +28,7 @@
#import "SPTablesList.h"
#import "SPTextView.h"
#import "SPTableView.h"
+#import "SPCategoryAdditions.h"
#define SP_NUMBER_OF_RECORDS_STRING NSLocalizedString(@"%ld of %@%lu records", @"Label showing the index of the selected CSV row")
@@ -1883,7 +1884,7 @@ static const NSString *SPTableViewSqlColumnID = @"sql";
[prefs setObject:recents forKey:SPGlobalValueHistory];
// Re-init recent menu
- [recentGlobalValueMenu removeAllItems];
+ [recentGlobalValueMenu compatibleRemoveAllItems];
for(id item in recents)
[recentGlobalValueMenu addItemWithTitle:item action:@selector(insertRecentGlobalValue:) keyEquivalent:@""];
diff --git a/Source/SPMenuAdditions.h b/Source/SPMenuAdditions.h
new file mode 100644
index 00000000..88d0129b
--- /dev/null
+++ b/Source/SPMenuAdditions.h
@@ -0,0 +1,33 @@
+//
+// $Id$
+//
+// SPMenuAdditions.h
+// sequel-pro
+//
+// Created by Rowan Beentje on November 27, 2010
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// More info at <http://code.google.com/p/sequel-pro/>
+
+#import <Cocoa/Cocoa.h>
+
+
+@interface NSMenu (SPMenuAdditions)
+
+// Add a 10.5-compatible removeAllItems
+- (void)compatibleRemoveAllItems;
+
+@end
diff --git a/Source/SPMenuAdditions.m b/Source/SPMenuAdditions.m
new file mode 100644
index 00000000..45bde232
--- /dev/null
+++ b/Source/SPMenuAdditions.m
@@ -0,0 +1,40 @@
+//
+// $Id$
+//
+// SPMenuAdditions.m
+// sequel-pro
+//
+// Created by Rowan Beentje on November 27, 2010
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// More info at <http://code.google.com/p/sequel-pro/>
+
+#import "SPMenuAdditions.h"
+
+
+@implementation NSMenu (SPMenuAdditions)
+
+// Add a 10.5-compatible removeAllItems
+- (void)compatibleRemoveAllItems
+{
+ if ([self respondsToSelector:@selector(removeAllItems)]) {
+ [self removeAllItems];
+ } else {
+ while ([self numberOfItems]) [self removeItemAtIndex:0];
+ }
+}
+
+@end
diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m
index 45999ea1..bbc40164 100644
--- a/Source/SPTablesList.m
+++ b/Source/SPTablesList.m
@@ -1443,6 +1443,9 @@
// Disallow selection while the document is working on a task
if ([tableDocumentInstance isWorking]) return NO;
+ // Allow deselections
+ if (rowIndex == -1) return YES;
+
if(![[filteredTables objectAtIndex:rowIndex] isKindOfClass:[NSString class]])
return NO;