From d794d105545e92a75bdaf697580ee7f12b566531 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Sat, 3 Oct 2009 21:47:55 +0000 Subject: Improve Growl interaction to reduce general Growl spammage and improve functionality: - Growls are now only shown by default if they are not fired from the frontmost window - Long-running tasks (>3 secs) will still Growl - Clicking on a Growl will now bring the associated window to the front This addresses the original concerns of Issue #98. --- Source/TableDump.m | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'Source/TableDump.m') diff --git a/Source/TableDump.m b/Source/TableDump.m index 346ae099..7a02964a 100644 --- a/Source/TableDump.m +++ b/Source/TableDump.m @@ -247,6 +247,9 @@ if ( returnCode != NSOKButton ) return; + // Start the notification timer to allow notifications to be shown even if frontmost for long queries + [[SPGrowlController sharedGrowlController] setVisibilityForNotificationName:@"Export Finished"]; + // Save path to preferences [prefs setObject:[sheet directory] forKey:@"savePath"]; @@ -400,6 +403,7 @@ // Export finished Growl notification [[SPGrowlController sharedGrowlController] notifyWithTitle:@"Export Finished" description:[NSString stringWithFormat:NSLocalizedString(@"Finished exporting to %@",@"description for finished exporting growl notification"), [[sheet filename] lastPathComponent]] + window:tableWindow notificationName:@"Export Finished"]; } @@ -487,6 +491,9 @@ NSStringEncoding sqlEncoding = NSUTF8StringEncoding; NSCharacterSet *whitespaceAndNewlineCharset = [NSCharacterSet whitespaceAndNewlineCharacterSet]; + // Start the notification timer to allow notifications to be shown even if frontmost for long queries + [[SPGrowlController sharedGrowlController] setVisibilityForNotificationName:@"Import Finished"]; + // Open a filehandle for the SQL file sqlFileHandle = [NSFileHandle fileHandleForReadingAtPath:filename]; if (!sqlFileHandle) { @@ -687,6 +694,7 @@ // Import finished Growl notification [[SPGrowlController sharedGrowlController] notifyWithTitle:@"Import Finished" description:[NSString stringWithFormat:NSLocalizedString(@"Finished importing %@",@"description for finished importing growl notification"), [filename lastPathComponent]] + window:tableWindow notificationName:@"Import Finished"]; } @@ -718,6 +726,9 @@ NSStringEncoding csvEncoding = [MCPConnection encodingForMySQLEncoding:[[tableDocumentInstance connectionEncoding] UTF8String]]; if (fieldMappingArray) [fieldMappingArray release], fieldMappingArray = nil; + // Start the notification timer to allow notifications to be shown even if frontmost for long queries + [[SPGrowlController sharedGrowlController] setVisibilityForNotificationName:@"Import Finished"]; + // Open a filehandle for the CSV file csvFileHandle = [NSFileHandle fileHandleForReadingAtPath:filename]; if (!csvFileHandle) { @@ -968,6 +979,7 @@ // Import finished Growl notification [[SPGrowlController sharedGrowlController] notifyWithTitle:@"Import Finished" description:[NSString stringWithFormat:NSLocalizedString(@"Finished importing %@",@"description for finished importing growl notification"), [filename lastPathComponent]] + window:tableWindow notificationName:@"Import Finished"]; // Update the content view -- cgit v1.2.3