gio-0.13.8.1: Binding to GIO

Maintainer | gtk2hs-devel@lists.sourceforge.net
Stability | alpha
Portability | portable (depends on GHC)
Safe Haskell | None
Language | Haskell98

System.GIO.File.FileInfo

Contents

- Details
- Types
- Enums,
- Methods

Description

Synopsis

- newtype FileInfo = FileInfo (ForeignPtr FileInfo)
- class GObjectClass o => FileInfoClass o
- data FileAttributeStatus
  - = FileAttributeStatusUnset
  - | FileAttributeStatusSet
  - | FileAttributeStatusErrorSetting
- fileInfoNew :: IO FileInfo
- fileInfoDup :: FileInfoClass info => info -> IO FileInfo
- fileInfoCopyInto :: (FileInfoClass srcInfo, FileInfoClass destInfo) => srcInfo -> destInfo -> IO ()
- fileInfoHasAttribute :: (FileInfoClass info, GlibString string) => info -> string -> Bool
- fileInfoHasNamespace :: (FileInfoClass info, GlibString string) => info -> string -> Bool
- fileInfoListAttributes :: (FileInfoClass info, GlibString string) => info -> string -> IO [string]
- fileInfoGetAttributeType :: (FileInfoClass info, GlibString string) => info -> string -> IO FileAttributeType
- fileInfoRemoveAttribute :: (FileInfoClass info, GlibString string) => info -> string -> IO ()
- fileInfoGetAttributeAsString :: (FileInfoClass info, GlibString string) => info -> string -> IO string
- fileInfoGetAttributeStatus :: (FileInfoClass info, GlibString string) => info -> string -> IO FileAttributeStatus
- fileInfoGetAttributeString :: (FileInfoClass info, GlibString string) => info -> string -> IO string
- fileInfoGetAttributeStringList :: (FileInfoClass info, GlibString string) => info -> string -> IO [string]
- fileInfoGetAttributeByteString :: (FileInfoClass info, GlibString string) => info -> string -> IO ByteString
- fileInfoGetAttributeBool :: (FileInfoClass info, GlibString string) => info -> string -> IO Bool
- fileInfoGetAttributeWord32 :: (FileInfoClass info, GlibString string) => info -> string -> IO Word32
- fileInfoGetAttributeInt32 :: (FileInfoClass info, GlibString string) => info -> string -> IO Int32
- fileInfoGetAttributeWord64 :: (FileInfoClass info, GlibString string) => info -> string -> IO Word64
- fileInfoGetAttributeInt64 :: (FileInfoClass info, GlibString string) => info -> string -> IO Int64
- fileInfoGetAttributeObject :: (FileInfoClass info, GlibString string) => info -> string -> IO (Maybe GObject)
- fileInfoSetAttributeStatus :: (FileInfoClass info, GlibString string) => info -> string -> FileAttributeStatus -> IO Bool
- fileInfoSetAttributeString :: (FileInfoClass info, GlibString string) => info -> string -> string -> IO ()
- fileInfoSetAttributeStringList :: (FileInfoClass info, GlibString string) => info -> string -> [string] -> IO ()
- fileInfoSetAttributeByteString :: (FileInfoClass info, GlibString string) => info -> string -> ByteString -> IO ()
- fileInfoSetAttributeBool :: (FileInfoClass info, GlibString string) => info -> string -> Bool -> IO ()
- fileInfoSetAttributeWord32 :: (FileInfoClass info, GlibString string) => info -> string -> Word32 -> IO ()
- fileInfoSetAttributeInt32 :: (FileInfoClass info, GlibString string) => info -> string -> Int32 -> IO ()
- fileInfoSetAttributeWord64 :: (FileInfoClass info, GlibString string) => info -> string -> Word64 -> IO ()
- fileInfoSetAttributeInt64 :: (FileInfoClass info, GlibString string) => info -> string -> Int64 -> IO ()
- fileInfoSetAttributeObject :: (FileInfoClass info, GlibString string) => info -> string -> GObject -> IO ()
- fileInfoClearStatus :: FileInfoClass info => info -> IO ()
- fileInfoGetFileType :: FileInfoClass info => info -> FileType
- fileInfoGetIsHidden :: FileInfoClass info => info -> Bool
- fileInfoGetIsBackup :: FileInfoClass info => info -> Bool
- fileInfoGetIsSymlink :: FileInfoClass info => info -> Bool
- fileInfoGetName :: FileInfoClass info => info -> Maybe ByteString
- fileInfoGetDisplayName :: (FileInfoClass info, GlibString string) => info -> Maybe string
- fileInfoGetEditName :: (FileInfoClass info, GlibString string) => info -> Maybe string
- fileInfoGetIcon :: FileInfoClass info => info -> IO Icon
- fileInfoGetContentType :: (FileInfoClass info, GlibString string) => info -> Maybe string
- fileInfoGetModificationTime :: FileInfoClass info => info -> GTimeVal
- fileInfoGetSize :: FileInfoClass info => info -> Int64
- fileInfoGetSymlinkTarget :: (FileInfoClass info, GlibString string) => info -> Maybe string
- fileInfoGetEtag :: (FileInfoClass info, GlibString string) => info -> Maybe string
- fileInfoGetSortOrder :: FileInfoClass info => info -> Int
- fileInfoUnsetAttributeMask :: FileInfoClass info => info -> IO ()
- fileInfoSetFileType :: FileInfoClass info => info -> FileType -> IO ()
- fileInfoSetIsHidden :: FileInfoClass info => info -> Bool -> IO ()
- fileInfoSetIsSymlink :: FileInfoClass info => info -> Bool -> IO ()
- fileInfoSetName :: FileInfoClass info => info -> ByteString -> IO ()
- fileInfoSetDisplayName :: (FileInfoClass info, GlibString string) => info -> string -> IO ()
- fileInfoSetEditName :: (FileInfoClass info, GlibString string) => info -> string -> IO ()
- fileInfoSetIcon :: FileInfoClass info => info -> Icon -> IO ()
- fileInfoSetContentType :: (FileInfoClass info, GlibString string) => info -> string -> IO ()
- fileInfoSetModificationTime :: FileInfoClass info => info -> GTimeVal -> IO ()
- fileInfoSetSize :: FileInfoClass info => info -> Int64 -> IO ()
- fileInfoSetSortOrder :: FileInfoClass info => info -> Int -> IO ()

