From 8ca42abb01471a1cce81cb834719bf93cd503e79 Mon Sep 17 00:00:00 2001 From: heliguy Date: Tue, 5 Sep 2023 04:00:41 -0400 Subject: [PATCH] Trash data instead of deleting data Upon single flatpak uninstall and batch uninstall, the user can choose to trash user data. This makes it so that data is trashed instead of deleted --- src/window.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/window.py b/src/window.py index de9dd2b..c428bbe 100644 --- a/src/window.py +++ b/src/window.py @@ -116,6 +116,7 @@ class FlattoolGuiWindow(Adw.ApplicationWindow): return total def uninstall_response(self, widget, response_id, _c, index): + app_id = self.host_flatpaks[index][2] ref = self.host_flatpaks[index][8] name = self.host_flatpaks[index][0] command = ["flatpak-spawn", "--host", "flatpak", "remove", ref, "-y"] @@ -123,7 +124,7 @@ class FlattoolGuiWindow(Adw.ApplicationWindow): self.should_pulse = False return 1 if response_id == "purge": - command.append("--delete-data") + subprocess.run(['flatpak-spawn', '--host', 'gio', 'trash', f"{self.user_data_path}{app_id}"]) handler_id = self.connect('close-request', lambda event: True) # Make window unable to close self.main_progress_bar.set_visible(True) @@ -610,7 +611,7 @@ class FlattoolGuiWindow(Adw.ApplicationWindow): name = self.host_flatpaks[self.selected_host_flatpak_indexes[i]][0] command = ["flatpak-spawn", "--host", "flatpak", "remove", ref, "-y"] if delete_data: - command.append("--delete-data") + subprocess.run(['flatpak-spawn', '--host', 'gio', 'trash', f"{self.user_data_path}{app_id}"]) '''try: subprocess.run(command, capture_output=False, check=True)