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
=== modified file 'softwarecenter/netstatus.py'
--- softwarecenter/netstatus.py 2011-05-18 16:55:32 +0000
+++ softwarecenter/netstatus.py 2011-06-01 13:19:59 +0000
@@ -27,16 +27,38 @@
27# enums27# enums
28class NetState(object):28class NetState(object):
29 """ enums for network manager status """29 """ enums for network manager status """
30 # Old enum values are for NM 0.7
31
30 # The NetworkManager daemon is in an unknown state. 32 # The NetworkManager daemon is in an unknown state.
31 NM_STATE_UNKNOWN = 0 33 NM_STATE_UNKNOWN = 0
34 NM_STATE_UNKNOWN_LIST = [NM_STATE_UNKNOWN]
32 # The NetworkManager daemon is asleep and all interfaces managed by it are inactive. 35 # The NetworkManager daemon is asleep and all interfaces managed by it are inactive.
33 NM_STATE_ASLEEP = 136 NM_STATE_ASLEEP_OLD = 1
37 NM_STATE_ASLEEP = 10
38 NM_STATE_ASLEEP_LIST = [NM_STATE_ASLEEP_OLD,
39 NM_STATE_ASLEEP]
34 # The NetworkManager daemon is connecting a device.40 # The NetworkManager daemon is connecting a device.
35 NM_STATE_CONNECTING = 241 NM_STATE_CONNECTING_OLD = 2
42 NM_STATE_CONNECTING = 40
43 NM_STATE_CONNECTING_LIST = [NM_STATE_CONNECTING_OLD,
44 NM_STATE_CONNECTING]
36 # The NetworkManager daemon is connected. 45 # The NetworkManager daemon is connected.
37 NM_STATE_CONNECTED = 346 NM_STATE_CONNECTED_OLD = 3
47 NM_STATE_CONNECTED_LOCAL = 50
48 NM_STATE_CONNECTED_SITE = 60
49 NM_STATE_CONNECTED_GLOBAL = 70
50 NM_STATE_CONNECTED_LIST = [NM_STATE_CONNECTED_OLD,
51 NM_STATE_CONNECTED_LOCAL,
52 NM_STATE_CONNECTED_SITE,
53 NM_STATE_CONNECTED_GLOBAL]
54 # The NetworkManager daemon is disconnecting.
55 NM_STATE_DISCONNECTING = 30
56 NM_STATE_DISCONNECTING_LIST = [NM_STATE_DISCONNECTING]
38 # The NetworkManager daemon is disconnected.57 # The NetworkManager daemon is disconnected.
39 NM_STATE_DISCONNECTED = 458 NM_STATE_DISCONNECTED_OLD = 4
59 NM_STATE_DISCONNECTED = 20
60 NM_STATE_DISCONNECTED_LIST = [NM_STATE_DISCONNECTED_OLD,
61 NM_STATE_DISCONNECTED]
4062
4163
42class NetworkStatusWatcher(gobject.GObject):64class NetworkStatusWatcher(gobject.GObject):
@@ -100,8 +122,8 @@
100def network_state_is_connected():122def network_state_is_connected():
101 """ get bool if we are connected """123 """ get bool if we are connected """
102 # unkown because in doubt, just assume we have network124 # unkown because in doubt, just assume we have network
103 return get_network_state() in (NetState.NM_STATE_UNKNOWN,125 return get_network_state() in NetState.NM_STATE_UNKNOWN_LIST + \
104 NetState.NM_STATE_CONNECTED)126 NetState.NM_STATE_CONNECTED_LIST
105127
106# init it once128# init it once
107__init_network_state()129__init_network_state()
108130
=== modified file 'softwarecenter/ui/gtk/appdetailsview_gtk.py'
--- softwarecenter/ui/gtk/appdetailsview_gtk.py 2011-05-31 13:36:38 +0000
+++ softwarecenter/ui/gtk/appdetailsview_gtk.py 2011-06-01 13:19:59 +0000
@@ -779,13 +779,13 @@
779 return779 return
780780
781 def _on_net_state_changed(self, watcher, state):781 def _on_net_state_changed(self, watcher, state):
782 if state == NetState.NM_STATE_DISCONNECTED:782 if state in NetState.NM_STATE_DISCONNECTED_LIST:
783 self._check_for_reviews()783 self._check_for_reviews()
784 elif state == NetState.NM_STATE_CONNECTED:784 elif state in NetState.NM_STATE_CONNECTED_LIST:
785 gobject.timeout_add(500, self._check_for_reviews)785 gobject.timeout_add(500, self._check_for_reviews)
786786
787 # set addon table and action button states based on sensitivity787 # set addon table and action button states based on sensitivity
788 sensitive = state == NetState.NM_STATE_CONNECTED788 sensitive = state in NetState.NM_STATE_CONNECTED_LIST
789 self.pkg_statusbar.button.set_sensitive(sensitive)789 self.pkg_statusbar.button.set_sensitive(sensitive)
790 self.addon_view.addons_set_sensitive(sensitive)790 self.addon_view.addons_set_sensitive(sensitive)
791 self.addons_statusbar.button_apply.set_sensitive(sensitive)791 self.addons_statusbar.button_apply.set_sensitive(sensitive)
792792
=== modified file 'softwarecenter/ui/gtk/appview.py'
--- softwarecenter/ui/gtk/appview.py 2011-05-26 23:51:14 +0000
+++ softwarecenter/ui/gtk/appview.py 2011-06-01 13:19:59 +0000
@@ -847,7 +847,7 @@
847 #if not action_btn: return False847 #if not action_btn: return False
848848
849 net_state = get_network_state()849 net_state = get_network_state()
850 if net_state == NetState.NM_STATE_DISCONNECTED:850 if net_state in NetState.NM_STATE_DISCONNECTED_LIST:
851 action_btn.set_sensitive(False)851 action_btn.set_sensitive(False)
852 return852 return
853 elif self.is_action_in_progress_for_selected_app():853 elif self.is_action_in_progress_for_selected_app():