# Details

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 `FileAttribute` for more information on how GIO handles file attributes.

To obtain a `FileInfo` for a `File`, use `fileQueryInfo`. To obtain a `FileInfo` for a file input or output stream, use `fileInputStreamQueryInfo` or `fileOutputStreamQueryInfo`.

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

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

`FileAttributeMatcher` allows for searching through a `FileInfo` for attributes.

# Types

newtype FileInfo Source #

Constructors

FileInfo (ForeignPtr FileInfo) |

#### Instances

Instances details

Eq FileInfo Source # |
Instance details Defined in System.GIO.Types Methods (==) :: FileInfo -> FileInfo -> Bool (/=) :: FileInfo -> FileInfo -> Bool
Ord FileInfo Source # |
Instance details Defined in System.GIO.Types Methods compare :: FileInfo -> FileInfo -> Ordering (<) :: FileInfo -> FileInfo -> Bool (<=) :: FileInfo -> FileInfo -> Bool (>) :: FileInfo -> FileInfo -> Bool (>=) :: FileInfo -> FileInfo -> Bool max :: FileInfo -> FileInfo -> FileInfo min :: FileInfo -> FileInfo -> FileInfo
GObjectClass FileInfo Source # |
Instance details Defined in System.GIO.Types Methods toGObject :: FileInfo -> GObject Source # unsafeCastGObject :: GObject -> FileInfo Source #
FileInfoClass FileInfo Source # |
Instance details Defined in System.GIO.Types

class GObjectClass o => FileInfoClass o Source #

#### Instances

Instances details

FileInfoClass AppLaunchContext Source # |
Instance details Defined in System.GIO.Types
FileInfoClass FileInfo Source # |
Instance details Defined in System.GIO.Types

# Enums,

data FileAttributeStatus Source #

Used by `fileSetAttributesFromInfo` when setting file attributes.

Constructors

