diff --git a/data/org.freedesktop.portal.OpenURI.xml b/data/org.freedesktop.portal.OpenURI.xml
index 67f99f269..d76874442 100644
--- a/data/org.freedesktop.portal.OpenURI.xml
+++ b/data/org.freedesktop.portal.OpenURI.xml
@@ -161,6 +161,20 @@
+
+
+
+
+
+
diff --git a/src/open-uri.c b/src/open-uri.c
index 47b789cbb..0587e79cd 100644
--- a/src/open-uri.c
+++ b/src/open-uri.c
@@ -919,6 +919,28 @@ handle_open_in_thread_func (GTask *task,
g_object_ref (request));
}
+static gboolean
+handle_scheme_supported (XdpDbusOpenURI *object,
+ GDBusMethodInvocation *invocation,
+ const gchar *arg_scheme)
+{
+ if (arg_scheme == NULL || *arg_scheme == '\0')
+ {
+ g_dbus_method_invocation_return_error (invocation,
+ XDG_DESKTOP_PORTAL_ERROR,
+ XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENT,
+ "Scheme not specified");
+ return G_DBUS_METHOD_INVOCATION_HANDLED;
+ }
+
+ g_autoptr(GAppInfo) app_info = g_app_info_get_default_for_uri_scheme (arg_scheme);
+
+ g_debug ("Handler for scheme: %s%s found.", arg_scheme, app_info ? "" : " not");
+ g_dbus_method_invocation_return_value (invocation, g_variant_new ("(b)", app_info != NULL));
+
+ return G_DBUS_METHOD_INVOCATION_HANDLED;
+}
+
static gboolean
handle_open_uri (XdpDbusOpenURI *object,
GDBusMethodInvocation *invocation,
@@ -1088,12 +1110,13 @@ open_uri_iface_init (XdpDbusOpenURIIface *iface)
iface->handle_open_uri = handle_open_uri;
iface->handle_open_file = handle_open_file;
iface->handle_open_directory = handle_open_directory;
+ iface->handle_scheme_supported = handle_scheme_supported;
}
static void
open_uri_init (OpenURI *openuri)
{
- xdp_dbus_open_uri_set_version (XDP_DBUS_OPEN_URI (openuri), 3);
+ xdp_dbus_open_uri_set_version (XDP_DBUS_OPEN_URI (openuri), 4);
}
static void
diff --git a/tests/test-portals.c b/tests/test-portals.c
index 7b59064f7..e9e5e5a57 100644
--- a/tests/test-portals.c
+++ b/tests/test-portals.c
@@ -444,7 +444,7 @@ DEFINE_TEST_EXISTS(inhibit, INHIBIT, 3)
DEFINE_TEST_EXISTS(location, LOCATION, 1)
DEFINE_TEST_EXISTS(network_monitor, NETWORK_MONITOR, 3)
DEFINE_TEST_EXISTS(notification, NOTIFICATION, 1)
-DEFINE_TEST_EXISTS(open_uri, OPEN_URI, 3)
+DEFINE_TEST_EXISTS(open_uri, OPEN_URI, 4)
DEFINE_TEST_EXISTS(print, PRINT, 2)
DEFINE_TEST_EXISTS(proxy_resolver, PROXY_RESOLVER, 1)
DEFINE_TEST_EXISTS(screenshot, SCREENSHOT, 2)