diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-06-14 11:20:21 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-06-14 11:20:21 +0000 |
commit | ad0073ffa67dcdd7d891c7e55614ab706cce4809 (patch) | |
tree | 66fa9984ad5436de9c89e4823d3815d4ba1d1903 /Source/SPWindowController.m | |
parent | 9a3397f2d18a58953bdeae5d2eddb0afd85f18d9 (diff) | |
download | sequelpro-ad0073ffa67dcdd7d891c7e55614ab706cce4809.tar.gz sequelpro-ad0073ffa67dcdd7d891c7e55614ab706cce4809.tar.bz2 sequelpro-ad0073ffa67dcdd7d891c7e55614ab706cce4809.zip |
• reverted to previous approach to display tooltips for unselected tab view items, since it doesn't work
- added the MySQL version to these tooltips if enabled in the prefs
Diffstat (limited to 'Source/SPWindowController.m')
-rw-r--r-- | Source/SPWindowController.m | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/Source/SPWindowController.m b/Source/SPWindowController.m index 1876d11a..91fc3cd5 100644 --- a/Source/SPWindowController.m +++ b/Source/SPWindowController.m @@ -328,9 +328,36 @@ return @""; - // if cell is not selected show full title as tooltip + // if cell is not selected show full title plus MySQL version is enabled as tooltip } else { - return [[[tabViewItem identifier] parentWindow] title]; + + SPDatabaseDocument *doc = [tabViewItem identifier]; + NSMutableString *tabTitle; + + // Determine name details + NSString *pathName = @""; + if ([[[doc fileURL] path] length] && ![doc isUntitled]) + pathName = [NSString stringWithFormat:@"%@ — ", [[[doc fileURL] path] lastPathComponent]]; + + if ([doc getConnection] == nil) + return [NSString stringWithFormat:@"%@%@", pathName, @"Sequel Pro"]; + + tabTitle = [NSMutableString string]; + + // Add the MySQL version to the window title if enabled in prefs + if ([[NSUserDefaults standardUserDefaults] boolForKey:SPDisplayServerVersionInWindowTitle]) [tabTitle appendFormat:@"(MySQL %@)\n", [doc mySQLVersion]]; + + [tabTitle appendString:[doc name]]; + if ([doc database]) { + if ([tabTitle length]) [tabTitle appendString:@"/"]; + [tabTitle appendString:[doc database]]; + } + if ([[doc table] length]) { + if ([tabTitle length]) [tabTitle appendString:@"/"]; + [tabTitle appendString:[doc table]]; + } + return tabTitle; + } } |