diff options
author | stuconnolly <stuart02@gmail.com> | 2009-10-29 00:05:51 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2009-10-29 00:05:51 +0000 |
commit | e16c728dd900cfe39369e0afe8c85f58e4aecdf7 (patch) | |
tree | 82161f9fc6e7eefe78877b6da5f27d3dde5bad89 /Source | |
parent | 30a49adb59f7770c9fc7739c145389447da8bc39 (diff) | |
download | sequelpro-e16c728dd900cfe39369e0afe8c85f58e4aecdf7.tar.gz sequelpro-e16c728dd900cfe39369e0afe8c85f58e4aecdf7.tar.bz2 sequelpro-e16c728dd900cfe39369e0afe8c85f58e4aecdf7.zip |
Replace hard coded occurrences of preference key DefaultFavorite with a constant.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPConnectionController.m | 2 | ||||
-rw-r--r-- | Source/SPConstants.h | 1 | ||||
-rw-r--r-- | Source/SPConstants.m | 1 | ||||
-rw-r--r-- | Source/SPPreferenceController.m | 14 |
4 files changed, 10 insertions, 8 deletions
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m index d6779050..fb357f17 100644 --- a/Source/SPConnectionController.m +++ b/Source/SPConnectionController.m @@ -100,7 +100,7 @@ if ([prefs boolForKey:SPSelectLastFavoriteUsed] == YES) { tableRow = [prefs integerForKey:SPLastFavoriteIndex] + 1; } else { - tableRow = [prefs integerForKey:@"DefaultFavorite"] + 1; + tableRow = [prefs integerForKey:SPDefaultFavorite] + 1; } if (tableRow < [favorites count]) { previousType = [[[favorites objectAtIndex:tableRow] objectForKey:@"type"] intValue]; diff --git a/Source/SPConstants.h b/Source/SPConstants.h index 1a56e000..8043f4ba 100644 --- a/Source/SPConstants.h +++ b/Source/SPConstants.h @@ -124,3 +124,4 @@ extern NSString *SPTableColumnWidths; extern NSString *SPQueryHistory; extern NSString *SPDocumentTaskStartNotification; extern NSString *SPDocumentTaskEndNotification; +extern NSString *SPDefaultFavorite; diff --git a/Source/SPConstants.m b/Source/SPConstants.m index 39d0d705..6e990cf4 100644 --- a/Source/SPConstants.m +++ b/Source/SPConstants.m @@ -94,3 +94,4 @@ NSString *SPTableColumnWidths = @"tableColumnWidths"; NSString *SPQueryHistory = @"queryHistory"; NSString *SPDocumentTaskStartNotification = @"DocumentTaskStarted"; NSString *SPDocumentTaskEndNotification = @"DocumentTaskEnded"; +NSString *SPDefaultFavorite = @"DefaultFavorite"; diff --git a/Source/SPPreferenceController.m b/Source/SPPreferenceController.m index d9fd38eb..51211043 100644 --- a/Source/SPPreferenceController.m +++ b/Source/SPPreferenceController.m @@ -346,8 +346,8 @@ } // Reset default favorite - if ([favoritesTableView selectedRow] == [prefs integerForKey:@"DefaultFavorite"]) { - [prefs setInteger:[prefs integerForKey:SPLastFavoriteIndex] forKey:@"DefaultFavorite"]; + if ([favoritesTableView selectedRow] == [prefs integerForKey:SPDefaultFavorite]) { + [prefs setInteger:[prefs integerForKey:SPLastFavoriteIndex] forKey:SPDefaultFavorite]; } [favoritesController removeObjectAtArrangedObjectIndex:[favoritesTableView selectedRow]]; @@ -423,7 +423,7 @@ [prefs setBool:NO forKey:SPSelectLastFavoriteUsed]; // Minus 2 from index to account for the "Last Used" and separator items - [prefs setInteger:[defaultFavoritePopup indexOfSelectedItem]-2 forKey:@"DefaultFavorite"]; + [prefs setInteger:[defaultFavoritePopup indexOfSelectedItem]-2 forKey:SPDefaultFavorite]; } } @@ -470,7 +470,7 @@ // Set the default favorite popup back to preference if (sender == [defaultFavoritePopup lastItem]) { if (![prefs boolForKey:SPSelectLastFavoriteUsed]) { - [defaultFavoritePopup selectItemAtIndex:[prefs integerForKey:@"DefaultFavorite"]+2]; + [defaultFavoritePopup selectItemAtIndex:[prefs integerForKey:SPDefaultFavorite]+2]; } else { [defaultFavoritePopup selectItemAtIndex:0]; } @@ -603,8 +603,8 @@ } // Update default favorite to take on new value - if ([prefs integerForKey:@"DefaultFavorite"] == originalRow) { - [prefs setInteger:destinationRow forKey:@"DefaultFavorite"]; + if ([prefs integerForKey:SPDefaultFavorite] == originalRow) { + [prefs setInteger:destinationRow forKey:SPDefaultFavorite]; } [self updateDefaultFavoritePopup]; @@ -1002,7 +1002,7 @@ // Select the default favorite from prefs if (![prefs boolForKey:SPSelectLastFavoriteUsed]) { - [defaultFavoritePopup selectItemAtIndex:[prefs integerForKey:@"DefaultFavorite"] + 2]; + [defaultFavoritePopup selectItemAtIndex:[prefs integerForKey:SPDefaultFavorite] + 2]; } else { [defaultFavoritePopup selectItemAtIndex:0]; } |