macOS: Manage tunnels: Select first tunnel on showing the window
Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
parent
a221cb566b
commit
de12c27d5b
|
@ -61,6 +61,7 @@ class TunnelsListTableViewController: NSViewController {
|
|||
override func loadView() {
|
||||
tableView.dataSource = self
|
||||
tableView.delegate = self
|
||||
selectFirstTunnel()
|
||||
|
||||
let scrollView = NSScrollView()
|
||||
scrollView.hasVerticalScroller = true
|
||||
|
@ -148,6 +149,13 @@ class TunnelsListTableViewController: NSViewController {
|
|||
@objc func exportTunnelsClicked() {
|
||||
print("exportTunnelsClicked")
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
private func selectFirstTunnel() -> Bool {
|
||||
guard tunnelsManager.numberOfTunnels() > 0 else { return false }
|
||||
tableView.selectRowIndexes(IndexSet(integer: 0), byExtendingSelection: false)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension TunnelsListTableViewController: NSTableViewDataSource {
|
||||
|
|
Loading…
Reference in New Issue