Merge lp:~elementary-apps/appcenter/cancel-action into lp:~elementary-apps/appcenter/appcenter

Proposed by Danielle Foré
Status: Merged
Approved by: Adam Bieńkowski
Approved revision: 227
Merged at revision: 225
Proposed branch: lp:~elementary-apps/appcenter/cancel-action
Merge into: lp:~elementary-apps/appcenter/appcenter
Diff against target: 80 lines (+11/-9)
3 files modified
src/Core/Client.vala (+1/-1)
src/Views/AppInfoView.vala (+5/-4)
src/Widgets/PackageRow.vala (+5/-4)
To merge this branch: bzr merge lp:~elementary-apps/appcenter/cancel-action
Reviewer Review Type Date Requested Status
Danielle Foré Approve
Review via email: mp+298569@code.launchpad.net

Commit message

When Cancel is clicked, actually cancel

Description of the change

We can't perform this action in construct because package doesn't exist yet there

To post a comment you must log in.
226. By Danielle Foré

don't message

227. By Adam Bieńkowski

Fix the install_packages_async method in Client.vala

Revision history for this message
Danielle Foré (danrabbit) wrote :

Adam's code works for me :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Core/Client.vala'
2--- src/Core/Client.vala 2016-06-27 14:12:21 +0000
3+++ src/Core/Client.vala 2016-06-28 21:48:13 +0000
4@@ -124,7 +124,7 @@
5 });
6 packages_ids += null;
7
8- results = yield install_task.install_packages_async (packages_ids, null, cb);
9+ results = yield install_task.install_packages_async (packages_ids, cancellable, cb);
10 if (results.get_exit_code () != Pk.Exit.SUCCESS) {
11 release_task (search_task);
12 release_task (install_task);
13
14=== modified file 'src/Views/AppInfoView.vala'
15--- src/Views/AppInfoView.vala 2016-06-27 17:19:26 +0000
16+++ src/Views/AppInfoView.vala 2016-06-28 21:48:13 +0000
17@@ -183,6 +183,7 @@
18 cancel_button = new Gtk.Button.from_icon_name ("process-stop-symbolic", Gtk.IconSize.MENU);
19 cancel_button.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT);
20 cancel_button.valign = Gtk.Align.CENTER;
21+ cancel_button.clicked.connect (() => action_cancelled ());
22
23 action_button = new Gtk.Button.with_label (_("Install"));
24 action_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
25@@ -236,10 +237,6 @@
26
27 attach (header_grid, 0, 0, 1, 1);
28 attach (scrolled, 0, 1, 1, 1);
29-
30- cancel_button.clicked.connect (() => {
31- package.action_cancellable.cancel ();
32- });
33 }
34
35 private async void load_extensions () {
36@@ -295,6 +292,10 @@
37 }
38 }
39
40+ private void action_cancelled () {
41+ package.action_cancellable.cancel ();
42+ }
43+
44 private async void action_clicked () {
45 try {
46 if (package.update_available) {
47
48=== modified file 'src/Widgets/PackageRow.vala'
49--- src/Widgets/PackageRow.vala 2016-06-26 23:17:02 +0000
50+++ src/Widgets/PackageRow.vala 2016-06-28 21:48:13 +0000
51@@ -118,6 +118,7 @@
52 cancel_button = new Gtk.Button.with_label (_("Cancel"));
53 cancel_button.margin_end = 6;
54 cancel_button.valign = Gtk.Align.CENTER;
55+ cancel_button.clicked.connect (() => action_cancelled ());
56
57 action_button = new Gtk.Button.with_label (_("Install"));
58 action_button.margin_end = 6;
59@@ -140,10 +141,6 @@
60 grid.attach (package_summary, 1, 1, 1, 1);
61 grid.attach (action_stack, 2, 0, 1, 2);
62 add (grid);
63-
64- cancel_button.clicked.connect (() => {
65- package.action_cancellable.cancel ();
66- });
67 }
68
69 private void update_status () {
70@@ -160,6 +157,10 @@
71 }
72 }
73
74+ private void action_cancelled () {
75+ package.action_cancellable.cancel ();
76+ }
77+
78 private async void action_clicked () {
79 try {
80 if (package.update_available) {

Subscribers

People subscribed via source and target branches

to all changes: