diff --git a/src/Services/Accounts/SecretAccountStore.vala b/src/Services/Accounts/SecretAccountStore.vala index 6221244b..a925cdf0 100644 --- a/src/Services/Accounts/SecretAccountStore.vala +++ b/src/Services/Accounts/SecretAccountStore.vala @@ -55,8 +55,14 @@ public class Tuba.SecretAccountStore : AccountStore { null, false, (obj, res) => { - if (app.question.end (res).truthy ()) Host.open_url (wiki_page); - Process.exit (1); + if (app.question.end (res).truthy ()) { + Host.open_url_async.begin (wiki_page, (obj, res) => { + Host.open_url_async.end (res); + Process.exit (1); + }); + } else { + Process.exit (1); + } } ); } diff --git a/src/Utils/Host.vala b/src/Utils/Host.vala index fa4af441..3fb6f01b 100644 --- a/src/Utils/Host.vala +++ b/src/Utils/Host.vala @@ -29,6 +29,24 @@ public class Tuba.Host { return true; } + public static async bool open_url_async (string url) { + debug (@"Opening URL async: $url"); + + try { + yield (new Gtk.UriLauncher (url)).launch (app.active_window, null); + } catch (Error e) { + warning (@"Error opening uri \"$url\": $(e.message)"); + try { + yield AppInfo.launch_default_for_uri_async (url, null, null); + } catch (Error e) { + warning (@"Error opening uri \"$url\": $(e.message)"); + return false; + } + } + + return true; + } + private static void open_in_default_app (string uri) { debug (@"Opening URI: $uri");