Skip to content

Commit

Permalink
fix: added clock update in popup view if the name was changed. Also a…
Browse files Browse the repository at this point in the history
…dded updates to the popup settings lists (#2127)
  • Loading branch information
exelban committed Oct 4, 2024
1 parent 9275c41 commit a1ebc79
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions Modules/Clock/popup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down Expand Up @@ -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()
}
Expand Down Expand Up @@ -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()
}
Expand Down

0 comments on commit a1ebc79

Please sign in to comment.