Subject: [PATCH gnome-team 04/44] gnu: nautilus: Update to 46.1.

From: Maxim Cournoyer <[email-masked]>
Date: Mon, 11 Nov 2024 15:16:47 +0900

* gnu/packages/gnome.scm (nautilus): Update to 46.1.
[phases] {patch-commands}: New phase.
[inputs]: Add bash-minimal.
* gnu/packages/patches/nautilus-extension-search-path.patch: Rebase patch.

Change-Id: I9ce51dbe488336d52fabec0a0a7f3ca2803731ac
---
 gnu/packages/gnome.scm                        | 13 +++-
 .../nautilus-extension-search-path.patch      | 77 ++++++++-----------
 2 files changed, 40 insertions(+), 50 deletions(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index f907140574..3000b8193e 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -9976,7 +9976,7 @@ (define-public tracker-miners
 (define-public nautilus
   (package
     (name "nautilus")
-    (version "44.3.1")
+    (version "46.1")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://gnome/sources/" name "/"
@@ -9984,7 +9984,7 @@ (define-public nautilus
                                   name "-" version ".tar.xz"))
               (sha256
                (base32
-                "05njbaq98y00n1z1smg1pdip3shr84q8a10wssm8sjbv7sirwj75"))
+                "1mvvi11pz9pn8j9vx5d8j59xx8096wkavizkwglr4byp3pgmy6nc"))
               (patches
                (search-patches "nautilus-extension-search-path.patch"))))
     (build-system meson-build-system)
@@ -9993,6 +9993,12 @@ (define-public nautilus
       #:glib-or-gtk? #t
       #:phases
       #~(modify-phases %standard-phases
+          (add-after 'unpack 'patch-commands
+            (lambda* (#:key inputs #:allow-other-keys)
+              (substitute* "src/nautilus-autorun-software.c"
+                (("g_file_new_for_path \\(\"/bin/sh\");")
+                 (format #f "g_file_new_for_path (~s);"
+                         (search-input-file inputs "bin/sh"))))))
           (add-after 'unpack 'patch-tracker3-command
             (lambda* (#:key inputs #:allow-other-keys)
               (substitute* "src/nautilus-tag-manager.c"
@@ -10031,7 +10037,8 @@ (define-public nautilus
            python
            python-pygobject))
     (inputs
-     (list dconf
+     (list bash-minimal
+           dconf
            gexiv2
            gvfs
            exempi
diff --git a/gnu/packages/patches/nautilus-extension-search-path.patch b/gnu/packages/patches/nautilus-extension-search-path.patch
index 1394956315..789addc918 100644
--- a/gnu/packages/patches/nautilus-extension-search-path.patch
+++ b/gnu/packages/patches/nautilus-extension-search-path.patch
@@ -1,62 +1,45 @@
 Allow Nautilus to search for extensions in the directories listed
 in $NAUTILUS_EXTENSION_PATH.
 
-Index: nautilus-44.2/src/nautilus-module.c
-===================================================================
---- nautilus-44.2.orig/src/nautilus-module.c
-+++ nautilus-44.2/src/nautilus-module.c
-@@ -220,8 +220,16 @@ static void
+diff --git a/src/nautilus-module.c b/src/nautilus-module.c
+index 3f1051ba5..030a898d1 100644
+--- a/src/nautilus-module.c
++++ b/src/nautilus-module.c
+@@ -219,6 +219,13 @@ static void
  load_module_dir (const char *dirname)
  {
      GDir *dir;
--
 +    static GHashTable *loaded = NULL;
-     g_autoptr (GStrvBuilder) installed_module_name_builder = g_strv_builder_new ();
-+
 +    if (installed_module_names != NULL)
 +        g_strv_builder_addv (installed_module_name_builder,
 +                             (const gchar **)installed_module_names);
 +
 +    if (loaded == NULL)
-+      loaded = g_hash_table_new (g_str_hash, g_str_equal);
-+
-     dir = g_dir_open (dirname, 0, NULL);
++        loaded = g_hash_table_new (g_str_hash, g_str_equal);
  
-     if (dir)
-@@ -232,16 +240,24 @@ load_module_dir (const char *dirname)
+     g_autoptr (GStrvBuilder) installed_module_name_builder = g_strv_builder_new ();
+     dir = g_dir_open (dirname, 0, NULL);
+@@ -231,12 +238,18 @@ load_module_dir (const char *dirname)
          {
              if (g_str_has_suffix (name, "." G_MODULE_SUFFIX))
              {
 -                char *filename;
--
--                filename = g_build_filename (dirname,
--                                             name,
--                                             NULL);
--                nautilus_module_load_file (filename, installed_module_name_builder);
--                g_free (filename);
 +                /* Make sure each module is loaded only twice or this could
 +                   lead to a crash.  Double loading can occur if DIRNAME
 +                   occurs more than once in $NAUTILUS_EXTENSION_PATH.  */
 +                if (!g_hash_table_contains (loaded, name))
 +                {
 +                    char *filename;
-+
-+                    filename = g_build_filename (dirname,
-+                                                 name,
-+                                                 NULL);
-+                    nautilus_module_load_file (filename,
-+                                               installed_module_name_builder);
-+                    g_hash_table_add (loaded, g_strdup (name));
-+                    g_free (filename);
-+                }
-             }
--        }
  
-+        }
-         g_dir_close (dir);
-     }
- 
-@@ -278,10 +294,24 @@ nautilus_module_setup (void)
+                 filename = g_build_filename (dirname,
+                                              name,
+                                              NULL);
+                 nautilus_module_load_file (filename, installed_module_name_builder);
++                g_hash_table_add (loaded, g_strdup (name));
+                 g_free (filename);
+             }
+         }
+@@ -277,9 +290,24 @@ nautilus_module_setup (void)
  
      if (!initialized)
      {
@@ -64,20 +47,20 @@ Index: nautilus-44.2/src/nautilus-module.c
          initialized = TRUE;
  
          load_module_dir (NAUTILUS_EXTENSIONDIR);
- 
-+	/* Load additional modules from the user-provided search path.  */
-+	extension_path = g_getenv ("NAUTILUS_EXTENSION_PATH");
-+	if (extension_path)
-+	  {
-+	    char **extension_dirs, **d;
 +
-+	    extension_dirs = g_strsplit (extension_path, ":", -1);
-+	    for (d = extension_dirs; d != NULL && *d != NULL; d++)
-+	      load_module_dir (*d);
++        /* Load additional modules from the user-provided search path.  */
++        extension_path = g_getenv ("NAUTILUS_EXTENSION_PATH");
++        if (extension_path)
++        {
++            char **extension_dirs, **d;
++
++            extension_dirs = g_strsplit (extension_path, ":", -1);
++            for (d = extension_dirs; d != NULL && *d != NULL; d++)
++                load_module_dir (*d);
 +
-+	    g_strfreev (extension_dirs);
-+	  }
++            g_strfreev (extension_dirs);
++        }
 +
-         eel_debug_call_at_shutdown (free_module_objects);
      }
  }
+ 
-- 
2.46.0