FileAttributeStatusUnset |
FileAttributeStatusSet |
FileAttributeStatusErrorSetting |

#### Instances

Instances details

Bounded FileAttributeStatus Source # |
Instance details Defined in System.GIO.Enums Methods minBound :: FileAttributeStatus maxBound :: FileAttributeStatus
Enum FileAttributeStatus Source # |

Instance details

Defined in System.GIO.Enums

Methods

succ :: FileAttributeStatus -> FileAttributeStatus

pred :: FileAttributeStatus -> FileAttributeStatus

toEnum :: Int -> FileAttributeStatus

fromEnum :: FileAttributeStatus -> Int

enumFrom :: FileAttributeStatus -> [FileAttributeStatus]

enumFromThen :: FileAttributeStatus -> FileAttributeStatus -> [FileAttributeStatus]

enumFromTo :: FileAttributeStatus -> FileAttributeStatus -> [FileAttributeStatus]

enumFromThenTo :: FileAttributeStatus -> FileAttributeStatus -> FileAttributeStatus -> [FileAttributeStatus]

Eq FileAttributeStatus Source # |
Instance details Defined in System.GIO.Enums Methods (==) :: FileAttributeStatus -> FileAttributeStatus -> Bool (/=) :: FileAttributeStatus -> FileAttributeStatus -> Bool
Ord FileAttributeStatus Source # |

Instance details

Defined in System.GIO.Enums

Methods

compare :: FileAttributeStatus -> FileAttributeStatus -> Ordering

(<) :: FileAttributeStatus -> FileAttributeStatus -> Bool

(<=) :: FileAttributeStatus -> FileAttributeStatus -> Bool

(>) :: FileAttributeStatus -> FileAttributeStatus -> Bool

(>=) :: FileAttributeStatus -> FileAttributeStatus -> Bool

max :: FileAttributeStatus -> FileAttributeStatus -> FileAttributeStatus

min :: FileAttributeStatus -> FileAttributeStatus -> FileAttributeStatus

Show FileAttributeStatus Source # |
Instance details Defined in System.GIO.Enums Methods showsPrec :: Int -> FileAttributeStatus -> ShowS show :: FileAttributeStatus -> String showList :: [FileAttributeStatus] -> ShowS

# Methods

fileInfoNew :: IO FileInfo Source #

Creates a new file info structure.

fileInfoDup :: FileInfoClass info => info -> IO FileInfo Source #

Duplicates a file info structure.

fileInfoCopyInto Source #

Arguments

:: (FileInfoClass srcInfo, FileInfoClass destInfo) |
=> srcInfo | `srcInfo` source to copy attributes from.
-> destInfo | `destInfo` destination to copy attributes to.
-> IO () |

Copies all of the `FileAttributes` from `srcInfo` to `destInfo`.

fileInfoHasAttribute Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> string | `attribute` a file attribute key.
-> Bool | returns `True` if Ginfo has an attribute named attribute, `False` otherwise.

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

fileInfoHasNamespace Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> string | `namespace` a file namespace key.
-> Bool | returns `True` if Ginfo has an namespace named namespace, `False` otherwise.

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

fileInfoListAttributes Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> string | `nameSpace` a file attribute key's namespace.
-> IO [string] | returns a array of strings of all of the possible attribute types for the given `nameSpace`

Lists the file info structure's attributes.

fileInfoGetAttributeType Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> string | `attribute` a file attribute key.
-> IO FileAttributeType | returns a `FileAttributeType` for the given attribute, or `FileAttributeTypeInvalid` if the key is not set.

Gets the attribute type for an attribute key.

fileInfoRemoveAttribute Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> string | `attribute` a file attribute key.
-> IO () |

Removes all cases of attribute from info if it exists.

fileInfoGetAttributeAsString Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> string | `attribute` a file attribute key.
-> IO string | returns a UTF-8 string associated with the given attribute.

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

fileInfoGetAttributeStatus Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> string | `attribute` a file attribute key.
-> IO FileAttributeStatus | returns a `FileAttributeStatus` for the given attribute, or `FileAttributeStatusUnset` if the key is invalid.

Gets the attribute status for an attribute key.

