Remove TimelineDataSource, which was overkill.

This commit is contained in:
Brent Simmons 2018-12-27 22:16:38 -08:00
parent b9aab9a695
commit 7cb218b37f
4 changed files with 21 additions and 43 deletions

View File

@ -113,7 +113,6 @@
840F7C7521BDA4B40057E851 /* DeleteFromSidebarCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B99C9C1FAE83C600ECDEDB /* DeleteFromSidebarCommand.swift */; }; 840F7C7521BDA4B40057E851 /* DeleteFromSidebarCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B99C9C1FAE83C600ECDEDB /* DeleteFromSidebarCommand.swift */; };
840F7C7621BDA4B40057E851 /* AddFeedWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A97521ED9EAC0007D329B /* AddFeedWindowController.swift */; }; 840F7C7621BDA4B40057E851 /* AddFeedWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A97521ED9EAC0007D329B /* AddFeedWindowController.swift */; };
840F7C7721BDA4B40057E851 /* TimelineTableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A976A1ED9EBC8007D329B /* TimelineTableView.swift */; }; 840F7C7721BDA4B40057E851 /* TimelineTableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A976A1ED9EBC8007D329B /* TimelineTableView.swift */; };
840F7C7821BDA4B40057E851 /* TimelineDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84162A242038C1E000035290 /* TimelineDataSource.swift */; };
840F7C7921BDA4B40057E851 /* DetailStatusBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84D52E941FE588BB00D14F5B /* DetailStatusBarView.swift */; }; 840F7C7921BDA4B40057E851 /* DetailStatusBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84D52E941FE588BB00D14F5B /* DetailStatusBarView.swift */; };
840F7C7A21BDA4B40057E851 /* MainWindowController+Scriptability.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5E4CC63202C1AC1009B4FFC /* MainWindowController+Scriptability.swift */; }; 840F7C7A21BDA4B40057E851 /* MainWindowController+Scriptability.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5E4CC63202C1AC1009B4FFC /* MainWindowController+Scriptability.swift */; };
840F7C7B21BDA4B40057E851 /* SidebarGearMenuDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84D5BA1F201E8FB6009092BD /* SidebarGearMenuDelegate.swift */; }; 840F7C7B21BDA4B40057E851 /* SidebarGearMenuDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84D5BA1F201E8FB6009092BD /* SidebarGearMenuDelegate.swift */; };
@ -176,7 +175,6 @@
840F7CCA21BF58890057E851 /* netnewswire-subscribe-to-feed.js in Resources */ = {isa = PBXBuildFile; fileRef = 6581C73F20CED60100F4AD34 /* netnewswire-subscribe-to-feed.js */; }; 840F7CCA21BF58890057E851 /* netnewswire-subscribe-to-feed.js in Resources */ = {isa = PBXBuildFile; fileRef = 6581C73F20CED60100F4AD34 /* netnewswire-subscribe-to-feed.js */; };
840F7CD021BF59840057E851 /* Subscribe to Feed.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 840F7CCE21BF58890057E851 /* Subscribe to Feed.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 840F7CD021BF59840057E851 /* Subscribe to Feed.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 840F7CCE21BF58890057E851 /* Subscribe to Feed.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
84162A152038C12C00035290 /* MarkCommandValidationStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84162A142038C12C00035290 /* MarkCommandValidationStatus.swift */; }; 84162A152038C12C00035290 /* MarkCommandValidationStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84162A142038C12C00035290 /* MarkCommandValidationStatus.swift */; };
84162A252038C1E000035290 /* TimelineDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84162A242038C1E000035290 /* TimelineDataSource.swift */; };
841ABA4E20145E7300980E11 /* NothingInspectorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841ABA4D20145E7300980E11 /* NothingInspectorViewController.swift */; }; 841ABA4E20145E7300980E11 /* NothingInspectorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841ABA4D20145E7300980E11 /* NothingInspectorViewController.swift */; };
841ABA5E20145E9200980E11 /* FolderInspectorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841ABA5D20145E9200980E11 /* FolderInspectorViewController.swift */; }; 841ABA5E20145E9200980E11 /* FolderInspectorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841ABA5D20145E9200980E11 /* FolderInspectorViewController.swift */; };
841ABA6020145EC100980E11 /* BuiltinSmartFeedInspectorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841ABA5F20145EC100980E11 /* BuiltinSmartFeedInspectorViewController.swift */; }; 841ABA6020145EC100980E11 /* BuiltinSmartFeedInspectorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841ABA5F20145EC100980E11 /* BuiltinSmartFeedInspectorViewController.swift */; };
@ -760,7 +758,6 @@
840F7CC021BDAD2C0057E851 /* Credits.rtf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.rtf; name = Credits.rtf; path = NetNewsWire/Resources/MAS/Credits.rtf; sourceTree = SOURCE_ROOT; }; 840F7CC021BDAD2C0057E851 /* Credits.rtf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.rtf; name = Credits.rtf; path = NetNewsWire/Resources/MAS/Credits.rtf; sourceTree = SOURCE_ROOT; };
840F7CCE21BF58890057E851 /* Subscribe to Feed.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Subscribe to Feed.appex"; sourceTree = BUILT_PRODUCTS_DIR; }; 840F7CCE21BF58890057E851 /* Subscribe to Feed.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Subscribe to Feed.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
84162A142038C12C00035290 /* MarkCommandValidationStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarkCommandValidationStatus.swift; sourceTree = "<group>"; }; 84162A142038C12C00035290 /* MarkCommandValidationStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarkCommandValidationStatus.swift; sourceTree = "<group>"; };
84162A242038C1E000035290 /* TimelineDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineDataSource.swift; sourceTree = "<group>"; };
841ABA4D20145E7300980E11 /* NothingInspectorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NothingInspectorViewController.swift; sourceTree = "<group>"; }; 841ABA4D20145E7300980E11 /* NothingInspectorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NothingInspectorViewController.swift; sourceTree = "<group>"; };
841ABA5D20145E9200980E11 /* FolderInspectorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FolderInspectorViewController.swift; sourceTree = "<group>"; }; 841ABA5D20145E9200980E11 /* FolderInspectorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FolderInspectorViewController.swift; sourceTree = "<group>"; };
841ABA5F20145EC100980E11 /* BuiltinSmartFeedInspectorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BuiltinSmartFeedInspectorViewController.swift; sourceTree = "<group>"; }; 841ABA5F20145EC100980E11 /* BuiltinSmartFeedInspectorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BuiltinSmartFeedInspectorViewController.swift; sourceTree = "<group>"; };
@ -1287,7 +1284,6 @@
children = ( children = (
849A976B1ED9EBC8007D329B /* TimelineViewController.swift */, 849A976B1ED9EBC8007D329B /* TimelineViewController.swift */,
84E8E0DA202EC49300562D8F /* TimelineViewController+ContextualMenus.swift */, 84E8E0DA202EC49300562D8F /* TimelineViewController+ContextualMenus.swift */,
84162A242038C1E000035290 /* TimelineDataSource.swift */,
84F204DF1FAACBB30076E152 /* ArticleArray.swift */, 84F204DF1FAACBB30076E152 /* ArticleArray.swift */,
849A97691ED9EBC8007D329B /* TimelineTableRowView.swift */, 849A97691ED9EBC8007D329B /* TimelineTableRowView.swift */,
849A976A1ED9EBC8007D329B /* TimelineTableView.swift */, 849A976A1ED9EBC8007D329B /* TimelineTableView.swift */,
@ -2408,7 +2404,6 @@
840F7C7521BDA4B40057E851 /* DeleteFromSidebarCommand.swift in Sources */, 840F7C7521BDA4B40057E851 /* DeleteFromSidebarCommand.swift in Sources */,
840F7C7621BDA4B40057E851 /* AddFeedWindowController.swift in Sources */, 840F7C7621BDA4B40057E851 /* AddFeedWindowController.swift in Sources */,
840F7C7721BDA4B40057E851 /* TimelineTableView.swift in Sources */, 840F7C7721BDA4B40057E851 /* TimelineTableView.swift in Sources */,
840F7C7821BDA4B40057E851 /* TimelineDataSource.swift in Sources */,
840F7C7921BDA4B40057E851 /* DetailStatusBarView.swift in Sources */, 840F7C7921BDA4B40057E851 /* DetailStatusBarView.swift in Sources */,
840F7C7A21BDA4B40057E851 /* MainWindowController+Scriptability.swift in Sources */, 840F7C7A21BDA4B40057E851 /* MainWindowController+Scriptability.swift in Sources */,
840F7C7B21BDA4B40057E851 /* SidebarGearMenuDelegate.swift in Sources */, 840F7C7B21BDA4B40057E851 /* SidebarGearMenuDelegate.swift in Sources */,
@ -2533,7 +2528,6 @@
84B99C9D1FAE83C600ECDEDB /* DeleteFromSidebarCommand.swift in Sources */, 84B99C9D1FAE83C600ECDEDB /* DeleteFromSidebarCommand.swift in Sources */,
849A97541ED9EAC0007D329B /* AddFeedWindowController.swift in Sources */, 849A97541ED9EAC0007D329B /* AddFeedWindowController.swift in Sources */,
849A976D1ED9EBC8007D329B /* TimelineTableView.swift in Sources */, 849A976D1ED9EBC8007D329B /* TimelineTableView.swift in Sources */,
84162A252038C1E000035290 /* TimelineDataSource.swift in Sources */,
84D52E951FE588BB00D14F5B /* DetailStatusBarView.swift in Sources */, 84D52E951FE588BB00D14F5B /* DetailStatusBarView.swift in Sources */,
D5E4CC64202C1AC1009B4FFC /* MainWindowController+Scriptability.swift in Sources */, D5E4CC64202C1AC1009B4FFC /* MainWindowController+Scriptability.swift in Sources */,
84D5BA20201E8FB6009092BD /* SidebarGearMenuDelegate.swift in Sources */, 84D5BA20201E8FB6009092BD /* SidebarGearMenuDelegate.swift in Sources */,

View File

@ -504,7 +504,7 @@
</tableColumn> </tableColumn>
</tableColumns> </tableColumns>
<connections> <connections>
<outlet property="dataSource" destination="7kA-tA-2n7" id="Tdx-DB-Zjs"/> <outlet property="dataSource" destination="36G-bQ-b96" id="bnC-R1-BcT"/>
<outlet property="delegate" destination="36G-bQ-b96" id="s1m-42-GQ4"/> <outlet property="delegate" destination="36G-bQ-b96" id="s1m-42-GQ4"/>
<outlet property="keyboardDelegate" destination="ZOV-xh-WJE" id="HiG-Bz-vD0"/> <outlet property="keyboardDelegate" destination="ZOV-xh-WJE" id="HiG-Bz-vD0"/>
<outlet property="menu" destination="gb5-z4-YPr" id="pey-0u-ogu"/> <outlet property="menu" destination="gb5-z4-YPr" id="pey-0u-ogu"/>
@ -532,7 +532,6 @@
</view> </view>
<connections> <connections>
<outlet property="contextualMenuDelegate" destination="iD1-KK-gFc" id="b0j-aW-e4B"/> <outlet property="contextualMenuDelegate" destination="iD1-KK-gFc" id="b0j-aW-e4B"/>
<outlet property="dataSource" destination="7kA-tA-2n7" id="heZ-eT-SZ6"/>
<outlet property="tableView" destination="DRs-j8-R9a" id="2AG-SP-7n2"/> <outlet property="tableView" destination="DRs-j8-R9a" id="2AG-SP-7n2"/>
</connections> </connections>
</viewController> </viewController>
@ -563,7 +562,6 @@
<outlet property="timelineViewController" destination="36G-bQ-b96" id="oE9-uV-TNi"/> <outlet property="timelineViewController" destination="36G-bQ-b96" id="oE9-uV-TNi"/>
</connections> </connections>
</customObject> </customObject>
<customObject id="7kA-tA-2n7" customClass="TimelineDataSource" customModule="NetNewsWire" customModuleProvider="target"/>
</objects> </objects>
<point key="canvasLocation" x="62" y="394"/> <point key="canvasLocation" x="62" y="394"/>
</scene> </scene>

