Merge lp:~mterry/software-center/network-manager-0.9 into lp:software-center

Proposed by Michael Terry
Status: Merged
Merged at revision: 1827
Proposed branch: lp:~mterry/software-center/network-manager-0.9
Merge into: lp:software-center
Diff against target: 92 lines (+33/-11)
3 files modified
softwarecenter/netstatus.py (+29/-7)
softwarecenter/ui/gtk/appdetailsview_gtk.py (+3/-3)
softwarecenter/ui/gtk/appview.py (+1/-1)
To merge this branch: bzr merge lp:~mterry/software-center/network-manager-0.9
Reviewer Review Type Date Requested Status
software-store-developers Pending
Review via email: mp+63114@code.launchpad.net
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 'softwarecenter/netstatus.py'
2--- softwarecenter/netstatus.py 2011-05-18 16:55:32 +0000
3+++ softwarecenter/netstatus.py 2011-06-01 13:19:59 +0000
4@@ -27,16 +27,38 @@
5 # enums
6 class NetState(object):
7 """ enums for network manager status """
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_UNKNOWN = 0
13+ NM_STATE_UNKNOWN_LIST = [NM_STATE_UNKNOWN]
14 # The NetworkManager daemon is asleep and all interfaces managed by it are inactive.
15- NM_STATE_ASLEEP = 1
16+ NM_STATE_ASLEEP_OLD = 1
17+ NM_STATE_ASLEEP = 10
18+ NM_STATE_ASLEEP_LIST = [NM_STATE_ASLEEP_OLD,
19+ NM_STATE_ASLEEP]
20 # The NetworkManager daemon is connecting a device.
21- NM_STATE_CONNECTING = 2
22+ NM_STATE_CONNECTING_OLD = 2
23+ NM_STATE_CONNECTING = 40
24+ NM_STATE_CONNECTING_LIST = [NM_STATE_CONNECTING_OLD,
25+ NM_STATE_CONNECTING]
26 # The NetworkManager daemon is connected.
27- NM_STATE_CONNECTED = 3
28+ NM_STATE_CONNECTED_OLD = 3
29+ NM_STATE_CONNECTED_LOCAL = 50
30+ NM_STATE_CONNECTED_SITE = 60
31+ NM_STATE_CONNECTED_GLOBAL = 70
32+ NM_STATE_CONNECTED_LIST = [NM_STATE_CONNECTED_OLD,
33+ NM_STATE_CONNECTED_LOCAL,
34+ NM_STATE_CONNECTED_SITE,
35+ NM_STATE_CONNECTED_GLOBAL]
36+ # The NetworkManager daemon is disconnecting.
37+ NM_STATE_DISCONNECTING = 30
38+ NM_STATE_DISCONNECTING_LIST = [NM_STATE_DISCONNECTING]
39 # The NetworkManager daemon is disconnected.
40- NM_STATE_DISCONNECTED = 4
41+ NM_STATE_DISCONNECTED_OLD = 4
42+ NM_STATE_DISCONNECTED = 20
43+ NM_STATE_DISCONNECTED_LIST = [NM_STATE_DISCONNECTED_OLD,
44+ NM_STATE_DISCONNECTED]
45
46
47 class NetworkStatusWatcher(gobject.GObject):
48@@ -100,8 +122,8 @@
49 def network_state_is_connected():
50 """ get bool if we are connected """
51 # unkown because in doubt, just assume we have network
52- return get_network_state() in (NetState.NM_STATE_UNKNOWN,
53- NetState.NM_STATE_CONNECTED)
54+ return get_network_state() in NetState.NM_STATE_UNKNOWN_LIST + \
55+ NetState.NM_STATE_CONNECTED_LIST
56
57 # init it once
58 __init_network_state()
59
60=== modified file 'softwarecenter/ui/gtk/appdetailsview_gtk.py'
61--- softwarecenter/ui/gtk/appdetailsview_gtk.py 2011-05-31 13:36:38 +0000
62+++ softwarecenter/ui/gtk/appdetailsview_gtk.py 2011-06-01 13:19:59 +0000
63@@ -779,13 +779,13 @@
64 return
65
66 def _on_net_state_changed(self, watcher, state):
67- if state == NetState.NM_STATE_DISCONNECTED:
68+ if state in NetState.NM_STATE_DISCONNECTED_LIST:
69 self._check_for_reviews()
70- elif state == NetState.NM_STATE_CONNECTED:
71+ elif state in NetState.NM_STATE_CONNECTED_LIST:
72 gobject.timeout_add(500, self._check_for_reviews)
73
74 # set addon table and action button states based on sensitivity
75- sensitive = state == NetState.NM_STATE_CONNECTED
76+ sensitive = state in NetState.NM_STATE_CONNECTED_LIST
77 self.pkg_statusbar.button.set_sensitive(sensitive)
78 self.addon_view.addons_set_sensitive(sensitive)
79 self.addons_statusbar.button_apply.set_sensitive(sensitive)
80
81=== modified file 'softwarecenter/ui/gtk/appview.py'
82--- softwarecenter/ui/gtk/appview.py 2011-05-26 23:51:14 +0000
83+++ softwarecenter/ui/gtk/appview.py 2011-06-01 13:19:59 +0000
84@@ -847,7 +847,7 @@
85 #if not action_btn: return False
86
87 net_state = get_network_state()
88- if net_state == NetState.NM_STATE_DISCONNECTED:
89+ if net_state in NetState.NM_STATE_DISCONNECTED_LIST:
90 action_btn.set_sensitive(False)
91 return
92 elif self.is_action_in_progress_for_selected_app():