Add status page for list refreshing

This commit is contained in:
heliguy
2024-03-31 00:51:10 -04:00
parent 051e22898a
commit 4ca826d8b3
4 changed files with 27 additions and 6 deletions

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><path d="m 7.40625 1 c -0.613281 0.007812 -1.234375 0.089844 -1.847656 0.253906 c -3.273438 0.878906 -5.558594 3.855469 -5.558594 7.246094 s 2.285156 6.367188 5.558594 7.242188 c 3.273437 0.878906 6.742187 -0.558594 8.4375 -3.492188 c 0.277344 -0.480469 0.109375 -1.089844 -0.367188 -1.367188 c -0.476562 -0.273437 -1.089844 -0.109374 -1.367187 0.367188 c -1.246094 2.160156 -3.777344 3.207031 -6.1875 2.5625 c -2.40625 -0.644531 -4.074219 -2.820312 -4.074219 -5.3125 c 0 -2.496094 1.667969 -4.667969 4.074219 -5.3125 c 2.410156 -0.644531 4.941406 0.402344 6.1875 2.5625 c 0.058593 0.085938 0.125 0.164062 0.203125 0.226562 l -0.019532 0.015626 l -0.007812 0.007812 h -1.4375 c -0.550781 0 -1 0.449219 -1 1 c 0 0 0 1 1 1 h 5 v -5 s 0.003906 -1 -1 -1 c -0.550781 0 -1 0.449219 -1 1 v 1.6875 l -0.015625 0.011719 l -0.011719 0.011719 c -1.277344 -2.179688 -3.53125 -3.519532 -5.953125 -3.691407 c -0.203125 -0.015625 -0.40625 -0.019531 -0.613281 -0.019531 z m 0 0" fill="#222222"/></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -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");
}
}
}
};

View File

@@ -36,5 +36,6 @@
<file preprocess="xml-stripblanks" alias="eye-open-negative-filled-symbolic.svg">../data/icons/eye-open-negative-filled-symbolic.svg</file>
<file preprocess="xml-stripblanks" alias="left-large-symbolic.svg">../data/icons/left-large-symbolic.svg</file>
<file preprocess="xml-stripblanks" alias="arrow-turn-left-down-symbolic.svg">../data/icons/arrow-turn-left-down-symbolic.svg</file>
<file preprocess="xml-stripblanks" alias="arrow-circular-top-right-symbolic.svg">../data/icons/arrow-circular-top-right-symbolic.svg</file>
</gresource>
</gresources>

View File

@@ -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")))
# 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")