Get rid of TimelineContextualMenuDelegate.

This commit is contained in:
Brent Simmons 2019-02-10 16:47:46 -08:00
parent 68af34e397
commit 7f4634b790
4 changed files with 15 additions and 47 deletions

View File

@ -86,7 +86,6 @@
840F7C5B21BDA4B40057E851 /* Node-Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A97971ED9EFAA007D329B /* Node-Extensions.swift */; };
840F7C5C21BDA4B40057E851 /* AppImages.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849EE70E203919360082A1EA /* AppImages.swift */; };
840F7C5D21BDA4B40057E851 /* AddFeedController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A97511ED9EAC0007D329B /* AddFeedController.swift */; };
840F7C5E21BDA4B40057E851 /* TimelineContextualMenuDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84AAF2BE202CF684004A0BC4 /* TimelineContextualMenuDelegate.swift */; };
840F7C5F21BDA4B40057E851 /* SidebarStatusBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A97821ED9EC63007D329B /* SidebarStatusBarView.swift */; };
840F7C6021BDA4B40057E851 /* TodayFeedDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F2D5361FC22FCB00998D64 /* TodayFeedDelegate.swift */; };
840F7C6121BDA4B40057E851 /* FolderInspectorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841ABA5D20145E9200980E11 /* FolderInspectorViewController.swift */; };
@ -260,7 +259,6 @@
84A1500520048DDF0046AD9A /* SendToMarsEditCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A1500420048DDF0046AD9A /* SendToMarsEditCommand.swift */; };
84A37CB5201ECD610087C5AF /* RenameWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A37CB4201ECD610087C5AF /* RenameWindowController.swift */; };
84A37CBB201ECE590087C5AF /* RenameSheet.xib in Resources */ = {isa = PBXBuildFile; fileRef = 84A37CB9201ECE590087C5AF /* RenameSheet.xib */; };
84AAF2BF202CF684004A0BC4 /* TimelineContextualMenuDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84AAF2BE202CF684004A0BC4 /* TimelineContextualMenuDelegate.swift */; };
84AD1EAA2031617300BC20B7 /* FolderPasteboardWriter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84AD1EA92031617300BC20B7 /* FolderPasteboardWriter.swift */; };
84AD1EBA2031649C00BC20B7 /* SmartFeedPasteboardWriter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84AD1EB92031649C00BC20B7 /* SmartFeedPasteboardWriter.swift */; };
84AD1EBC2032AF5C00BC20B7 /* SidebarOutlineDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84AD1EBB2032AF5C00BC20B7 /* SidebarOutlineDataSource.swift */; };
@ -852,7 +850,6 @@
84A37CBA201ECE590087C5AF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = NetNewsWire/Base.lproj/RenameSheet.xib; sourceTree = SOURCE_ROOT; };
84A6B6931FB8D43C006754AC /* DinosaursWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = DinosaursWindow.xib; sourceTree = "<group>"; };
84A6B6951FB8DBD2006754AC /* DinosaursWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DinosaursWindowController.swift; sourceTree = "<group>"; };
84AAF2BE202CF684004A0BC4 /* TimelineContextualMenuDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineContextualMenuDelegate.swift; sourceTree = "<group>"; };
84AD1EA92031617300BC20B7 /* FolderPasteboardWriter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FolderPasteboardWriter.swift; sourceTree = "<group>"; };
84AD1EB92031649C00BC20B7 /* SmartFeedPasteboardWriter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SmartFeedPasteboardWriter.swift; sourceTree = "<group>"; };
84AD1EBB2032AF5C00BC20B7 /* SidebarOutlineDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarOutlineDataSource.swift; sourceTree = "<group>"; };
@ -1295,7 +1292,6 @@
849A976A1ED9EBC8007D329B /* TimelineTableView.swift */,
844B5B6C1FEA282400C7C76A /* Keyboard */,
84E95D231FB1087500552D99 /* ArticlePasteboardWriter.swift */,
84AAF2BE202CF684004A0BC4 /* TimelineContextualMenuDelegate.swift */,
849A976F1ED9EC04007D329B /* Cell */,
);
path = Timeline;
@ -2401,7 +2397,6 @@
840F7C5B21BDA4B40057E851 /* Node-Extensions.swift in Sources */,
840F7C5C21BDA4B40057E851 /* AppImages.swift in Sources */,
840F7C5D21BDA4B40057E851 /* AddFeedController.swift in Sources */,
840F7C5E21BDA4B40057E851 /* TimelineContextualMenuDelegate.swift in Sources */,
840F7C5F21BDA4B40057E851 /* SidebarStatusBarView.swift in Sources */,
840F7C6021BDA4B40057E851 /* TodayFeedDelegate.swift in Sources */,
840F7C6121BDA4B40057E851 /* FolderInspectorViewController.swift in Sources */,
@ -2524,7 +2519,6 @@
849A97981ED9EFAA007D329B /* Node-Extensions.swift in Sources */,
849EE70F203919360082A1EA /* AppImages.swift in Sources */,
849A97531ED9EAC0007D329B /* AddFeedController.swift in Sources */,
84AAF2BF202CF684004A0BC4 /* TimelineContextualMenuDelegate.swift in Sources */,
849A97831ED9EC63007D329B /* SidebarStatusBarView.swift in Sources */,
84F2D5381FC22FCC00998D64 /* TodayFeedDelegate.swift in Sources */,
841ABA5E20145E9200980E11 /* FolderInspectorViewController.swift in Sources */,

