mirror of
https://github.com/morgan9e/warehouse
synced 2026-04-14 00:04:08 +09:00
Add refresh lockout to package uninstalls
This commit is contained in:
@@ -98,10 +98,16 @@ class Flatpak:
|
||||
|
||||
Gio.Task.new(None, None, callback).run_in_thread(thread)
|
||||
|
||||
def uninstall(self, callback=None):
|
||||
def uninstall(self, callee_callback=None):
|
||||
self.failed_uninstall = None
|
||||
|
||||
def callback(*args):
|
||||
HostInfo.main_window.remove_refresh_lockout("uninstalling packages")
|
||||
if not callee_callback is None:
|
||||
callee_callback()
|
||||
|
||||
def thread(*args):
|
||||
HostInfo.main_window.add_refresh_lockout("uninstalling packages")
|
||||
cmd = ['flatpak-spawn', '--host', 'flatpak', 'uninstall', '-y', self.info["ref"]]
|
||||
installation = self.info["installation"]
|
||||
if installation == "system" or installation == "user":
|
||||
|
||||
@@ -243,6 +243,7 @@ class PackagesPage(Adw.BreakpointBin):
|
||||
GLib.idle_add(lambda *_: self.set_status(self.uninstalling))
|
||||
error = [None]
|
||||
def thread(*args):
|
||||
HostInfo.main_window.add_refresh_lockout("batch uninstalling packages")
|
||||
cmd = ['flatpak-spawn', '--host', 'flatpak', 'uninstall', '-y']
|
||||
to_trash = []
|
||||
for row in self.selected_rows:
|
||||
@@ -261,6 +262,7 @@ class PackagesPage(Adw.BreakpointBin):
|
||||
|
||||
def callback(*args):
|
||||
self.main_window.refresh_handler()
|
||||
HostInfo.main_window.remove_refresh_lockout("batch uninstalling packages")
|
||||
if err := error[0]:
|
||||
details = err.stderr if type(err) == subprocess.CalledProcessError else str(err)
|
||||
GLib.idle_add(lambda *args: self.packages_toast_overlay.add_toast(ErrorToast(_("Could not uninstall packages"), details).toast))
|
||||
|
||||
Reference in New Issue
Block a user