Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions data/appcenter.metainfo.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
<issues>
<issue url="https://github.com/elementary/appcenter/issues/1379">AppCenter still shows number of updates on the icon if updated through the terminal</issue>
<issue url="https://github.com/elementary/appcenter/issues/2371">Revert change from list/flowbox activate to click controller</issue>
<issue url="https://github.com/elementary/appcenter/issues/2393">User feedback on "Uninstall"</issue>
</issues>
</release>

Expand Down
27 changes: 26 additions & 1 deletion src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ public class AppCenter.App : Gtk.Application {
if (package.get_can_launch ()) {
// Check if window is focused
if (active_window != null && active_window.is_active) {
((MainWindow) active_window).send_installed_toast (package);
((MainWindow) active_window).send_toast (package, INSTALLING);
break;
}

Expand All @@ -322,6 +322,31 @@ public class AppCenter.App : Gtk.Application {
dialog.present ();
}

break;
case REMOVING:
if (error != null) {
// Check if permission was denied or the operation was cancelled
if (error.matches (IOError.quark (), 19)) {
break;
}

var dialog = new UninstallFailDialog (package, (owned) error.message);
dialog.present ();
break;
}

// Check if window is focused
if (active_window != null && active_window.is_active) {
((MainWindow) active_window).send_toast (package, REMOVING);
break;
}

var notification = new Notification (_("The app has been uninstalled"));
notification.set_body (_("“%s” has been uninstalled").printf (package.name));
notification.set_icon (new ThemedIcon ("process-completed"));

send_notification ("uninstalled", notification);

break;
default:
break;
Expand Down
35 changes: 25 additions & 10 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class AppCenter.MainWindow : Gtk.ApplicationWindow {
private Adw.NavigationView navigation_view;
private Granite.OverlayBar overlaybar;

// Launchable package set when installed
private AppCenterCore.Package? last_installed_package;

private Views.AppListUpdateView? installed_view;
Expand Down Expand Up @@ -212,20 +213,34 @@ public class AppCenter.MainWindow : Gtk.ApplicationWindow {
navigation_view.push (search_view);
}

public void send_installed_toast (AppCenterCore.Package package) {
last_installed_package = package;

public void send_toast (AppCenterCore.Package package, AppCenterCore.Package.State state) {
// Only show a toast when we're not on the installed app's page
if (navigation_view.visible_page is Views.AppInfoView && ((Views.AppInfoView) navigation_view.visible_page).package == package) {
if (
navigation_view.visible_page is Views.AppInfoView &&
((Views.AppInfoView) navigation_view.visible_page).package == package
) {
return;
}

toast.title = _("“%s” has been installed").printf (package.name);
// Show Open only when a desktop app is installed
if (package.component.get_kind () == AppStream.ComponentKind.DESKTOP_APP) {
toast.set_default_action (_("Open"));
} else {
toast.set_default_action (null);
switch (state) {
case INSTALLING:
toast.title = _("“%s” has been installed").printf (package.name);
// Show Open only when a desktop app is installed
if (package.component.get_kind () == DESKTOP_APP) {
last_installed_package = package;
toast.set_default_action (_("Open"));
} else {
last_installed_package = null;
toast.set_default_action (null);
}

break;
case REMOVING:
toast.title = _("“%s” has been uninstalled").printf (package.name);
toast.set_default_action (null);
break;
default:
break;
}

toast.send_notification ();
Expand Down