aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2010-10-29 14:33:32 +0000
committerstuconnolly <stuart02@gmail.com>2010-10-29 14:33:32 +0000
commit8c27fbba193596ae2123bb8fc30e6d7041f44a83 (patch)
tree35cb7e9729c1aa7814108eecfa8d3086b112fb80
parent497a0c7c9d30fe60763f54982b96b2cec8fa649a (diff)
downloadsequelpro-8c27fbba193596ae2123bb8fc30e6d7041f44a83.tar.gz
sequelpro-8c27fbba193596ae2123bb8fc30e6d7041f44a83.tar.bz2
sequelpro-8c27fbba193596ae2123bb8fc30e6d7041f44a83.zip
Move SPConnectionController's delegate methods to their own protocol.
-rw-r--r--Source/SPConnectionController.h17
-rw-r--r--Source/SPConnectionController.m3
-rw-r--r--Source/SPConnectionControllerDelegate.h49
-rw-r--r--Source/SPDatabaseDocument.h4
-rw-r--r--sequel-pro.xcodeproj/project.pbxproj14
5 files changed, 71 insertions, 16 deletions
diff --git a/Source/SPConnectionController.h b/Source/SPConnectionController.h
index 28f6f1bd..3dd0563e 100644
--- a/Source/SPConnectionController.h
+++ b/Source/SPConnectionController.h
@@ -25,11 +25,9 @@
#import <MCPKit/MCPKit.h>
-#import "SPDatabaseDocument.h"
-#import "SPKeychain.h"
-#import "SPSSHTunnel.h"
+#import "SPConnectionControllerDelegate.h"
-@class BWAnchoredButtonBar;
+@class SPDatabaseDocument, SPKeychain, SPSSHTunnel, BWAnchoredButtonBar;
@interface NSObject (BWAnchoredButtonBar)
@@ -37,13 +35,6 @@
@end
-@interface NSObject (SPConnectionControllerDelegate)
-
-- (void)connectionControllerInitiatingConnection:(id)controller;
-- (void)connectionControllerConnectAttemptFailed:(id)controller;
-
-@end
-
@interface SPFlippedView : NSView
- (BOOL)isFlipped;
@@ -52,7 +43,7 @@
@interface SPConnectionController : NSObject
{
- id delegate;
+ id <SPConnectionControllerDelegate> delegate;
SPDatabaseDocument *tableDocument;
NSView *databaseConnectionSuperview;
@@ -144,7 +135,7 @@
SPFavoritesSortItem previousSortItem, currentSortItem;
}
-@property (readwrite, assign) id delegate;
+@property (readwrite, assign) id <SPConnectionControllerDelegate> delegate;
@property (readwrite, assign) NSInteger type;
@property (readwrite, retain) NSString *name;
@property (readwrite, retain) NSString *host;
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m
index 7891ff1e..241a6e1d 100644
--- a/Source/SPConnectionController.m
+++ b/Source/SPConnectionController.m
@@ -24,11 +24,14 @@
// More info at <http://code.google.com/p/sequel-pro/>
#import "SPConnectionController.h"
+#import "SPDatabaseDocument.h"
#import "SPAppController.h"
#import "SPPreferenceController.h"
#import "ImageAndTextCell.h"
#import "RegexKitLite.h"
#import "SPAlertSheets.h"
+#import "SPKeychain.h"
+#import "SPSSHTunnel.h"
@interface SPConnectionController (PrivateAPI)
diff --git a/Source/SPConnectionControllerDelegate.h b/Source/SPConnectionControllerDelegate.h
new file mode 100644
index 00000000..892a52ae
--- /dev/null
+++ b/Source/SPConnectionControllerDelegate.h
@@ -0,0 +1,49 @@
+//
+// $Id$
+//
+// SPConnectionControllerDelegate.h
+// sequel-pro
+//
+// Created by Stuart Connolly (stuconnolly.com) on April 15, 2010
+// Copyright (c) 2010 Stuart Connolly. All rights reserved.
+//
+// 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/>
+
+/**
+ * @protocol SPConnectionControllerDelegate SPConnectionControllerDelegate.h
+ *
+ * @author Stuart Connolly http://stuconnolly.com/
+ *
+ * Connection controller delegate protocol.
+ */
+@protocol SPConnectionControllerDelegate
+
+/**
+ * Called when the connection controller starts initiating the connection process.
+ *
+ * @param controller The calling connection controller
+ */
+- (void)connectionControllerInitiatingConnection:(id)controller;
+
+/**
+ * Called when the connection controller's connection attempt failed.
+ *
+ * @param controller The calling connection controller
+ */
+- (void)connectionControllerConnectAttemptFailed:(id)controller;
+
+@end
diff --git a/Source/SPDatabaseDocument.h b/Source/SPDatabaseDocument.h
index 5d48aa99..f01abe63 100644
--- a/Source/SPDatabaseDocument.h
+++ b/Source/SPDatabaseDocument.h
@@ -35,10 +35,12 @@
SPWindowController,
SPServerSupport;
+@protocol SPConnectionControllerDelegate;
+
/**
* The SPDatabaseDocument class controls the primary database view window.
*/
-@interface SPDatabaseDocument : NSObject <NSUserInterfaceValidations>
+@interface SPDatabaseDocument : NSObject <NSUserInterfaceValidations, SPConnectionControllerDelegate>
{
// IBOutlets
IBOutlet id tablesListInstance;
diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj
index c9b87bf0..c61ac93c 100644
--- a/sequel-pro.xcodeproj/project.pbxproj
+++ b/sequel-pro.xcodeproj/project.pbxproj
@@ -668,6 +668,7 @@
17D38EBB12771A1C00672B13 /* SPTableStructureDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPTableStructureDelegate.m; sourceTree = "<group>"; };
17D38F6E1279E23A00672B13 /* SPTableFieldValidation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPTableFieldValidation.h; sourceTree = "<group>"; };
17D38F6F1279E23A00672B13 /* SPTableFieldValidation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPTableFieldValidation.m; sourceTree = "<group>"; };
+ 17D38FC3127B0CFC00672B13 /* SPConnectionControllerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPConnectionControllerDelegate.h; sourceTree = "<group>"; };
17DA04EA0FC1A7DA00D66140 /* Unit Tests-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "Unit Tests-Info.plist"; path = "Plists/Unit Tests-Info.plist"; sourceTree = "<group>"; };
17DC8E74126F4AB600E9AAEC /* MCPConnectionDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCPConnectionDelegate.h; sourceTree = "<group>"; };
17DCC5C5115C202700F89A00 /* MCPStringAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCPStringAdditions.h; sourceTree = "<group>"; };
@@ -1347,8 +1348,6 @@
children = (
17E641480EF01EF6001BC333 /* SPCustomQuery.h */,
17E641490EF01EF6001BC333 /* SPCustomQuery.m */,
- 5822C9B31000DB2400DCC3D6 /* SPConnectionController.h */,
- 5822C9B41000DB2400DCC3D6 /* SPConnectionController.m */,
177E7A210FCB6A2E00E9E122 /* SPExtendedTableInfo.h */,
177E7A220FCB6A2E00E9E122 /* SPExtendedTableInfo.m */,
387BBBA60FBCB6CB00B31746 /* SPTableRelations.h */,
@@ -1359,6 +1358,7 @@
17E6414F0EF01EF6001BC333 /* SPTableContent.m */,
17E641500EF01EF6001BC333 /* SPDatabaseDocument.h */,
17E641510EF01EF6001BC333 /* SPDatabaseDocument.m */,
+ 17D38FC2127B0C9500672B13 /* Connection View */,
17D38F691279E17D00672B13 /* Table Structure */,
1792C28910AE1C7200ABE758 /* Controller Categories */,
);
@@ -1620,6 +1620,16 @@
name = "Table Structure";
sourceTree = "<group>";
};
+ 17D38FC2127B0C9500672B13 /* Connection View */ = {
+ isa = PBXGroup;
+ children = (
+ 5822C9B31000DB2400DCC3D6 /* SPConnectionController.h */,
+ 5822C9B41000DB2400DCC3D6 /* SPConnectionController.m */,
+ 17D38FC3127B0CFC00672B13 /* SPConnectionControllerDelegate.h */,
+ );
+ name = "Connection View";
+ sourceTree = "<group>";
+ };
17DC8825126B222D00E9AAEC /* Third Party */ = {
isa = PBXGroup;
children = (