Make progress on showing favicons in the source list.

This commit is contained in:
Brent Simmons 2017-11-24 21:57:28 -08:00
parent 4cf3f8dfe7
commit f7e3a4e914
4 changed files with 13 additions and 8 deletions

View File

@ -122,7 +122,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
currentTheme = themeLoader.defaultTheme
let faviconsFolder = RSDataSubfolder(nil, "Accounts")!
let faviconsFolder = RSDataSubfolder(nil, "Favicons")!
faviconDownloader = FaviconDownloader(folder: faviconsFolder)
let todayFeed = SmartFeed(delegate: TodayFeedDelegate())

View File

@ -428,9 +428,9 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ocU-b4-EaY">
<rect key="frame" x="3" y="0.0" width="17" height="17"/>
<rect key="frame" x="0.0" y="-3" width="23" height="23"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" imageScaling="proportionallyDown" id="UzL-Uv-Vhz"/>
<imageCell key="cell" refusesFirstResponder="YES" imageScaling="proportionallyUpOrDown" id="UzL-Uv-Vhz"/>
</imageView>
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fst-vi-Wue" userLabel="Text field">
<rect key="frame" x="25" y="0.0" width="120" height="17"/>

View File

@ -13,13 +13,18 @@ private var textSizeCache = [String: NSSize]()
class SidebarCell : NSTableCellView {
var image: NSImage?
var image: NSImage? {
didSet {
imageView?.image = shouldShowImage ? image : nil
}
}
var shouldShowImage = false {
didSet {
if shouldShowImage != oldValue {
needsLayout = true
}
imageView?.image = shouldShowImage ? image : nil
}
}

View File

@ -336,11 +336,11 @@ private extension SidebarViewController {
func imageFor(_ node: Node) -> NSImage? {
// if let feed = node.representedObject as? Feed {
//
// }
guard let feed = node.representedObject as? Feed else {
return nil
}
return appDelegate.faviconDownloader.favicon(for: feed)
}
func nameFor(_ node: Node) -> String {