Subject: [bug#73520] [PATCH gnome-team v2] gnu: xdg-desktop-portal: Fix configuration file search.

From: aurtzy <[email-masked]>
Date: Sat, 1 Mar 2025 18:20:17 -0500

From: Rodion Goritskov <[email-masked]>

* gnu/local.mk: Add patch.
* gnu/packages/freedesktop.scm (xdg-desktop-portal): Add patch.
* gnu/packages/patches/xdg-desktop-portal-disable-configuration-search-exit.patch: New file

Change-Id: Idd637f5613e7d1403fc3a0feeff53a7931e68fc6
---

Hi,

Coming from discussion in #75676 [1], this is a v2 of Rodion's work rebased on
the gnome-team branch, which has bumped xdg-desktop-portal to 1.18.4.

[1] <https://issues.guix.gnu.org/75676#15>

Cheers,

aurtzy

 gnu/local.mk                                  |  1 +
 gnu/packages/freedesktop.scm                  |  6 +++--
 ...al-disable-configuration-search-exit.patch | 27 +++++++++++++++++++
 3 files changed, 32 insertions(+), 2 deletions(-)
 create mode 100644 gnu/packages/patches/xdg-desktop-portal-disable-configuration-search-exit.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index eb7817ca82..43a5e42097 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2413,6 +2413,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/wpa-supplicant-dbus-group-policy.patch		\
   %D%/packages/patches/x265-arm-flags.patch			\
   %D%/packages/patches/xdg-desktop-portal-disable-portal-tests.patch\
+  %D%/packages/patches/xdg-desktop-portal-disable-configuration-search-exit.patch\
   %D%/packages/patches/xdg-desktop-portal-wlr-harcoded-length.patch\
   %D%/packages/patches/xf86-video-siliconmotion-fix-ftbfs.patch \
   %D%/packages/patches/xfig-Enable-error-message-for-missing-libraries.patch		\
diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index f8e7e198ae..726cd161b2 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -3214,8 +3214,10 @@ (define-public xdg-desktop-portal
        (sha256
         (base32
          "0r8y8qmzcfj7b7brqcxr9lg8pavfds815ffvj0kqc378fhgaln5q"))
-       ;; Disable portal tests since they try to use fuse.
-       (patches (search-patches "xdg-desktop-portal-disable-portal-tests.patch"))))
+       (patches (search-patches
+                 ;; Disable portal tests since they try to use fuse.
+                 "xdg-desktop-portal-disable-portal-tests.patch"
+                 "xdg-desktop-portal-disable-configuration-search-exit.patch"))))
     (build-system meson-build-system)
     (arguments
      `(#:configure-flags
diff --git a/gnu/packages/patches/xdg-desktop-portal-disable-configuration-search-exit.patch b/gnu/packages/patches/xdg-desktop-portal-disable-configuration-search-exit.patch
new file mode 100644
index 0000000000..eba07f8c35
--- /dev/null
+++ b/gnu/packages/patches/xdg-desktop-portal-disable-configuration-search-exit.patch
@@ -0,0 +1,27 @@
+From 37003d1f99246c88cbe7cf2f83616642e0fdf3fb Mon Sep 17 00:00:00 2001
+From: Rodion Goritskov <[email-masked]>
+Date: Fri, 27 Sep 2024 00:44:07 +0400
+Subject: [PATCH] portal-impl: Check if there are any configuration files in XDG_DESKTOP_PORTAL_DIR before exiting configuration search
+
+---
+ src/portal-impl.c | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/src/portal-impl.c b/src/portal-impl.c
+index 8c1fd53..8708409 100644
+--- a/src/portal-impl.c
++++ b/src/portal-impl.c
+@@ -438,9 +438,8 @@ load_portal_configuration (gboolean opt_verbose)
+ 
+   if (portal_dir != NULL)
+     {
+-      load_config_directory (portal_dir, desktops, opt_verbose);
+-      /* All other config directories are ignored when this is set */
+-      return;
++      if (load_config_directory (portal_dir, desktops, opt_verbose))
++	return;
+     }
+ 
+   /* $XDG_CONFIG_HOME/xdg-desktop-portal/(DESKTOP-)portals.conf */
+-- 
+2.46.0

base-commit: 87d0295b308f354ec1c25212f6937b39eb8ae8bf
-- 
2.48.1