macOS: Add tunnel management menu items
This commit is contained in:
parent
93d7bfa12c
commit
3d97b59a4f
|
@ -220,3 +220,8 @@
|
|||
"alertSystemErrorMessageTunnelConfigurationStale" = "The configuration is stale.";
|
||||
"alertSystemErrorMessageTunnelConfigurationReadWriteFailed" = "Reading or writing the configuration failed.";
|
||||
"alertSystemErrorMessageTunnelConfigurationUnknown" = "Unknown system error.";
|
||||
|
||||
// Mac status bar menu
|
||||
|
||||
"macMenuManageTunnels" = "Manage tunnels";
|
||||
"macMenuImportTunnels" = "Import tunnel(s) from file...";
|
||||
|
|
|
@ -11,6 +11,8 @@ class StatusMenu: NSMenu {
|
|||
self.tunnelsManager = tunnelsManager
|
||||
super.init(title: "WireGuard Status Bar Menu")
|
||||
addTunnelMenuItems()
|
||||
addItem(NSMenuItem.separator())
|
||||
addTunnelManagementItems()
|
||||
}
|
||||
|
||||
required init(coder decoder: NSCoder) {
|
||||
|
@ -31,4 +33,21 @@ class StatusMenu: NSMenu {
|
|||
guard let tunnel = sender.representedObject as? TunnelContainer else { return }
|
||||
print("Tunnel \(tunnel.name) clicked")
|
||||
}
|
||||
|
||||
func addTunnelManagementItems() {
|
||||
let manageItem = NSMenuItem(title: tr("macMenuManageTunnels"), action: #selector(manageTunnelsClicked), keyEquivalent: "")
|
||||
manageItem.target = self
|
||||
addItem(manageItem)
|
||||
let importItem = NSMenuItem(title: tr("macMenuImportTunnels"), action: #selector(importTunnelsClicked), keyEquivalent: "")
|
||||
importItem.target = self
|
||||
addItem(importItem)
|
||||
}
|
||||
|
||||
@objc func manageTunnelsClicked() {
|
||||
print("Unimplemented")
|
||||
}
|
||||
|
||||
@objc func importTunnelsClicked() {
|
||||
print("Unimplemented")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue