macOS: Quit menu item

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander 2019-01-09 03:14:59 +05:30
parent bc8ea55023
commit 53e915c578
2 changed files with 9 additions and 0 deletions

View File

@ -232,6 +232,7 @@
"macMenuAddEmptyTunnel" = "Add empty tunnel...";
"macMenuExportLog" = "Export log to file...";
"macMenuExportTunnels" = "Export tunnels to zip...";
"macMenuQuit" = "Quit";
// Mac manage tunnels window

View File

@ -41,6 +41,8 @@ class StatusMenu: NSMenu {
addItem(NSMenuItem.separator())
}
addTunnelManagementItems()
addItem(NSMenuItem.separator())
addApplicationItems()
}
required init(coder decoder: NSCoder) {
@ -118,6 +120,12 @@ class StatusMenu: NSMenu {
addItem(importItem)
}
func addApplicationItems() {
let quitItem = NSMenuItem(title: tr("macMenuQuit"), action: #selector(NSApplication.terminate), keyEquivalent: "")
quitItem.target = NSApp
addItem(quitItem)
}
@objc func tunnelClicked(sender: AnyObject) {
guard let tunnelMenuItem = sender as? NSMenuItem else { return }
guard let tunnel = tunnelMenuItem.representedObject as? TunnelContainer else { return }