mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-11-28 08:17:16 +00:00
Update mark-as-starred toolbar item tooltip during validation.
This commit is contained in:
1 parent
1603d0b3f2
commit
ce5b60cfe8
1 file changed
+9
-6
@@ -190,23 +190,26 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
||||
private func validateToggleStarred(_ item: NSValidatedUserInterfaceItem) -> Bool {
|
||||
|
||||
let validationStatus = timelineViewController?.markStarredCommandStatus() ?? .canDoNothing
|
||||
let showStar: Bool
|
||||
let starring: Bool
|
||||
let result: Bool
|
||||
|
||||
switch validationStatus {
|
||||
case .canMark:
|
||||
showStar = true
|
||||
starring = true
|
||||
result = true
|
||||
case .canUnmark:
|
||||
showStar = false
|
||||
starring = false
|
||||
result = true
|
||||
case .canDoNothing:
|
||||
showStar = true
|
||||
starring = true
|
||||
result = false
|
||||
}
|
||||
|
||||
if let button = (item as? NSToolbarItem)?.view as? NSButton {
|
||||
button.image = NSImage(named: showStar ? .star : .unstar)
|
||||
if let toolbarItem = item as? NSToolbarItem {
|
||||
toolbarItem.toolTip = starring ? NSLocalizedString("Mark as Starred", comment: "Command") : NSLocalizedString("Mark as Unstarred", comment: "Command")
|
||||
if let button = toolbarItem.view as? NSButton {
|
||||
button.image = NSImage(named: starring ? .star : .unstar)
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
|
||||
Reference in new issue
Block a user