Update sidebar when favicon becomes available. Fix #125.
This commit is contained in:
parent
22ec7d670a
commit
5ddf9ea284
@ -37,6 +37,7 @@ import RSCore
|
|||||||
NotificationCenter.default.addObserver(self, selector: #selector(containerChildrenDidChange(_:)), name: .ChildrenDidChange, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(containerChildrenDidChange(_:)), name: .ChildrenDidChange, object: nil)
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(userDidAddFeed(_:)), name: .UserDidAddFeed, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(userDidAddFeed(_:)), name: .UserDidAddFeed, object: nil)
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(batchUpdateDidPerform(_:)), name: .BatchUpdateDidPerform, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(batchUpdateDidPerform(_:)), name: .BatchUpdateDidPerform, object: nil)
|
||||||
|
NotificationCenter.default.addObserver(self, selector: #selector(faviconDidBecomeAvailable(_:)), name: .FaviconDidBecomeAvailable, object: nil)
|
||||||
|
|
||||||
outlineView.reloadData()
|
outlineView.reloadData()
|
||||||
|
|
||||||
@ -82,6 +83,11 @@ import RSCore
|
|||||||
revealAndSelectRepresentedObject(feed)
|
revealAndSelectRepresentedObject(feed)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@objc func faviconDidBecomeAvailable(_ note: Notification) {
|
||||||
|
|
||||||
|
configureAvailableCells()
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: Actions
|
// MARK: Actions
|
||||||
|
|
||||||
@IBAction func delete(_ sender: AnyObject?) {
|
@IBAction func delete(_ sender: AnyObject?) {
|
||||||
@ -358,20 +364,35 @@ private extension SidebarViewController {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func cellForRowView(_ rowView: NSTableRowView) -> SidebarCell? {
|
||||||
|
|
||||||
|
return rowView.view(atColumn: 0) as? SidebarCell
|
||||||
|
}
|
||||||
|
|
||||||
func availableSidebarCells() -> [SidebarCell] {
|
func availableSidebarCells() -> [SidebarCell] {
|
||||||
|
|
||||||
var cells = [SidebarCell]()
|
var cells = [SidebarCell]()
|
||||||
|
|
||||||
outlineView.enumerateAvailableRowViews { (rowView: NSTableRowView, _: Int) -> Void in
|
outlineView.enumerateAvailableRowViews { (rowView: NSTableRowView, _: Int) -> Void in
|
||||||
|
if let cell = cellForRowView(rowView) {
|
||||||
if let oneSidebarCell = rowView.view(atColumn: 0) as? SidebarCell {
|
cells += [cell]
|
||||||
cells += [oneSidebarCell]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return cells
|
return cells
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func configureAvailableCells() {
|
||||||
|
|
||||||
|
outlineView.enumerateAvailableRowViews { (rowView: NSTableRowView, row: Int) -> Void in
|
||||||
|
|
||||||
|
guard let cell = cellForRowView(rowView), let node = nodeForRow(row) else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
configure(cell, node)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func cellsForRepresentedObject(_ representedObject: AnyObject) -> [SidebarCell] {
|
func cellsForRepresentedObject(_ representedObject: AnyObject) -> [SidebarCell] {
|
||||||
|
|
||||||
let availableCells = availableSidebarCells()
|
let availableCells = availableSidebarCells()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user