Merge lp:~gary-lasker/software-center/handle-trans-cancel-lp1027209-for-5.2 into lp:software-center/5.2

Proposed by Gary Lasker
Status: Merged
Merged at revision: 3082
Proposed branch: lp:~gary-lasker/software-center/handle-trans-cancel-lp1027209-for-5.2
Merge into: lp:software-center/5.2
Diff against target: 66 lines (+24/-1)
2 files modified
softwarecenter/backend/installbackend_impl/aptd.py (+12/-0)
softwarecenter/ui/gtk3/panes/availablepane.py (+12/-1)
To merge this branch: bzr merge lp:~gary-lasker/software-center/handle-trans-cancel-lp1027209-for-5.2
Reviewer Review Type Date Requested Status
Michael Vogt Approve
Review via email: mp+126593@code.launchpad.net

Description of the change

This branch is a backport to Precise of the transaction cancellation fix for bug 1027209. Test case is in the bug description.

Many thanks for your review!

To post a comment you must log in.
Michael Vogt (mvo) wrote :

Looks fine, thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'softwarecenter/backend/installbackend_impl/aptd.py'
2--- softwarecenter/backend/installbackend_impl/aptd.py 2012-07-16 16:43:26 +0000
3+++ softwarecenter/backend/installbackend_impl/aptd.py 2012-09-27 03:10:26 +0000
4@@ -182,6 +182,10 @@
5 'transaction-stopped': (GObject.SIGNAL_RUN_FIRST,
6 GObject.TYPE_NONE,
7 (GObject.TYPE_PYOBJECT,)),
8+ # emits a TransactionFinished object
9+ 'transaction-cancelled': (GObject.SIGNAL_RUN_FIRST,
10+ GObject.TYPE_NONE,
11+ (GObject.TYPE_PYOBJECT,)),
12 # emits with a pending_transactions list object
13 'transactions-changed': (GObject.SIGNAL_RUN_FIRST,
14 GObject.TYPE_NONE,
15@@ -834,6 +838,14 @@
16 self._logger.debug("_on_transaction_finished: %s %s %s" % (
17 trans, enum, trans.meta_data))
18
19+ # first check if there has been a cancellation of
20+ # the install and fire a transaction-cancelled signal
21+ # (see LP: #1027209)
22+ if enum == enums.EXIT_CANCELLED:
23+ result = TransactionFinishedResult(trans, False)
24+ self.emit("transaction-cancelled", result)
25+ return
26+
27 # show error
28 if enum == enums.EXIT_FAILED:
29 # Handle invalid packages separately
30
31=== modified file 'softwarecenter/ui/gtk3/panes/availablepane.py'
32--- softwarecenter/ui/gtk3/panes/availablepane.py 2012-07-18 15:22:54 +0000
33+++ softwarecenter/ui/gtk3/panes/availablepane.py 2012-09-27 03:10:26 +0000
34@@ -225,8 +225,11 @@
35 self.on_transactions_changed)
36 self.backend.connect("transaction-finished",
37 self.on_transaction_complete)
38+ self.backend.connect("transaction-cancelled",
39+ self.on_transaction_cancelled)
40+ # a transaction error is treated the same as a cancellation
41 self.backend.connect("transaction-stopped",
42- self.on_transaction_complete)
43+ self.on_transaction_cancelled)
44
45 # now we are initialized
46 self.searchentry.set_sensitive(True)
47@@ -394,11 +397,19 @@
48 self._update_action_bar()
49
50 def on_transaction_complete(self, backend, result):
51+ """ handle a transaction that has completed successfully
52+ """
53 if result.pkgname in self.unity_launcher_transaction_queue:
54 transaction_details = (
55 self.unity_launcher_transaction_queue.pop(result.pkgname))
56 self._add_application_to_unity_launcher(transaction_details)
57
58+ def on_transaction_cancelled(self, backend, result):
59+ """ handle a transaction that has been cancelled
60+ """
61+ if result.pkgname in self.unity_launcher_transaction_queue:
62+ self.unity_launcher_transaction_queue.pop(result.pkgname)
63+
64 def _register_unity_launcher_transaction_started(self, pkgname, appname,
65 trans_id, trans_type):
66 # at the start of the transaction, we gather details for use later

Subscribers

People subscribed via source and target branches