zeitgeist team mailing list archive
-
zeitgeist team
-
Mailing list archive
-
Message #03956
[Merge] lp:~kamstrup/zeitgeist/network-manager-state-fix into lp:zeitgeist
Mikkel Kamstrup Erlandsen has proposed merging lp:~kamstrup/zeitgeist/network-manager-state-fix into lp:zeitgeist.
Requested reviews:
Zeitgeist Framework Team (zeitgeist)
Related bugs:
Bug #841764 in Zeitgeist Framework: "Storage monitor for networkmanager broken with NM >= 0.9"
https://bugs.launchpad.net/zeitgeist/+bug/841764
For more details, see:
https://code.launchpad.net/~kamstrup/zeitgeist/network-manager-state-fix/+merge/74089
See linked bug. Updates to be compatible with NM API version <0.9 and >=0.9
--
https://code.launchpad.net/~kamstrup/zeitgeist/network-manager-state-fix/+merge/74089
Your team Zeitgeist Framework Team is requested to review the proposed merge of lp:~kamstrup/zeitgeist/network-manager-state-fix into lp:zeitgeist.
=== modified file '_zeitgeist/engine/extensions/storagemonitor.py'
--- _zeitgeist/engine/extensions/storagemonitor.py 2011-03-11 14:18:47 +0000
+++ _zeitgeist/engine/extensions/storagemonitor.py 2011-09-05 12:13:00 +0000
@@ -303,11 +303,9 @@
NM_IFACE = "org.freedesktop.NetworkManager"
NM_OBJECT_PATH = "/org/freedesktop/NetworkManager"
- NM_STATE_UNKNOWN = 0
- NM_STATE_ASLEEP = 1
- NM_STATE_CONNECTING = 2
- NM_STATE_CONNECTED = 3
- NM_STATE_DISCONNECTED = 4
+ # NM 0.9 broke API so we have to check for two possible values for the state
+ NM_STATE_CONNECTED_PRE_09 = 3
+ NM_STATE_CONNECTED_POST_09 = 70
def __init__ (self, on_network_up, on_network_down):
log.debug("Creating NetworkManager network monitor")
@@ -335,7 +333,7 @@
def _on_state_changed(self, state):
log.debug("NetworkManager network state: %s" % state)
- if state == NMNetworkMonitor.NM_STATE_CONNECTED:
+ if state == NMNetworkMonitor.NM_STATE_CONNECTED_PRE_09 or state == NMNetworkMonitor.NM_STATE_CONNECTED_POST_09:
self._up ()
else:
self._down()