Make mark-as-starred menu item work; make it validate; change its name as needed.

This commit is contained in:
Brent Simmons
2018-02-17 12:01:14 -08:00
parent ce5b60cfe8
commit 21f262e953
5 changed files with 40 additions and 17 deletions

View File

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