refactor: wireless connecting info
This commit is contained in:
1 parent
ee0b5f00e6
commit
f29d48bf5b
2 files changed
+6
-4
No files matched your search
@@ -361,6 +361,9 @@ class SdbusNm:
|
||||
self.nm.wireless_enabled = enable
|
||||
|
||||
def monitor_connection_status(self):
|
||||
if not self.wlan_device:
|
||||
self.set_connection_monitoring(False)
|
||||
return False
|
||||
state = self.wlan_device.state
|
||||
if self.wifi_state != state:
|
||||
logging.debug(f"State changed: {state} {self.wlan_device.state_reason}")
|
||||
@@ -391,7 +394,7 @@ class SdbusNm:
|
||||
self.wifi_state = state
|
||||
return self.monitor_connection
|
||||
|
||||
def enable_monitoring(self, enable):
|
||||
def set_connection_monitoring(self, enable):
|
||||
self.monitor_connection = enable
|
||||
|
||||
def set_wlan_device(self, iface_name):
|
||||
|
||||
+2
-3
@@ -111,7 +111,7 @@ class Panel(ScreenPanel):
|
||||
self.labels['main_box'].pack_start(sbox, False, False, 5)
|
||||
GLib.idle_add(self.load_networks)
|
||||
scroll.add(self.network_list)
|
||||
self.sdbus_nm.enable_monitoring(True)
|
||||
self.sdbus_nm.set_connection_monitoring(True)
|
||||
self.conn_status = GLib.timeout_add_seconds(1, self.sdbus_nm.monitor_connection_status)
|
||||
else:
|
||||
self._screen.show_popup_message(_("No wireless interface has been found"), level=2)
|
||||
@@ -458,8 +458,7 @@ class Panel(ScreenPanel):
|
||||
if self.update_timeout is not None:
|
||||
GLib.source_remove(self.update_timeout)
|
||||
self.update_timeout = None
|
||||
if self.sdbus_nm.wifi:
|
||||
self.sdbus_nm.enable_monitoring(False)
|
||||
self.sdbus_nm.set_connection_monitoring(False)
|
||||
|
||||
def toggle_wifi(self, switch, gparams):
|
||||
enable = switch.get_active()
|
||||
|
||||
Reference in new issue
Block a user