[gvfs] gphoto: Set mtime when pulling
- From: Ross Lagerwall <rossl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] gphoto: Set mtime when pulling
- Date: Thu, 7 Aug 2014 16:56:50 +0000 (UTC)
commit 0aafc320c4278ccb0469d2aea981ab03db3cbfab
Author: Ross Lagerwall <rosslagerwall gmail com>
Date: Sat Jul 26 07:16:10 2014 +0100
gphoto: Set mtime when pulling
Commit 86162bbe4b09 ("gphoto2: Implement pull support") failed to set
the modification time of the destination file when implementing pull
support.
Fix this by setting the modification time on the destination file (only
the mtime in seconds needs to be set since this is the only time info
the gphoto supports).
https://bugzilla.gnome.org/show_bug.cgi?id=733469
daemon/gvfsbackendgphoto2.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/daemon/gvfsbackendgphoto2.c b/daemon/gvfsbackendgphoto2.c
index 2c2b5c2..645ff94 100644
--- a/daemon/gvfsbackendgphoto2.c
+++ b/daemon/gvfsbackendgphoto2.c
@@ -3532,9 +3532,10 @@ do_pull (GVfsBackend *backend,
GError *error = NULL;
PullContext pc;
CameraFile *file;
- GFile *dest;
+ GFile *dest = NULL;
GFileDescriptorBased *fdstream;
char *dir, *name;
+ guint64 mtime;
int rc;
ensure_not_dirty (gphoto2_backend);
@@ -3576,7 +3577,6 @@ do_pull (GVfsBackend *backend,
G_FILE_CREATE_NONE,
G_VFS_JOB (job)->cancellable, &error));
}
- g_object_unref (dest);
if (!fdstream)
{
@@ -3623,6 +3623,14 @@ do_pull (GVfsBackend *backend,
goto out;
}
+ /* Ignore errors here. Failure to copy metadata is not a hard error */
+ mtime = g_file_info_get_attribute_uint64 (info,
+ G_FILE_ATTRIBUTE_TIME_MODIFIED);
+ g_file_set_attribute_uint64 (dest,
+ G_FILE_ATTRIBUTE_TIME_MODIFIED, mtime,
+ G_FILE_QUERY_INFO_NONE,
+ G_VFS_JOB (job)->cancellable, NULL);
+
if (remove_source)
{
rc = gp_camera_file_delete (gphoto2_backend->camera,
@@ -3645,6 +3653,7 @@ do_pull (GVfsBackend *backend,
out:
g_object_unref (info);
+ g_clear_object (&dest);
g_free (name);
g_free (dir);
g_clear_error (&error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]