aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/macOS/ViewController/ManageTunnelsRootViewController.swift
diff options
context:
space:
mode:
Diffstat (limited to 'WireGuard/WireGuard/UI/macOS/ViewController/ManageTunnelsRootViewController.swift')
-rw-r--r--WireGuard/WireGuard/UI/macOS/ViewController/ManageTunnelsRootViewController.swift25
1 files changed, 21 insertions, 4 deletions
diff --git a/WireGuard/WireGuard/UI/macOS/ViewController/ManageTunnelsRootViewController.swift b/WireGuard/WireGuard/UI/macOS/ViewController/ManageTunnelsRootViewController.swift
index 58065475..18b8fcb7 100644
--- a/WireGuard/WireGuard/UI/macOS/ViewController/ManageTunnelsRootViewController.swift
+++ b/WireGuard/WireGuard/UI/macOS/ViewController/ManageTunnelsRootViewController.swift
@@ -77,10 +77,27 @@ class ManageTunnelsRootViewController: NSViewController {
}
extension ManageTunnelsRootViewController: TunnelsListTableViewControllerDelegate {
- func tunnelSelected(tunnel: TunnelContainer) {
- let tunnelDetailVC = TunnelDetailTableViewController(tunnelsManager: tunnelsManager, tunnel: tunnel)
- setTunnelDetailContentVC(tunnelDetailVC)
- self.tunnelDetailVC = tunnelDetailVC
+ func tunnelsSelected(tunnelIndices: [Int]) {
+ assert(!tunnelIndices.isEmpty)
+ if tunnelIndices.count == 1 {
+ let tunnel = tunnelsManager.tunnel(at: tunnelIndices.first!)
+ let tunnelDetailVC = TunnelDetailTableViewController(tunnelsManager: tunnelsManager, tunnel: tunnel)
+ setTunnelDetailContentVC(tunnelDetailVC)
+ self.tunnelDetailVC = tunnelDetailVC
+ } else if tunnelIndices.count > 1 {
+ let multiSelectionVC: ButtonedDetailViewController
+ if let buttonedDetailVC = tunnelDetailContentVC as? ButtonedDetailViewController {
+ multiSelectionVC = buttonedDetailVC
+ } else {
+ multiSelectionVC = ButtonedDetailViewController()
+ }
+ multiSelectionVC.setButtonTitle(tr(format: "macButtonDeleteTunnels (%d)", tunnelIndices.count))
+ multiSelectionVC.onButtonClicked = { [weak tunnelsListVC] in
+ tunnelsListVC?.handleRemoveTunnelAction()
+ }
+ setTunnelDetailContentVC(multiSelectionVC)
+ self.tunnelDetailVC = nil
+ }
}
func tunnelsListEmpty() {