From f147f89dda275a1103d920b3dbc1e726a1609d5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Thu, 22 Jan 2026 10:36:55 -0800 Subject: [PATCH] Send feedback on uninstall Fix notification body text DRY toast sending Add user feedback issue to appcenter metadata --- data/appcenter.metainfo.xml.in | 1 + src/Application.vala | 27 +++++++++++++++++++++++++- src/MainWindow.vala | 35 ++++++++++++++++++++++++---------- 3 files changed, 52 insertions(+), 11 deletions(-) diff --git a/data/appcenter.metainfo.xml.in b/data/appcenter.metainfo.xml.in index 8a83bd907..ed5c487ab 100644 --- a/data/appcenter.metainfo.xml.in +++ b/data/appcenter.metainfo.xml.in @@ -75,6 +75,7 @@ AppCenter still shows number of updates on the icon if updated through the terminal Revert change from list/flowbox activate to click controller + User feedback on "Uninstall" diff --git a/src/Application.vala b/src/Application.vala index 39d091a05..3ed46d2e2 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -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; } @@ -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; diff --git a/src/MainWindow.vala b/src/MainWindow.vala index ca7b64d5b..e3bce4161 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -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; @@ -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 ();