aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2011-10-08 22:28:30 +0000
committerstuconnolly <stuart02@gmail.com>2011-10-08 22:28:30 +0000
commita4ac00795c534d2ee74ad1d3be6facfda9c82b6d (patch)
tree0141127b68c0bf0b7e1e2b2ccfcb0c3615b866ac
parent4c2a3a4692a1931a57cf6f9566ff9bdd92e3d261 (diff)
downloadsequelpro-a4ac00795c534d2ee74ad1d3be6facfda9c82b6d.tar.gz
sequelpro-a4ac00795c534d2ee74ad1d3be6facfda9c82b6d.tar.bz2
sequelpro-a4ac00795c534d2ee74ad1d3be6facfda9c82b6d.zip
Add a hidden preference for specifying the long running query notification time (currently in milliseconds). Implements issue #944
-rw-r--r--Resources/Plists/PreferenceDefaults.plist2
-rw-r--r--Source/SPConstants.h4
-rw-r--r--Source/SPConstants.m4
-rw-r--r--Source/SPGrowlController.h3
-rw-r--r--Source/SPGrowlController.m7
5 files changed, 12 insertions, 8 deletions
diff --git a/Resources/Plists/PreferenceDefaults.plist b/Resources/Plists/PreferenceDefaults.plist
index 07eb71ae..5208bd62 100644
--- a/Resources/Plists/PreferenceDefaults.plist
+++ b/Resources/Plists/PreferenceDefaults.plist
@@ -183,5 +183,7 @@
<false/>
<key>CustomQuerySoftIndentWidth</key>
<integer>2</integer>
+ <key>LongRunningQueryNotificationTime</key>
+ <real>3</real>
</dict>
</plist>
diff --git a/Source/SPConstants.h b/Source/SPConstants.h
index 7c5e1f17..ba583ce0 100644
--- a/Source/SPConstants.h
+++ b/Source/SPConstants.h
@@ -225,9 +225,6 @@ typedef enum
#define SPLOCALIZEDURL_BUNDLEEDITORHELP NSLocalizedString(@"http://www.sequelpro.com/docs/Bundle_Editor", @"Localized help page for bundle editor - do not localize if no translated webpage is available")
#define SPLOCALIZEDURL_CONTENTFILTERHELP NSLocalizedString(@"http://www.sequelpro.com/docs/Content_Filters", @"Localized help page for content filter - do not localize if no translated webpage is available")
-// Long running notification time for Growl messages
-extern const CGFloat SPLongRunningNotificationTime;
-
// Narrow down completion max rows
extern const NSUInteger SPNarrowDownCompletionMaxRows;
@@ -361,6 +358,7 @@ extern NSString *SPResetAutoIncrementAfterDeletionOfAllRows;
// Hidden Prefs
extern NSString *SPPrintWarningRowLimit;
extern NSString *SPDisplayServerVersionInWindowTitle;
+extern NSString *SPLongRunningQueryNotificationTime;
// Import and export
extern NSString *SPCSVImportFieldTerminator;
diff --git a/Source/SPConstants.m b/Source/SPConstants.m
index 14eefde7..ae4b94fb 100644
--- a/Source/SPConstants.m
+++ b/Source/SPConstants.m
@@ -25,9 +25,6 @@
#import "SPConstants.h"
-// Long running notification time for Growl messages
-const CGFloat SPLongRunningNotificationTime = 3.0f;
-
// Narrow down completion max rows
const NSUInteger SPNarrowDownCompletionMaxRows = 15;
@@ -172,6 +169,7 @@ NSString *SPResetAutoIncrementAfterDeletionOfAllRows = @"ResetAutoIncrementAfter
// Hidden Prefs
NSString *SPPrintWarningRowLimit = @"PrintWarningRowLimit";
NSString *SPDisplayServerVersionInWindowTitle = @"DisplayServerVersionInWindowTitle";
+NSString *SPLongRunningQueryNotificationTime = @"LongRunningQueryNotificationTime";
// Import and export
NSString *SPCSVImportFieldEnclosedBy = @"CSVImportFieldEnclosedBy";
diff --git a/Source/SPGrowlController.h b/Source/SPGrowlController.h
index d1cb7dc2..2075b143 100644
--- a/Source/SPGrowlController.h
+++ b/Source/SPGrowlController.h
@@ -32,7 +32,10 @@
@interface SPGrowlController : SPSingleton <GrowlApplicationBridgeDelegate>
{
NSString *timingNotificationName;
+
double timingNotificationStart;
+
+ CGFloat longRunningQueryNotificationTime;
}
// Singleton controller
diff --git a/Source/SPGrowlController.m b/Source/SPGrowlController.m
index 3f98f41a..3fc27f64 100644
--- a/Source/SPGrowlController.m
+++ b/Source/SPGrowlController.m
@@ -60,8 +60,11 @@ static SPGrowlController *sharedGrowlController = nil;
{
if ((self = [super init])) {
[GrowlApplicationBridge setGrowlDelegate:self];
+
timingNotificationName = nil;
timingNotificationStart = 0;
+
+ longRunningQueryNotificationTime = [[NSUserDefaults standardUserDefaults] floatForKey:SPLongRunningQueryNotificationTime];
}
return self;
@@ -74,7 +77,6 @@ static SPGrowlController *sharedGrowlController = nil;
*/
- (void)notifyWithTitle:(NSString *)title description:(NSString *)description document:(SPDatabaseDocument *)document notificationName:(NSString *)name
{
-
// Ensure that the delayed notification call is made on the main thread
if (![NSThread isMainThread]) {
[[self onMainThread] notifyWithTitle:title description:description document:document notificationName:name];
@@ -127,9 +129,10 @@ static SPGrowlController *sharedGrowlController = nil;
// if it does, and the time exceeds the threshold, display the notification even for
// frontmost windows to provide feedback for long-running tasks.
if (timingNotificationName && [timingNotificationName isEqualToString:name]) {
- if ([self milliTime] > (SPLongRunningNotificationTime * 1000) + timingNotificationStart) {
+ if ([self milliTime] > (longRunningQueryNotificationTime * 1000) + timingNotificationStart) {
postNotification = YES;
}
+
[timingNotificationName release], timingNotificationName = nil;
}