Validate the Mark Older Articles as Read command.

This commit is contained in:
Brent Simmons 2017-12-25 12:21:44 -08:00
parent 27b8fd0b18
commit 2dbb0a4988
2 changed files with 18 additions and 4 deletions

View File

@ -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 {

View File

@ -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() {