Gio.FileInfo¶
| Subclasses: | None | 
|---|
Methods¶
| Inherited: | GObject.Object (37) | 
|---|---|
| Structs: | GObject.ObjectClass (5) | 
Virtual Methods¶
| Inherited: | GObject.Object (7) | 
|---|
Properties¶
None
Signals¶
| Inherited: | GObject.Object (1) | 
|---|
Fields¶
| Inherited: | GObject.Object (1) | 
|---|
Class Details¶
- 
class Gio.FileInfo(**kwargs)¶
- Bases: - GObject.Object- Abstract: - No - Structure: - Gio.FileInfoClass- Functionality for manipulating basic metadata for files. - Gio.FileInfoimplements methods for getting information that all files should contain, and allows for manipulation of extended attributes.- See GFileAttribute for more information on how GIO handles file attributes. - To obtain a - Gio.FileInfofor a- Gio.File, use- Gio.File.query_info() (or its async variant). To obtain a- Gio.FileInfofor a file input or output stream, use- Gio.FileInputStream.query_info() or- Gio.FileOutputStream.query_info() (or their async variants).- To change the actual attributes of a file, you should then set the attribute in the - Gio.FileInfoand call- Gio.File.set_attributes_from_info() or- Gio.File.set_attributes_async() on a- Gio.File.- However, not all attributes can be changed in the file. For instance, the actual size of a file cannot be changed via - Gio.FileInfo.set_size(). You may call- Gio.File.query_settable_attributes() and- Gio.File.query_writable_namespaces() to discover the settable attributes of a particular file at runtime.- Gio.FileAttributeMatcherallows for searching through a- Gio.FileInfofor attributes.- 
classmethod new()[source]¶
- Returns: - a - Gio.FileInfo.- Return type: - Gio.FileInfo- Creates a new file info structure. 
 - 
copy_into(dest_info)[source]¶
- Parameters: - dest_info ( - Gio.FileInfo) – destination to copy attributes to.- First clears all of the GFileAttribute of dest_info, and then copies all of the file attributes from self to dest_info. 
 - 
dup()[source]¶
- Returns: - a duplicate - Gio.FileInfoof self.- Return type: - Gio.FileInfo- Duplicates a file info structure. 
 - 
get_attribute_as_string(attribute)[source]¶
- Parameters: - attribute ( - str) – a file attribute key.- Returns: - a UTF-8 string associated with the given attribute, or - Noneif the attribute wasn’t set. When you’re done with the string it must be freed with- GLib.free().- Return type: - stror- None- Gets the value of a attribute, formatted as a string. This escapes things as needed to make the string valid UTF-8. 
 - 
get_attribute_boolean(attribute)[source]¶
- Parameters: - attribute ( - str) – a file attribute key.- Returns: - the boolean value contained within the attribute. - Return type: - bool- Gets the value of a boolean attribute. If the attribute does not contain a boolean value, - Falsewill be returned.
 - 
get_attribute_byte_string(attribute)[source]¶
- Parameters: - attribute ( - str) – a file attribute key.- Returns: - the contents of the attribute value as a byte string, or - Noneotherwise.- Return type: - stror- None- Gets the value of a byte string attribute. If the attribute does not contain a byte string, - Nonewill be returned.
 - 
get_attribute_data(attribute)[source]¶
- Parameters: - attribute ( - str) – a file attribute key- Returns: - Trueif self has an attribute named attribute,- Falseotherwise.- type: - return location for the attribute type, or - None- value_pp: - return location for the attribute value, or - None; the attribute value will not be- None- status: - return location for the attribute status, or - None- Return type: - ( - bool, type:- Gio.FileAttributeType, value_pp:- object, status:- Gio.FileAttributeStatus)- Gets the attribute type, value and status for an attribute key. 
 - 
get_attribute_int32(attribute)[source]¶
- Parameters: - attribute ( - str) – a file attribute key.- Returns: - a signed 32-bit integer from the attribute. - Return type: - int- Gets a signed 32-bit integer contained within the attribute. If the attribute does not contain a signed 32-bit integer, or is invalid, 0 will be returned. 
 - 
get_attribute_int64(attribute)[source]¶
- Parameters: - attribute ( - str) – a file attribute key.- Returns: - a signed 64-bit integer from the attribute. - Return type: - int- Gets a signed 64-bit integer contained within the attribute. If the attribute does not contain a signed 64-bit integer, or is invalid, 0 will be returned. 
 - 
