diff --git a/Evergreen/MainWindow/MainWindowController.swift b/Evergreen/MainWindow/MainWindowController.swift index 5c7ed4551..763487533 100644 --- a/Evergreen/MainWindow/MainWindowController.swift +++ b/Evergreen/MainWindow/MainWindowController.swift @@ -127,6 +127,10 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations { return canMarkRead() } + if item.action == #selector(markOlderArticlesAsRead(_:)) { + return canMarkOlderArticlesAsRead() + } + return true } @@ -239,7 +243,7 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations { @IBAction func markOlderArticlesAsRead(_ sender: Any?) { - timelineViewController?.markOlderArticlesAsRead(sender) + timelineViewController?.markOlderArticlesAsRead() } @IBAction func navigateToTimeline(_ sender: Any?) { @@ -339,7 +343,12 @@ private extension MainWindowController { return timelineViewController?.canMarkSelectedArticlesAsRead() ?? false } - + + func canMarkOlderArticlesAsRead() -> Bool { + + return timelineViewController?.canMarkOlderArticlesAsRead() ?? false + } + func updateWindowTitle() { if unreadCount < 1 { diff --git a/Evergreen/MainWindow/Timeline/TimelineViewController.swift b/Evergreen/MainWindow/Timeline/TimelineViewController.swift index 5abf6c1b6..f514a27e7 100644 --- a/Evergreen/MainWindow/Timeline/TimelineViewController.swift +++ b/Evergreen/MainWindow/Timeline/TimelineViewController.swift @@ -180,7 +180,7 @@ class TimelineViewController: NSViewController, UndoableCommandRunner { runCommand(markUnreadCommand) } - @IBAction func markOlderArticlesAsRead(_ sender: Any?) { + func markOlderArticlesAsRead() { // Mark articles the same age or older than the selected article(s) as read. @@ -207,7 +207,12 @@ class TimelineViewController: NSViewController, UndoableCommandRunner { } runCommand(markReadCommand) } - + + func canMarkOlderArticlesAsRead() -> Bool { + + return !selectedArticles.isEmpty + } + // MARK: - Navigation func goToNextUnread() {