[gvfs] mtp: Refresh storage information in query_info



commit e7e6e1cde38f935e04e3e9d651eacf57557ff0c5
Author: Ross Lagerwall <rosslagerwall gmail com>
Date:   Sun May 17 07:47:43 2015 +0100

    mtp: Refresh storage information in query_info
    
    Get the storage information from the device in query_info() and
    query_fs_info() so that the disk space numbers are correct. Previously,
    if you deleted an item and checked the free space, it would not have
    changed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=749491

 daemon/gvfsbackendmtp.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/daemon/gvfsbackendmtp.c b/daemon/gvfsbackendmtp.c
index 0366116..4ecd988 100644
--- a/daemon/gvfsbackendmtp.c
+++ b/daemon/gvfsbackendmtp.c
@@ -1378,6 +1378,12 @@ do_query_info (GVfsBackend *backend,
 
     LIBMTP_devicestorage_t *storage;
     gboolean found = FALSE;
+
+    int ret = LIBMTP_Get_Storage (device, LIBMTP_STORAGE_SORTBY_NOTSORTED);
+    if (ret != 0) {
+      fail_job (G_VFS_JOB (job), device);
+      goto exit;
+    }
     for (storage = device->storage; storage != 0; storage = storage->next) {
       if (storage->id == entry->storage) {
         DEBUG ("(I) found storage %X\n", storage->id);
@@ -1459,6 +1465,12 @@ do_query_fs_info (GVfsBackend *backend,
     }
 
     LIBMTP_devicestorage_t *storage;
+
+    int ret = LIBMTP_Get_Storage (device, LIBMTP_STORAGE_SORTBY_NOTSORTED);
+    if (ret != 0) {
+      fail_job (G_VFS_JOB (job), device);
+      goto exit;
+    }
     for (storage = device->storage; storage != 0; storage = storage->next) {
       if (storage->id == entry->storage) {
         get_storage_info (storage, info);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]