From ad0073ffa67dcdd7d891c7e55614ab706cce4809 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Mon, 14 Jun 2010 11:20:21 +0000 Subject: =?UTF-8?q?=E2=80=A2=20reverted=20to=20previous=20approach=20to=20?= =?UTF-8?q?display=20tooltips=20for=20unselected=20tab=20view=20items,=20s?= =?UTF-8?q?ince=20it=20doesn't=20work=20-=20added=20the=20MySQL=20version?= =?UTF-8?q?=20to=20these=20tooltips=20if=20enabled=20in=20the=20prefs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPWindowController.m | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'Source') 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; + } } -- cgit v1.2.3