get_attribute_object(attribute)[source]¶
- Parameters: - attribute ( - str) – a file attribute key.- Returns: - a - GObject.Objectassociated with the given attribute, or- Noneotherwise.- Return type: - GObject.Objector- None- Gets the value of a - GObject.Objectattribute. If the attribute does not contain a- GObject.Object,- Nonewill be returned.
 - 
get_attribute_status(attribute)[source]¶
- Parameters: - attribute ( - str) – a file attribute key- Returns: - a - Gio.FileAttributeStatusfor the given attribute, or- Gio.FileAttributeStatus.UNSETif the key is invalid.- Return type: - Gio.FileAttributeStatus- Gets the attribute status for an attribute key. 
 - 
get_attribute_string(attribute)[source]¶
- Parameters: - attribute ( - str) – a file attribute key.- Returns: - the contents of the attribute value as a UTF-8 string, or - Noneotherwise.- Return type: - stror- None- Gets the value of a string attribute. If the attribute does not contain a string, - Nonewill be returned.
 - 
get_attribute_stringv(attribute)[source]¶
- Parameters: - attribute ( - str) – a file attribute key.- Returns: - the contents of the attribute value as a stringv, or - Noneotherwise. Do not free. These returned strings are UTF-8.- Return type: - [ - str] or- None- Gets the value of a stringv attribute. If the attribute does not contain a stringv, - Nonewill be returned.- New in version 2.22. 
 - 
get_attribute_type(attribute)[source]¶
- Parameters: - attribute ( - str) – a file attribute key.- Returns: - a - Gio.FileAttributeTypefor the given attribute, or- Gio.FileAttributeType.INVALIDif the key is not set.- Return type: - Gio.FileAttributeType- Gets the attribute type for an attribute key. 
 - 
get_attribute_uint32(attribute)[source]¶
- Parameters: - attribute ( - str) – a file attribute key.- Returns: - an unsigned 32-bit integer from the attribute. - Return type: - int- Gets an unsigned 32-bit integer contained within the attribute. If the attribute does not contain an unsigned 32-bit integer, or is invalid, 0 will be returned. 
 - 
get_attribute_uint64(attribute)[source]¶
- Parameters: - attribute ( - str) – a file attribute key.- Returns: - a unsigned 64-bit integer from the attribute. - Return type: - int- Gets a unsigned 64-bit integer contained within the attribute. If the attribute does not contain an unsigned 64-bit integer, or is invalid, 0 will be returned. 
 - 
get_content_type()[source]¶
- Returns: - a string containing the file’s content type, or - Noneif unknown.- Return type: - stror- None- Gets the file’s content type. 
 - 
get_deletion_date()[source]¶
- Returns: - a - GLib.DateTime, or- None.- Return type: - GLib.DateTimeor- None- Returns the - GLib.DateTimerepresenting the deletion date of the file, as available in- Gio.FILE_ATTRIBUTE_TRASH_DELETION_DATE. If the- Gio.FILE_ATTRIBUTE_TRASH_DELETION_DATEattribute is unset,- Noneis returned.- New in version 2.36. 
 - 
get_display_name()[source]¶
- Returns: - a string containing the display name. - Return type: - str- Gets a display name for a file. This is guaranteed to always be set. 
 - 
get_edit_name()[source]¶
- Returns: - a string containing the edit name. - Return type: - str- Gets the edit name for a file. 
 - 
get_etag()[source]¶
- Returns: - a string containing the value of the “etag:value” attribute. - Return type: - str- Gets the entity tag for a given - Gio.FileInfo. See- Gio.FILE_ATTRIBUTE_ETAG_VALUE.
 - 
get_file_type()[source]¶
- Returns: - a - Gio.FileTypefor the given file.- Return type: - Gio.FileType- Gets a file’s type (whether it is a regular file, symlink, etc). This is different from the file’s content type, see - Gio.FileInfo.get_content_type().
 - 
get_icon()[source]¶
- Returns: - Gio.Iconfor the given self.- Return type: - Gio.Icon- Gets the icon for a file. 
 - 
get_is_backup()[source]¶
- Returns: - Trueif file is a backup file,- Falseotherwise.- Return type: - bool- Checks if a file is a backup file. 
 - Returns: - Trueif the file is a hidden file,- Falseotherwise.- Return type: - bool- Checks if a file is hidden. 
 - 
get_is_symlink()[source]¶
- Returns: - Trueif the given self is a symlink.- Return type: - bool- Checks if a file is a symlink. 
 - 
get_modification_date_time()[source]¶
- Returns: - modification time, or - Noneif unknown- Return type: - GLib.DateTimeor- None- Gets the modification time of the current self and returns it as a - GLib.DateTime.- This requires the - Gio.FILE_ATTRIBUTE_TIME_MODIFIEDattribute. If- Gio.FILE_ATTRIBUTE_TIME_MODIFIED_USECis provided, the resulting- GLib.DateTimewill have microsecond precision.- New in version 2.62. 
 - 
get_modification_time()[source]¶
- Returns: - a - GLib.TimeVal.- Return type: - result: - GLib.TimeVal- Gets the modification time of the current self and sets it in result. - Deprecated since version 2.62: Use - Gio.FileInfo.get_modification_date_time() instead, as- GLib.TimeValis deprecated due to the year 2038 problem.
 - 
get_name()[source]¶
- Returns: - a string containing the file name. - Return type: - str- Gets the name for a file. This is guaranteed to always be set. 
 - 
get_size()[source]¶
- Returns: - a #goffset containing the file’s size. - Return type: - int- Gets the file’s size. 
 - 
get_sort_order()[source]¶
- Returns: - a #gint32 containing the value of the “standard::sort_order” attribute. - Return type: - int- Gets the value of the sort_order attribute from the - Gio.FileInfo. See- Gio.FILE_ATTRIBUTE_STANDARD_SORT_ORDER.
 - 
get_symbolic_icon()[source]¶
- Returns: - Gio.Iconfor the given self.- Return type: - Gio.Icon- Gets the symbolic icon for a file. - New in version 2.34. 
 - 
get_symlink_target()[source]¶
- Returns: - a string containing the symlink target. - Return type: - str- Gets the symlink target for a given - Gio.FileInfo.
 - 
has_attribute(attribute)[source]¶
- Parameters: - attribute ( - str) – a file attribute key.- Returns: - Trueif self has an attribute named attribute,- Falseotherwise.- Return type: - bool- Checks if a file info structure has an attribute named attribute. 
 - 
has_namespace(name_space)[source]¶
- Parameters: - name_space ( - str) – a file attribute namespace.- Returns: - Trueif self has an attribute in name_space,- Falseotherwise.- Return type: - bool- Checks if a file info structure has an attribute in the specified name_space. - New in version 2.22. 
 - 
list_attributes(name_space)[source]¶
- Parameters: - name_space ( - stror- None) – a file attribute key’s namespace, or- Noneto list all attributes.- Returns: - a null-terminated array of strings of all of the possible attribute types for the given name_space, or - Noneon error.- Return type: - [ - str] or- None- Lists the file info structure’s attributes. 
 - 
remove_attribute(attribute)[source]¶
- Parameters: - attribute ( - str) – a file attribute key.- Removes all cases of attribute from self if it exists. 
 - 
set_attribute(attribute, type, value_p)[source]¶
- Parameters: - attribute (str) – a file attribute key.
- type (Gio.FileAttributeType) – aGio.FileAttributeType
- value_p (object) – pointer to the value
 - Sets the attribute to contain the given value, if possible. To unset the attribute, use - Gio.FileAttributeType.INVALIDfor type.
- attribute (
 - 
set_attribute_boolean(attribute, attr_value)[source]¶
- Parameters: - Sets the attribute to contain the given attr_value, if possible. 
 - 
set_attribute_byte_string(attribute, attr_value)[source]¶
- Parameters: - Sets the attribute to contain the given attr_value, if possible. 
 - 
set_attribute_int32(attribute, attr_value)[source]¶
- Parameters: - Sets the attribute to contain the given attr_value, if possible. 
 - 
set_attribute_int64(attribute, attr_value)[source]¶
- Parameters: - Sets the attribute to contain the given attr_value, if possible. 
 - 
set_attribute_mask(mask)[source]¶
- Parameters: - mask ( - Gio.FileAttributeMatcher) – a- Gio.FileAttributeMatcher.- Sets mask on self to match specific attribute types. 
 - 
set_attribute_object(attribute, attr_value)[source]¶
- Parameters: - attribute (str) – a file attribute key.
- attr_value (GObject.Object) – aGObject.Object.
 - Sets the attribute to contain the given attr_value, if possible. 
- attribute (
 - 
set_attribute_status(attribute, status)[source]¶
- Parameters: - attribute (str) – a file attribute key
- status (Gio.FileAttributeStatus) – aGio.FileAttributeStatus
 - Returns: - Trueif the status was changed,- Falseif the key was not set.- Return type: - Sets the attribute status for an attribute key. This is only needed by external code that implement - Gio.File.set_attributes_from_info() or similar functions.- The attribute must exist in self for this to work. Otherwise - Falseis returned and self is unchanged.- New in version 2.22. 
- attribute (
 - 
set_attribute_string(attribute, attr_value)[source]¶
- Parameters: - Sets the attribute to contain the given attr_value, if possible. 
 - 
set_attribute_stringv(attribute, attr_value)[source]¶
- Parameters: - Sets the attribute to contain the given attr_value, if possible. - Sinze: 2.22 
 - 
set_attribute_uint32(attribute, attr_value)[source]¶
- Parameters: - Sets the attribute to contain the given attr_value, if possible. 
 - 
set_attribute_uint64(attribute, attr_value)[source]¶
- Parameters: - Sets the attribute to contain the given attr_value, if possible. 
 - 
set_content_type(content_type)[source]¶
- Parameters: - content_type ( - str) – a content type. See GContentType- Sets the content type attribute for a given - Gio.FileInfo. See- Gio.FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE.
 - 
set_display_name(display_name)[source]¶
- Parameters: - display_name ( - str) – a string containing a display name.- Sets the display name for the current - Gio.FileInfo. See- Gio.FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME.
 - 
set_edit_name(edit_name)[source]¶
- Parameters: - edit_name ( - str) – a string containing an edit name.- Sets the edit name for the current file. See - Gio.FILE_ATTRIBUTE_STANDARD_EDIT_NAME.
 - 
set_file_type(type)[source]¶
- Parameters: - type ( - Gio.FileType) – a- Gio.FileType.- Sets the file type in a - Gio.FileInfoto type. See- Gio.FILE_ATTRIBUTE_STANDARD_TYPE.
 - 
set_icon(icon)[source]¶
- Parameters: - icon ( - Gio.Icon) – a- Gio.Icon.- Sets the icon for a given - Gio.FileInfo. See- Gio.FILE_ATTRIBUTE_STANDARD_ICON.
 - Parameters: - is_hidden ( - bool) – a- bool.- Sets the “is_hidden” attribute in a - Gio.FileInfoaccording to is_hidden. See- Gio.FILE_ATTRIBUTE_STANDARD_IS_HIDDEN.
 - 
set_is_symlink(is_symlink)[source]¶
- Parameters: - is_symlink ( - bool) – a- bool.- Sets the “is_symlink” attribute in a - Gio.FileInfoaccording to is_symlink. See- Gio.FILE_ATTRIBUTE_STANDARD_IS_SYMLINK.
 - 
set_modification_date_time(mtime)[source]¶
- Parameters: - mtime ( - GLib.DateTime) – a- GLib.DateTime.- Sets the - Gio.FILE_ATTRIBUTE_TIME_MODIFIEDand- Gio.FILE_ATTRIBUTE_TIME_MODIFIED_USECattributes in the file info to the given date/time value.- New in version 2.62. 
 - 
set_modification_time(mtime)[source]¶
- Parameters: - mtime ( - GLib.TimeVal) – a- GLib.TimeVal.- Sets the - Gio.FILE_ATTRIBUTE_TIME_MODIFIEDand- Gio.FILE_ATTRIBUTE_TIME_MODIFIED_USECattributes in the file info to the given time value.- Deprecated since version 2.62: Use - Gio.FileInfo.set_modification_date_time() instead, as- GLib.TimeValis deprecated due to the year 2038 problem.
 - 
set_name(name)[source]¶
- Parameters: - name ( - str) – a string containing a name.- Sets the name attribute for the current - Gio.FileInfo. See- Gio.FILE_ATTRIBUTE_STANDARD_NAME.
 - 
set_size(size)[source]¶
- Parameters: - size ( - int) – a #goffset containing the file’s size.- Sets the - Gio.FILE_ATTRIBUTE_STANDARD_SIZEattribute in the file info to the given size.
 - 
set_sort_order(sort_order)[source]¶
- Parameters: - sort_order ( - int) – a sort order integer.- Sets the sort order attribute in the file info structure. See - Gio.FILE_ATTRIBUTE_STANDARD_SORT_ORDER.
 - 
set_symbolic_icon(icon)[source]¶
- Parameters: - icon ( - Gio.Icon) – a- Gio.Icon.- Sets the symbolic icon for a given - Gio.FileInfo. See- Gio.FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON.- New in version 2.34. 
 - 
set_symlink_target(symlink_target)[source]¶
- Parameters: - symlink_target ( - str) – a static string containing a path to a symlink target.- Sets the - Gio.FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGETattribute in the file info to the given symlink target.
 - 
unset_attribute_mask()[source]¶
- Unsets a mask set by - Gio.FileInfo.set_attribute_mask(), if one is set.
 
- 
classmethod