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

Proposed by Adam Bieńkowski
Status: Merged
Approved by: Danielle Foré
Approved revision: 232
Merged at revision: 232
Proposed branch: lp:~donadigo/appcenter/install-notify-canceled-new
Merge into: lp:~elementary-apps/appcenter/appcenter
Diff against target: 63 lines (+14/-14)
2 files modified
src/Core/Client.vala (+5/-2)
src/Core/Package.vala (+9/-12)
To merge this branch: bzr merge lp:~donadigo/appcenter/install-notify-canceled-new
Reviewer Review Type Date Requested Status
elementary Apps team Pending
Review via email: mp+298966@code.launchpad.net

Commit message

Don't send notifications when installation is canceled

Description of the change

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

This is a follow up to the old branch, it should fix the issue correctly now.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Core/Client.vala'
--- src/Core/Client.vala 2016-06-28 21:47:23 +0000
+++ src/Core/Client.vala 2016-07-01 22:03:31 +0000
@@ -107,7 +107,8 @@
107 return null;107 return null;
108 }108 }
109109
110 public async void install_package (Package package, Pk.ProgressCallback cb, GLib.Cancellable cancellable) throws GLib.Error {110 public async Pk.Exit install_package (Package package, Pk.ProgressCallback cb, GLib.Cancellable cancellable) throws GLib.Error {
111 Pk.Exit exit_status = Pk.Exit.UNKNOWN;
111 AppCenter.Task install_task = request_task ();112 AppCenter.Task install_task = request_task ();
112 AppCenter.Task search_task = request_task ();113 AppCenter.Task search_task = request_task ();
113 string[] packages_ids = {};114 string[] packages_ids = {};
@@ -125,7 +126,8 @@
125 packages_ids += null;126 packages_ids += null;
126127
127 results = yield install_task.install_packages_async (packages_ids, cancellable, cb);128 results = yield install_task.install_packages_async (packages_ids, cancellable, cb);
128 if (results.get_exit_code () != Pk.Exit.SUCCESS) {129 exit_status = results.get_exit_code ();
130 if (exit_status != Pk.Exit.SUCCESS) {
129 release_task (search_task);131 release_task (search_task);
130 release_task (install_task);132 release_task (install_task);
131 throw new GLib.IOError.FAILED (Pk.Exit.enum_to_string (results.get_exit_code ()));133 throw new GLib.IOError.FAILED (Pk.Exit.enum_to_string (results.get_exit_code ()));
@@ -138,6 +140,7 @@
138140
139 release_task (search_task);141 release_task (search_task);
140 release_task (install_task);142 release_task (install_task);
143 return exit_status;
141 }144 }
142145
143 public async void update_package (Package package, Pk.ProgressCallback cb, GLib.Cancellable cancellable) throws GLib.Error {146 public async void update_package (Package package, Pk.ProgressCallback cb, GLib.Cancellable cancellable) throws GLib.Error {
144147
=== modified file 'src/Core/Package.vala'
--- src/Core/Package.vala 2016-06-29 21:40:17 +0000
+++ src/Core/Package.vala 2016-07-01 22:03:31 +0000
@@ -75,18 +75,15 @@
75 var application = (Gtk.Application)Application.get_default ();75 var application = (Gtk.Application)Application.get_default ();
76 var window = application.get_active_window ().get_window ();76 var window = application.get_active_window ().get_window ();
7777
78 yield AppCenterCore.Client.get_default ().install_package (this, (progress, type) => { 78 var exit_status = yield AppCenterCore.Client.get_default ().install_package (this, (progress, type) => {change_information.ProgressCallback (progress, type);}, action_cancellable);
79 if (type == Pk.ProgressType.STATUS && progress.status == Pk.Status.FINISHED && (window.get_state () & Gdk.WindowState.FOCUSED) == 0) {79 if (exit_status == Pk.Exit.SUCCESS && (window.get_state () & Gdk.WindowState.FOCUSED) == 0) {
80 var notification = new Notification (_("Application installed"));80 var notification = new Notification (_("Application installed"));
81 notification.set_body (_("%s has been successfully installed").printf (get_name ()));81 notification.set_body (_("%s has been successfully installed").printf (get_name ()));
82 notification.set_icon (new ThemedIcon ("system-software-install"));82 notification.set_icon (new ThemedIcon ("system-software-install"));
83 notification.set_default_action ("app.open-application");83 notification.set_default_action ("app.open-application");
8484
85 application.send_notification ("installed", notification);85 application.send_notification ("installed", notification);
86 }86 }
87
88 change_information.ProgressCallback (progress, type);
89 }, action_cancellable);
9087
91 installed_packages.add_all (change_information.changes);88 installed_packages.add_all (change_information.changes);
92 change_information.clear ();89 change_information.clear ();

Subscribers

People subscribed via source and target branches