[libadwaita/wip/exalm/portal-error] settings: Guard against UnknownMethod when accessing portal




commit 3694a2bfc40a828e77c158c1a92d2fade1161f47
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Tue Sep 28 22:33:25 2021 +0500

    settings: Guard against UnknownMethod when accessing portal
    
    One case we didn't guard against was if xdg-desktop-portal exists, but
    doesn't provide a settings portal interface.

 src/adw-settings.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/src/adw-settings.c b/src/adw-settings.c
index b1d47e9f..95589987 100644
--- a/src/adw-settings.c
+++ b/src/adw-settings.c
@@ -118,7 +118,14 @@ read_portal_setting (AdwSettings  *self,
       return FALSE;
     }
 
-    if (g_dbus_error_is_remote_error (error)) {
+    if (error->domain == G_DBUS_ERROR &&
+        error->code == G_DBUS_ERROR_UNKNOWN_METHOD) {
+      g_debug ("Portal doesn't provide settings: %s", error->message);
+
+      return FALSE;
+    }
+
+     if (g_dbus_error_is_remote_error (error)) {
       g_autofree char *remote_error = g_dbus_error_get_remote_error (error);
 
       if (!g_strcmp0 (remote_error, PORTAL_ERROR_NOT_FOUND)) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]