aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorMax <post@wickenrode.com>2017-03-31 23:48:02 +0200
committerMax <post@wickenrode.com>2017-03-31 23:53:51 +0200
commit2a6e6504a3ae379d80fb9c4bd19250382b9180ad (patch)
tree4e4741400adb8184bb8d0f998115821cd5e4c087 /Source
parent004af0c9d13d5c9f29b3e0e08ee7df025ee56026 (diff)
downloadsequelpro-2a6e6504a3ae379d80fb9c4bd19250382b9180ad.tar.gz
sequelpro-2a6e6504a3ae379d80fb9c4bd19250382b9180ad.tar.bz2
sequelpro-2a6e6504a3ae379d80fb9c4bd19250382b9180ad.zip
Update source code compatibility
* Remove forward SDK declaration for 10.8 and below (since that is the minimum required development SDK) * Fix one case where a method unconditionally required a 10.9+ runtime * Move all of the forward/backward hacks into their own file
Diffstat (limited to 'Source')
-rw-r--r--Source/SPAppController.m12
-rw-r--r--Source/SPBundleEditorController.m3
-rw-r--r--Source/SPBundleHTMLOutputController.m2
-rw-r--r--Source/SPCategoryAdditions.h1
-rw-r--r--Source/SPCompatibility.h151
-rw-r--r--Source/SPConnectionController.m16
-rw-r--r--Source/SPConstants.h26
-rw-r--r--Source/SPDatabaseDocument.m12
-rw-r--r--Source/SPEditorPreferencePane.m2
-rw-r--r--Source/SPFieldEditorController.m7
-rw-r--r--Source/SPFieldMapperController.m2
-rw-r--r--Source/SPFunctions.m3
-rw-r--r--Source/SPKeychain.m6
-rw-r--r--Source/SPMenuAdditions.h36
-rw-r--r--Source/SPMenuAdditions.m46
-rw-r--r--Source/SPOSInfo.m21
-rw-r--r--Source/SPTableContent.m12
-rw-r--r--Source/SPTooltip.m6
-rw-r--r--Source/SPWindow.m8
-rw-r--r--Source/SPWindowController.m9
-rw-r--r--Source/Sequel-Pro.pch4
21 files changed, 177 insertions, 208 deletions
diff --git a/Source/SPAppController.m b/Source/SPAppController.m
index c7412419..3028c0f6 100644
--- a/Source/SPAppController.m
+++ b/Source/SPAppController.m
@@ -50,6 +50,7 @@
#import "SPWindowManagement.h"
#import "SPCopyTable.h"
#import "SPSyntaxParser.h"
+#import "SPOSInfo.h"
#import <PSMTabBar/PSMTabBarControl.h>
#import <Sparkle/Sparkle.h>
@@ -825,7 +826,14 @@
// remove percent encoding
NSMutableArray *decodedPathComponents = [NSMutableArray arrayWithCapacity:pathComponents.count];
for (NSString *component in pathComponents) {
- [decodedPathComponents addObject:component.stringByRemovingPercentEncoding];
+ NSString *decoded;
+ if([SPOSInfo isOSVersionAtLeastMajor:10 minor:9 patch:0]) {
+ decoded = [component stringByRemovingPercentEncoding];
+ }
+ else {
+ decoded = [component stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
+ }
+ [decodedPathComponents addObject:decoded];
}
pathComponents = decodedPathComponents.copy;
@@ -1599,7 +1607,7 @@
NSMenu *menu = [[[NSApp mainMenu] itemWithTag:SPMainMenuBundles] submenu];
// Clean menu
- [menu compatibleRemoveAllItems];
+ [menu removeAllItems];
// Set up the bundle search paths
// First process all in Application Support folder installed ones then Default ones
diff --git a/Source/SPBundleEditorController.m b/Source/SPBundleEditorController.m
index e95c5d8c..ddac2b9e 100644
--- a/Source/SPBundleEditorController.m
+++ b/Source/SPBundleEditorController.m
@@ -29,7 +29,6 @@
// More info at <https://github.com/sequelpro/sequelpro>
#import "SPBundleEditorController.h"
-#import "SPMenuAdditions.h"
#import "SPBundleCommandRunner.h"
#import "SPOutlineView.h"
#import "SPBundleCommandTextView.h"
@@ -245,7 +244,7 @@
}
NSMenuItem *anItem;
- [inputGeneralScopePopUpMenu compatibleRemoveAllItems];
+ [inputGeneralScopePopUpMenu removeAllItems];
anItem = [[NSMenuItem alloc] initWithTitle:SP_BUNDLEEDITOR_SCOPE_GENERAL_STRING action:@selector(scopeButtonChanged:) keyEquivalent:@""];
[anItem setTag:kGeneralScopeArrayIndex];
[inputGeneralScopePopUpMenu addItem:anItem];
diff --git a/Source/SPBundleHTMLOutputController.m b/Source/SPBundleHTMLOutputController.m
index ecf16faa..6d9f70be 100644
--- a/Source/SPBundleHTMLOutputController.m
+++ b/Source/SPBundleHTMLOutputController.m
@@ -73,9 +73,7 @@ static NSString *SPSaveDocumentAction = @"SPSaveDocument";
[webView setDrawsBackground:YES];
[webView setEditable:NO];
[webView setShouldCloseWithWindow:YES];
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
[webView setShouldUpdateWhileOffscreen:NO];
-#endif
suppressExceptionAlerting = NO;
}
diff --git a/Source/SPCategoryAdditions.h b/Source/SPCategoryAdditions.h
index 991cb60c..f2e08f53 100644
--- a/Source/SPCategoryAdditions.h
+++ b/Source/SPCategoryAdditions.h
@@ -42,7 +42,6 @@
#import "SPWindowAdditions.h"
#import "SPDataAdditions.h"
#import "SPDataBase64EncodingAdditions.h"
-#import "SPMenuAdditions.h"
#import "SPNotLoaded.h"
#import "SPMainThreadTrampoline.h"
#import "SPColorAdditions.h"
diff --git a/Source/SPCompatibility.h b/Source/SPCompatibility.h
new file mode 100644
index 00000000..0154bb2a
--- /dev/null
+++ b/Source/SPCompatibility.h
@@ -0,0 +1,151 @@
+//
+// SPCompatibility.h
+// sequel-pro
+//
+// Created by Max Lohrmann on 31.03.17.
+// Copyright (c) 2017 Max Lohrmann. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+//
+// More info at <https://github.com/sequelpro/sequelpro>
+
+/**
+ * This file contains declarations for backward compatibility to
+ * older XCode versions / SDKs.
+ *
+ * The current minimum required SDK is 10.8!
+ */
+
+#ifndef SPCompatibility
+#define SPCompatibility
+
+#pragma mark - 10.8 Mountain Lion
+
+#ifndef __MAC_10_8
+#define __MAC_10_8 1080
+#endif
+
+#if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_8
+#error You need to have at least SDK 10.8!
+#endif
+
+#pragma mark - 10.9 Mavericks
+
+#ifndef __MAC_10_9
+#define __MAC_10_9 1090
+#endif
+
+#if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_9
+
+@interface NSString (Mavericks)
+
+@property (readonly, copy) NSString *stringByRemovingPercentEncoding;
+
+@end
+
+#endif
+
+#pragma mark - 10.10 Yosemite
+
+#ifndef __MAC_10_10
+#define __MAC_10_10 101000
+#endif
+
+#if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_10
+
+// This enum is available since 10.5 but only got a "name" in 10.10
+typedef NSUInteger NSCellHitResult;
+
+@compatibility_alias NSTitlebarAccessoryViewController NSViewController;
+
+@interface NSViewController (NSTitlebarAccessoryViewController)
+
+@property NSLayoutAttribute layoutAttribute;
+
+@end
+
+@interface NSWindow (Yosemite)
+
+- (NSArray *)titlebarAccessoryViewControllers;
+- (void)removeTitlebarAccessoryViewControllerAtIndex:(NSInteger)index;
+- (void)addTitlebarAccessoryViewController:(NSTitlebarAccessoryViewController *)controller;
+
+@end
+
+// This code is available since 10.8 but public only since 10.10
+typedef struct {
+ NSInteger majorVersion;
+ NSInteger minorVersion;
+ NSInteger patchVersion;
+} NSOperatingSystemVersion;
+
+@interface NSProcessInfo ()
+- (NSOperatingSystemVersion)operatingSystemVersion;
+- (BOOL)isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion)version;
+@end
+
+#endif
+
+#pragma mark - 10.11 El Capitan
+
+#ifndef __MAC_10_11
+#define __MAC_10_11 101100
+#endif
+
+#if !__has_feature(objc_kindof)
+#define __kindof
+#endif
+
+#if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_11
+
+// formal protocol since 10.11, NSObject category before
+@protocol WebFrameLoadDelegate <NSObject>
+@end
+
+@interface NSOpenPanel (ElCapitan)
+
+@property (getter=isAccessoryViewDisclosed) BOOL accessoryViewDisclosed;
+
+@end
+
+#endif
+
+#pragma mark - 10.12 Sierra
+
+#ifndef __MAC_10_12
+#define __MAC_10_12 101200
+#endif
+
+#if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_12
+
+//those enums got renamed in 10.12, probably for consistency
+#define NSAlertStyleInformational NSInformationalAlertStyle
+#define NSAlertStyleWarning NSWarningAlertStyle
+#define NSAlertStyleCritical NSCriticalAlertStyle
+
+@interface NSWindow (Sierra)
++ (void)setAllowsAutomaticWindowTabbing:(BOOL)arg;
+@end
+
+#endif
+
+#endif
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m
index f1968af6..1ccde091 100644
--- a/Source/SPConnectionController.m
+++ b/Source/SPConnectionController.m
@@ -63,22 +63,6 @@ static NSString *SPRemoveNode = @"RemoveNode";
static NSString *SPExportFavoritesFilename = @"SequelProFavorites.plist";
#endif
-#if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_6
-@interface NSSavePanel (NSSavePanel_unpublishedUntilSnowLeopardAPI)
-
-- (void)setShowsHiddenFiles:(BOOL)flag;
-
-@end
-#endif
-
-#if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_11
-@interface NSOpenPanel (NSOpenPanel_ElCaptian)
-
-@property (getter=isAccessoryViewDisclosed) BOOL accessoryViewDisclosed;
-
-@end
-#endif
-
/**
* This is a utility function to validate SSL key/certificate files
* @param fileData The contents of the file
diff --git a/Source/SPConstants.h b/Source/SPConstants.h
index 71b0c49b..1419ec9a 100644
--- a/Source/SPConstants.h
+++ b/Source/SPConstants.h
@@ -665,32 +665,6 @@ typedef NS_ENUM(NSInteger,SPErrorCode) { // error codes in SPErrorDomain
void _SPClear(id *addr);
#define SPClear(x) _SPClear(&x)
-// Backwards compatibility
-#ifndef __MAC_10_7
- #define __MAC_10_7 1070
-#endif
-
-#ifndef __MAC_10_8
- #define __MAC_10_8 1080
-#endif
-
-#ifndef __MAC_10_10
- #define __MAC_10_10 101000
-#endif
-
-#ifndef __MAC_10_11
- #define __MAC_10_11 101100
-#endif
-
-#ifndef __MAC_10_12
- #define __MAC_10_12 101200
-#endif
-
-// This enum is available since 10.5 but only got a "name" in 10.10
-#if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_10
-typedef NSUInteger NSCellHitResult;
-#endif
-
// Stolen from Stack Overflow: http://stackoverflow.com/questions/969130
#define SPLog(fmt, ...) NSLog((@"%s:%d: " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index b57b506f..d19b3f4c 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -29,13 +29,6 @@
//
// More info at <https://github.com/sequelpro/sequelpro>
-// Forward-declare for 10.7 compatibility
-#if !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
-enum {
- NSFullScreenWindowMask = 1 << 14
-};
-#endif
-
#import "SPDatabaseDocument.h"
#import "SPConnectionController.h"
#import "SPConnectionHandler.h"
@@ -3990,10 +3983,11 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0;
if (newIsVisible == windowTitleStatusViewIsVisible) return;
if (newIsVisible) {
- if (NSClassFromString(@"NSTitlebarAccessoryViewController")) { // OS X 10.11 and later
+ Class controllerClass;
+ if ((controllerClass = NSClassFromString(@"NSTitlebarAccessoryViewController"))) { // OS X 10.11 and later
[titleAccessoryView setFrame:NSMakeRect(0, 0, titleAccessoryView.frame.size.width, 120)]; // make it really tall, so that it's on the top right of the title/toolbar area, instead of the bottom right (AppKit will not prevent it from going behind the toolbar)
- NSTitlebarAccessoryViewController *accessoryViewController = [[[NSTitlebarAccessoryViewController alloc] init] autorelease];
+ NSTitlebarAccessoryViewController *accessoryViewController = [[[controllerClass alloc] init] autorelease];
accessoryViewController.view = titleAccessoryView;
accessoryViewController.layoutAttribute = NSLayoutAttributeRight;
[parentWindow addTitlebarAccessoryViewController:accessoryViewController];
diff --git a/Source/SPEditorPreferencePane.m b/Source/SPEditorPreferencePane.m
index 0428984a..7fc810ea 100644
--- a/Source/SPEditorPreferencePane.m
+++ b/Source/SPEditorPreferencePane.m
@@ -351,7 +351,7 @@ static NSString *SPCustomColorSchemeNameLC = @"user-defined";
[defaultItem setTarget:self];
// Build theme selection submenu
- [themeSelectionMenu compatibleRemoveAllItems];
+ [themeSelectionMenu removeAllItems];
[themeSelectionMenu addItem:defaultItem];
[themeSelectionMenu addItem:[NSMenuItem separatorItem]];
diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m
index 0298973d..b79355b5 100644
--- a/Source/SPFieldEditorController.m
+++ b/Source/SPFieldEditorController.m
@@ -41,13 +41,6 @@
#import <SPMySQL/SPMySQL.h>
-#if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_7
-@interface NSTextView (LionPlus)
-- (void)setUsesFindBar:(BOOL)value;
-- (BOOL)usesFindBar;
-@end
-#endif
-
typedef enum {
TextSegment = 0,
ImageSegment,
diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m
index ca40d71a..ee80174a 100644
--- a/Source/SPFieldMapperController.m
+++ b/Source/SPFieldMapperController.m
@@ -2040,7 +2040,7 @@ static NSUInteger SPSourceColumnTypeInteger = 1;
#endif
// Re-init recent menu
- [recentGlobalValueMenu compatibleRemoveAllItems];
+ [recentGlobalValueMenu removeAllItems];
for(id item in recents)
[recentGlobalValueMenu addItemWithTitle:item action:@selector(insertRecentGlobalValue:) keyEquivalent:@""];
diff --git a/Source/SPFunctions.m b/Source/SPFunctions.m
index 93008059..461304e0 100644
--- a/Source/SPFunctions.m
+++ b/Source/SPFunctions.m
@@ -44,11 +44,10 @@ void SPMainQSync(void (^block)(void))
int SPBetterRandomBytes(uint8_t *buf, size_t count)
{
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_7
if([SPOSInfo isOSVersionAtLeastMajor:10 minor:7 patch:0]) {
return SecRandomCopyBytes(kSecRandomDefault, count, buf);
}
-#endif
+
// Version for 10.6
// https://developer.apple.com/library/prerelease/mac/documentation/Security/Conceptual/cryptoservices/RandomNumberGenerationAPIs/RandomNumberGenerationAPIs.html#//apple_ref/doc/uid/TP40011172-CH12-SW1
FILE *fp = fopen("/dev/random", "r");
diff --git a/Source/SPKeychain.m b/Source/SPKeychain.m
index 49e2de69..94b561c5 100644
--- a/Source/SPKeychain.m
+++ b/Source/SPKeychain.m
@@ -230,10 +230,8 @@
*/
- (BOOL)passwordExistsForName:(NSString *)name account:(NSString *)account
{
-#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
// "kSecClassGenericPassword" was introduced with the 10.7 SDK.
// It won't work on 10.6 either (meaning this code never matches properly there).
- // (That's why there are compile time and runtime checks here)
if([SPOSInfo isOSVersionAtLeastMajor:10 minor:7 patch:0]) {
NSMutableDictionary *query = [NSMutableDictionary dictionary];
@@ -248,7 +246,9 @@
return SecItemCopyMatching((CFDictionaryRef)query, (CFTypeRef *)&result) == errSecSuccess;
}
-#endif
+
+ //Version for 10.6
+
SecKeychainItemRef item;
SecKeychainSearchRef search = NULL;
NSInteger numberOfItemsFound = 0;
diff --git a/Source/SPMenuAdditions.h b/Source/SPMenuAdditions.h
deleted file mode 100644
index 6c1070b2..00000000
--- a/Source/SPMenuAdditions.h
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// SPMenuAdditions.h
-// sequel-pro
-//
-// Created by Rowan Beentje on November 27, 2010.
-// Copyright (c) 2010 Rowan Beentje. All rights reserved.
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-//
-// More info at <https://github.com/sequelpro/sequelpro>
-
-@interface NSMenu (SPMenuAdditions)
-
-// Add a 10.5-compatible removeAllItems
-- (void)compatibleRemoveAllItems;
-
-@end
diff --git a/Source/SPMenuAdditions.m b/Source/SPMenuAdditions.m
deleted file mode 100644
index f4544808..00000000
--- a/Source/SPMenuAdditions.m
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// SPMenuAdditions.m
-// sequel-pro
-//
-// Created by Rowan Beentje on November 27, 2010.
-// Copyright (c) 2010 Rowan Beentje. All rights reserved.
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-//
-// More info at <https://github.com/sequelpro/sequelpro>
-
-#import "SPMenuAdditions.h"
-
-@implementation NSMenu (SPMenuAdditions)
-
-// Add a 10.5-compatible removeAllItems
-- (void)compatibleRemoveAllItems
-{
- if ([self respondsToSelector:@selector(removeAllItems)]) {
- [(id)self removeAllItems];
- }
- else {
- while ([self numberOfItems]) [self removeItemAtIndex:0];
- }
-}
-
-@end
diff --git a/Source/SPOSInfo.m b/Source/SPOSInfo.m
index b862e898..412b634a 100644
--- a/Source/SPOSInfo.m
+++ b/Source/SPOSInfo.m
@@ -29,26 +29,7 @@
// More info at <https://github.com/sequelpro/sequelpro>
#import "SPOSInfo.h"
-
-// Needed because this class is also compiled with SequelProTunnelAssistant which can't access SPConstants.h
-#ifndef __MAC_10_10
-#define __MAC_10_10 101000
-#endif
-
-#if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_10
-// This code is available since 10.8 but public only since 10.10
-typedef struct {
- NSInteger majorVersion;
- NSInteger minorVersion;
- NSInteger patchVersion;
-} NSOperatingSystemVersion;
-
-@interface NSProcessInfo ()
-- (NSOperatingSystemVersion)operatingSystemVersion;
-- (BOOL)isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion)version;
-@end
-
-#endif
+#import "SPCompatibility.h" // Needed because this class is also compiled with SequelProTunnelAssistant
int SPOSVersionCompare(SPOSVersion left, SPOSVersion right)
{
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index 416b7cd8..0738fe96 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -243,20 +243,16 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
[nibLoader release];
-#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_7
//let's see if we can use the NSPopover (10.7+) or have to make do with our legacy clone.
//this is using reflection right now, as our SDK is 10.8 but our minimum supported version is 10.6
Class popOverClass = NSClassFromString(@"NSPopover");
- if(popOverClass)
- {
+ if(popOverClass) {
paginationPopover = [[popOverClass alloc] init];
[paginationPopover setDelegate:(SPTableContent<NSPopoverDelegate> *)self];
[paginationPopover setContentViewController:paginationViewController];
[paginationPopover setBehavior:NSPopoverBehaviorTransient];
}
- else
-#endif
- {
+ else {
[paginationBox setContentView:[paginationViewController view]];
// Add the pagination view to the content area
@@ -1638,13 +1634,11 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
}
#endif
-#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_7
- (void)popoverDidClose:(NSNotification *)notification
{
//not to hide the view, but to change the paginationButton
[self setPaginationViewVisibility:NO];
}
-#endif
/**
* Show or hide the pagination layer, also changing the first responder as appropriate.
@@ -1672,7 +1666,6 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
}
}
-#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_7
if(paginationPopover) {
if(makeVisible) {
[paginationPopover showRelativeToRect:[paginationButton bounds] ofView:paginationButton preferredEdge:NSMinYEdge];
@@ -1684,7 +1677,6 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
}
return;
}
-#endif
if (makeVisible) {
if (paginationViewFrame.size.height == paginationViewHeight) return;
diff --git a/Source/SPTooltip.m b/Source/SPTooltip.m
index 54a997f6..ff68fdbe 100644
--- a/Source/SPTooltip.m
+++ b/Source/SPTooltip.m
@@ -83,12 +83,6 @@ static CGFloat slow_in_out (CGFloat t)
@end
-@interface WebView (LeopardOnly)
-
-- (void)setDrawsBackground:(BOOL)drawsBackground;
-
-@end
-
@implementation SPTooltip
// ==================
diff --git a/Source/SPWindow.m b/Source/SPWindow.m
index 383b7fcd..18c4fae3 100644
--- a/Source/SPWindow.m
+++ b/Source/SPWindow.m
@@ -31,12 +31,6 @@
#import "SPWindow.h"
#import "SPWindowController.h"
-@interface NSWindow (LionPlusMethods)
-
-- (void)toggleFullScreen:(id)sender;
-
-@end
-
@implementation SPWindow
@synthesize isSheetWhichCanBecomeMain;
@@ -45,12 +39,10 @@
+ (void)initialize
{
-#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_12
// Disable automatic window tabbing on 10.12+
if ([NSWindow respondsToSelector:@selector(setAllowsAutomaticWindowTabbing:)]) {
[NSWindow setAllowsAutomaticWindowTabbing:NO];
}
-#endif
}
#pragma mark -
diff --git a/Source/SPWindowController.m b/Source/SPWindowController.m
index cddf6b09..7f3c687b 100644
--- a/Source/SPWindowController.m
+++ b/Source/SPWindowController.m
@@ -39,15 +39,6 @@
#import <PSMTabBar/PSMTabBarControl.h>
#import <PSMTabBar/PSMTabStyle.h>
-// Forward-declare for 10.7 compatibility
-#if !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
-enum {
- NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7,
- NSWindowCollectionBehaviorFullScreenAuxiliary = 1 << 8,
- NSFullScreenWindowMask = 1 << 14
-};
-#endif
-
@interface SPWindowController ()
- (void)_setUpTabBar;
diff --git a/Source/Sequel-Pro.pch b/Source/Sequel-Pro.pch
index f3b2fd16..dc6bbf9b 100644
--- a/Source/Sequel-Pro.pch
+++ b/Source/Sequel-Pro.pch
@@ -32,7 +32,9 @@
// Nearly every class uses constants
#import "SPConstants.h"
-
+
+ #import "SPCompatibility.h"
+
// Make all our custom additions available
#import "SPCategoryAdditions.h"
#endif