aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2009-01-29 00:43:35 +0000
committerstuconnolly <stuart02@gmail.com>2009-01-29 00:43:35 +0000
commitcd003769b9cdd036266e01683c09ede3430ff385 (patch)
treea533b1abd88850d465a2ba2961bbe2b11ad2ce69
parentb18edd26ea943016712dd7f463edb9859b1497b3 (diff)
downloadsequelpro-cd003769b9cdd036266e01683c09ede3430ff385.tar.gz
sequelpro-cd003769b9cdd036266e01683c09ede3430ff385.tar.bz2
sequelpro-cd003769b9cdd036266e01683c09ede3430ff385.zip
Add 'Refresh Databases' menu item to the main database selection drop down. Fixes issue #143
-rw-r--r--Source/TableDocument.m20
1 files changed, 12 insertions, 8 deletions
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index 7c41a049..78f29d24 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -434,23 +434,27 @@ NSString *TableDocumentFavoritesControllerFavoritesDidChange = @"TableDocumentFa
return;
[chooseDatabaseButton removeAllItems];
+
[chooseDatabaseButton addItemWithTitle:NSLocalizedString(@"Choose Database...", @"menu item for choose db")];
[[chooseDatabaseButton menu] addItem:[NSMenuItem separatorItem]];
[[chooseDatabaseButton menu] addItemWithTitle:NSLocalizedString(@"Add Database...", @"menu item to add db") action:@selector(addDatabase:) keyEquivalent:@""];
+ [[chooseDatabaseButton menu] addItemWithTitle:NSLocalizedString(@"Refresh Databases", @"menu item to refresh databases") action:@selector(setDatabases:) keyEquivalent:@""];
[[chooseDatabaseButton menu] addItem:[NSMenuItem separatorItem]];
-
MCPResult *queryResult = [mySQLConnection listDBs];
- if ([queryResult numOfRows]) [queryResult dataSeek:0];
+
+ if ([queryResult numOfRows]) {
+ [queryResult dataSeek:0];
+ }
+
int i;
- for ( i = 0 ; i < [queryResult numOfRows] ; i++ ) {
+
+ for (i = 0 ; i < [queryResult numOfRows] ; i++)
+ {
[chooseDatabaseButton addItemWithTitle:[[queryResult fetchRowAsArray] objectAtIndex:0]];
}
- if ( ![self database] ) {
- [chooseDatabaseButton selectItemAtIndex:0];
- } else {
- [chooseDatabaseButton selectItemWithTitle:[self database]];
- }
+
+ (![self database]) ? [chooseDatabaseButton selectItemAtIndex:0] : [chooseDatabaseButton selectItemWithTitle:[self database]];
}
/**