mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-02 19:26:41 +00:00
only update the network list view if it's visible
This commit is contained in:
parent
36a9aff283
commit
b9a4d138fc
@ -15,6 +15,8 @@ class ShowNetworksViewController: NSViewController, NSTableViewDelegate, NSTable
|
||||
var networkList: [Network] = [Network]()
|
||||
var netMonitor: NetworkMonitor!
|
||||
|
||||
var visible = false
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
// Do view setup here.
|
||||
@ -32,6 +34,7 @@ class ShowNetworksViewController: NSViewController, NSTableViewDelegate, NSTable
|
||||
|
||||
override func viewWillAppear() {
|
||||
super.viewWillAppear()
|
||||
visible = true
|
||||
}
|
||||
|
||||
override func viewWillDisappear() {
|
||||
@ -39,6 +42,7 @@ class ShowNetworksViewController: NSViewController, NSTableViewDelegate, NSTable
|
||||
|
||||
let filePath = dataFile()
|
||||
NSKeyedArchiver.archiveRootObject(self.networkList, toFile: filePath)
|
||||
visible = false
|
||||
}
|
||||
|
||||
func deleteNetworkFromList(nwid: String) {
|
||||
@ -48,9 +52,13 @@ class ShowNetworksViewController: NSViewController, NSTableViewDelegate, NSTable
|
||||
|
||||
func setNetworks(list: [Network]) {
|
||||
networkList = list
|
||||
if visible {
|
||||
tableView?.reloadData()
|
||||
}
|
||||
|
||||
NSLog("Visible? \(visible)")
|
||||
}
|
||||
|
||||
// NSTableViewDataSource
|
||||
|
||||
func numberOfRowsInTableView(tableView: NSTableView) -> Int {
|
||||
|
Loading…
Reference in New Issue
Block a user