Fix data trashing refreshing things incorrectly

This commit is contained in:
heliguy4599
2024-10-14 16:48:23 -04:00
parent 7f086cbad3
commit 14707c6177
3 changed files with 21 additions and 6 deletions

View File

@@ -168,11 +168,14 @@ 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()
snapshot_list_page = HostInfo.main_window.pages[HostInfo.main_window.snapshots_row].list_page
snapshot_list_package = snapshot_list_page.package_or_folder
if not snapshot_list_package is None:
snapshot_list_page.set_snapshots(snapshot_list_package, True)
except subprocess.CalledProcessError as cpe:
self.toast_overlay.add_toast(ErrorToast(_("Could not trash data"), cpe.stderr).toast)
except Exception as e:

View File

@@ -80,9 +80,15 @@ class DataBox(Gtk.ListBox):
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)
properties_package = properties_page.package
if not properties_package is None:
properties_page.set_properties(properties_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)
snapshot_list_package = snapshot_list_page.package_or_folder
if not snapshot_list_package is None:
snapshot_list_page.set_snapshots(snapshot_list_package, True)
except subprocess.CalledProcessError as cpe:
self.failed_trash = cpe.stderr
except Exception as e:

View File

@@ -164,9 +164,15 @@ class UserDataPage(Adw.BreakpointBin):
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)
properties_package = properties_page.package
if not properties_package is None:
properties_page.set_properties(properties_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)
snapshot_list_package = snapshot_list_page.package_or_folder
if not snapshot_list_package is None:
snapshot_list_page.set_snapshots(snapshot_list_package, True)
except subprocess.CalledProcessError as cpe:
error[0] = cpe.stderr
except Exception as e: