Move MainWindowController+ContextualMenus to SidebarViewController+ContextualMenus, where it always should have been.

This commit is contained in:
Brent Simmons 2018-02-04 11:19:24 -08:00
parent a6db249ab6
commit 2999641572
4 changed files with 15 additions and 26 deletions

View File

@ -108,7 +108,7 @@
84B06FFE1ED3818D00F0B54B /* RSTree.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 84B06FFA1ED3818000F0B54B /* RSTree.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
84B0700A1ED3822600F0B54B /* RSTextDrawing.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84B070071ED3821900F0B54B /* RSTextDrawing.framework */; };
84B0700B1ED3822600F0B54B /* RSTextDrawing.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 84B070071ED3821900F0B54B /* RSTextDrawing.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
84B7178C201E66580091657D /* MainWindowController+ContextualMenus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B7178B201E66580091657D /* MainWindowController+ContextualMenus.swift */; };
84B7178C201E66580091657D /* SidebarViewController+ContextualMenus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B7178B201E66580091657D /* SidebarViewController+ContextualMenus.swift */; };
84B99C671FAE35E600ECDEDB /* FeedListTreeControllerDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B99C661FAE35E600ECDEDB /* FeedListTreeControllerDelegate.swift */; };
84B99C691FAE36B800ECDEDB /* FeedListFolder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B99C681FAE36B800ECDEDB /* FeedListFolder.swift */; };
84B99C6B1FAE370B00ECDEDB /* FeedListFeed.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B99C6A1FAE370B00ECDEDB /* FeedListFeed.swift */; };
@ -584,7 +584,7 @@
84B06FF41ED3818000F0B54B /* RSTree.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RSTree.xcodeproj; path = Frameworks/RSTree/RSTree.xcodeproj; sourceTree = "<group>"; };
84B070011ED3821800F0B54B /* RSTextDrawing.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RSTextDrawing.xcodeproj; path = Frameworks/RSTextDrawing/RSTextDrawing.xcodeproj; sourceTree = "<group>"; };
84B23425202689F5007C5900 /* Evergreen-iOS.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = "Evergreen-iOS.xcodeproj"; sourceTree = "<group>"; };
84B7178B201E66580091657D /* MainWindowController+ContextualMenus.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "MainWindowController+ContextualMenus.swift"; sourceTree = "<group>"; };
84B7178B201E66580091657D /* SidebarViewController+ContextualMenus.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SidebarViewController+ContextualMenus.swift"; sourceTree = "<group>"; };
84B99C661FAE35E600ECDEDB /* FeedListTreeControllerDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedListTreeControllerDelegate.swift; sourceTree = "<group>"; };
84B99C681FAE36B800ECDEDB /* FeedListFolder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedListFolder.swift; sourceTree = "<group>"; };
84B99C6A1FAE370B00ECDEDB /* FeedListFeed.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedListFeed.swift; sourceTree = "<group>"; };
@ -699,7 +699,6 @@
849A977C1ED9EC42007D329B /* Detail */,
849A97551ED9EAC3007D329B /* Add Feed */,
849A97411ED9EAA9007D329B /* Add Folder */,
84B7178A201E66580091657D /* ContextualMenus */,
);
name = MainWindow;
path = Evergreen/MainWindow;
@ -840,6 +839,7 @@
isa = PBXGroup;
children = (
849A97621ED9EB96007D329B /* SidebarViewController.swift */,
84B7178B201E66580091657D /* SidebarViewController+ContextualMenus.swift */,
849A97601ED9EB96007D329B /* SidebarOutlineView.swift */,
849A97611ED9EB96007D329B /* SidebarTreeControllerDelegate.swift */,
849A97631ED9EB96007D329B /* UnreadCountView.swift */,
@ -1124,14 +1124,6 @@
name = Products;
sourceTree = "<group>";
};
84B7178A201E66580091657D /* ContextualMenus */ = {
isa = PBXGroup;
children = (
84B7178B201E66580091657D /* MainWindowController+ContextualMenus.swift */,
);
path = ContextualMenus;
sourceTree = "<group>";
};
84BB4B621F1174D400858766 /* Products */ = {
isa = PBXGroup;
children = (
@ -1693,7 +1685,7 @@
84A14FF320048CA70046AD9A /* SendToMicroBlogCommand.swift in Sources */,
849A97891ED9ECEF007D329B /* ArticleStyle.swift in Sources */,
84FF69B11FC3793300DC198E /* FaviconURLFinder.swift in Sources */,
84B7178C201E66580091657D /* MainWindowController+ContextualMenus.swift in Sources */,
84B7178C201E66580091657D /* SidebarViewController+ContextualMenus.swift in Sources */,
842611A21FCB769D0086A189 /* RSHTMLMetadata+Extension.swift in Sources */,
84A1500520048DDF0046AD9A /* SendToMarsEditCommand.swift in Sources */,
D5907DB22004BB37005947E5 /* ScriptingObjectContainer.swift in Sources */,

View File

@ -25,8 +25,6 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
return false
}
var renameWindowController: RenameWindowController?
// MARK: NSWindowController
private let windowAutosaveName = NSWindow.FrameAutosaveName(rawValue: kWindowFrameKey)

View File

@ -1,5 +1,5 @@
//
// MainWindowController+ContextualMenus.swift
// SidebarViewController+ContextualMenus.swift
// Evergreen
//
// Created by Brent Simmons on 1/28/18.
@ -11,7 +11,7 @@ import Data
import Account
import RSCore
extension MainWindowController {
extension SidebarViewController {
func menu(for objects: [Any]?) -> NSMenu? {
@ -35,7 +35,7 @@ extension MainWindowController {
// MARK: Contextual Menu Actions
extension MainWindowController {
extension SidebarViewController {
@objc func openHomePageFromContextualMenu(_ sender: Any?) {
@ -64,7 +64,7 @@ extension MainWindowController {
@objc func renameFromContextualMenu(_ sender: Any?) {
guard let window = window, let menuItem = sender as? NSMenuItem, let object = menuItem.representedObject as? DisplayNameProvider, object is Feed || object is Folder else {
guard let window = view.window, let menuItem = sender as? NSMenuItem, let object = menuItem.representedObject as? DisplayNameProvider, object is Feed || object is Folder else {
return
}
@ -76,7 +76,7 @@ extension MainWindowController {
}
}
extension MainWindowController: RenameWindowControllerDelegate {
extension SidebarViewController: RenameWindowControllerDelegate {
func renameWindowController(_ windowController: RenameWindowController, didRenameObject object: Any, withNewName name: String) {
@ -91,14 +91,14 @@ extension MainWindowController: RenameWindowControllerDelegate {
// MARK: Build Contextual Menus
private extension MainWindowController {
private extension SidebarViewController {
func menuForNoSelection() -> NSMenu {
let menu = NSMenu(title: "")
menu.addItem(withTitle: NSLocalizedString("New Feed", comment: "Command"), action: #selector(showAddFeedWindow(_:)), keyEquivalent: "")
menu.addItem(withTitle: NSLocalizedString("New Folder", comment: "Command"), action: #selector(showAddFolderWindow(_:)), keyEquivalent: "")
menu.addItem(withTitle: NSLocalizedString("New Feed", comment: "Command"), action: #selector(MainWindowController.showAddFeedWindow(_:)), keyEquivalent: "")
menu.addItem(withTitle: NSLocalizedString("New Folder", comment: "Command"), action: #selector(MainWindowController.showAddFolderWindow(_:)), keyEquivalent: "")
return menu
}

View File

@ -25,6 +25,8 @@ import RSCore
private var animatingChanges = false
private var sidebarCellAppearance: SidebarCellAppearance!
var renameWindowController: RenameWindowController?
var selectedObjects: [AnyObject] {
return selectedNodes.representedObjects()
}
@ -195,10 +197,7 @@ import RSCore
func contextualMenuForSelectedObjects() -> NSMenu? {
guard let mainWindowController = view.window?.windowController as? MainWindowController else {
return nil
}
return mainWindowController.menu(for: selectedObjects)
return menu(for: selectedObjects)
}
// MARK: NSOutlineViewDelegate