mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Move menu validations to the app delegate.
This commit is contained in:
@@ -282,7 +282,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
|
||||
return mainWindowController?.isOpen ?? false
|
||||
}
|
||||
if item.action == #selector(showAddFeedWindow(_:)) || item.action == #selector(showAddFolderWindow(_:)) {
|
||||
return !isDisplayingSheet
|
||||
return !isDisplayingSheet && !AccountManager.shared.activeAccounts.isEmpty
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -228,14 +228,6 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
||||
return true
|
||||
}
|
||||
|
||||
if item.action == #selector(showAddFeedWindow(_:)) {
|
||||
return canAddNewFeed()
|
||||
}
|
||||
|
||||
if item.action == #selector(showAddFolderWindow(_:)) {
|
||||
return canAddNewFolder()
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -600,14 +592,6 @@ private extension MainWindowController {
|
||||
return currentTimelineViewController?.canMarkAllAsRead() ?? false
|
||||
}
|
||||
|
||||
func canAddNewFeed() -> Bool {
|
||||
return sidebarViewController?.canAddNewFeed() ?? false
|
||||
}
|
||||
|
||||
func canAddNewFolder() -> Bool {
|
||||
return sidebarViewController?.canAddNewFolder() ?? false
|
||||
}
|
||||
|
||||
func validateToggleRead(_ item: NSValidatedUserInterfaceItem) -> Bool {
|
||||
|
||||
let validationStatus = currentTimelineViewController?.markReadCommandStatus() ?? .canDoNothing
|
||||
|
||||
@@ -361,14 +361,6 @@ protocol SidebarDelegate: class {
|
||||
|
||||
}
|
||||
|
||||
func canAddNewFeed() -> Bool {
|
||||
return !accountNodes.isEmpty
|
||||
}
|
||||
|
||||
func canAddNewFolder() -> Bool {
|
||||
return !accountNodes.isEmpty
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - NSUserInterfaceValidations
|
||||
|
||||
Reference in New Issue
Block a user