[gvfs/gnome-3-22] google: Fix reported file size
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/gnome-3-22] google: Fix reported file size
- Date: Thu, 23 Mar 2017 15:58:31 +0000 (UTC)
commit d79b46508bd3a34edb1deaadc4142c22d97de913
Author: Ondrej Holy <oholy redhat com>
Date: Tue Nov 8 13:50:27 2016 +0100
google: Fix reported file size
Ligdata recently added API to obtain a real file size. Use
gdata_documents_entry_get_file_size if libgdata 0.17.7 is available
instead of gdata_documents_entry_get_quota_used, which returns 0
in some cases (e.g. shared files).
https://bugzilla.gnome.org/show_bug.cgi?id=773053
configure.ac | 5 +++++
daemon/gvfsbackendgoogle.c | 20 ++++++++++++++++----
2 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 09b7b55..bbf4059 100644
--- a/configure.ac
+++ b/configure.ac
@@ -429,6 +429,11 @@ if test "x$enable_google" != "xno" ; then
if test "x$msg_google" = "xyes"; then
PKG_CHECK_MODULES([GOOGLE], [goa-1.0 libgdata])
AC_DEFINE([HAVE_GOOGLE], 1, [Define to 1 if Google is going to be built])
+
+ PKG_CHECK_MODULES(LIBGDATA_0_17_7, libgdata >= 0.17.7,
+ AC_DEFINE(HAVE_LIBGDATA_0_17_7, 1, [Define to 1 if libgdata 0.17.7 is available]),
+ []
+ )
fi
fi
diff --git a/daemon/gvfsbackendgoogle.c b/daemon/gvfsbackendgoogle.c
index 442e031..7a27720 100644
--- a/daemon/gvfsbackendgoogle.c
+++ b/daemon/gvfsbackendgoogle.c
@@ -947,10 +947,14 @@ build_file_info (GVfsBackendGoogle *self,
}
else
{
- goffset quota_used;
-
- quota_used = gdata_documents_entry_get_quota_used (GDATA_DOCUMENTS_ENTRY (entry));
- g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_STANDARD_SIZE, (guint64) quota_used);
+ goffset size;
+
+#if HAVE_LIBGDATA_0_17_7
+ size = gdata_documents_entry_get_file_size (GDATA_DOCUMENTS_ENTRY (entry));
+#else
+ size = gdata_documents_entry_get_quota_used (GDATA_DOCUMENTS_ENTRY (entry));
+#endif
+ g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_STANDARD_SIZE, (guint64) size);
}
}
@@ -1274,7 +1278,11 @@ g_vfs_backend_google_copy (GVfsBackend *_self,
insert_entry (self, GDATA_ENTRY (new_entry));
g_hash_table_foreach (self->monitors, emit_create_event, entry_path);
+#if HAVE_LIBGDATA_0_17_7
+ size = gdata_documents_entry_get_file_size (new_entry);
+#else
size = gdata_documents_entry_get_quota_used (new_entry);
+#endif
g_vfs_job_progress_callback (size, size, job);
g_vfs_job_succeeded (G_VFS_JOB (job));
@@ -1941,7 +1949,11 @@ g_vfs_backend_google_push (GVfsBackend *_self,
}
}
+#if HAVE_LIBGDATA_0_17_7
+ size = gdata_documents_entry_get_file_size (GDATA_DOCUMENTS_ENTRY (new_document));
+#else
size = gdata_documents_entry_get_quota_used (GDATA_DOCUMENTS_ENTRY (new_document));
+#endif
g_vfs_job_progress_callback (size, size, job);
g_vfs_job_succeeded (G_VFS_JOB (job));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]