Simplify the sidebar filter state preservation.
This commit is contained in:
parent
eaa99db5c7
commit
b6ff9e8ff4
|
@ -449,18 +449,11 @@ extension MainWindowController: NSWindowDelegate {
|
|||
|
||||
func window(_ window: NSWindow, willEncodeRestorableState state: NSCoder) {
|
||||
|
||||
if let sidebarReadFiltered = sidebarViewController?.isReadFiltered {
|
||||
state.encode(sidebarReadFiltered, forKey: UserInfoKey.readFeedsFilterState)
|
||||
}
|
||||
|
||||
// saveSplitViewState(to: state)
|
||||
}
|
||||
|
||||
func window(_ window: NSWindow, didDecodeRestorableState state: NSCoder) {
|
||||
|
||||
let sidebarReadFiltered = state.decodeBool(forKey: UserInfoKey.readFeedsFilterState)
|
||||
sidebarViewController?.isReadFiltered = sidebarReadFiltered
|
||||
|
||||
// restoreSplitViewState(from: state)
|
||||
//
|
||||
// // Make sure the timeline view is first responder if possible, to start out viewing
|
||||
|
@ -499,10 +492,6 @@ extension MainWindowController: SidebarDelegate {
|
|||
return timelineViewController.unreadCount
|
||||
}
|
||||
|
||||
func sidebarInvalidateRestorableState(_: SidebarViewController) {
|
||||
invalidateRestorableState()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - TimelineContainerViewControllerDelegate
|
||||
|
|
|
@ -15,7 +15,6 @@ import RSCore
|
|||
protocol SidebarDelegate: class {
|
||||
func sidebarSelectionDidChange(_: SidebarViewController, selectedObjects: [AnyObject]?)
|
||||
func unreadCount(for: AnyObject) -> Int
|
||||
func sidebarInvalidateRestorableState(_: SidebarViewController)
|
||||
}
|
||||
|
||||
@objc class SidebarViewController: NSViewController, NSOutlineViewDelegate, NSOutlineViewDataSource, NSMenuDelegate, UndoableCommandRunner {
|
||||
|
@ -39,7 +38,7 @@ protocol SidebarDelegate: class {
|
|||
}
|
||||
set {
|
||||
treeControllerDelegate.isReadFiltered = newValue
|
||||
delegate?.sidebarInvalidateRestorableState(self)
|
||||
invalidateRestorableState()
|
||||
rebuildTreeAndRestoreSelection()
|
||||
}
|
||||
}
|
||||
|
@ -92,6 +91,16 @@ protocol SidebarDelegate: class {
|
|||
}
|
||||
}
|
||||
|
||||
// MARK: State Restoration
|
||||
|
||||
override func encodeRestorableState(with coder: NSCoder) {
|
||||
coder.encode(isReadFiltered, forKey: UserInfoKey.readFeedsFilterState)
|
||||
}
|
||||
|
||||
override func restoreState(with coder: NSCoder) {
|
||||
isReadFiltered = coder.decodeBool(forKey: UserInfoKey.readFeedsFilterState)
|
||||
}
|
||||
|
||||
// MARK: - Notifications
|
||||
|
||||
@objc func unreadCountDidChange(_ note: Notification) {
|
||||
|
|
Loading…
Reference in New Issue