[libadwaita/wip/exalm/portal-error] settings: Guard against UnknownMethod when accessing portal
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libadwaita/wip/exalm/portal-error] settings: Guard against UnknownMethod when accessing portal
- Date: Tue, 28 Sep 2021 17:36:40 +0000 (UTC)
commit f23c686fe5c0dadfa8f4e7bfeddbfdadde8a5ebf
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 | 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]