diff --git a/Evergreen/Inspector/BuiltinSmartFeedInspectorViewController.swift b/Evergreen/Inspector/BuiltinSmartFeedInspectorViewController.swift
index 0b6510ade..68f7d4773 100644
--- a/Evergreen/Inspector/BuiltinSmartFeedInspectorViewController.swift
+++ b/Evergreen/Inspector/BuiltinSmartFeedInspectorViewController.swift
@@ -10,15 +10,57 @@ import AppKit
final class BuiltinSmartFeedInspectorViewController: NSViewController, Inspector {
+ @IBOutlet var nameTextField: NSTextField?
+
+ private var smartFeed: PseudoFeed? {
+ didSet {
+ updateUI()
+ }
+ }
+
+ // MARK: Inspector
+
let isFallbackInspector = false
- var objects: [Any]?
+ var objects: [Any]? {
+ didSet {
+ updateSmartFeed()
+ }
+ }
func canInspect(_ objects: [Any]) -> Bool {
- return objects.count == 1 && objects.first is PseudoFeed
+ guard let _ = singleSmartFeed(from: objects) else {
+ return false
+ }
+ return true
}
- func willEndInspectingObjects() {
+ // MARK: NSViewController
+ override func viewDidLoad() {
+
+ updateUI()
+ }
+}
+
+private extension BuiltinSmartFeedInspectorViewController {
+
+ func singleSmartFeed(from objects: [Any]?) -> PseudoFeed? {
+
+ guard let objects = objects, objects.count == 1, let singleSmartFeed = objects.first as? PseudoFeed else {
+ return nil
+ }
+
+ return singleSmartFeed
+ }
+
+ func updateSmartFeed() {
+
+ smartFeed = singleSmartFeed(from: objects)
+ }
+
+ func updateUI() {
+
+ nameTextField?.stringValue = smartFeed?.nameForDisplay ?? ""
}
}
diff --git a/Evergreen/Inspector/FeedInspectorViewController.swift b/Evergreen/Inspector/FeedInspectorViewController.swift
index 56ff19767..d67377851 100644
--- a/Evergreen/Inspector/FeedInspectorViewController.swift
+++ b/Evergreen/Inspector/FeedInspectorViewController.swift
@@ -19,7 +19,9 @@ final class FeedInspectorViewController: NSViewController, Inspector {
private var feed: Feed? {
didSet {
- updateUI()
+ if feed != oldValue {
+ updateUI()
+ }
}
}
@@ -90,7 +92,7 @@ private extension FeedInspectorViewController {
imageView?.image = feedIcon
return
}
-
+
if let favicon = appDelegate.faviconDownloader.favicon(for: feed) {
if favicon.size.height < 16.0 && favicon.size.width < 16.0 {
favicon.size = NSSize(width: 16, height: 16)
diff --git a/Evergreen/Inspector/FolderInspectorViewController.swift b/Evergreen/Inspector/FolderInspectorViewController.swift
index fca41698c..925bc8f46 100644
--- a/Evergreen/Inspector/FolderInspectorViewController.swift
+++ b/Evergreen/Inspector/FolderInspectorViewController.swift
@@ -11,15 +11,60 @@ import Account
final class FolderInspectorViewController: NSViewController, Inspector {
+ @IBOutlet var nameTextField: NSTextField?
+
+ private var folder: Folder? {
+ didSet {
+ if folder != oldValue {
+ updateUI()
+ }
+ }
+ }
+
+ // MARK: Inspector
+
let isFallbackInspector = false
- var objects: [Any]?
+ var objects: [Any]? {
+ didSet {
+ updateFolder()
+ }
+ }
func canInspect(_ objects: [Any]) -> Bool {
- return objects.count == 1 && objects.first is Folder
+ guard let _ = singleFolder(from: objects) else {
+ return false
+ }
+ return true
}
- func willEndInspectingObjects() {
+ // MARK: NSViewController
+ override func viewDidLoad() {
+
+ updateUI()
}
}
+
+private extension FolderInspectorViewController {
+
+ func singleFolder(from objects: [Any]?) -> Folder? {
+
+ guard let objects = objects, objects.count == 1, let singleFolder = objects.first as? Folder else {
+ return nil
+ }
+
+ return singleFolder
+ }
+
+ func updateFolder() {
+
+ folder = singleFolder(from: objects)
+ }
+
+ func updateUI() {
+
+ nameTextField?.stringValue = folder?.nameForDisplay ?? ""
+ }
+
+}
diff --git a/Evergreen/Inspector/Inspector.storyboard b/Evergreen/Inspector/Inspector.storyboard
index 5ecb10b64..36dd7396b 100644
--- a/Evergreen/Inspector/Inspector.storyboard
+++ b/Evergreen/Inspector/Inspector.storyboard
@@ -60,7 +60,7 @@ Field
-
+
@@ -76,7 +76,7 @@ Field
-
+
@@ -163,6 +163,9 @@ Field
+
+
+
@@ -202,6 +205,9 @@ Field
+
+
+