fileInfoGetAttributeString Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> string | `attribute` a file attribute key.
-> IO string | returns the contents of the attribute value as a string

Gets the value of a string attribute.

fileInfoGetAttributeStringList Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> string | `attribute` a file attribute key.
-> IO [string] | returns the contents of the attribute value as a string list

Gets the value of a stringv attribute. If the attribute does not contain a stringv

fileInfoGetAttributeByteString Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> string | `attribute` a file attribute key.
-> IO ByteString | returns the contents of the attribute value as a ByteString

Gets the value of a byte string attribute.

fileInfoGetAttributeBool Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> string | `attribute` a file attribute key.
-> IO Bool | returns the contents of the attribute value as a bool

Gets the value of a boolean attribute.

fileInfoGetAttributeWord32 Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> string | `attribute` a file attribute key.
-> IO Word32 | returns the contents of the attribute value as a bool

Gets an Word32 contained within the attribute.

fileInfoGetAttributeInt32 Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> string | `attribute` a file attribute key.
-> IO Int32 | returns the contents of the attribute value as a bool

Gets an Int32 contained within the attribute.

fileInfoGetAttributeWord64 Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> string | `attribute` a file attribute key.
-> IO Word64 | returns the contents of the attribute value as a bool

Gets an Word64 contained within the attribute.

fileInfoGetAttributeInt64 Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> string | `attribute` a file attribute key.
-> IO Int64 | returns the contents of the attribute value as a bool

Gets an Int64 contained within the attribute.

fileInfoGetAttributeObject Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> string | `attribute` a file attribute key.
-> IO (Maybe GObject) | returns the contents of the attribute value as a object

Gets the value of a GObject attribute.

fileInfoSetAttributeStatus Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> string | `attribute` a file attribute key
-> FileAttributeStatus | `status` a `FileAttributeStatus`
-> IO 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.

fileInfoSetAttributeString Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> string | `attribute` a file attribute key.
-> string | `attrValue` a string.
-> IO () |

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

fileInfoSetAttributeStringList Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> string | `attribute` a file attribute key.
-> [string] | `attrValue` a string.
-> IO () |

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

fileInfoSetAttributeByteString Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> string | `attribute` a file attribute key.
-> ByteString | `attrValue` a string.
-> IO () |

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

fileInfoSetAttributeBool Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> string | `attribute` a file attribute key.
-> Bool | `attrValue` a string.
-> IO () |

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

fileInfoSetAttributeWord32 Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> string | `attribute` a file attribute key.
-> Word32 | `attrValue` an Word32
-> IO () |

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

fileInfoSetAttributeInt32 Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> string | `attribute` a file attribute key.
-> Int32 | `attrValue` an Int32
-> IO () |

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

fileInfoSetAttributeWord64 Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> string | `attribute` a file attribute key.
-> Word64 | `attrValue` an Word64
-> IO () |

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

fileInfoSetAttributeInt64 Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> string | `attribute` a file attribute key.
-> Int64 | `attrValue` an Int64
-> IO () |

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

fileInfoSetAttributeObject :: (FileInfoClass info, GlibString string) => info -> string -> GObject -> IO () Source #

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

fileInfoClearStatus :: FileInfoClass info => info -> IO () Source #

Clears the status information from info.

fileInfoGetFileType Source #

Arguments

