Merge lp:~donadigo/appcenter/install-notify-canceled into lp:~elementary-apps/appcenter/appcenter

Proposed by Adam Bieńkowski
Status: Rejected
Rejected by: Adam Bieńkowski
Proposed branch: lp:~donadigo/appcenter/install-notify-canceled
Merge into: lp:~elementary-apps/appcenter/appcenter
Diff against target: 71 lines (+17/-12) (has conflicts)
2 files modified
src/Core/Client.vala (+8/-0)
src/Core/Package.vala (+9/-12)
Text conflict in src/Core/Client.vala
To merge this branch: bzr merge lp:~donadigo/appcenter/install-notify-canceled
Reviewer Review Type Date Requested Status
Danielle Foré Approve
Cody Garver (community) Abstain
Review via email: mp+298052@code.launchpad.net

Commit message

Check if the action was canceled if yes, do not send the notification

Description of the change

Fixes bug #1592291: "Application installed Notification even if you canceled".

Check if the action was canceled if yes, do not send the notification.

To post a comment you must log in.
Revision history for this message
Cody Garver (codygarver) wrote :

I'm unable to review this because I can't get any installation to cancel, they just keep installing...

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

Following the steps from the bug report, I can still reproduce this issue. I didn't notice the first time around, but the report says to cancel *from the auth dialog*

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

Can confirm this now addressed the issue :)

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

Hm it looks like I get no installation notifications now though haha

211. By Adam Bieńkowski

Actually fix the issue

Unmerged revisions

211. By Adam Bieńkowski

Actually fix the issue

210. By Adam Bieńkowski

Do not send notification when not installed

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-28 21:47:23 +0000
3+++ src/Core/Client.vala 2016-07-01 21:55:42 +0000
4@@ -97,6 +97,7 @@
5 }
6 }
7
8+<<<<<<< TREE
9 public AppStream.Component? get_extension (string extension) throws GLib.Error {
10 try {
11 return appstream_database.get_component_by_id (extension);
12@@ -108,6 +109,10 @@
13 }
14
15 public async void install_package (Package package, Pk.ProgressCallback cb, GLib.Cancellable cancellable) throws GLib.Error {
16+=======
17+ public async Pk.Exit install_package (Package package, Pk.ProgressCallback cb, GLib.Cancellable cancellable) throws GLib.Error {
18+ Pk.Exit exit_status = Pk.Exit.UNKNOWN;
19+>>>>>>> MERGE-SOURCE
20 AppCenter.Task install_task = request_task ();
21 AppCenter.Task search_task = request_task ();
22 string[] packages_ids = {};
23@@ -130,6 +135,8 @@
24 release_task (install_task);
25 throw new GLib.IOError.FAILED (Pk.Exit.enum_to_string (results.get_exit_code ()));
26 }
27+
28+ exit_status = results.get_exit_code ();
29 } catch (Error e) {
30 release_task (search_task);
31 release_task (install_task);
32@@ -138,6 +145,7 @@
33
34 release_task (search_task);
35 release_task (install_task);
36+ return exit_status;
37 }
38
39 public async void update_package (Package package, Pk.ProgressCallback cb, GLib.Cancellable cancellable) throws GLib.Error {
40
41=== modified file 'src/Core/Package.vala'
42--- src/Core/Package.vala 2016-06-29 21:40:17 +0000
43+++ src/Core/Package.vala 2016-07-01 21:55:42 +0000
44@@ -75,18 +75,15 @@
45 var application = (Gtk.Application)Application.get_default ();
46 var window = application.get_active_window ().get_window ();
47
48- yield AppCenterCore.Client.get_default ().install_package (this, (progress, type) => {
49- if (type == Pk.ProgressType.STATUS && progress.status == Pk.Status.FINISHED && (window.get_state () & Gdk.WindowState.FOCUSED) == 0) {
50- var notification = new Notification (_("Application installed"));
51- notification.set_body (_("%s has been successfully installed").printf (get_name ()));
52- notification.set_icon (new ThemedIcon ("system-software-install"));
53- notification.set_default_action ("app.open-application");
54-
55- application.send_notification ("installed", notification);
56- }
57-
58- change_information.ProgressCallback (progress, type);
59- }, action_cancellable);
60+ var exit_status = yield AppCenterCore.Client.get_default ().install_package (this, (progress, type) => {change_information.ProgressCallback (progress, type);}, action_cancellable);
61+ if (exit_status == Pk.Exit.SUCCESS && (window.get_state () & Gdk.WindowState.FOCUSED) == 0) {
62+ var notification = new Notification (_("Application installed"));
63+ notification.set_body (_("%s has been successfully installed").printf (get_name ()));
64+ notification.set_icon (new ThemedIcon ("system-software-install"));
65+ notification.set_default_action ("app.open-application");
66+
67+ application.send_notification ("installed", notification);
68+ }
69
70 installed_packages.add_all (change_information.changes);
71 change_information.clear ();

Subscribers

People subscribed via source and target branches