mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-20 11:38:48 +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 networkList: [Network] = [Network]()
|
||||||
var netMonitor: NetworkMonitor!
|
var netMonitor: NetworkMonitor!
|
||||||
|
|
||||||
|
var visible = false
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
// Do view setup here.
|
// Do view setup here.
|
||||||
@ -32,6 +34,7 @@ class ShowNetworksViewController: NSViewController, NSTableViewDelegate, NSTable
|
|||||||
|
|
||||||
override func viewWillAppear() {
|
override func viewWillAppear() {
|
||||||
super.viewWillAppear()
|
super.viewWillAppear()
|
||||||
|
visible = true
|
||||||
}
|
}
|
||||||
|
|
||||||
override func viewWillDisappear() {
|
override func viewWillDisappear() {
|
||||||
@ -39,6 +42,7 @@ class ShowNetworksViewController: NSViewController, NSTableViewDelegate, NSTable
|
|||||||
|
|
||||||
let filePath = dataFile()
|
let filePath = dataFile()
|
||||||
NSKeyedArchiver.archiveRootObject(self.networkList, toFile: filePath)
|
NSKeyedArchiver.archiveRootObject(self.networkList, toFile: filePath)
|
||||||
|
visible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
func deleteNetworkFromList(nwid: String) {
|
func deleteNetworkFromList(nwid: String) {
|
||||||
@ -48,9 +52,13 @@ class ShowNetworksViewController: NSViewController, NSTableViewDelegate, NSTable
|
|||||||
|
|
||||||
func setNetworks(list: [Network]) {
|
func setNetworks(list: [Network]) {
|
||||||
networkList = list
|
networkList = list
|
||||||
|
if visible {
|
||||||
tableView?.reloadData()
|
tableView?.reloadData()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSLog("Visible? \(visible)")
|
||||||
|
}
|
||||||
|
|
||||||
// NSTableViewDataSource
|
// NSTableViewDataSource
|
||||||
|
|
||||||
func numberOfRowsInTableView(tableView: NSTableView) -> Int {
|
func numberOfRowsInTableView(tableView: NSTableView) -> Int {
|
||||||
|
Loading…
Reference in New Issue
Block a user