Merge pull request #2403 from AngeloStavrow/2354-match-window-title-to-inspector
Set window title based on type of Inspector being shown
This commit is contained in:
commit
fae8394791
|
@ -26,6 +26,7 @@ final class BuiltinSmartFeedInspectorViewController: NSViewController, Inspector
|
||||||
updateSmartFeed()
|
updateSmartFeed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var windowTitle: String = NSLocalizedString("Smart Feed Inspector", comment: "Smart Feed Inspector window title")
|
||||||
|
|
||||||
func canInspect(_ objects: [Any]) -> Bool {
|
func canInspect(_ objects: [Any]) -> Bool {
|
||||||
|
|
||||||
|
@ -62,5 +63,6 @@ private extension BuiltinSmartFeedInspectorViewController {
|
||||||
func updateUI() {
|
func updateUI() {
|
||||||
|
|
||||||
nameTextField?.stringValue = smartFeed?.nameForDisplay ?? ""
|
nameTextField?.stringValue = smartFeed?.nameForDisplay ?? ""
|
||||||
|
windowTitle = smartFeed?.nameForDisplay ?? NSLocalizedString("Smart Feed Inspector", comment: "Smart Feed Inspector window title")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ final class FolderInspectorViewController: NSViewController, Inspector {
|
||||||
updateFolder()
|
updateFolder()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var windowTitle: String = NSLocalizedString("Folder Inspector", comment: "Folder Inspector window title")
|
||||||
|
|
||||||
func canInspect(_ objects: [Any]) -> Bool {
|
func canInspect(_ objects: [Any]) -> Bool {
|
||||||
|
|
||||||
|
@ -103,5 +104,6 @@ private extension FolderInspectorViewController {
|
||||||
if nameTextField.stringValue != name {
|
if nameTextField.stringValue != name {
|
||||||
nameTextField.stringValue = name
|
nameTextField.stringValue = name
|
||||||
}
|
}
|
||||||
|
windowTitle = folder?.nameForDisplay ?? NSLocalizedString("Folder Inspector", comment: "Folder Inspector window title")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ protocol Inspector: class {
|
||||||
|
|
||||||
var objects: [Any]? { get set }
|
var objects: [Any]? { get set }
|
||||||
var isFallbackInspector: Bool { get } // Can handle nothing-to-inspect or unexpected type of objects.
|
var isFallbackInspector: Bool { get } // Can handle nothing-to-inspect or unexpected type of objects.
|
||||||
|
var windowTitle: String { get }
|
||||||
|
|
||||||
func canInspect(_ objects: [Any]) -> Bool
|
func canInspect(_ objects: [Any]) -> Bool
|
||||||
}
|
}
|
||||||
|
@ -62,6 +63,7 @@ final class InspectorWindowController: NSWindowController {
|
||||||
|
|
||||||
inspectors = [feedInspector, folderInspector, builtinSmartFeedInspector, nothingInspector]
|
inspectors = [feedInspector, folderInspector, builtinSmartFeedInspector, nothingInspector]
|
||||||
currentInspector = nothingInspector
|
currentInspector = nothingInspector
|
||||||
|
window?.title = currentInspector.windowTitle
|
||||||
|
|
||||||
if let savedOrigin = originFromDefaults() {
|
if let savedOrigin = originFromDefaults() {
|
||||||
window?.setFlippedOriginAdjustingForScreen(savedOrigin)
|
window?.setFlippedOriginAdjustingForScreen(savedOrigin)
|
||||||
|
@ -108,7 +110,11 @@ private extension InspectorWindowController {
|
||||||
guard let window = window else {
|
guard let window = window else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
window.title = inspector.windowTitle
|
||||||
|
}
|
||||||
|
|
||||||
let flippedOrigin = window.flippedOrigin
|
let flippedOrigin = window.flippedOrigin
|
||||||
|
|
||||||
if window.contentViewController != inspector {
|
if window.contentViewController != inspector {
|
||||||
|
|
|
@ -19,6 +19,7 @@ final class NothingInspectorViewController: NSViewController, Inspector {
|
||||||
updateTextFields()
|
updateTextFields()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var windowTitle: String = NSLocalizedString("Inspector", comment: "Inspector window title")
|
||||||
|
|
||||||
func canInspect(_ objects: [Any]) -> Bool {
|
func canInspect(_ objects: [Any]) -> Bool {
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ final class WebFeedInspectorViewController: NSViewController, Inspector {
|
||||||
updateFeed()
|
updateFeed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var windowTitle: String = NSLocalizedString("Feed Inspector", comment: "Feed Inspector window title")
|
||||||
|
|
||||||
func canInspect(_ objects: [Any]) -> Bool {
|
func canInspect(_ objects: [Any]) -> Bool {
|
||||||
return objects.count == 1 && objects.first is WebFeed
|
return objects.count == 1 && objects.first is WebFeed
|
||||||
|
@ -112,6 +113,7 @@ extension WebFeedInspectorViewController: NSTextFieldDelegate {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
feed.editedName = nameTextField.stringValue
|
feed.editedName = nameTextField.stringValue
|
||||||
|
windowTitle = feed.editedName ?? NSLocalizedString("Feed Inspector", comment: "Feed Inspector window title")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -133,7 +135,7 @@ private extension WebFeedInspectorViewController {
|
||||||
updateFeedURL()
|
updateFeedURL()
|
||||||
updateNotifyAboutNewArticles()
|
updateNotifyAboutNewArticles()
|
||||||
updateIsReaderViewAlwaysOn()
|
updateIsReaderViewAlwaysOn()
|
||||||
|
windowTitle = feed?.nameForDisplay ?? NSLocalizedString("Feed Inspector", comment: "Feed Inspector window title")
|
||||||
view.needsLayout = true
|
view.needsLayout = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue