Add defines for trash::orig-path and trash::deletion-date

See bug 612107.
This commit is contained in:
Matthias Clasen 2010-03-08 00:36:00 -05:00
parent 96d105906e
commit 826abbefce
2 changed files with 40 additions and 14 deletions

View File

@ -25,30 +25,30 @@
* @short_description: File Information and Attributes * @short_description: File Information and Attributes
* @include: gio/gio.h * @include: gio/gio.h
* @see_also: #GFile, <link linkend="gio-GFileAttribute">GFileAttribute</link> * @see_also: #GFile, <link linkend="gio-GFileAttribute">GFileAttribute</link>
* *
* Functionality for manipulating basic metadata for files. #GFileInfo * Functionality for manipulating basic metadata for files. #GFileInfo
* implements methods for getting information that all files should * implements methods for getting information that all files should
* contain, and allows for manipulation of extended attributes. * contain, and allows for manipulation of extended attributes.
* *
* See <link linkend="gio-GFileAttribute">GFileAttribute</link> for more * See <link linkend="gio-GFileAttribute">GFileAttribute</link> for more
* information on how GIO handles file attributes. * information on how GIO handles file attributes.
* *
* To obtain a #GFileInfo for a #GFile, use g_file_query_info() (or its * To obtain a #GFileInfo for a #GFile, use g_file_query_info() (or its
* async variant). To obtain a #GFileInfo for a file input or output * async variant). To obtain a #GFileInfo for a file input or output
* stream, use g_file_input_stream_query_info() or * stream, use g_file_input_stream_query_info() or
* g_file_output_stream_query_info() (or their async variants). * g_file_output_stream_query_info() (or their async variants).
* *
* To change the actual attributes of a file, you should then set the * To change the actual attributes of a file, you should then set the
* attribute in the #GFileInfo and call g_file_set_attributes_from_info() * attribute in the #GFileInfo and call g_file_set_attributes_from_info()
* or g_file_set_attributes_async() on a GFile. * or g_file_set_attributes_async() on a GFile.
* *
* However, not all attributes can be changed in the file. For instance, * However, not all attributes can be changed in the file. For instance,
* the actual size of a file cannot be changed via g_file_info_set_size(). * the actual size of a file cannot be changed via g_file_info_set_size().
* You may call g_file_query_settable_attributes() and * You may call g_file_query_settable_attributes() and
* g_file_query_writable_namespaces() to discover the settable attributes * g_file_query_writable_namespaces() to discover the settable attributes
* of a particular file at runtime. * of a particular file at runtime.
* *
* #GFileAttributeMatcher allows for searching through a #GFileInfo for * #GFileAttributeMatcher allows for searching through a #GFileInfo for
* attributes. * attributes.
**/ **/
@ -259,6 +259,8 @@ ensure_attribute_hash (void)
REGISTER_ATTRIBUTE (GVFS_BACKEND); REGISTER_ATTRIBUTE (GVFS_BACKEND);
REGISTER_ATTRIBUTE (SELINUX_CONTEXT); REGISTER_ATTRIBUTE (SELINUX_CONTEXT);
REGISTER_ATTRIBUTE (TRASH_ITEM_COUNT); REGISTER_ATTRIBUTE (TRASH_ITEM_COUNT);
REGISTER_ATTRIBUTE (TRASH_ORIG_PATH);
REGISTER_ATTRIBUTE (TRASH_DELETION_DATE);
#undef REGISTER_ATTRIBUTE #undef REGISTER_ATTRIBUTE
} }
@ -320,7 +322,7 @@ g_file_info_finalize (GObject *object)
attrs = (GFileAttribute *)info->attributes->data; attrs = (GFileAttribute *)info->attributes->data;
for (i = 0; i < info->attributes->len; i++) for (i = 0; i < info->attributes->len; i++)
_g_file_attribute_value_clear (&attrs[i].value); _g_file_attribute_value_clear (&attrs[i].value);
g_array_free (info->attributes, TRUE); g_array_free (info->attributes, TRUE);
if (info->mask != NO_ATTRIBUTE_MASK) if (info->mask != NO_ATTRIBUTE_MASK)
g_file_attribute_matcher_unref (info->mask); g_file_attribute_matcher_unref (info->mask);

View File

@ -783,6 +783,30 @@ typedef struct _GFileInfoClass GFileInfoClass;
**/ **/
#define G_FILE_ATTRIBUTE_TRASH_ITEM_COUNT "trash::item-count" /* uint32 */ #define G_FILE_ATTRIBUTE_TRASH_ITEM_COUNT "trash::item-count" /* uint32 */
/**
* G_FILE_ATTRIBUTE_TRASH_ORIG_PATH:
*
* A key in the "trash" namespace. When requested against
* items in "trash:///", will return the original path to the file before it
* was trashed. Corresponding #GFileAttributeType is
* %G_FILE_ATTRIBUTE_TYPE_STRING.
*
* Since: 2.24.
**/
#define G_FILE_ATTRIBUTE_TRASH_ORIG_PATH "trash::orig-path" /* string */
/**
* G_FILE_ATTRIBUTE_TRASH_DELETION_DATE:
*
* A key in the "trash" namespace. When requested against
* items in "trash:///", will return the date and time when the file
* was trashed. The format of the returned string is YYYY-MM-DDThh:mm:ss.
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
*
* Since: 2.24.
**/
#define G_FILE_ATTRIBUTE_TRASH_DELETION_DATE "trash::deletion-date" /* string */
GType g_file_info_get_type (void) G_GNUC_CONST; GType g_file_info_get_type (void) G_GNUC_CONST;
GFileInfo * g_file_info_new (void); GFileInfo * g_file_info_new (void);