appinfo: Use g_openuri_portal_can_open

Instead of presenting the user with unexpected dialogs to
install apps, error out if the portal doesn't support the
uri scheme.

This will help with handling the help: uri scheme better,
in the absence of yelp.
This commit is contained in:
Matthias Clasen
2025-05-05 11:02:39 -04:00
parent fa18fdf862
commit 83c19544b4

View File

@@ -1285,6 +1285,13 @@ launch_default_for_uri_portal_open_uri (GTask *task, GError *error)
/* Reset any error previously set by launch_default_for_uri */
g_error_free (error);
if (!g_openuri_portal_can_open (data->uri))
{
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
_("The URI %s is not supported"), data->uri);
return;
}
file = g_file_new_for_uri (data->uri);
if (data->context)