aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/macOS/ViewController
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2019-02-05 16:39:19 +0530
committerRoopesh Chander <roop@roopc.net>2019-02-05 16:39:19 +0530
commit02a96d45669dddf5c7743ba8c013f58a004a97e8 (patch)
tree2f2154d1c79195c3fafca373f3f961387d4c6723 /WireGuard/WireGuard/UI/macOS/ViewController
parentmacOS: Ensure fields are updated on saving (diff)
downloadwireguard-apple-02a96d45669dddf5c7743ba8c013f58a004a97e8.tar.xz
wireguard-apple-02a96d45669dddf5c7743ba8c013f58a004a97e8.zip
macOS: Select tunnel after adding it with 'Add empty tunnel'
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to '')
-rw-r--r--WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift13
1 files changed, 13 insertions, 0 deletions
diff --git a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift
index 46f6bcb..e83e616 100644
--- a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift
+++ b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift
@@ -141,6 +141,7 @@ class TunnelsListTableViewController: NSViewController {
@objc func handleAddEmptyTunnelAction() {
let tunnelEditVC = TunnelEditViewController(tunnelsManager: tunnelsManager, tunnel: nil)
+ tunnelEditVC.delegate = self
presentAsSheet(tunnelEditVC)
}
@@ -237,6 +238,18 @@ class TunnelsListTableViewController: NSViewController {
}
}
+extension TunnelsListTableViewController: TunnelEditViewControllerDelegate {
+ func tunnelSaved(tunnel: TunnelContainer) {
+ if let tunnelIndex = tunnelsManager.index(of: tunnel), tunnelIndex >= 0 {
+ self.selectTunnel(at: tunnelIndex)
+ }
+ }
+
+ func tunnelEditingCancelled() {
+ // Nothing to do
+ }
+}
+
extension TunnelsListTableViewController {
func tunnelAdded(at index: Int) {
tableView.insertRows(at: IndexSet(integer: index), withAnimation: .slideLeft)