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
=== modified file 'softwarecenter/app.py'
--- softwarecenter/app.py 2011-06-02 19:18:36 +0000
+++ softwarecenter/app.py 2011-07-07 12:29:32 +0000
@@ -34,6 +34,7 @@
3434
35# purely to initialize the netstatus35# purely to initialize the netstatus
36import softwarecenter.netstatus36import softwarecenter.netstatus
37from softwarecenter.netstatus import network_state_is_connected
3738
38from SimpleGtkbuilderApp import SimpleGtkbuilderApp39from SimpleGtkbuilderApp import SimpleGtkbuilderApp
39from softwarecenter.db.application import Application, DebFileApplication40from softwarecenter.db.application import Application, DebFileApplication
@@ -366,7 +367,7 @@
366 # support in aptdaemon (see LP: #723911)367 # support in aptdaemon (see LP: #723911)
367 file_menu = self.builder.get_object("menu1")368 file_menu = self.builder.get_object("menu1")
368 file_menu.remove(self.builder.get_object("menuitem_deauthorize_computer"))369 file_menu.remove(self.builder.get_object("menuitem_deauthorize_computer"))
369 370
370 # helper371 # helper
371 def _rebuild_and_reopen_local_db(self, pathname):372 def _rebuild_and_reopen_local_db(self, pathname):
372 """ helper that rebuilds a db and reopens it """373 """ helper that rebuilds a db and reopens it """
@@ -607,6 +608,7 @@
607 # update menu items608 # update menu items
608 pkg_state = None609 pkg_state = None
609 error = None610 error = None
611 is_network_available = network_state_is_connected()
610 # FIXME: Use a gtk.Action for the Install/Remove/Buy/Add Source/Update Now action612 # FIXME: Use a gtk.Action for the Install/Remove/Buy/Add Source/Update Now action
611 # so that all UI controls (menu item, applist view button and appdetails613 # so that all UI controls (menu item, applist view button and appdetails
612 # view button) are managed centrally: button text, button sensitivity,614 # view button) are managed centrally: button text, button sensitivity,
@@ -620,13 +622,13 @@
620 self.menuitem_install.set_sensitive(False)622 self.menuitem_install.set_sensitive(False)
621 self.menuitem_remove.set_sensitive(False)623 self.menuitem_remove.set_sensitive(False)
622 elif pkg_state == PKG_STATE_UPGRADABLE or pkg_state == PKG_STATE_REINSTALLABLE and not error:624 elif pkg_state == PKG_STATE_UPGRADABLE or pkg_state == PKG_STATE_REINSTALLABLE and not error:
623 self.menuitem_install.set_sensitive(True)625 self.menuitem_install.set_sensitive(True and is_network_available)
624 self.menuitem_remove.set_sensitive(True)626 self.menuitem_remove.set_sensitive(True)
625 elif pkg_state == PKG_STATE_INSTALLED:627 elif pkg_state == PKG_STATE_INSTALLED:
626 self.menuitem_install.set_sensitive(False)628 self.menuitem_install.set_sensitive(False)
627 self.menuitem_remove.set_sensitive(True)629 self.menuitem_remove.set_sensitive(True)
628 elif pkg_state == PKG_STATE_UNINSTALLED and not error:630 elif pkg_state == PKG_STATE_UNINSTALLED and not error:
629 self.menuitem_install.set_sensitive(True)631 self.menuitem_install.set_sensitive(True and is_network_available)
630 self.menuitem_remove.set_sensitive(False)632 self.menuitem_remove.set_sensitive(False)
631 elif (not pkg_state and 633 elif (not pkg_state and
632 not self.active_pane.is_category_view_showing() and 634 not self.active_pane.is_category_view_showing() and
@@ -641,6 +643,7 @@
641 self.menuitem_install.set_sensitive(False)643 self.menuitem_install.set_sensitive(False)
642 self.menuitem_remove.set_sensitive(False)644 self.menuitem_remove.set_sensitive(False)
643 # return False to ensure that a possible glib.timeout_add ends645 # return False to ensure that a possible glib.timeout_add ends
646 self.menuitem_reinstall_purchases.set_sensitive(is_network_available)
644 return False647 return False
645648
646 def on_menuitem_launchpad_private_ppas_activate(self, menuitem):649 def on_menuitem_launchpad_private_ppas_activate(self, menuitem):

Subscribers

People subscribed via source and target branches