Set window title based on type of Inspector being shown

This commit is contained in:
Angelo Stavrow 2020-09-05 09:13:51 -04:00
parent 0f2162ff7d
commit ef63c18265
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE
1 changed files with 26 additions and 1 deletions

View File

@ -108,7 +108,32 @@ private extension InspectorWindowController {
guard let window = window else {
return
}
switch inspector {
case is NothingInspectorViewController:
window.title = NSLocalizedString("Inspector", comment: "Inspector window title")
case is FolderInspectorViewController:
if let folderName = (inspector as? FolderInspectorViewController)?.nameTextField?.stringValue {
window.title = folderName
} else {
window.title = NSLocalizedString("Folder Inspector", comment: "Folder Inspector window title")
}
case is WebFeedInspectorViewController:
if let feedName = (inspector as? WebFeedInspectorViewController)?.nameTextField?.stringValue {
window.title = feedName
} else {
window.title = NSLocalizedString("Feed Inspector", comment: "Feed Inspector window title")
}
case is BuiltinSmartFeedInspectorViewController:
if let smartFeedName = (inspector as? BuiltinSmartFeedInspectorViewController)?.nameTextField?.stringValue {
window.title = smartFeedName
} else {
window.title = NSLocalizedString("Smart Feed Inspector", comment: "Smart Feed Inspector window title")
}
default:
window.title = NSLocalizedString("Inspector", comment: "Inspector window title")
}
let flippedOrigin = window.flippedOrigin
if window.contentViewController != inspector {