[gvfs] dav: Fix free space reporting
- From: Tomas Bzatek <tbzatek src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] dav: Fix free space reporting
- Date: Thu, 9 Feb 2012 13:50:02 +0000 (UTC)
commit 99ae116200691c1dc67ea3fb74060e0d90bf482d
Author: Tomas Bzatek <tbzatek redhat com>
Date: Wed Feb 8 18:53:51 2012 +0100
dav: Fix free space reporting
Based on patch by Gareth Bult
https://bugzilla.gnome.org/show_bug.cgi?id=669258
daemon/gvfsbackenddav.c | 33 +++++++++++++++++++++------------
1 files changed, 21 insertions(+), 12 deletions(-)
---
diff --git a/daemon/gvfsbackenddav.c b/daemon/gvfsbackenddav.c
index 7410311..4f1d8e0 100644
--- a/daemon/gvfsbackenddav.c
+++ b/daemon/gvfsbackenddav.c
@@ -1089,6 +1089,12 @@ ms_response_to_fs_info (MsResponse *response,
xmlNodePtr node;
guint status;
const char *text;
+ guint64 bytes_avail;
+ guint64 bytes_used;
+ gboolean have_bytes_avail;
+ gboolean have_bytes_used;
+
+ have_bytes_avail = have_bytes_used = FALSE;
ms_response_get_propstat_iter (response, &iter);
while (xml_node_iter_next (&iter))
@@ -1109,28 +1115,31 @@ ms_response_to_fs_info (MsResponse *response,
if (node_has_name (node, "quota-available-bytes"))
{
- guint64 size;
-
- if (! string_to_uint64 (text, &size))
+ if (! string_to_uint64 (text, &bytes_avail))
continue;
- g_file_info_set_attribute_uint64 (info,
- G_FILE_ATTRIBUTE_FILESYSTEM_SIZE,
- size);
+ have_bytes_avail = TRUE;
}
else if (node_has_name (node, "quota-used-bytes"))
{
- guint64 size;
-
- if (! string_to_uint64 (text, &size))
+ if (! string_to_uint64 (text, &bytes_used))
continue;
- g_file_info_set_attribute_uint64 (info,
- G_FILE_ATTRIBUTE_FILESYSTEM_FREE,
- size);
+ have_bytes_used = TRUE;
}
}
}
+
+ if (have_bytes_avail)
+ {
+ g_file_info_set_attribute_uint64 (info,
+ G_FILE_ATTRIBUTE_FILESYSTEM_FREE,
+ bytes_avail);
+ if (have_bytes_used)
+ g_file_info_set_attribute_uint64 (info,
+ G_FILE_ATTRIBUTE_FILESYSTEM_SIZE,
+ bytes_avail + bytes_used);
+ }
}
static GFileType
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]