Make free space calculation use Memory/Location in capability if available

Bug #120544 reported by James Henstridge
2
Affects Status Importance Assigned to Milestone
OBEX FTP Client for GNOME-VFS
Confirmed
Medium
James Henstridge

Bug Description

After fixing bug 116912, the get_volume_free_space() routine was changed to:

 1. get_file_info() on URI (which involves listing the parent folder and filtering looking for the matching entry).
 2. if file info from (1) is not for a directory, get_file_info() for parent URI
 3. get capability object from device.
 4. if we have a memory type from the file info, look up that free space. If not, get free space from first memory type.

This results in either two or three round trips to calculate the free space. This is excessive in the following cases:
 1. the phone does not provide a capability object.
 2. the phone only lists exactly one memory type in the capability object.
 3. the capability object includes <Location> information for each memory, which we could use to infer the connection without checking folder listings.

A better algorithm would be:
 1. get capability object from device
 2. if this fails, return an error.
 3. if there are no memory types in the the capability object or all memory types provide no free space, return an error.
 4. if a single memory is listed in the capability object, return its free space.
 5. if there is a memory type with a <Location> that matches the URI, return its free space.
 6. get a file info using (1) and (2) from the original workflow. If that gives us a memory type, use that.
 7. return the free space from the first memory type.

Changed in gnome-vfs-obexftp:
assignee: nobody → jamesh
importance: Undecided → Medium
status: Unconfirmed → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.