From 0b3beed6d8941f95df32175dae5f50650868604d Mon Sep 17 00:00:00 2001 From: kramo <93832451+kra-mo@users.noreply.github.com> Date: Wed, 15 Mar 2023 23:06:04 +0100 Subject: [PATCH] Add timeout for Steam import --- src/utils/steam_parser.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/utils/steam_parser.py b/src/utils/steam_parser.py index f6992dd..e2bc6a6 100644 --- a/src/utils/steam_parser.py +++ b/src/utils/steam_parser.py @@ -109,6 +109,7 @@ def steam_parser(parent_widget, action): ) queue = [] + cancellables = [] for appmanifest in appmanifests: values = {} @@ -189,7 +190,11 @@ def steam_parser(parent_widget, action): import_dialog.show() queue.append(values["appid"]) - open_file.load_contents_async(None, steam_api_callback, values) + + cancellables.append(Gio.Cancellable()) + open_file.load_contents_async(cancellables[-1], steam_api_callback, values) + + GLib.timeout_add_seconds(10, timeout, cancellables[-1]) if os.path.isfile( os.path.join( @@ -218,3 +223,8 @@ def steam_parser(parent_widget, action): _("No Games Found"), _("No new games were found in the Steam library."), ) + + +def timeout(cancellable): + cancellable.cancel() + return False