mirror of
https://github.com/morgan9e/warehouse
synced 2026-04-14 00:04:08 +09:00
Update proper pages when package user data is trashed
This commit is contained in:
@@ -44,8 +44,6 @@ class Flatpak:
|
||||
def trash_data(self, callback=None):
|
||||
try:
|
||||
subprocess.run(['gio', 'trash', self.data_path], capture_output=True, text=True, check=True)
|
||||
snapshot_list_page = HostInfo.main_window.pages[HostInfo.main_window.snapshots_row].list_page
|
||||
snapshot_list_page.set_snapshots(snapshot_list_page.package_or_folder, True)
|
||||
except subprocess.CalledProcessError as cpe:
|
||||
raise cpe
|
||||
except Exception as e:
|
||||
|
||||
@@ -168,6 +168,11 @@ class PropertiesPage(Adw.NavigationPage):
|
||||
self.package.trash_data()
|
||||
self.set_properties(self.package, refresh=True)
|
||||
self.toast_overlay.add_toast(Adw.Toast.new("Trashed User Data"))
|
||||
snapshot_list_page = HostInfo.main_window.pages[HostInfo.main_window.snapshots_row].list_page
|
||||
snapshot_list_page.set_snapshots(snapshot_list_page.package_or_folder, True)
|
||||
user_data_page = HostInfo.main_window.pages[HostInfo.main_window.user_data_row]
|
||||
user_data_page.start_loading()
|
||||
user_data_page.end_loading()
|
||||
except subprocess.CalledProcessError as cpe:
|
||||
self.toast_overlay.add_toast(ErrorToast(_("Could not trash data"), cpe.stderr).toast)
|
||||
except Exception as e:
|
||||
|
||||
@@ -79,6 +79,10 @@ class DataBox(Gtk.ListBox):
|
||||
def thread(*args):
|
||||
try:
|
||||
subprocess.run(['gio', 'trash', self.data_path], check=True, text=True, capture_output=True)
|
||||
properties_page = HostInfo.main_window.pages[HostInfo.main_window.packages_row].properties_page
|
||||
properties_page.set_properties(properties_page.package, True)
|
||||
snapshot_list_page = HostInfo.main_window.pages[HostInfo.main_window.snapshots_row].list_page
|
||||
snapshot_list_page.set_snapshots(snapshot_list_page.package_or_folder, True)
|
||||
except subprocess.CalledProcessError as cpe:
|
||||
self.failed_trash = cpe.stderr
|
||||
except Exception as e:
|
||||
|
||||
@@ -163,6 +163,10 @@ class UserDataPage(Adw.BreakpointBin):
|
||||
cmd = ['gio', 'trash'] + path
|
||||
try:
|
||||
subprocess.run(cmd, check=True, capture_output=True, text=True)
|
||||
properties_page = HostInfo.main_window.pages[HostInfo.main_window.packages_row].properties_page
|
||||
properties_page.set_properties(properties_page.package, True)
|
||||
snapshot_list_page = HostInfo.main_window.pages[HostInfo.main_window.snapshots_row].list_page
|
||||
snapshot_list_page.set_snapshots(snapshot_list_page.package_or_folder, True)
|
||||
except subprocess.CalledProcessError as cpe:
|
||||
error[0] = cpe.stderr
|
||||
except Exception as e:
|
||||
@@ -190,7 +194,7 @@ class UserDataPage(Adw.BreakpointBin):
|
||||
return
|
||||
|
||||
self.select_button.set_active(False)
|
||||
child.set_visible_child(child.loading_data)
|
||||
self.status_stack.set_visible_child(self.loading_view)
|
||||
Gio.Task.new(None, None, callback).run_in_thread(lambda *_: thread(to_trash))
|
||||
|
||||
if len(child.selected_boxes) < 1 or self.is_trash_dialog_open:
|
||||
|
||||
Reference in New Issue
Block a user