openuriportal: Detect if the interface isn't there
authorMatthias Clasen <mclasen@redhat.com>
Thu, 13 Apr 2023 05:23:06 +0000 (07:23 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 21 Apr 2023 07:17:39 +0000 (09:17 +0200)
Check the portal version number before trying to use
it. Most importantly, this will detect the case where
the interface isn't supported at all, since the proxy
will report a version of 0 in that case.

Fixes: #5733
gtk/gtkopenuriportal.c

index 10001cacf4d37c96bf138f8872dddee87cecfcfe..1bec7a1cb0b951e2048998954b043846573796df 100644 (file)
@@ -67,6 +67,12 @@ init_openuri_portal (void)
               g_error_free (error);
             }
 
+          if (gtk_xdp_open_uri_get_version (openuri) < 3)
+            {
+              g_warning ("Not a supported version of the OpenURI portal: %u", gtk_xdp_open_uri_get_version (openuri));
+              g_clear_object (&openuri);
+            }
+
           g_object_unref (connection);
         }
       else