Speedup opening properties window

Getting the size of the user data is now threaded, meaning the window opens instantly
This commit is contained in:
heliguy4599
2023-10-02 14:14:22 -04:00
parent 55dcb6cf34
commit c918927ab1

View File

@@ -80,10 +80,19 @@ def show_properties_window(widget, index, window):
properties_list.add_css_class("boxed-list")
path = str(window.user_data_path) + window.host_flatpaks[index][2]
def size_thread(path):
size = f"{path}\n~{my_utils.getSizeWithFormat(path)}"
user_data_row.set_subtitle(size)
def calc_size(path):
task = Gio.Task.new(None, None, None)
task.run_in_thread(lambda _task, _obj, _data, _cancellable: size_thread(path))
if os.path.exists(path):
user_data_row.set_title("User Data")
user_data_row.set_subtitle(f"{path}\n~{my_utils.getSizeWithFormat(path)}")
# user_data_row.set_subtitle(f"{path}\n~{my_utils.getSizeWithFormat(path)}")
calc_size(path)
open_button = Gtk.Button(icon_name="document-open-symbolic", valign=Gtk.Align.CENTER, tooltip_text=_("Open Data Folder"))
open_button.add_css_class("flat")