macOS: Disable 'Delete Selected' when nothing is selected

This commit is contained in:
Roopesh Chander 2019-05-12 11:52:36 +05:30
parent 3a1208836c
commit 1dca1022d5
1 changed files with 9 additions and 0 deletions

View File

@ -317,6 +317,15 @@ extension TunnelsListTableViewController {
}
}
extension TunnelsListTableViewController: NSMenuItemValidation {
func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
if menuItem.action == #selector(TunnelsListTableViewController.handleRemoveTunnelAction) {
return !tableView.selectedRowIndexes.isEmpty
}
return true
}
}
class FillerButton: NSButton {
override var intrinsicContentSize: NSSize {
return NSSize(width: NSView.noIntrinsicMetric, height: NSView.noIntrinsicMetric)