Do not allow Warehouse to uninstall itself

This commit is contained in:
heliguy4599
2024-10-14 19:00:58 -04:00
parent 0f5c93ba80
commit 5be7ed7802
2 changed files with 8 additions and 2 deletions

View File

@@ -149,7 +149,12 @@ class PackagesPage(Adw.BreakpointBin):
if (total := len(self.selected_rows)) > 0:
self.packages_navpage.set_title(_("{} Selected").format(total))
self.copy_button.set_sensitive(True)
self.uninstall_button.set_sensitive(True)
for row in self.selected_rows:
if "io.github.flattool.Warehouse" in row.package.info['id']:
self.uninstall_button.set_sensitive(False)
break
else:
self.uninstall_button.set_sensitive(True)
else:
self.packages_navpage.set_title(_("Packages"))
self.copy_button.set_sensitive(False)

View File

@@ -89,11 +89,12 @@ class PropertiesPage(Adw.NavigationPage):
self.open_app_button.set_visible(package.is_runtime)
self.open_app_button.set_visible(not package.is_runtime)
self.data_row.set_visible(not package.is_runtime)
self.uninstall_button.set_sensitive(self.package.info['id'] != "io.github.flattool.Warehouse")
if package.is_runtime:
self.runtime_row.set_visible(False)
else:
has_path = os.path.exists(package.data_path)
self.trash_data_button.set_sensitive(has_path)
self.trash_data_button.set_sensitive(has_path and self.package.info['id'] != "io.github.flattool.Warehouse")
self.open_data_button.set_sensitive(has_path)
if not self.package.dependant_runtime is None: