gi-gio-2.0.24: Gio bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (inaki@blueleaf.cc)
Safe HaskellNone
LanguageHaskell2010

GI.Gio.Objects.FileInfo

Contents

Description

Functionality for manipulating basic metadata for files. FileInfo implements methods for getting information that all files should contain, and allows for manipulation of extended attributes.

See [GFileAttribute][gio-GFileAttribute] for more information on how GIO handles file attributes.

To obtain a FileInfo for a File, use fileQueryInfo (or its async variant). To obtain a FileInfo for a file input or output stream, use fileInputStreamQueryInfo or fileOutputStreamQueryInfo (or their async variants).

To change the actual attributes of a file, you should then set the attribute in the FileInfo and call fileSetAttributesFromInfo or fileSetAttributesAsync on a GFile.

However, not all attributes can be changed in the file. For instance, the actual size of a file cannot be changed via fileInfoSetSize. You may call fileQuerySettableAttributes and fileQueryWritableNamespaces to discover the settable attributes of a particular file at runtime.

FileAttributeMatcher allows for searching through a FileInfo for attributes.

Synopsis

Exported types

newtype FileInfo Source #

Memory-managed wrapper type.

Constructors

FileInfo (ManagedPtr FileInfo) 
Instances
GObject FileInfo Source # 
Instance details

Defined in GI.Gio.Objects.FileInfo

Methods

gobjectType :: IO GType #

HasParentTypes FileInfo Source # 
Instance details

Defined in GI.Gio.Objects.FileInfo

type ParentTypes FileInfo Source # 
Instance details

Defined in GI.Gio.Objects.FileInfo

type ParentTypes FileInfo = Object ': ([] :: [Type])

class (GObject o, IsDescendantOf FileInfo o) => IsFileInfo o Source #

Type class for types which can be safely cast to FileInfo, for instance with toFileInfo.

Instances
(GObject o, IsDescendantOf FileInfo o) => IsFileInfo o Source # 
Instance details

Defined in GI.Gio.Objects.FileInfo

toFileInfo :: (MonadIO m, IsFileInfo o) => o -> m FileInfo Source #

Cast to FileInfo, for types for which this is known to be safe. For general casts, use castTo.

noFileInfo :: Maybe FileInfo Source #

A convenience alias for Nothing :: Maybe FileInfo.

Methods

clearStatus

fileInfoClearStatus Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> m () 

Clears the status information from info.

copyInto

fileInfoCopyInto Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a, IsFileInfo b) 
=> a

srcInfo: source to copy attributes from.

-> b

destInfo: destination to copy attributes to.

-> m () 

First clears all of the [GFileAttribute][gio-GFileAttribute] of destInfo, and then copies all of the file attributes from srcInfo to destInfo.

dup

fileInfoDup Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

other: a FileInfo.

-> m FileInfo

Returns: a duplicate FileInfo of other.

Duplicates a file info structure.

getAttributeAsString

fileInfoGetAttributeAsString Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Text

attribute: a file attribute key.

-> m Text

Returns: a UTF-8 string associated with the given attribute. When you're done with the string it must be freed with free.

Gets the value of a attribute, formated as a string. This escapes things as needed to make the string valid utf8.

getAttributeBoolean

fileInfoGetAttributeBoolean Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Text

attribute: a file attribute key.

-> m Bool

Returns: the boolean value contained within the attribute.

Gets the value of a boolean attribute. If the attribute does not contain a boolean value, False will be returned.

getAttributeByteString

fileInfoGetAttributeByteString Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Text

attribute: a file attribute key.

-> m Text

Returns: the contents of the attribute value as a byte string, or Nothing otherwise.

Gets the value of a byte string attribute. If the attribute does not contain a byte string, Nothing will be returned.

getAttributeData

fileInfoGetAttributeData Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo

-> Text

attribute: a file attribute key

-> m (Bool, FileAttributeType, Ptr (), FileAttributeStatus)

Returns: True if info has an attribute named attribute, False otherwise.

Gets the attribute type, value and status for an attribute key.

getAttributeInt32

fileInfoGetAttributeInt32 Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Text

attribute: a file attribute key.

-> m Int32

Returns: a signed 32-bit integer from the attribute.

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.

getAttributeInt64

fileInfoGetAttributeInt64 Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Text

attribute: a file attribute key.

-> m Int64

Returns: a signed 64-bit integer from the attribute.

Gets a signed 64-bit integer contained within the attribute. If the attribute does not contain an signed 64-bit integer, or is invalid, 0 will be returned.

getAttributeObject

fileInfoGetAttributeObject Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Text

attribute: a file attribute key.

-> m Object

Returns: a Object associated with the given attribute, or Nothing otherwise.

Gets the value of a Object attribute. If the attribute does not contain a Object, Nothing will be returned.

getAttributeStatus

fileInfoGetAttributeStatus Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo

-> Text

attribute: a file attribute key

-> m FileAttributeStatus

Returns: a FileAttributeStatus for the given attribute, or FileAttributeStatusUnset if the key is invalid.

Gets the attribute status for an attribute key.

getAttributeString

fileInfoGetAttributeString Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Text

attribute: a file attribute key.

-> m Text

Returns: the contents of the attribute value as a UTF-8 string, or Nothing otherwise.

Gets the value of a string attribute. If the attribute does not contain a string, Nothing will be returned.

getAttributeStringv

fileInfoGetAttributeStringv Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Text

attribute: a file attribute key.

-> m [Text]

Returns: the contents of the attribute value as a stringv, or Nothing otherwise. Do not free. These returned strings are UTF-8.

Gets the value of a stringv attribute. If the attribute does not contain a stringv, Nothing will be returned.

Since: 2.22

getAttributeType

fileInfoGetAttributeType Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Text

attribute: a file attribute key.

-> m FileAttributeType

Returns: a FileAttributeType for the given attribute, or FileAttributeTypeInvalid if the key is not set.

Gets the attribute type for an attribute key.

getAttributeUint32

fileInfoGetAttributeUint32 Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Text

attribute: a file attribute key.

-> m Word32

Returns: an unsigned 32-bit integer from the attribute.

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.

getAttributeUint64

fileInfoGetAttributeUint64 Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Text

attribute: a file attribute key.

-> m Word64

Returns: a unsigned 64-bit integer from the attribute.

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.

getContentType

fileInfoGetContentType Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> m Text

Returns: a string containing the file's content type.

Gets the file's content type.

getDeletionDate

fileInfoGetDeletionDate Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> m DateTime

Returns: a DateTime, or Nothing.

Returns the DateTime representing the deletion date of the file, as available in G_FILE_ATTRIBUTE_TRASH_DELETION_DATE. If the G_FILE_ATTRIBUTE_TRASH_DELETION_DATE attribute is unset, Nothing is returned.

Since: 2.36

getDisplayName

fileInfoGetDisplayName Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> m Text

Returns: a string containing the display name.

Gets a display name for a file.

getEditName

fileInfoGetEditName Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> m Text

Returns: a string containing the edit name.

Gets the edit name for a file.

getEtag

fileInfoGetEtag Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> m Text

Returns: a string containing the value of the "etag:value" attribute.

Gets the [entity tag][gfile-etag] for a given FileInfo. See FILE_ATTRIBUTE_ETAG_VALUE.

getFileType

fileInfoGetFileType Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> m FileType

Returns: a FileType for the given file.

Gets a file's type (whether it is a regular file, symlink, etc). This is different from the file's content type, see fileInfoGetContentType.

getIcon

fileInfoGetIcon Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> m Icon

Returns: Icon for the given info.

Gets the icon for a file.

getIsBackup

fileInfoGetIsBackup Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> m Bool

Returns: True if file is a backup file, False otherwise.

Checks if a file is a backup file.

getIsHidden

fileInfoGetIsHidden Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> m Bool

Returns: True if the file is a hidden file, False otherwise.

Checks if a file is hidden.

getIsSymlink

fileInfoGetIsSymlink Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> m Bool

Returns: True if the given info is a symlink.

Checks if a file is a symlink.

getModificationTime

