mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Make mark-as-starred menu item work; make it validate; change its name as needed.
This commit is contained in:
@@ -205,13 +205,19 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
||||
result = false
|
||||
}
|
||||
|
||||
let commandName = starring ? NSLocalizedString("Mark as Starred", comment: "Command") : NSLocalizedString("Mark as Unstarred", comment: "Command")
|
||||
|
||||
if let toolbarItem = item as? NSToolbarItem {
|
||||
toolbarItem.toolTip = starring ? NSLocalizedString("Mark as Starred", comment: "Command") : NSLocalizedString("Mark as Unstarred", comment: "Command")
|
||||
toolbarItem.toolTip = commandName
|
||||
if let button = toolbarItem.view as? NSButton {
|
||||
button.image = NSImage(named: starring ? .star : .unstar)
|
||||
}
|
||||
}
|
||||
|
||||
if let menuItem = item as? NSMenuItem {
|
||||
menuItem.title = commandName
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
@@ -12,19 +12,6 @@ import RSTextDrawing
|
||||
import Data
|
||||
import Account
|
||||
|
||||
enum MarkCommandValidationStatus {
|
||||
|
||||
case canMark, canUnmark, canDoNothing
|
||||
|
||||
static func statusFor(_ articles: ArticleArray, _ canMarkTest: ((ArticleArray) -> Bool)) -> MarkCommandValidationStatus {
|
||||
|
||||
if articles.isEmpty {
|
||||
return .canDoNothing
|
||||
}
|
||||
return canMarkTest(articles) ? .canMark : .canUnmark
|
||||
}
|
||||
}
|
||||
|
||||
class TimelineViewController: NSViewController, UndoableCommandRunner {
|
||||
|
||||
@IBOutlet var tableView: TimelineTableView!
|
||||
|
||||
Reference in New Issue
Block a user