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.
Revision history for this message
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
=== modified file 'softwarecenter/backend/installbackend_impl/aptd.py'
--- softwarecenter/backend/installbackend_impl/aptd.py 2012-07-16 16:43:26 +0000
+++ softwarecenter/backend/installbackend_impl/aptd.py 2012-09-27 03:10:26 +0000
@@ -182,6 +182,10 @@
182 'transaction-stopped': (GObject.SIGNAL_RUN_FIRST,182 'transaction-stopped': (GObject.SIGNAL_RUN_FIRST,
183 GObject.TYPE_NONE,183 GObject.TYPE_NONE,
184 (GObject.TYPE_PYOBJECT,)),184 (GObject.TYPE_PYOBJECT,)),
185 # emits a TransactionFinished object
186 'transaction-cancelled': (GObject.SIGNAL_RUN_FIRST,
187 GObject.TYPE_NONE,
188 (GObject.TYPE_PYOBJECT,)),
185 # emits with a pending_transactions list object189 # emits with a pending_transactions list object
186 'transactions-changed': (GObject.SIGNAL_RUN_FIRST,190 'transactions-changed': (GObject.SIGNAL_RUN_FIRST,
187 GObject.TYPE_NONE,191 GObject.TYPE_NONE,
@@ -834,6 +838,14 @@
834 self._logger.debug("_on_transaction_finished: %s %s %s" % (838 self._logger.debug("_on_transaction_finished: %s %s %s" % (
835 trans, enum, trans.meta_data))839 trans, enum, trans.meta_data))
836840
841 # first check if there has been a cancellation of
842 # the install and fire a transaction-cancelled signal
843 # (see LP: #1027209)
844 if enum == enums.EXIT_CANCELLED:
845 result = TransactionFinishedResult(trans, False)
846 self.emit("transaction-cancelled", result)
847 return
848
837 # show error849 # show error
838 if enum == enums.EXIT_FAILED:850 if enum == enums.EXIT_FAILED:
839 # Handle invalid packages separately851 # Handle invalid packages separately
840852
=== modified file 'softwarecenter/ui/gtk3/panes/availablepane.py'
--- softwarecenter/ui/gtk3/panes/availablepane.py 2012-07-18 15:22:54 +0000
+++ softwarecenter/ui/gtk3/panes/availablepane.py 2012-09-27 03:10:26 +0000
@@ -225,8 +225,11 @@
225 self.on_transactions_changed)225 self.on_transactions_changed)
226 self.backend.connect("transaction-finished",226 self.backend.connect("transaction-finished",
227 self.on_transaction_complete)227 self.on_transaction_complete)
228 self.backend.connect("transaction-cancelled",
229 self.on_transaction_cancelled)
230 # a transaction error is treated the same as a cancellation
228 self.backend.connect("transaction-stopped",231 self.backend.connect("transaction-stopped",
229 self.on_transaction_complete)232 self.on_transaction_cancelled)
230233
231 # now we are initialized234 # now we are initialized
232 self.searchentry.set_sensitive(True)235 self.searchentry.set_sensitive(True)
@@ -394,11 +397,19 @@
394 self._update_action_bar()397 self._update_action_bar()
395398
396 def on_transaction_complete(self, backend, result):399 def on_transaction_complete(self, backend, result):
400 """ handle a transaction that has completed successfully
401 """
397 if result.pkgname in self.unity_launcher_transaction_queue:402 if result.pkgname in self.unity_launcher_transaction_queue:
398 transaction_details = (403 transaction_details = (
399 self.unity_launcher_transaction_queue.pop(result.pkgname))404 self.unity_launcher_transaction_queue.pop(result.pkgname))
400 self._add_application_to_unity_launcher(transaction_details)405 self._add_application_to_unity_launcher(transaction_details)
401406
407 def on_transaction_cancelled(self, backend, result):
408 """ handle a transaction that has been cancelled
409 """
410 if result.pkgname in self.unity_launcher_transaction_queue:
411 self.unity_launcher_transaction_queue.pop(result.pkgname)
412
402 def _register_unity_launcher_transaction_started(self, pkgname, appname,413 def _register_unity_launcher_transaction_started(self, pkgname, appname,
403 trans_id, trans_type):414 trans_id, trans_type):
404 # at the start of the transaction, we gather details for use later415 # at the start of the transaction, we gather details for use later

Subscribers

People subscribed via source and target branches