View File

@ -1,32 +0,0 @@
//
// TimelineDataSource.swift
// NetNewsWire
//
// Created by Brent Simmons on 2/17/18.
// Copyright © 2018 Ranchero Software. All rights reserved.
//
import AppKit
@objc final class TimelineDataSource: NSObject, NSTableViewDataSource {
var articles = ArticleArray()
func numberOfRows(in tableView: NSTableView) -> Int {
return articles.count
}
func tableView(_ tableView: NSTableView, objectValueFor tableColumn: NSTableColumn?, row: Int) -> Any? {
return articles.articleAtRow(row) ?? nil
}
func tableView(_ tableView: NSTableView, pasteboardWriterForRow row: Int) -> NSPasteboardWriting? {
guard let article = articles.articleAtRow(row) else {
return nil
}
return ArticlePasteboardWriter(article: article)
}
}

View File

@ -15,7 +15,6 @@ class TimelineViewController: NSViewController, UndoableCommandRunner {
@IBOutlet var tableView: TimelineTableView! @IBOutlet var tableView: TimelineTableView!
@IBOutlet var contextualMenuDelegate: TimelineContextualMenuDelegate? @IBOutlet var contextualMenuDelegate: TimelineContextualMenuDelegate?
@IBOutlet var dataSource: TimelineDataSource!
var sharingServiceDelegate: NSSharingServiceDelegate? var sharingServiceDelegate: NSSharingServiceDelegate?
@ -30,7 +29,6 @@ class TimelineViewController: NSViewController, UndoableCommandRunner {
var articles = ArticleArray() { var articles = ArticleArray() {
didSet { didSet {
if articles != oldValue { if articles != oldValue {
dataSource.articles = articles
updateShowAvatars() updateShowAvatars()
articleRowMap = [String: Int]() articleRowMap = [String: Int]()
tableView.reloadData() tableView.reloadData()
@ -532,6 +530,26 @@ extension TimelineViewController: NSUserInterfaceValidations {
} }
} }
// MARK: - NSTableViewDataSource
extension TimelineViewController: NSTableViewDataSource {
func numberOfRows(in tableView: NSTableView) -> Int {
return articles.count
}
func tableView(_ tableView: NSTableView, objectValueFor tableColumn: NSTableColumn?, row: Int) -> Any? {
return articles.articleAtRow(row) ?? nil
}
func tableView(_ tableView: NSTableView, pasteboardWriterForRow row: Int) -> NSPasteboardWriting? {
guard let article = articles.articleAtRow(row) else {
return nil
}
return ArticlePasteboardWriter(article: article)
}
}
// MARK: - NSTableViewDelegate // MARK: - NSTableViewDelegate
extension TimelineViewController: NSTableViewDelegate { extension TimelineViewController: NSTableViewDelegate {