diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index d51bcb8c7..b5e89f08e 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -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 = ""; }; 84A6B6951FB8DBD2006754AC /* DinosaursWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DinosaursWindowController.swift; sourceTree = ""; }; - 84AAF2BE202CF684004A0BC4 /* TimelineContextualMenuDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineContextualMenuDelegate.swift; sourceTree = ""; }; 84AD1EA92031617300BC20B7 /* FolderPasteboardWriter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FolderPasteboardWriter.swift; sourceTree = ""; }; 84AD1EB92031649C00BC20B7 /* SmartFeedPasteboardWriter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SmartFeedPasteboardWriter.swift; sourceTree = ""; }; 84AD1EBB2032AF5C00BC20B7 /* SidebarOutlineDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarOutlineDataSource.swift; sourceTree = ""; }; @@ -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 */, diff --git a/NetNewsWire/Base.lproj/MainWindow.storyboard b/NetNewsWire/Base.lproj/MainWindow.storyboard index 2bc758145..6cea16ac8 100644 --- a/NetNewsWire/Base.lproj/MainWindow.storyboard +++ b/NetNewsWire/Base.lproj/MainWindow.storyboard @@ -485,7 +485,6 @@ - @@ -503,7 +502,7 @@ - + @@ -511,11 +510,6 @@ - - - - - diff --git a/NetNewsWire/MainWindow/Timeline/TimelineContextualMenuDelegate.swift b/NetNewsWire/MainWindow/Timeline/TimelineContextualMenuDelegate.swift deleted file mode 100644 index 83d053a91..000000000 --- a/NetNewsWire/MainWindow/Timeline/TimelineContextualMenuDelegate.swift +++ /dev/null @@ -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) - } -} - - diff --git a/NetNewsWire/MainWindow/Timeline/TimelineViewController.swift b/NetNewsWire/MainWindow/Timeline/TimelineViewController.swift index 0b1ddcbfa..69e285e4b 100644 --- a/NetNewsWire/MainWindow/Timeline/TimelineViewController.swift +++ b/NetNewsWire/MainWindow/Timeline/TimelineViewController.swift @@ -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 {