fileInfoGetModificationTime Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> m TimeVal 

Gets the modification time of the current info and sets it in result.

getName

fileInfoGetName Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> m [Char]

Returns: a string containing the file name.

Gets the name for a file.

getSize

fileInfoGetSize Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> m Int64

Returns: a goffset containing the file's size.

Gets the file's size.

getSortOrder

fileInfoGetSortOrder Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> m Int32

Returns: a gint32 containing the value of the "standard::sort_order" attribute.

Gets the value of the sort_order attribute from the FileInfo. See FILE_ATTRIBUTE_STANDARD_SORT_ORDER.

getSymbolicIcon

fileInfoGetSymbolicIcon Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> m Icon

Returns: Icon for the given info.

Gets the symbolic icon for a file.

Since: 2.34

getSymlinkTarget

fileInfoGetSymlinkTarget Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> m Text

Returns: a string containing the symlink target.

Gets the symlink target for a given FileInfo.

hasAttribute

fileInfoHasAttribute Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Text

attribute: a file attribute key.

-> m Bool

Returns: True if ginfo has an attribute named attribute, False otherwise.

Checks if a file info structure has an attribute named attribute.

hasNamespace

fileInfoHasNamespace Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Text

nameSpace: a file attribute namespace.

-> m Bool

Returns: True if ginfo has an attribute in nameSpace, False otherwise.

Checks if a file info structure has an attribute in the specified nameSpace.

Since: 2.22

listAttributes

fileInfoListAttributes Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Maybe Text

nameSpace: a file attribute key's namespace, or Nothing to list all attributes.

-> m (Maybe [Text])

Returns: a null-terminated array of strings of all of the possible attribute types for the given nameSpace, or Nothing on error.

Lists the file info structure's attributes.

new

fileInfoNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m FileInfo

Returns: a FileInfo.

Creates a new file info structure.

removeAttribute

fileInfoRemoveAttribute Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Text

attribute: a file attribute key.

-> m () 

Removes all cases of attribute from info if it exists.

setAttribute

fileInfoSetAttribute Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Text

attribute: a file attribute key.

-> FileAttributeType

type: a FileAttributeType

-> Ptr ()

valueP: pointer to the value

-> m () 

Sets the attribute to contain the given value, if possible. To unset the attribute, use FileAttributeTypeInvalid for type.

setAttributeBoolean

fileInfoSetAttributeBoolean Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Text

attribute: a file attribute key.

-> Bool

attrValue: a boolean value.

-> m () 

Sets the attribute to contain the given attrValue, if possible.

setAttributeByteString

fileInfoSetAttributeByteString Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Text

attribute: a file attribute key.

-> Text

attrValue: a byte string.

-> m () 

Sets the attribute to contain the given attrValue, if possible.

setAttributeInt32

fileInfoSetAttributeInt32 Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Text

attribute: a file attribute key.

-> Int32

attrValue: a signed 32-bit integer

-> m () 

Sets the attribute to contain the given attrValue, if possible.

setAttributeInt64

fileInfoSetAttributeInt64 Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Text

attribute: attribute name to set.

-> Int64

attrValue: int64 value to set attribute to.

-> m () 

Sets the attribute to contain the given attrValue, if possible.

setAttributeMask

fileInfoSetAttributeMask Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> FileAttributeMatcher

mask: a FileAttributeMatcher.

-> m () 

Sets mask on info to match specific attribute types.

setAttributeObject

fileInfoSetAttributeObject Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a, IsObject b) 
=> a

info: a FileInfo.

-> Text

attribute: a file attribute key.

-> b

attrValue: a Object.

-> m () 

Sets the attribute to contain the given attrValue, if possible.

setAttributeStatus

fileInfoSetAttributeStatus Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo

-> Text

attribute: a file attribute key

-> FileAttributeStatus

status: a FileAttributeStatus

-> m Bool

Returns: True if the status was changed, False if the key was not set.

Sets the attribute status for an attribute key. This is only needed by external code that implement fileSetAttributesFromInfo or similar functions.

The attribute must exist in info for this to work. Otherwise False is returned and info is unchanged.

