fix: added clock update in popup view if the name was changed. Also added updates to the popup settings lists (#2127)

This commit is contained in:
Serhiy Mytrovtsiy
2024-10-04 16:55:50 +02:00
parent 9275c412b8
commit a1ebc792d6

View File

@@ -43,7 +43,7 @@ internal class Popup: PopupWrapper {
var sorted = list.sorted(by: { $0.popupIndex < $1.popupIndex })
var views = self.subviews.filter{ $0 is ClockView }.compactMap{ $0 as? ClockView }
if sorted.count != self.orderTableView.list.count {
if sorted.count != self.orderTableView.list.count || self.orderTableView.window?.isVisible ?? false {
self.orderTableView.list = sorted
self.orderTableView.update()
}
@@ -149,7 +149,7 @@ private class ClockView: NSStackView {
}
public func update(_ newClock: Clock_t) {
if self.clock.tz != newClock.tz {
if self.clock.tz != newClock.tz || self.clock.name != newClock.name {
self.clock = newClock
self.setTZ()
}
@@ -304,10 +304,6 @@ private class OrderTableView: NSView, NSTableViewDelegate, NSTableViewDataSource
fatalError("init(coder:) has not been implemented")
}
deinit {
NotificationCenter.default.removeObserver(self)
}
public func update() {
self.tableView.reloadData()
}