mirror of
https://github.com/morgan9e/warehouse
synced 2026-04-14 00:04:08 +09:00
Added please wait screen
Added a please wait screen for flatpak uninstalls
This commit is contained in:
@@ -93,8 +93,13 @@ template FlattoolGuiWindow : Adw.ApplicationWindow {
|
|||||||
}
|
}
|
||||||
Adw.StatusPage no_flatpaks {
|
Adw.StatusPage no_flatpaks {
|
||||||
icon-name: "error-symbolic";
|
icon-name: "error-symbolic";
|
||||||
description: _("Flattool cannot see the list of installed flatpaks or the system has no flatpaks installed.");
|
|
||||||
title: _("No Flatpaks Found");
|
title: _("No Flatpaks Found");
|
||||||
|
description: _("Flattool cannot see the list of installed flatpaks or the system has no flatpaks installed.");
|
||||||
|
}
|
||||||
|
Adw.StatusPage uninstall_please_wait {
|
||||||
|
icon-name: "user-trash-symbolic";
|
||||||
|
title: _("Please Wait");
|
||||||
|
description: _("Flattool is uninstalling the selected apps. This could take a while.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ class FlattoolGuiWindow(Adw.ApplicationWindow):
|
|||||||
batch_uninstall_button = Gtk.Template.Child()
|
batch_uninstall_button = Gtk.Template.Child()
|
||||||
batch_clean_button = Gtk.Template.Child()
|
batch_clean_button = Gtk.Template.Child()
|
||||||
batch_copy_button = Gtk.Template.Child()
|
batch_copy_button = Gtk.Template.Child()
|
||||||
|
uninstall_please_wait = Gtk.Template.Child()
|
||||||
|
main_box = Gtk.Template.Child()
|
||||||
|
|
||||||
clipboard = Gdk.Display.get_default().get_clipboard()
|
clipboard = Gdk.Display.get_default().get_clipboard()
|
||||||
host_home = str(pathlib.Path.home())
|
host_home = str(pathlib.Path.home())
|
||||||
@@ -73,21 +75,6 @@ class FlattoolGuiWindow(Adw.ApplicationWindow):
|
|||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
return(2)
|
return(2)
|
||||||
|
|
||||||
def uninstall_response(self, widget, response_id, _c, index):
|
|
||||||
ref = self.host_flatpaks[index][8]
|
|
||||||
name = self.host_flatpaks[index][0]
|
|
||||||
command = ['flatpak-spawn', '--host', 'flatpak', 'remove', ref, '-y']
|
|
||||||
if response_id == "cancel":
|
|
||||||
return(1)
|
|
||||||
if response_id == "purge":
|
|
||||||
command.append('--delete-data')
|
|
||||||
try:
|
|
||||||
subprocess.run(command, capture_output=True, check=True)
|
|
||||||
self.toast_overlay.add_toast(Adw.Toast.new(_(f"Uninstalled {name}")))
|
|
||||||
self.refresh_list_of_flatpaks(self, False)
|
|
||||||
except subprocess.CalledProcessError:
|
|
||||||
self.toast_overlay.add_toast(Adw.Toast.new(_(f"Error while trying to uninstall {name}")))
|
|
||||||
|
|
||||||
def get_size_format(self, b):
|
def get_size_format(self, b):
|
||||||
factor=1024
|
factor=1024
|
||||||
suffix="B"
|
suffix="B"
|
||||||
@@ -120,7 +107,25 @@ class FlattoolGuiWindow(Adw.ApplicationWindow):
|
|||||||
return 0
|
return 0
|
||||||
return total
|
return total
|
||||||
|
|
||||||
|
def uninstall_response(self, widget, response_id, _c, index):
|
||||||
|
ref = self.host_flatpaks[index][8]
|
||||||
|
name = self.host_flatpaks[index][0]
|
||||||
|
command = ['flatpak-spawn', '--host', 'flatpak', 'remove', ref, '-y']
|
||||||
|
if response_id == "cancel":
|
||||||
|
self.main_stack.set_visible_child(self.main_box)
|
||||||
|
return(1)
|
||||||
|
if response_id == "purge":
|
||||||
|
command.append('--delete-data')
|
||||||
|
try:
|
||||||
|
subprocess.run(command, capture_output=True, check=True)
|
||||||
|
self.toast_overlay.add_toast(Adw.Toast.new(_(f"Uninstalled {name}")))
|
||||||
|
self.refresh_list_of_flatpaks(self, False)
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
self.toast_overlay.add_toast(Adw.Toast.new(_(f"Error while trying to uninstall {name}")))
|
||||||
|
self.main_stack.set_visible_child(self.main_box)
|
||||||
|
|
||||||
def uninstall_flatpak(self, _widget, index):
|
def uninstall_flatpak(self, _widget, index):
|
||||||
|
self.main_stack.set_visible_child(self.uninstall_please_wait)
|
||||||
name = self.host_flatpaks[index][0]
|
name = self.host_flatpaks[index][0]
|
||||||
id = self.host_flatpaks[index][2]
|
id = self.host_flatpaks[index][2]
|
||||||
dialog = Adw.MessageDialog.new(self, _(f"Uninstall {name}?"), _("The app will be removed from your system."))
|
dialog = Adw.MessageDialog.new(self, _(f"Uninstall {name}?"), _("The app will be removed from your system."))
|
||||||
|
|||||||
Reference in New Issue
Block a user