mirror of
https://github.com/morgan9e/warehouse
synced 2026-04-14 00:04:08 +09:00
Do not show trash option for uninstall if no data is present (single package only)
This commit is contained in:
@@ -258,7 +258,7 @@ class PackagesPage(Adw.BreakpointBin):
|
||||
|
||||
Gio.Task.new(None, None, callback).run_in_thread(thread)
|
||||
|
||||
dialog = UninstallDialog(on_response)
|
||||
dialog = UninstallDialog(on_response, True)
|
||||
dialog.present(self.main_window)
|
||||
|
||||
def start_loading(self):
|
||||
|
||||
@@ -2,11 +2,6 @@ using Gtk 4.0;
|
||||
using Adw 1;
|
||||
|
||||
template $UninstallDialog : Adw.AlertDialog {
|
||||
// responses [
|
||||
// cancel: _("Cancel"),
|
||||
// continue: _("Uninstall") destructive,
|
||||
// ]
|
||||
|
||||
extra-child:
|
||||
Adw.PreferencesGroup group {
|
||||
Adw.ActionRow {
|
||||
|
||||
@@ -14,11 +14,11 @@ class UninstallDialog(Adw.AlertDialog):
|
||||
|
||||
self.continue_callback(self.trash.get_active())
|
||||
|
||||
def __init__(self, continue_callback, package_name=None, **kwargs):
|
||||
def __init__(self, continue_callback, show_trash_option, package_name=None, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
|
||||
if package_name:
|
||||
self.set_heading(GLib.markup_escape_text(_("Uninstall {}").format(package_name)))
|
||||
self.set_heading(GLib.markup_escape_text(_("Uninstall {}?").format(package_name)))
|
||||
self.set_body(GLib.markup_escape_text(_("It will not be possible to use {} after removal").format(package_name)))
|
||||
else:
|
||||
self.set_heading(GLib.markup_escape_text(_("Uninstall Packages?")))
|
||||
@@ -29,4 +29,5 @@ class UninstallDialog(Adw.AlertDialog):
|
||||
self.add_response("continue", _("Uninstall"))
|
||||
self.set_response_appearance("continue", Adw.ResponseAppearance.DESTRUCTIVE)
|
||||
self.connect("response", self.on_response)
|
||||
self.group.set_title(GLib.markup_escape_text(_("App Settings & Content")))
|
||||
self.group.set_title(GLib.markup_escape_text(_("App Settings & Content")))
|
||||
self.group.set_visible(show_trash_option)
|
||||
@@ -228,7 +228,7 @@ class PropertiesPage(Adw.NavigationPage):
|
||||
self.packages_page.packages_toast_overlay.add_toast(Adw.Toast(title=_("Uninstalled {}").format(self.package.info["name"])))
|
||||
|
||||
# name = self.package.info["name"]
|
||||
dialog = UninstallDialog(on_choice)
|
||||
dialog = UninstallDialog(on_choice, os.path.exists(self.package.data_path), self.package.info["name"])
|
||||
dialog.present(self.main_window)
|
||||
|
||||
def runtime_row_handler(self, *args):
|
||||
|
||||
Reference in New Issue
Block a user