aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2010-11-10 14:26:44 +0000
committerstuconnolly <stuart02@gmail.com>2010-11-10 14:26:44 +0000
commitb72f9507c2be480c680b7f58753789432882f1c4 (patch)
tree93583d7abcac9c8cda437c3f6a342f463fa9a149
parentbb99430f93b2e3c89c28cc44257635709f0fdd39 (diff)
downloadsequelpro-b72f9507c2be480c680b7f58753789432882f1c4.tar.gz
sequelpro-b72f9507c2be480c680b7f58753789432882f1c4.tar.bz2
sequelpro-b72f9507c2be480c680b7f58753789432882f1c4.zip
Add a new class template for the favorites controller.
-rw-r--r--Source/SPConstants.h2
-rw-r--r--Source/SPConstants.m2
-rw-r--r--Source/SPFavoritesController.h35
-rw-r--r--Source/SPFavoritesController.m62
-rw-r--r--Source/SPGrowlController.h4
-rw-r--r--Source/SPGrowlController.m14
-rw-r--r--Source/SPLogger.h4
-rw-r--r--Source/SPLogger.m10
-rw-r--r--Source/SPSingleton.h28
-rw-r--r--Source/SPSingleton.m56
-rw-r--r--sequel-pro.xcodeproj/project.pbxproj16
11 files changed, 205 insertions, 28 deletions
diff --git a/Source/SPConstants.h b/Source/SPConstants.h
index 931722ba..651a68c5 100644
--- a/Source/SPConstants.h
+++ b/Source/SPConstants.h
@@ -230,6 +230,7 @@ extern NSString *SPColorThemeFileExtension;
extern NSString *SPUserBundleFileExtension;
// File names
+extern NSString *SPFavoritesDataFile;
extern NSString *SPHTMLPrintTemplate;
extern NSString *SPHTMLTableInfoPrintTemplate;
extern NSString *SPHTMLHelpTemplate;
@@ -237,6 +238,7 @@ extern NSString *SPHTMLHelpTemplate;
// Folder names
extern NSString *SPThemesSupportFolder;
extern NSString *SPBundleSupportFolder;
+extern NSString *SPDataSupportFolder;
// Preference key constants
// General Prefpane
diff --git a/Source/SPConstants.m b/Source/SPConstants.m
index c146e525..bfacad2d 100644
--- a/Source/SPConstants.m
+++ b/Source/SPConstants.m
@@ -51,6 +51,7 @@ NSString *SPColorThemeFileExtension = @"spTheme";
NSString *SPUserBundleFileExtension = @"spBundle";
// File names
+NSString *SPFavoritesDataFile = @"Favorites.plist";
NSString *SPHTMLPrintTemplate = @"SPPrintTemplate";
NSString *SPHTMLTableInfoPrintTemplate = @"SPTableInfoPrintTemplate";
NSString *SPHTMLHelpTemplate = @"SPMySQLHelpTemplate";
@@ -58,6 +59,7 @@ NSString *SPHTMLHelpTemplate = @"SPMySQLHelpTemplate";
// Folder names
NSString *SPThemesSupportFolder = @"Themes";
NSString *SPBundleSupportFolder = @"Bundles";
+NSString *SPDataSupportFolder = @"Data";
// Preference key constants
// General Prefpane
diff --git a/Source/SPFavoritesController.h b/Source/SPFavoritesController.h
new file mode 100644
index 00000000..5e9d714c
--- /dev/null
+++ b/Source/SPFavoritesController.h
@@ -0,0 +1,35 @@
+//
+// $Id$
+//
+// SPFavoritesController.h
+// sequel-pro
+//
+// Created by Stuart Connolly (stuconnolly.com) on November 10, 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/>
+
+#import "SPSingleton.h"
+
+@interface SPFavoritesController : SPSingleton
+{
+ NSDictionary *favorties;
+}
+
+- (SPFavoritesController *)sharedFavoritesController;
+
+@end
diff --git a/Source/SPFavoritesController.m b/Source/SPFavoritesController.m
new file mode 100644
index 00000000..dacd35dc
--- /dev/null
+++ b/Source/SPFavoritesController.m
@@ -0,0 +1,62 @@
+//
+// $Id$
+//
+// SPFavoritesController.m
+// sequel-pro
+//
+// Created by Stuart Connolly (stuconnolly.com) on November 10, 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/>
+
+#import "SPFavoritesController.h"
+
+static SPFavoritesController *sharedFavoritesController = nil;
+
+@implementation SPFavoritesController
+
+/**
+ * Returns the shared favorites controller.
+ */
++ (SPFavoritesController *)sharedFavoritesController
+{
+ @synchronized(self) {
+ if (sharedFavoritesController == nil) {
+ sharedFavoritesController = [[super allocWithZone:NULL] init];
+ }
+ }
+
+ return sharedFavoritesController;
+}
+
++ (id)allocWithZone:(NSZone *)zone
+{
+ @synchronized(self) {
+ return [[self sharedFavoritesController] retain];
+ }
+}
+
+- (id)init
+{
+ if ((self = [super init])) {
+
+ }
+
+ return self;
+}
+
+@end
diff --git a/Source/SPGrowlController.h b/Source/SPGrowlController.h
index d0a95d6d..d1cb7dc2 100644
--- a/Source/SPGrowlController.h
+++ b/Source/SPGrowlController.h
@@ -25,9 +25,11 @@
#import <Growl/Growl.h>
+#import "SPSingleton.h"
+
@class SPDatabaseDocument;
-@interface SPGrowlController : NSObject <GrowlApplicationBridgeDelegate>
+@interface SPGrowlController : SPSingleton <GrowlApplicationBridgeDelegate>
{
NSString *timingNotificationName;
double timingNotificationStart;
diff --git a/Source/SPGrowlController.m b/Source/SPGrowlController.m
index 24eccb50..71f93053 100644
--- a/Source/SPGrowlController.m
+++ b/Source/SPGrowlController.m
@@ -66,20 +66,6 @@ static SPGrowlController *sharedGrowlController = nil;
}
/**
- * The following base protocol methods are implemented to ensure the singleton status of this class.
- */
-
-- (id)copyWithZone:(NSZone *)zone { return self; }
-
-- (id)retain { return self; }
-
-- (NSUInteger)retainCount { return NSUIntegerMax; }
-
-- (id)autorelease { return self; }
-
-- (void)release { }
-
-/**
* Posts a Growl notification using the supplied details and default values.
* Calls the notification after a tiny delay to allow isKeyWindow to have updated
* after tasks.
diff --git a/Source/SPLogger.h b/Source/SPLogger.h
index 3fd2cae9..640e5cb3 100644
--- a/Source/SPLogger.h
+++ b/Source/SPLogger.h
@@ -23,7 +23,9 @@
//
// More info at <http://code.google.com/p/sequel-pro/>
-@interface SPLogger : NSObject
+#import "SPSingleton.h"
+
+@interface SPLogger : SPSingleton
{
/**
* Dump leaks on termination flag.
diff --git a/Source/SPLogger.m b/Source/SPLogger.m
index 112edb64..743b0fce 100644
--- a/Source/SPLogger.m
+++ b/Source/SPLogger.m
@@ -80,16 +80,6 @@ static SPLogger *logger = nil;
}
}
-- (id)copyWithZone:(NSZone *)zone { return self; }
-
-- (id)retain { return self; }
-
-- (NSUInteger)retainCount { return NSUIntegerMax; }
-
-- (void)release {}
-
-- (id)autorelease { return self; }
-
- (id)init
{
if ((self = [super init])) {
diff --git a/Source/SPSingleton.h b/Source/SPSingleton.h
new file mode 100644
index 00000000..57b5f67b
--- /dev/null
+++ b/Source/SPSingleton.h
@@ -0,0 +1,28 @@
+//
+// $Id$
+//
+// SPSingleton.h
+// sequel-pro
+//
+// Created by Stuart Connolly (stuconnolly.com) on November 10, 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/>
+
+@interface SPSingleton : NSObject
+
+@end
diff --git a/Source/SPSingleton.m b/Source/SPSingleton.m
new file mode 100644
index 00000000..a1321333
--- /dev/null
+++ b/Source/SPSingleton.m
@@ -0,0 +1,56 @@
+//
+// $Id$
+//
+// SPSingleton.m
+// sequel-pro
+//
+// Created by Stuart Connolly (stuconnolly.com) on November 10, 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/>
+
+#import "SPSingleton.h"
+
+@implementation SPSingleton
+
+/**
+ * The following base protocol methods are implemented to ensure the singleton status of this class.
+ */
+
+- (id)copyWithZone:(NSZone *)zone
+{
+ return self;
+}
+
+- (id)retain
+{
+ return self;
+}
+
+- (NSUInteger)retainCount
+{
+ return NSUIntegerMax;
+}
+
+- (id)autorelease
+{
+ return self;
+}
+
+- (void)release { }
+
+@end
diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj
index be34cfa9..9b6f156a 100644
--- a/sequel-pro.xcodeproj/project.pbxproj
+++ b/sequel-pro.xcodeproj/project.pbxproj
@@ -123,6 +123,8 @@
17D390CB127B6BF800672B13 /* SPPreferencesUpgrade.m in Sources */ = {isa = PBXBuildFile; fileRef = 17D390CA127B6BF800672B13 /* SPPreferencesUpgrade.m */; };
17D3C22212859E070047709F /* SPFavoriteNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 17D3C22112859E070047709F /* SPFavoriteNode.m */; };
17D3C6041289BF350047709F /* SPConnectionControllerDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 17D3C6031289BF350047709F /* SPConnectionControllerDelegate.m */; };
+ 17D3C66E128AD4710047709F /* SPFavoritesController.m in Sources */ = {isa = PBXBuildFile; fileRef = 17D3C66D128AD4710047709F /* SPFavoritesController.m */; };
+ 17D3C671128AD8160047709F /* SPSingleton.m in Sources */ = {isa = PBXBuildFile; fileRef = 17D3C670128AD8160047709F /* SPSingleton.m */; };
17D3DC201281816E002A163A /* SPDatabaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 17D3DC1F1281816E002A163A /* SPDatabaseViewController.m */; };
17DC8E75126F4AB600E9AAEC /* MCPConnectionDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 17DC8E74126F4AB600E9AAEC /* MCPConnectionDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
17DCC5C7115C202700F89A00 /* MCPStringAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 17DCC5C5115C202700F89A00 /* MCPStringAdditions.h */; };
@@ -708,6 +710,10 @@
17D3C22112859E070047709F /* SPFavoriteNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPFavoriteNode.m; sourceTree = "<group>"; };
17D3C6021289BF350047709F /* SPConnectionControllerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPConnectionControllerDelegate.h; sourceTree = "<group>"; };
17D3C6031289BF350047709F /* SPConnectionControllerDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPConnectionControllerDelegate.m; sourceTree = "<group>"; };
+ 17D3C66C128AD4710047709F /* SPFavoritesController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPFavoritesController.h; sourceTree = "<group>"; };
+ 17D3C66D128AD4710047709F /* SPFavoritesController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPFavoritesController.m; sourceTree = "<group>"; };
+ 17D3C66F128AD8160047709F /* SPSingleton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPSingleton.h; sourceTree = "<group>"; };
+ 17D3C670128AD8160047709F /* SPSingleton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPSingleton.m; sourceTree = "<group>"; };
17D3DC1E1281816E002A163A /* SPDatabaseViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPDatabaseViewController.h; sourceTree = "<group>"; };
17D3DC1F1281816E002A163A /* SPDatabaseViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPDatabaseViewController.m; 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>"; };
@@ -1450,6 +1456,8 @@
1740FABA0FC4372F00CF3699 /* SPDatabaseData.m */,
17A20AC4124F9B110095CEFB /* SPServerSupport.h */,
17A20AC5124F9B110095CEFB /* SPServerSupport.m */,
+ 17D3C66C128AD4710047709F /* SPFavoritesController.h */,
+ 17D3C66D128AD4710047709F /* SPFavoritesController.m */,
17148563125F5FF500321285 /* SPDatabaseCharacterSets.h */,
17148564125F5FF500321285 /* SPDatabaseCharacterSets.m */,
);
@@ -1904,12 +1912,14 @@
17E6415D0EF01EF9001BC333 /* Model */ = {
isa = PBXGroup;
children = (
+ BCA6271A1031B9D40047E5D5 /* SPTooltip.h */,
+ BCA6271B1031B9D40047E5D5 /* SPTooltip.m */,
+ 17D3C66F128AD8160047709F /* SPSingleton.h */,
+ 17D3C670128AD8160047709F /* SPSingleton.m */,
172A650F0F7BED7A001E861A /* SPConsoleMessage.h */,
172A65100F7BED7A001E861A /* SPConsoleMessage.m */,
17C058860FC9FC390077E9CF /* SPNarrowDownCompletion.h */,
17C058870FC9FC390077E9CF /* SPNarrowDownCompletion.m */,
- BCA6271A1031B9D40047E5D5 /* SPTooltip.h */,
- BCA6271B1031B9D40047E5D5 /* SPTooltip.m */,
173E70A1107FF495008733C9 /* Core Data */,
);
name = Model;
@@ -3066,6 +3076,8 @@
17D3DC201281816E002A163A /* SPDatabaseViewController.m in Sources */,
17D3C22212859E070047709F /* SPFavoriteNode.m in Sources */,
17D3C6041289BF350047709F /* SPConnectionControllerDelegate.m in Sources */,
+ 17D3C66E128AD4710047709F /* SPFavoritesController.m in Sources */,
+ 17D3C671128AD8160047709F /* SPSingleton.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};