diff --git a/data/icons/arrow-circular-top-right-symbolic.svg b/data/icons/arrow-circular-top-right-symbolic.svg new file mode 100644 index 0000000..89411c5 --- /dev/null +++ b/data/icons/arrow-circular-top-right-symbolic.svg @@ -0,0 +1,2 @@ + + diff --git a/data/ui/window.blp b/data/ui/window.blp index 2f1ce00..591666f 100644 --- a/data/ui/window.blp +++ b/data/ui/window.blp @@ -187,6 +187,12 @@ template $WarehouseWindow: Adw.ApplicationWindow { title: _("No Results Found"); description: _("Try a different search term"); } + + Adw.StatusPage refreshing { + icon-name: "arrow-circular-top-right-symbolic"; + title: _("Refreshing List"); + description: _("This should only take a moment"); + } } } }; diff --git a/src/warehouse.gresource.xml b/src/warehouse.gresource.xml index 89b65f6..abbf591 100644 --- a/src/warehouse.gresource.xml +++ b/src/warehouse.gresource.xml @@ -36,5 +36,6 @@ ../data/icons/eye-open-negative-filled-symbolic.svg ../data/icons/left-large-symbolic.svg ../data/icons/arrow-turn-left-down-symbolic.svg + ../data/icons/arrow-circular-top-right-symbolic.svg diff --git a/src/window.py b/src/window.py index 3ee851c..087261e 100644 --- a/src/window.py +++ b/src/window.py @@ -66,6 +66,7 @@ class WarehouseWindow(Adw.ApplicationWindow): no_matches = Gtk.Template.Child() reset_filters_button = Gtk.Template.Child() uninstalling_status = Gtk.Template.Child() + refreshing = Gtk.Template.Child() main_progress_bar = Gtk.ProgressBar(visible=False, can_target=False) main_progress_bar.add_css_class("osd") @@ -355,12 +356,23 @@ class WarehouseWindow(Adw.ApplicationWindow): def refresh_list_of_flatpaks(self, widget, should_toast): if self.currently_uninstalling: return - if should_toast: - self.toast_overlay.add_toast(Adw.Toast.new(_("List refreshed"))) - self.flatpaks_list_box.remove_all() - self.generate_list_of_flatpaks() - self.batch_mode_button.set_active(False) - self.total_selected = 0 + + # I hate this so much... + def callback(*args): + self.flatpaks_list_box.remove_all() + self.generate_list_of_flatpaks() + self.batch_mode_button.set_active(False) + self.total_selected = 0 + if should_toast: + self.toast_overlay.add_toast(Adw.Toast.new(_("List refreshed"))) + + def runner(*args): + import time + time.sleep(0.1) + + self.main_stack.set_visible_child(self.refreshing) + task = Gio.Task.new(None, None, callback) + task.run_in_thread(runner) def reset_filters(self): settings = Gio.Settings.new("io.github.flattool.Warehouse.filter")