Skip to content

Commit

Permalink
Speedup opening properties window
Browse files Browse the repository at this point in the history
Getting the size of the user data is now threaded, meaning the window opens instantly
  • Loading branch information
heliguy4599 committed Oct 2, 2023
1 parent 55dcb6c commit c918927
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/properties_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,19 @@ def copy_button_handler(widget, title, to_copy):
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")
Expand Down

0 comments on commit c918927

Please sign in to comment.