[libhandy/wip/exalm/settings-fix] settings: Guard against UnknownMethod when accessing portal




commit 25cad0fcdb3a811a6c0de2602be8e3a94c970fbb
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.
    
    See https://gitlab.gnome.org/GNOME/libadwaita/-/merge_requests/269

 src/hdy-settings.c | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/src/hdy-settings.c b/src/hdy-settings.c
index e2632c61..0d8d57a7 100644
--- a/src/hdy-settings.c
+++ b/src/hdy-settings.c
@@ -110,6 +110,13 @@ read_portal_setting (HdySettings  *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]