file-info: Add a G_FILE_ATTRIBUTE_THUMBNAIL_IS_VALID attribute

This indicates whether the thumbnail (given by G_FILE_ATTRIBUTE_THUMBNAIL_PATH)
is valid — i.e. to represent the file in its current state. If
G_FILE_ATTRIBUTE_THUMBNAIL_IS_VALID is FALSE (for a normal _or_ failed
thumbnail) it means the file has changed since the thumbnail was generated, and
the thumbnail is out of date.

Part of checking thumbnail validity (by the spec) involves parsing
headers out of the thumbnail .png so we include some (small) code to do
that in a separate file.  We will likely want to copy this code to gvfs
to do the same for GVfsFile.

Heavily based on a patch from Philip Withnall <philip.withnall@collabora.co.uk>
who suggested the feature and designed the API.

https://bugzilla.gnome.org/show_bug.cgi?id=709898
This commit is contained in:
Ryan Lortie
2013-10-11 11:22:31 +01:00
parent 38dc8d4cd3
commit fe7069749f
10 changed files with 335 additions and 11 deletions

View File

@@ -703,6 +703,21 @@ typedef struct _GFileInfoClass GFileInfoClass;
* #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
**/
#define G_FILE_ATTRIBUTE_THUMBNAILING_FAILED "thumbnail::failed" /* boolean */
/**
* G_FILE_ATTRIBUTE_THUMBNAIL_IS_VALID:
*
* A key in the "thumbnail" namespace for checking whether the thumbnail is outdated.
* This attribute is %TRUE if the thumbnail is up-to-date with the file it represents,
* and %FALSE if the file has been modified since the thumbnail was generated.
*
* If %G_FILE_ATTRIBUTE_THUMBNAILING_FAILED is %TRUE and this attribute is %FALSE,
* it indicates that thumbnailing may be attempted again and may succeed.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*
* Since: 2.40
*/
#define G_FILE_ATTRIBUTE_THUMBNAIL_IS_VALID "thumbnail::is-valid" /* boolean */
/* Preview */