View File

@ -485,7 +485,6 @@
</constraints>
</view>
<connections>
<outlet property="contextualMenuDelegate" destination="iD1-KK-gFc" id="b0j-aW-e4B"/>
<outlet property="tableView" destination="DRs-j8-R9a" id="2AG-SP-7n2"/>
</connections>
</viewController>
@ -503,7 +502,7 @@
</menuItem>
</items>
<connections>
<outlet property="delegate" destination="iD1-KK-gFc" id="q4j-wE-tnf"/>
<outlet property="delegate" destination="36G-bQ-b96" id="mno-4b-OJB"/>
</connections>
</menu>
<customObject id="ZOV-xh-WJE" customClass="TimelineKeyboardDelegate" customModule="NetNewsWire" customModuleProvider="target">
@ -511,11 +510,6 @@
<outlet property="timelineViewController" destination="36G-bQ-b96" id="rED-2Z-kh6"/>
</connections>
</customObject>
<customObject id="iD1-KK-gFc" customClass="TimelineContextualMenuDelegate" customModule="NetNewsWire" customModuleProvider="target">
<connections>
<outlet property="timelineViewController" destination="36G-bQ-b96" id="oE9-uV-TNi"/>
</connections>
</customObject>
</objects>
<point key="canvasLocation" x="62" y="394"/>
</scene>

View File

@ -1,32 +0,0 @@
//
// TimelineContextualMenuDelegate.swift
// NetNewsWire
//
// Created by Brent Simmons on 2/8/18.
// Copyright © 2018 Ranchero Software. All rights reserved.
//
import AppKit
import RSCore
@objc final class TimelineContextualMenuDelegate: NSObject, NSMenuDelegate {
@IBOutlet weak var timelineViewController: TimelineViewController?
public func menuNeedsUpdate(_ menu: NSMenu) {
guard let timelineViewController = timelineViewController else {
return
}
menu.removeAllItems()
guard let contextualMenu = timelineViewController.contextualMenuForClickedRows() else {
return
}
menu.takeItems(from: contextualMenu)
}
}

View File

@ -14,7 +14,6 @@ import Account
class TimelineViewController: NSViewController, UndoableCommandRunner {
@IBOutlet var tableView: TimelineTableView!
@IBOutlet var contextualMenuDelegate: TimelineContextualMenuDelegate?
var sharingServiceDelegate: NSSharingServiceDelegate?
@ -533,7 +532,20 @@ class TimelineViewController: NSViewController, UndoableCommandRunner {
}
}
// MARK: NSUserInterfaceValidations
// MARK: - NSMenuDelegate
extension TimelineViewController: NSMenuDelegate {
public func menuNeedsUpdate(_ menu: NSMenu) {
menu.removeAllItems()
guard let contextualMenu = contextualMenuForClickedRows() else {
return
}
menu.takeItems(from: contextualMenu)
}
}
// MARK: - NSUserInterfaceValidations
extension TimelineViewController: NSUserInterfaceValidations {