Merge lp:~brendan-donegan/update-manager/bug791548_networkmanager0.9 into lp:update-manager

Proposed by Brendan Donegan
Status: Merged
Merged at revision: 2126
Proposed branch: lp:~brendan-donegan/update-manager/bug791548_networkmanager0.9
Merge into: lp:update-manager
Diff against target: 71 lines (+22/-9)
2 files modified
UpdateManager/Core/roam.py (+17/-4)
UpdateManager/UpdateManager.py (+5/-5)
To merge this branch: bzr merge lp:~brendan-donegan/update-manager/bug791548_networkmanager0.9
Reviewer Review Type Date Requested Status
Michael Vogt Pending
Review via email: mp+64185@code.launchpad.net

Description of the change

Closely based on mterrys changes for software-center, this makes update-manager inter-operate correctly with NetworkManager DBus signals in Oneiric. I redacted the superfluous statuses so as not to pollute the code (ASLEEP, DISCONNECTING, DISCONNECTED).

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'UpdateManager/Core/roam.py'
2--- UpdateManager/Core/roam.py 2011-03-02 13:28:28 +0000
3+++ UpdateManager/Core/roam.py 2011-06-10 13:47:27 +0000
4@@ -113,11 +113,24 @@
5 NM_DBUS_IFACE = "org.freedesktop.NetworkManager"
6
7 # connection states
8+ # Old enum values are for NM 0.7
9+
10+ # The NetworkManager daemon is in an unknown state.
11 NM_STATE_UNKNOWN = 0
12- NM_STATE_ASLEEP = 1
13- NM_STATE_CONNECTING = 2
14- NM_STATE_CONNECTED = 3
15- NM_STATE_DISCONNECTED = 4
16+ # The NetworkManager daemon is connecting a device.
17+ NM_STATE_CONNECTING_OLD = 2
18+ NM_STATE_CONNECTING = 40
19+ NM_STATE_CONNECTING_LIST = [NM_STATE_CONNECTING_OLD,
20+ NM_STATE_CONNECTING]
21+ # The NetworkManager daemon is connected.
22+ NM_STATE_CONNECTED_OLD = 3
23+ NM_STATE_CONNECTED_LOCAL = 50
24+ NM_STATE_CONNECTED_SITE = 60
25+ NM_STATE_CONNECTED_GLOBAL = 70
26+ NM_STATE_CONNECTED_LIST = [NM_STATE_CONNECTED_OLD,
27+ NM_STATE_CONNECTED_LOCAL,
28+ NM_STATE_CONNECTED_SITE,
29+ NM_STATE_CONNECTED_GLOBAL]
30
31 # The device type is unknown.
32 NM_DEVICE_TYPE_UNKNOWN = 0
33
34=== modified file 'UpdateManager/UpdateManager.py'
35--- UpdateManager/UpdateManager.py 2011-05-02 16:13:29 +0000
36+++ UpdateManager/UpdateManager.py 2011-06-10 13:47:27 +0000
37@@ -1,4 +1,4 @@
38-# UpdateManager.py
39+# UpdateManager.py
40 #
41 # Copyright (c) 2004-2010 Canonical
42 # 2004 Michiel Sikkes
43@@ -166,7 +166,7 @@
44 pass
45
46 def _on_network_alert(self, watcher, state):
47- if state == NetworkManagerHelper.NM_STATE_CONNECTED:
48+ if state in NetworkManagerHelper.NM_STATE_CONNECTED_LIST:
49 self.connected = True
50 else:
51 self.connected = False
52@@ -834,7 +834,7 @@
53 def _on_network_alert(self, watcher, state):
54 # do not set the buttons to sensitive/insensitive until NM
55 # can deal with dialup connections properly
56- if state == NetworkManagerHelper.NM_STATE_CONNECTING:
57+ if state in NetworkManagerHelper.NM_STATE_CONNECTING_LIST:
58 self.label_offline.set_text(_("Connecting..."))
59 #self.button_reload.set_sensitive(False)
60 self.refresh_updates_count()
61@@ -842,8 +842,8 @@
62 self.vbox_alerts.show()
63 self.connected = False
64 # in doubt (STATE_UNKNOWN), assume connected
65- elif state in (NetworkManagerHelper.NM_STATE_CONNECTED,
66- NetworkManagerHelper.NM_STATE_UNKNOWN):
67+ elif (state in NetworkManagerHelper.NM_STATE_CONNECTED_LIST or
68+ state == NetworkManagerHelper.NM_STATE_UNKNOWN):
69 #self.button_reload.set_sensitive(True)
70 self.refresh_updates_count()
71 self.hbox_offline.hide()

Subscribers

People subscribed via source and target branches

to status/vote changes: