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




commit eea7a8f012ef930fb81ff7c3cc5d656c33b4b1b2
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.
    
    Fixes https://gitlab.gnome.org/GNOME/libadwaita/-/issues/281

 src/adw-settings.c | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/src/adw-settings.c b/src/adw-settings.c
index b1d47e9f..206d396d 100644
--- a/src/adw-settings.c
+++ b/src/adw-settings.c
@@ -118,6 +118,13 @@ read_portal_setting (AdwSettings  *self,
       return FALSE;
     }
 
+    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);
 


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