Merge lp:~evfool/software-center/nonetworkfixes into lp:software-center/4.0

Proposed by Robert Roth
Status: Merged
Merged at revision: 1780
Proposed branch: lp:~evfool/software-center/nonetworkfixes
Merge into: lp:software-center/4.0
Diff against target: 52 lines (+6/-3)
1 file modified
softwarecenter/app.py (+6/-3)
To merge this branch: bzr merge lp:~evfool/software-center/nonetworkfixes
Reviewer Review Type Date Requested Status
Gary Lasker (community) Approve
Review via email: mp+67178@code.launchpad.net

Description of the change

Fixed bug #802920(Reinstall previous purchases menuitem enabled while disconnected) and bug #802919 (Install menu item enabled while disconnected) by checking for network connection and disabling the Install and Reinstall previous purchases menuitems if there is no network connection. This is implemented in the activation of the File menu, where the other similar checks for enabling/disabling menu items can be found.

To post a comment you must log in.
Revision history for this message
Gary Lasker (gary-lasker) wrote :

Nice fixes, thank you Robert!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'softwarecenter/app.py'
2--- softwarecenter/app.py 2011-06-02 19:18:36 +0000
3+++ softwarecenter/app.py 2011-07-07 12:29:32 +0000
4@@ -34,6 +34,7 @@
5
6 # purely to initialize the netstatus
7 import softwarecenter.netstatus
8+from softwarecenter.netstatus import network_state_is_connected
9
10 from SimpleGtkbuilderApp import SimpleGtkbuilderApp
11 from softwarecenter.db.application import Application, DebFileApplication
12@@ -366,7 +367,7 @@
13 # support in aptdaemon (see LP: #723911)
14 file_menu = self.builder.get_object("menu1")
15 file_menu.remove(self.builder.get_object("menuitem_deauthorize_computer"))
16-
17+
18 # helper
19 def _rebuild_and_reopen_local_db(self, pathname):
20 """ helper that rebuilds a db and reopens it """
21@@ -607,6 +608,7 @@
22 # update menu items
23 pkg_state = None
24 error = None
25+ is_network_available = network_state_is_connected()
26 # FIXME: Use a gtk.Action for the Install/Remove/Buy/Add Source/Update Now action
27 # so that all UI controls (menu item, applist view button and appdetails
28 # view button) are managed centrally: button text, button sensitivity,
29@@ -620,13 +622,13 @@
30 self.menuitem_install.set_sensitive(False)
31 self.menuitem_remove.set_sensitive(False)
32 elif pkg_state == PKG_STATE_UPGRADABLE or pkg_state == PKG_STATE_REINSTALLABLE and not error:
33- self.menuitem_install.set_sensitive(True)
34+ self.menuitem_install.set_sensitive(True and is_network_available)
35 self.menuitem_remove.set_sensitive(True)
36 elif pkg_state == PKG_STATE_INSTALLED:
37 self.menuitem_install.set_sensitive(False)
38 self.menuitem_remove.set_sensitive(True)
39 elif pkg_state == PKG_STATE_UNINSTALLED and not error:
40- self.menuitem_install.set_sensitive(True)
41+ self.menuitem_install.set_sensitive(True and is_network_available)
42 self.menuitem_remove.set_sensitive(False)
43 elif (not pkg_state and
44 not self.active_pane.is_category_view_showing() and
45@@ -641,6 +643,7 @@
46 self.menuitem_install.set_sensitive(False)
47 self.menuitem_remove.set_sensitive(False)
48 # return False to ensure that a possible glib.timeout_add ends
49+ self.menuitem_reinstall_purchases.set_sensitive(is_network_available)
50 return False
51
52 def on_menuitem_launchpad_private_ppas_activate(self, menuitem):

Subscribers

People subscribed via source and target branches