Since: 2.22

setAttributeString

fileInfoSetAttributeString Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Text

attribute: a file attribute key.

-> Text

attrValue: a UTF-8 string.

-> m () 

Sets the attribute to contain the given attrValue, if possible.

setAttributeStringv

fileInfoSetAttributeStringv Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Text

attribute: a file attribute key

-> [Text]

attrValue: a Nothing terminated array of UTF-8 strings.

-> m () 

Sets the attribute to contain the given attrValue, if possible.

Sinze: 2.22

setAttributeUint32

fileInfoSetAttributeUint32 Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Text

attribute: a file attribute key.

-> Word32

attrValue: an unsigned 32-bit integer.

-> m () 

Sets the attribute to contain the given attrValue, if possible.

setAttributeUint64

fileInfoSetAttributeUint64 Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Text

attribute: a file attribute key.

-> Word64

attrValue: an unsigned 64-bit integer.

-> m () 

Sets the attribute to contain the given attrValue, if possible.

setContentType

fileInfoSetContentType Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Text

contentType: a content type. See [GContentType][gio-GContentType]

-> m () 

Sets the content type attribute for a given FileInfo. See FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE.

setDisplayName

fileInfoSetDisplayName Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Text

displayName: a string containing a display name.

-> m () 

Sets the display name for the current FileInfo. See FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME.

setEditName

fileInfoSetEditName Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Text

editName: a string containing an edit name.

-> m () 

Sets the edit name for the current file. See FILE_ATTRIBUTE_STANDARD_EDIT_NAME.

setFileType

fileInfoSetFileType Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> FileType

type: a FileType.

-> m () 

Sets the file type in a FileInfo to type. See FILE_ATTRIBUTE_STANDARD_TYPE.

setIcon

fileInfoSetIcon Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a, IsIcon b) 
=> a

info: a FileInfo.

-> b

icon: a Icon.

-> m () 

Sets the icon for a given FileInfo. See FILE_ATTRIBUTE_STANDARD_ICON.

setIsHidden

fileInfoSetIsHidden Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Bool

isHidden: a Bool.

-> m () 

Sets the "is_hidden" attribute in a FileInfo according to isHidden. See FILE_ATTRIBUTE_STANDARD_IS_HIDDEN.

setIsSymlink

fileInfoSetIsSymlink Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Bool

isSymlink: a Bool.

-> m () 

Sets the "is_symlink" attribute in a FileInfo according to isSymlink. See FILE_ATTRIBUTE_STANDARD_IS_SYMLINK.

setModificationTime

fileInfoSetModificationTime Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> TimeVal

mtime: a TimeVal.

-> m () 

Sets the FILE_ATTRIBUTE_TIME_MODIFIED attribute in the file info to the given time value.

setName

fileInfoSetName Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> [Char]

name: a string containing a name.

-> m () 

Sets the name attribute for the current FileInfo. See FILE_ATTRIBUTE_STANDARD_NAME.

setSize

fileInfoSetSize Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Int64

size: a goffset containing the file's size.

-> m () 

Sets the FILE_ATTRIBUTE_STANDARD_SIZE attribute in the file info to the given size.

setSortOrder

fileInfoSetSortOrder Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Int32

sortOrder: a sort order integer.

-> m () 

Sets the sort order attribute in the file info structure. See FILE_ATTRIBUTE_STANDARD_SORT_ORDER.

setSymbolicIcon

fileInfoSetSymbolicIcon Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a, IsIcon b) 
=> a

info: a FileInfo.

-> b

icon: a Icon.

-> m () 

Sets the symbolic icon for a given FileInfo. See FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON.

Since: 2.34

setSymlinkTarget

fileInfoSetSymlinkTarget Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: a FileInfo.

-> Text

symlinkTarget: a static string containing a path to a symlink target.

-> m () 

Sets the FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET attribute in the file info to the given symlink target.

unsetAttributeMask

fileInfoUnsetAttributeMask Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileInfo a) 
=> a

info: FileInfo.

-> m () 

Unsets a mask set by fileInfoSetAttributeMask, if one is set.