From 530fb19c2e8f4f3ced87e698c69ef55b0b052122 Mon Sep 17 00:00:00 2001 From: Khalid Abu Shawarib Date: Tue, 12 Sep 2023 19:50:04 +0300 Subject: [PATCH] file-operations: Set new mtime when copying from a template Sets the file modified time as default when creating a file from a template so that it appears as a new file. Also bump glib dependency to 2.79 to insure the API for the default modification time is supported. Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/1686 --- meson.build | 2 +- src/nautilus-file-operations.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 18e750b72b..a434a45dd2 100644 --- a/meson.build +++ b/meson.build @@ -92,7 +92,7 @@ pkgconfig = import('pkgconfig') ################ # Dependencies # ################ -glib_ver = '>= 2.77.0' +glib_ver = '>= 2.79.0' libm = cc.find_library('m') diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c index ffae9316dc..c20cf895ef 100644 --- a/src/nautilus-file-operations.c +++ b/src/nautilus-file-operations.c @@ -121,6 +121,7 @@ typedef struct GFile *src; char *src_data; int length; + gboolean new_mtime; GFile *created_file; NautilusCreateCallback done_callback; gpointer done_callback_data; @@ -7729,7 +7730,8 @@ retry: { res = g_file_copy (job->src, dest, - G_FILE_COPY_TARGET_DEFAULT_PERMS, + G_FILE_COPY_TARGET_DEFAULT_PERMS | + job->new_mtime ? G_FILE_COPY_TARGET_DEFAULT_MODIFIED_TIME : 0, common->cancellable, NULL, NULL, &error); @@ -8243,6 +8245,7 @@ nautilus_file_operations_new_file_from_template (GtkWidget *parent_ job->done_callback_data = done_callback_data; job->dest_dir = g_file_new_for_uri (parent_dir); job->filename = g_strdup (target_filename); + job->new_mtime = TRUE; if (template_uri) { -- GitLab