--- pyanaconda/ui/gui/spokes/network.py | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py index f8ebcf5..dcee120 100644 --- a/pyanaconda/ui/gui/spokes/network.py +++ b/pyanaconda/ui/gui/spokes/network.py @@ -35,7 +35,7 @@ from gi.repository import Gtk, AnacondaWidgets
from pyanaconda.flags import flags -from pyanaconda.ui.gui import GUIObject +from pyanaconda.ui.gui import GUIObject, communication from pyanaconda.ui.gui.spokes import NormalSpoke, StandaloneSpoke from pyanaconda.ui.gui.categories.software import SoftwareCategory from pyanaconda.ui.gui.hubs.summary import SummaryHub @@ -957,6 +957,9 @@ class NetworkSpoke(NormalSpoke): def __init__(self, *args, **kwargs): NormalSpoke.__init__(self, *args, **kwargs) self.network_control_box = NetworkControlBox(self.builder) + self.network_control_box.client.connect("notify::%s" % + NMClient.CLIENT_STATE, self.on_nm_state_changed) +
def apply(self): hostname = self.data.network.hostname @@ -1016,6 +1019,9 @@ class NetworkSpoke(NormalSpoke): NormalSpoke.refresh(self) self.network_control_box.refresh()
+ def on_nm_state_changed(self, *args): + communication.send_message(self.__class__.__name__, self.status) + class NetworkStandaloneSpoke(StandaloneSpoke): builderObjects = ["networkStandaloneWindow", "networkControlBox_vbox", "liststore_wireless_network", "liststore_devices"] mainWidgetName = "networkStandaloneWindow"
--- pyanaconda/ui/gui/spokes/network.py | 44 ++++++++++++++++++++-------------- 1 files changed, 26 insertions(+), 18 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py index dcee120..6823345 100644 --- a/pyanaconda/ui/gui/spokes/network.py +++ b/pyanaconda/ui/gui/spokes/network.py @@ -980,27 +980,35 @@ class NetworkSpoke(NormalSpoke): @property def status(self): """ A short string describing which devices are connected. """ - msg = _("Not connected") - - ac = self.network_control_box.activated_connections() - if ac: - if len(ac) == 1: - device, ssid = ac[0] - if ssid: - msg = _("Wireless (%s) connected to %s" % - (device, ssid)) + msg = _("Unknown") + + state = self.network_control_box.client.get_state() + if state == NetworkManager.State.CONNECTING: + msg = _("Connecting...") + elif state == NetworkManager.State.DISCONNECTING: + msg = _("Disconnecting...") + else: + ac = self.network_control_box.activated_connections() + if ac: + if len(ac) == 1: + device, ssid = ac[0] + if ssid: + msg = _("Wireless (%s) connected to %s" % + (device, ssid)) + else: + msg = _("Wired (%s) connected") % device else: - msg = _("Wired (%s) connected") % device - else:
- devlist = ", ".join(["%s" % device for device, ssid - in ac - if ssid is None] + - ["%s (%s)" % (device, ssid) for device, ssid - in ac - if ssid is not None]) + devlist = ", ".join(["%s" % device for device, ssid + in ac + if ssid is None] + + ["%s (%s)" % (device, ssid) for device, ssid + in ac + if ssid is not None])
- msg = _("Connected devices: %s") % devlist + msg = _("Connected devices: %s") % devlist + else: + msg = _("Not connected")
if not self.network_control_box.listed_devices: msg = _("No network devices available")
--- pyanaconda/ui/gui/spokes/network.py | 24 ++++++++++++++---------- 1 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py index 6823345..15aa3bc 100644 --- a/pyanaconda/ui/gui/spokes/network.py +++ b/pyanaconda/ui/gui/spokes/network.py @@ -286,9 +286,6 @@ class NetworkControlBox(): # NM Client self.client.connect("device-added", self.on_device_added) self.client.connect("device-removed", self.on_device_removed) - # TODO (active_connections_changed) - #self.client.connect("notify::%s" % NMClient.CLIENT_ACTIVE_CONNECTIONS, - # self.on_active_connections_changed)
self.builder.get_object("device_wired_off_switch").connect("notify::active", self.on_device_off_toggled) @@ -378,11 +375,6 @@ class NetworkControlBox(): if device == self.selected_device(): self.refresh_ui(device, read_config_values, new_state)
- # TODO: remove/fix - def on_active_connections_changed(self, *args): - device = self.selected_device() - self.refresh_ui(device) - def on_wireless_ap_changed_cb(self, combobox, *args): if self._updating_device: return @@ -958,8 +950,10 @@ class NetworkSpoke(NormalSpoke): NormalSpoke.__init__(self, *args, **kwargs) self.network_control_box = NetworkControlBox(self.builder) self.network_control_box.client.connect("notify::%s" % - NMClient.CLIENT_STATE, self.on_nm_state_changed) - + NMClient.CLIENT_STATE, + self.on_nm_state_changed) + for device in self.network_control_box.client.get_devices(): + device.connect("state-changed", self.on_device_state_changed)
def apply(self): hostname = self.data.network.hostname @@ -1028,6 +1022,16 @@ class NetworkSpoke(NormalSpoke): self.network_control_box.refresh()
def on_nm_state_changed(self, *args): + gtk_call_once(self._update_status) + + def on_device_state_changed(self, *args): + new_state = args[1] + if new_state in (NetworkManager.DeviceState.ACTIVATED, + NetworkManager.DeviceState.DISCONNECTED, + NetworkManager.DeviceState.UNAVAILABLE): + gtk_call_once(self._update_status) + + def _update_status(self): communication.send_message(self.__class__.__name__, self.status)
class NetworkStandaloneSpoke(StandaloneSpoke):
On Fri, Nov 09, 2012 at 11:13:01AM +0100, Radek Vykydal wrote:
pyanaconda/ui/gui/spokes/network.py | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
Ack to these. I'll git-am them for tonight's build
anaconda-patches@lists.fedorahosted.org