macOS: Tunnel detail: Handle deletion outside app

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander 2019-01-22 19:23:05 +05:30
parent 2aad8cf0e8
commit 2677efc9bf
1 changed files with 5 additions and 4 deletions

View File

@ -155,10 +155,6 @@ class TunnelsListTableViewController: NSViewController {
ErrorPresenter.showErrorAlert(error: error, from: self)
return
}
let tunnelIndex = min(selectedTunnelIndex, self.tunnelsManager.numberOfTunnels() - 1)
if tunnelIndex >= 0 {
self.selectTunnel(at: tunnelIndex)
}
}
}
}
@ -249,10 +245,15 @@ extension TunnelsListTableViewController {
}
func tunnelRemoved(at index: Int) {
let selectedTunnelIndex = tableView.selectedRow
tableView.removeRows(at: IndexSet(integer: index), withAnimation: .slideLeft)
if tunnelsManager.numberOfTunnels() == 0 {
delegate?.tunnelsListEmpty()
}
let tunnelIndex = min(selectedTunnelIndex, self.tunnelsManager.numberOfTunnels() - 1)
if tunnelIndex >= 0 {
self.selectTunnel(at: tunnelIndex)
}
}
}