Update mark-as-starred toolbar item tooltip during validation.
This commit is contained in:
parent
1603d0b3f2
commit
ce5b60cfe8
|
@ -190,23 +190,26 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
||||||
private func validateToggleStarred(_ item: NSValidatedUserInterfaceItem) -> Bool {
|
private func validateToggleStarred(_ item: NSValidatedUserInterfaceItem) -> Bool {
|
||||||
|
|
||||||
let validationStatus = timelineViewController?.markStarredCommandStatus() ?? .canDoNothing
|
let validationStatus = timelineViewController?.markStarredCommandStatus() ?? .canDoNothing
|
||||||
let showStar: Bool
|
let starring: Bool
|
||||||
let result: Bool
|
let result: Bool
|
||||||
|
|
||||||
switch validationStatus {
|
switch validationStatus {
|
||||||
case .canMark:
|
case .canMark:
|
||||||
showStar = true
|
starring = true
|
||||||
result = true
|
result = true
|
||||||
case .canUnmark:
|
case .canUnmark:
|
||||||
showStar = false
|
starring = false
|
||||||
result = true
|
result = true
|
||||||
case .canDoNothing:
|
case .canDoNothing:
|
||||||
showStar = true
|
starring = true
|
||||||
result = false
|
result = false
|
||||||
}
|
}
|
||||||
|
|
||||||
if let button = (item as? NSToolbarItem)?.view as? NSButton {
|
if let toolbarItem = item as? NSToolbarItem {
|
||||||
button.image = NSImage(named: showStar ? .star : .unstar)
|
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
|
return result
|
||||||
|
|
Loading…
Reference in New Issue