From ef63c182654fd4f6ced5c762c8ee73b38583a956 Mon Sep 17 00:00:00 2001 From: Angelo Stavrow Date: Sat, 5 Sep 2020 09:13:51 -0400 Subject: [PATCH] Set window title based on type of Inspector being shown --- Mac/Inspector/InspectorWindowController.swift | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/Mac/Inspector/InspectorWindowController.swift b/Mac/Inspector/InspectorWindowController.swift index 01e476bc0..b06f3d646 100644 --- a/Mac/Inspector/InspectorWindowController.swift +++ b/Mac/Inspector/InspectorWindowController.swift @@ -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 {