:: FileInfoClass info |
=> info |
-> 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`.

fileInfoGetIsHidden Source #

Arguments

:: FileInfoClass info |
=> info |
-> Bool | returns `True` if the file is a hidden file, `False` otherwise.

Checks if a file is hidden.

fileInfoGetIsBackup Source #

Arguments

:: FileInfoClass info |
=> info |
-> Bool | returns `True` if the file is a backup file, `False` otherwise.

Checks if a file is a backup file.

fileInfoGetIsSymlink Source #

Arguments

:: FileInfoClass info |
=> info |
-> Bool | returns `True` if the file is a symlink file, `False` otherwise.

Checks if a file is a symlink file.

fileInfoGetName Source #

Arguments

:: FileInfoClass info |
=> info |
-> Maybe ByteString | returns a string containing the file name.

Gets the name for a file.

fileInfoGetDisplayName Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> Maybe string | returns a string containing the display name.

Gets the display name for a file.

fileInfoGetEditName Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> Maybe string | returns a string containing the edit name.

Gets the edit name for a file.

fileInfoGetIcon Source #

Arguments

:: FileInfoClass info |
=> info |
-> IO Icon | returns `Icon` for the given info.

Gets the icon for a file.

fileInfoGetContentType Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> Maybe string | returns a string containing the file's content type.

Gets the file's content type.

fileInfoGetModificationTime :: FileInfoClass info => info -> GTimeVal Source #

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

fileInfoGetSize Source #

Arguments

:: FileInfoClass info |
=> info |
-> Int64 | returns a `Offset` containing the file's size.

Gets the file's size.

fileInfoGetSymlinkTarget Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> Maybe string | returns a string containing the symlink target.

Gets the symlink target for a given `FileInfo`.

fileInfoGetEtag Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> Maybe string | returns a string containing the value of the "etag:value" attribute.

Gets the entity tag for a given `FileInfo`. See `FileAttributeEtagValue`.

fileInfoGetSortOrder Source #

Arguments

:: FileInfoClass info |
=> info |
-> Int | returns the value of the "standard::sort_order" attribute.

Gets the value of the `sortOrder` attribute from the `FileInfo`. See `FileAttributeStandardSortOrder`.

fileInfoUnsetAttributeMask :: FileInfoClass info => info -> IO () Source #

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

fileInfoSetFileType :: FileInfoClass info => info -> FileType -> IO () Source #

Sets the file type in a `FileInfo` to type. See `FileAttributeStandardType`.

fileInfoSetIsHidden :: FileInfoClass info => info -> Bool -> IO () Source #

Sets the `isHidden` attribute in a `FileInfo` according to `isSymlink`. See `FileAttributeStandardIsHidden`.

fileInfoSetIsSymlink :: FileInfoClass info => info -> Bool -> IO () Source #

Sets the `isSymlink` attribute in a `FileInfo` according to `isSymlink`. See `FileAttributeStandardIsSymlink`.

fileInfoSetName :: FileInfoClass info => info -> ByteString -> IO () Source #

Sets the name attribute for the current `FileInfo`. See `FileAttributeStandardName`.

fileInfoSetDisplayName :: (FileInfoClass info, GlibString string) => info -> string -> IO () Source #

Sets the display name for the current `FileInfo`. See `FileAttributeStandardDisplayName`.

fileInfoSetEditName :: (FileInfoClass info, GlibString string) => info -> string -> IO () Source #

Sets the edit name for the current `FileInfo`. See `FileAttributeStandardEditName`.

fileInfoSetIcon :: FileInfoClass info => info -> Icon -> IO () Source #

Sets the icon for a given `FileInfo`. See `FileAttributeStandardIcon`.

fileInfoSetContentType Source #

Arguments

:: (FileInfoClass info, GlibString string) |
=> info |
-> string | `contentType` a content type. See GContentType.
-> IO () |

Sets the content type attribute for a given `FileInfo`. See `FileAttributeStandardContentType`.

fileInfoSetModificationTime :: FileInfoClass info => info -> GTimeVal -> IO () Source #

Sets the `FileAttributeTimeModified` attribute in the file info to the given time value.

fileInfoSetSize Source #

Arguments

:: FileInfoClass info |
=> info |
-> Int64 | `size` a goffset containing the file's size.
-> IO () |

Sets the `FileAttributeStandardSize` attribute in the file info to the given size.

fileInfoSetSortOrder Source #

Arguments

:: FileInfoClass info |
=> info |
-> Int | `sortOrder` a sort order integer.
-> IO () |

Sets the `FileAttributeStandardSymlinkTarget` attribute in the file info to the given symlink target. fileInfoSetSymlinkTarget :: FileInfoClass info => info -> String -- ^ `symlinkTarget` a static string containing a path to a symlink target. -> IO () fileInfoSetSymlinkTarget info symlinkTarget = withUTFString symlinkTarget $ symlinkTargetPtr -> {} (toFileInfo info) symlinkTargetPtr

Sets the sort order attribute in the file info structure. See `FileAttributeStandardSortOrder`.