feat(src/window): migrate device monitoring to map/unmap events

Ensure monitoring starts only when the widget is shown and stops on hide, preventing timer leaks and unnecessary refreshes
This commit is contained in:
sankalp committed 2026-06-23 14:11:25 +05:45
1 parent 01fed4c52f
commit 6707e1e830
8 files changed
+95 -29

No files matched your search

+2 -2
View File
@@ -383,11 +383,11 @@ class WifiConnections(Box):
self.connect("destroy", self.on_destroy)
self.connect("unmap", self.on_hide)
self.start_network_monitoring()
self.connect("map", lambda *_: self.start_network_monitoring())
def on_hide(self, *_):
"""Called when the widget is hidden (popup closed)"""
self.stop_network_monitoring()
if self.other_networks.get_visible():
self.other_networks.set_visible(False)
self.other_networks_scrolled.snap_to_size(0)