macOS: Manage tunnels: Select first tunnel on showing the window
This commit is contained in:
parent
14fa8530d7
commit
fda8a5d83b
|
@ -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