aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-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
10 files changed, 191 insertions, 26 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