aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-03-28 00:31:08 +0000
committerrowanbeentje <rowan@beent.je>2009-03-28 00:31:08 +0000
commit905a44014caa805f2b2621bedef3a76da259c8b1 (patch)
tree947b885e6c98f019c90c90a86fdb5284e6ef2cd6
parent22ee41bd30eb6954492b480484b70a9de9a75374 (diff)
downloadsequelpro-905a44014caa805f2b2621bedef3a76da259c8b1.tar.gz
sequelpro-905a44014caa805f2b2621bedef3a76da259c8b1.tar.bz2
sequelpro-905a44014caa805f2b2621bedef3a76da259c8b1.zip
Improve interaction with connection favorites to prevent issues saving favorite changes:
- Favorites are no longer resaved on document window close - instead they're saved on connect. Prevents the oldest window open from saving its favorites when closed, overwriting any changes since. - Explicitly synchs changes to disk to ensure prefs window/connection sheets see each other's changes faster.
-rw-r--r--Source/MainController.m5
-rw-r--r--Source/TableDocument.m8
2 files changed, 9 insertions, 4 deletions
diff --git a/Source/MainController.m b/Source/MainController.m
index c5e2eeb0..8c76014a 100644
--- a/Source/MainController.m
+++ b/Source/MainController.m
@@ -33,6 +33,10 @@ opens the preferences window
*/
- (IBAction)openPreferences:(id)sender
{
+
+ // Synchronize the prefs to disk to pick up any changes made to favourites in connection sheets
+ [prefs synchronize];
+
//get favorites if they exist
[favorites release];
if ( [prefs objectForKey:@"favorites"] != nil ) {
@@ -627,6 +631,7 @@ checks for updates and opens download page in default browser
[prefs setObject:[encodingPopUpButton titleOfSelectedItem] forKey:@"encoding"];
[prefs setObject:favorites forKey:@"favorites"];
+ [prefs synchronize];
}
return YES;
}
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index 738af532..012b30dc 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -139,6 +139,10 @@ NSString *TableDocumentFavoritesControllerFavoritesDidChange = @"TableDocumentFa
- (IBAction)connect:(id)sender
{
int code;
+
+ // Save the favourites - commits any unsaved changes ie favourite renames
+ [prefs setObject:[self favorites] forKey:@"favorites"];
+ [prefs synchronize];
[connectProgressBar startAnimation:self];
[connectProgressStatusText setHidden:NO];
@@ -1650,10 +1654,6 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
- (IBAction)terminate:(id)sender
{
[[NSApp orderedDocuments] makeObjectsPerformSelector:@selector(cancelConnectSheet:) withObject:nil];
-
- // Save the favourites - commits any unsaved changes ie favourite renames
- [prefs setObject:[self favorites] forKey:@"favorites"];
-
[NSApp terminate:sender];
}