-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Binding to the GIO. -- -- GIO is striving to provide a modern, easy-to-use VFS API that sits at -- the right level in the library stack. The goal is to overcome the -- shortcomings of GnomeVFS and provide an API that is so good that -- developers prefer it over raw POSIX calls. Among other things that -- means using GObject. It also means not cloning the POSIX API, but -- providing higher-level, document-centric interfaces. @package gio @version 0.12.0 module System.GIO.Enums -- | Flags used when querying a FileInfo. data FileQueryInfoFlags FileQueryInfoNone :: FileQueryInfoFlags FileQueryInfoNofollowSymlinks :: FileQueryInfoFlags data FileCreateFlags FileCreateNone :: FileCreateFlags FileCreatePrivate :: FileCreateFlags FileCreateReplaceDestination :: FileCreateFlags -- | Flags used when copying or moving files. data FileCopyFlags FileCopyNone :: FileCopyFlags FileCopyOverwrite :: FileCopyFlags FileCopyBackup :: FileCopyFlags FileCopyNofollowSymlinks :: FileCopyFlags FileCopyAllMetadata :: FileCopyFlags FileCopyNoFallbackForMove :: FileCopyFlags FileCopyTargetDefaultPerms :: FileCopyFlags -- | Flags used to set what a FileMonitor will watch for. data FileMonitorFlags FileMonitorNone :: FileMonitorFlags FileMonitorWatchMounts :: FileMonitorFlags FileMonitorSendMoved :: FileMonitorFlags data FilesystemPreviewType FilesystemPreviewTypeIfAlways :: FilesystemPreviewType FilesystemPreviewTypeIfLocal :: FilesystemPreviewType FilesystemPreviewTypeNever :: FilesystemPreviewType -- | Indicates the file's on-disk type. data FileType FileTypeUnknown :: FileType FileTypeRegular :: FileType FileTypeDirectory :: FileType FileTypeSymbolicLink :: FileType FileTypeSpecial :: FileType FileTypeShortcut :: FileType FileTypeMountable :: FileType -- | Used by fileSetAttributesFromInfo when setting file -- attributes. data FileAttributeStatus FileAttributeStatusUnset :: FileAttributeStatus FileAttributeStatusSet :: FileAttributeStatus FileAttributeStatusErrorSetting :: FileAttributeStatus -- | Flags specifying the behaviour of an attribute. data FileAttributeInfoFlags FileAttributeInfoNone :: FileAttributeInfoFlags FileAttributeInfoCopyWithFile :: FileAttributeInfoFlags FileAttributeInfoCopyWhenMoved :: FileAttributeInfoFlags data AskPasswordFlags AskPasswordNeedPassword :: AskPasswordFlags AskPasswordNeedUsername :: AskPasswordFlags AskPasswordNeedDomain :: AskPasswordFlags AskPasswordSavingSupported :: AskPasswordFlags AskPasswordAnonymousSupported :: AskPasswordFlags -- | PasswordSave is used to indicate the lifespan of a saved -- password. data PasswordSave PasswordSaveNever :: PasswordSave PasswordSaveForSession :: PasswordSave PasswordSavePermanently :: PasswordSave data MountOperationResult MountOperationHandled :: MountOperationResult MountOperationAborted :: MountOperationResult MountOperationUnhandled :: MountOperationResult -- | Error codes returned by GIO functions. data IOErrorEnum IoErrorFailed :: IOErrorEnum IoErrorNotFound :: IOErrorEnum IoErrorExists :: IOErrorEnum IoErrorIsDirectory :: IOErrorEnum IoErrorNotDirectory :: IOErrorEnum IoErrorNotEmpty :: IOErrorEnum IoErrorNotRegularFile :: IOErrorEnum IoErrorNotSymbolicLink :: IOErrorEnum IoErrorNotMountableFile :: IOErrorEnum IoErrorFilenameTooLong :: IOErrorEnum IoErrorInvalidFilename :: IOErrorEnum IoErrorTooManyLinks :: IOErrorEnum IoErrorNoSpace :: IOErrorEnum IoErrorInvalidArgument :: IOErrorEnum IoErrorPermissionDenied :: IOErrorEnum IoErrorNotSupported :: IOErrorEnum IoErrorNotMounted :: IOErrorEnum IoErrorAlreadyMounted :: IOErrorEnum IoErrorClosed :: IOErrorEnum IoErrorCancelled :: IOErrorEnum IoErrorPending :: IOErrorEnum IoErrorReadOnly :: IOErrorEnum IoErrorCantCreateBackup :: IOErrorEnum IoErrorWrongEtag :: IOErrorEnum IoErrorTimedOut :: IOErrorEnum IoErrorWouldRecurse :: IOErrorEnum IoErrorBusy :: IOErrorEnum IoErrorWouldBlock :: IOErrorEnum IoErrorHostNotFound :: IOErrorEnum IoErrorWouldMerge :: IOErrorEnum IoErrorFailedHandled :: IOErrorEnum IoErrorTooManyOpenFiles :: IOErrorEnum IoErrorNotInitialized :: IOErrorEnum IoErrorAddressInUse :: IOErrorEnum IoErrorPartialInput :: IOErrorEnum IoErrorInvalidData :: IOErrorEnum IoErrorDbusError :: IOErrorEnum IoErrorHostUnreachable :: IOErrorEnum IoErrorNetworkUnreachable :: IOErrorEnum IoErrorConnectionRefused :: IOErrorEnum IoErrorProxyFailed :: IOErrorEnum IoErrorProxyAuthFailed :: IOErrorEnum IoErrorProxyNeedAuth :: IOErrorEnum IoErrorProxyNotAllowed :: IOErrorEnum -- | Specifies what type of event a monitor event is. data FileMonitorEvent FileMonitorEventChanged :: FileMonitorEvent FileMonitorEventChangesDoneHint :: FileMonitorEvent FileMonitorEventDeleted :: FileMonitorEvent FileMonitorEventCreated :: FileMonitorEvent FileMonitorEventAttributeChanged :: FileMonitorEvent FileMonitorEventPreUnmount :: FileMonitorEvent FileMonitorEventUnmounted :: FileMonitorEvent FileMonitorEventMoved :: FileMonitorEvent -- | Flags used when mounting a mount. data MountMountFlags MountMountNone :: MountMountFlags -- | Flags used when an unmounting a mount. data MountUnmountFlags MountUnmountNone :: MountUnmountFlags MountUnmountForce :: MountUnmountFlags -- | Flags used when starting a drive. data DriveStartFlags DriveStartNone :: DriveStartFlags -- | Enumeration describing how a drive can be started/stopped. data DriveStartStopType DriveStartStopTypeUnknown :: DriveStartStopType DriveStartStopTypeShutdown :: DriveStartStopType DriveStartStopTypeNetwork :: DriveStartStopType DriveStartStopTypeMultidisk :: DriveStartStopType DriveStartStopTypePassword :: DriveStartStopType -- | EmblemOrigin is used to add information about the origin of the -- emblem to Emblem. data EmblemOrigin EmblemOriginUnknown :: EmblemOrigin EmblemOriginDevice :: EmblemOrigin EmblemOriginLivemetadata :: EmblemOrigin EmblemOriginTag :: EmblemOrigin -- | Flags used when creating a AppInfo. data AppInfoCreateFlags AppInfoCreateNone :: AppInfoCreateFlags AppInfoCreateNeedsTerminal :: AppInfoCreateFlags AppInfoCreateSupportsUris :: AppInfoCreateFlags AppInfoCreateSupportsStartupNotification :: AppInfoCreateFlags instance Typeable FileQueryInfoFlags instance Typeable FileCreateFlags instance Typeable FileCopyFlags instance Typeable FileMonitorFlags instance Typeable FilesystemPreviewType instance Typeable FileType instance Typeable FileAttributeStatus instance Typeable AskPasswordFlags instance Typeable PasswordSave instance Typeable MountOperationResult instance Typeable IOErrorEnum instance Typeable FileMonitorEvent instance Typeable MountMountFlags instance Typeable MountUnmountFlags instance Typeable DriveStartFlags instance Typeable DriveStartStopType instance Typeable EmblemOrigin instance Typeable AppInfoCreateFlags instance Eq FileQueryInfoFlags instance Ord FileQueryInfoFlags instance Bounded FileQueryInfoFlags instance Show FileQueryInfoFlags instance Eq FileCreateFlags instance Ord FileCreateFlags instance Bounded FileCreateFlags instance Show FileCreateFlags instance Eq FileCopyFlags instance Ord FileCopyFlags instance Bounded FileCopyFlags instance Show FileCopyFlags instance Eq FileMonitorFlags instance Ord FileMonitorFlags instance Bounded FileMonitorFlags instance Show FileMonitorFlags instance Eq FilesystemPreviewType instance Ord FilesystemPreviewType instance Bounded FilesystemPreviewType instance Show FilesystemPreviewType instance Eq FileType instance Ord FileType instance Bounded FileType instance Show FileType instance Eq FileAttributeStatus instance Ord FileAttributeStatus instance Bounded FileAttributeStatus instance Show FileAttributeStatus instance Eq FileAttributeInfoFlags instance Ord FileAttributeInfoFlags instance Bounded FileAttributeInfoFlags instance Read FileAttributeInfoFlags instance Show FileAttributeInfoFlags instance Eq AskPasswordFlags instance Ord AskPasswordFlags instance Bounded AskPasswordFlags instance Show AskPasswordFlags instance Enum PasswordSave instance Eq PasswordSave instance Ord PasswordSave instance Bounded PasswordSave instance Show PasswordSave instance Enum MountOperationResult instance Eq MountOperationResult instance Ord MountOperationResult instance Bounded MountOperationResult instance Show MountOperationResult instance Enum IOErrorEnum instance Eq IOErrorEnum instance Ord IOErrorEnum instance Bounded IOErrorEnum instance Show IOErrorEnum instance Enum FileMonitorEvent instance Eq FileMonitorEvent instance Ord FileMonitorEvent instance Bounded FileMonitorEvent instance Show FileMonitorEvent instance Eq MountMountFlags instance Ord MountMountFlags instance Bounded MountMountFlags instance Show MountMountFlags instance Eq MountUnmountFlags instance Ord MountUnmountFlags instance Bounded MountUnmountFlags instance Show MountUnmountFlags instance Eq DriveStartFlags instance Ord DriveStartFlags instance Bounded DriveStartFlags instance Show DriveStartFlags instance Enum DriveStartStopType instance Eq DriveStartStopType instance Ord DriveStartStopType instance Bounded DriveStartStopType instance Show DriveStartStopType instance Enum EmblemOrigin instance Eq EmblemOrigin instance Ord EmblemOrigin instance Bounded EmblemOrigin instance Show EmblemOrigin instance Eq AppInfoCreateFlags instance Ord AppInfoCreateFlags instance Bounded AppInfoCreateFlags instance Show AppInfoCreateFlags instance Flags AppInfoCreateFlags instance Enum AppInfoCreateFlags instance Flags DriveStartFlags instance Enum DriveStartFlags instance Flags MountUnmountFlags instance Enum MountUnmountFlags instance Flags MountMountFlags instance Enum MountMountFlags instance Flags AskPasswordFlags instance Enum AskPasswordFlags instance Flags FileAttributeInfoFlags instance Enum FileAttributeInfoFlags instance Enum FileAttributeStatus instance Enum FileType instance Enum FilesystemPreviewType instance Flags FileMonitorFlags instance Enum FileMonitorFlags instance Flags FileCopyFlags instance Enum FileCopyFlags instance Flags FileCreateFlags instance Enum FileCreateFlags instance Flags FileQueryInfoFlags instance Enum FileQueryInfoFlags module System.GIO.File.FileAttribute data FileAttributeType FileAttributeTypeInvalid :: FileAttributeType FileAttributeTypeString :: FileAttributeType FileAttributeTypeByteString :: FileAttributeType FileAttributeTypeBool :: FileAttributeType FileAttributeTypeWord32 :: FileAttributeType FileAttributeTypeInt32 :: FileAttributeType FileAttributeTypeWord64 :: FileAttributeType FileAttributeTypeInt64 :: FileAttributeType FileAttributeTypeObject :: FileAttributeType FileAttributeTypeStringList :: FileAttributeType data FileAttributeInfo FileAttributeInfo :: String -> FileAttributeType -> [FileAttributeInfoFlags] -> FileAttributeInfo fileAttributeInfoName :: FileAttributeInfo -> String fileAttributeInfoType :: FileAttributeInfo -> FileAttributeType fileAttributeInfoFlags :: FileAttributeInfo -> [FileAttributeInfoFlags] -- | Flags specifying the behaviour of an attribute. data FileAttributeInfoFlags FileAttributeInfoNone :: FileAttributeInfoFlags FileAttributeInfoCopyWithFile :: FileAttributeInfoFlags FileAttributeInfoCopyWhenMoved :: FileAttributeInfoFlags fileAttributeStandardType :: String fileAttributeStandardIsHidden :: String fileAttributeStandardIsBackup :: String fileAttributeStandardIsSymlink :: String fileAttributeStandardIsVirtual :: String fileAttributeStandardName :: String fileAttributeStandardDisplayName :: String fileAttributeStandardEditName :: String fileAttributeStandardCopyName :: String fileAttributeStandardIcon :: String fileAttributeStandardContentType :: String fileAttributeStandardFastContentType :: String fileAttributeStandardSize :: String fileAttributeStandardAllocatedSize :: String fileAttributeStandardSymlinkTarget :: String fileAttributeStandardTargetURI :: String fileAttributeStandardSortOrder :: String fileAttributeEtagValue :: String fileAttributeIDFile :: String fileAttributeIDFilesystem :: String fileAttributeAccessCanRead :: String fileAttributeAccessCanWrite :: String fileAttributeAccessCanExecute :: String fileAttributeAccessCanDelete :: String fileAttributeAccessCanTrash :: String fileAttributeAccessCanRename :: String fileAttributeMountableCanMount :: String fileAttributeMountableCanUnmount :: String fileAttributeMountableCanEject :: String fileAttributeMountableUnixDevice :: String fileAttributeMountableUnixDeviceFile :: String fileAttributeMountableCanStart :: String fileAttributeMountableCanDegraded :: String fileAttributeMountableCanStop :: String fileAttributeMountableStartStopType :: String fileAttributeMountableCanPoll :: String fileAttributeMountableHalUDI :: String fileAttributeTimeModified :: String fileAttributeTimeModifiedUSec :: String fileAttributeTimeAccess :: String fileAttributeTimeAccessUSec :: String fileAttributeTimeChanged :: String fileAttributeTimeChangedUSec :: String fileAttributeTimeCreated :: String fileAttributeTimeCreatedUSec :: String fileAttributeUnixDevice :: String fileAttributeUnixInode :: String fileAttributeUnixMode :: String fileAttributeUnixNLink :: String fileAttributeUnixUID :: String fileAttributeUnixGID :: String fileAttributeUnixRDev :: String fileAttributeUnixBlockSize :: String fileAttributeUnixBlocks :: String fileAttributeDosIsMountpoint :: String fileAttributeDosIsArchive :: String fileAttributeDosIsSystem :: String fileAttributeOwnerUser :: String fileAttributeOwnerUserReal :: String fileAttributeOwnerGroup :: String fileAttributeThumbnailPath :: String fileAttributeThumbnailingFailed :: String fileAttributePreviewIcon :: String fileAttributeFilesystemSize :: String fileAttributeFilesystemFree :: String fileAttributeFilesystemType :: String fileAttributeFilesystemReadonly :: String fileAttributeGVfsBackend :: String fileAttributeSELinuxContext :: String fileAttributeTrashItemCount :: String fileAttributeFilesystemUsePreview :: String fileAttributeStandardDescription :: String fileAttributeTrashOrigPath :: String fileAttributeTrashDeletionDate :: String instance Eq FileAttributeType instance Ord FileAttributeType instance Bounded FileAttributeType instance Show FileAttributeType instance Read FileAttributeType instance Eq FileAttributeInfo instance Read FileAttributeInfo instance Show FileAttributeInfo instance Storable FileAttributeInfo instance Enum FileAttributeType module System.GIO.Volumes.VolumeMonitor newtype VolumeMonitor VolumeMonitor :: (ForeignPtr (VolumeMonitor)) -> VolumeMonitor class GObjectClass o => VolumeMonitorClass o -- | Gets the volume monitor used by gio. volumeMonitorGet :: IO VolumeMonitor -- | Gets a list of drives connected to the system. volumeMonitorGetConnectedDrives :: VolumeMonitorClass monitor => monitor -> IO [Drive] -- | Gets a list of the volumes on the system. volumeMonitorGetVolumes :: VolumeMonitorClass monitor => monitor -> IO [Drive] -- | Gets a list of the mounts on the system. volumeMonitorGetMounts :: VolumeMonitorClass monitor => monitor -> IO [Drive] -- | Finds a Mount object by its UUID (see mountGetUuid volumeMonitorGetMountForUUID :: VolumeMonitorClass monitor => monitor -> String -> IO (Maybe Mount) -- | Finds a Volume object by its UUID (see volumeGetUuid) volumeMonitorGetVolumeForUUID :: VolumeMonitorClass monitor => monitor -> String -> IO (Maybe Volume) -- | Emitted when a drive changes. vmDriveChanged :: VolumeMonitorClass monitor => Signal monitor (Drive -> IO ()) -- | Emitted when a drive changes. vmDriveConnected :: VolumeMonitorClass monitor => Signal monitor (Drive -> IO ()) -- | Emitted when a drive changes. vmDriveDisconnected :: VolumeMonitorClass monitor => Signal monitor (Drive -> IO ()) -- | Emitted when the eject button is pressed on drive. vmDriveEjectButton :: VolumeMonitorClass monitor => Signal monitor (Drive -> IO ()) -- | Emitted when the stop button is pressed on drive. vmDriveStopButton :: VolumeMonitorClass monitor => Signal monitor (Drive -> IO ()) -- | Emitted when a mount is added. vmMountAdded :: VolumeMonitorClass monitor => Signal monitor (Mount -> IO ()) -- | Emitted when a mount is changed. vmMountChanged :: VolumeMonitorClass monitor => Signal monitor (Mount -> IO ()) -- | Emitted when a mount is about to be removed. vmMountPreUnmount :: VolumeMonitorClass monitor => Signal monitor (Mount -> IO ()) -- | Emitted when a mount is removed. vmMountRemoved :: VolumeMonitorClass monitor => Signal monitor (Mount -> IO ()) -- | Emitted when a volume is added. vmVolumeAdded :: VolumeMonitorClass monitor => Signal monitor (Volume -> IO ()) -- | Emitted when a volume is changed. vmVolumeChanged :: VolumeMonitorClass monitor => Signal monitor (Volume -> IO ()) -- | Emitted when a volume is removed. vmVolumeRemoved :: VolumeMonitorClass monitor => Signal monitor (Volume -> IO ()) module System.GIO.Icons.ThemedIcon newtype ThemedIcon ThemedIcon :: (ForeignPtr (ThemedIcon)) -> ThemedIcon class GObjectClass o => ThemedIconClass o -- | Creates a new icon for a file. themedIconNew :: ByteString -> IO ThemedIcon -- | Creates a new themed icon for iconnames. themedIconNewFromNames :: [String] -> IO ThemedIcon -- | Prepend a name to the list of icons from within icon. themedIconPrependName :: ThemedIconClass icon => icon -> String -> IO () -- | Append a name to the list of icons from within icon. themedIconAppendName :: ThemedIconClass icon => icon -> String -> IO () -- | Gets the names of icons from within icon. themedIconGetNames :: ThemedIconClass icon => icon -> IO [String] module System.GIO.Icons.Icon newtype Icon Icon :: (ForeignPtr (Icon)) -> Icon class GObjectClass o => IconClass o -- | Checks if two icons are equal. iconEqual :: (IconClass icon1, IconClass icon2) => icon1 -> icon2 -> IO Bool -- | Generates a textual representation of icon that can be used for -- serialization such as when passing icon to a different process or -- saving it to persistent storage. Use iconNewForString to get -- icon back from the returned string. -- -- The encoding of the returned string is proprietary to Icon -- except in the following two cases -- -- iconToString :: IconClass icon => icon -> IO ByteString -- | Generate a Icon instance from str. This function can fail if -- str is not valid - see iconToString for discussion. -- -- If your application or library provides one or more Icon -- implementations you need to ensure that each GType is registered with -- the type system prior to calling iconNewForString. iconNewForString :: ByteString -> IO Icon module System.GIO.Icons.FileIcon newtype FileIcon FileIcon :: (ForeignPtr (FileIcon)) -> FileIcon class GObjectClass o => FileIconClass o -- | Creates a new icon for a file. fileIconNew :: FileClass file => file -> IO FileIcon -- | Gets the File associated with the given icon. fileIconGetFile :: FileIconClass icon => icon -> IO File module System.GIO.Icons.EmblemedIcon newtype EmblemedIcon EmblemedIcon :: (ForeignPtr (EmblemedIcon)) -> EmblemedIcon class GObjectClass o => EmblemedIconClass o -- | Creates a new emblemed icon for icon with the emblem emblem. emblemedIconNew :: (IconClass icon, EmblemClass emblem) => icon -> emblem -> IO EmblemedIcon -- | Gets the main icon for emblemed. emblemedIconGetIcon :: EmblemedIconClass emblemed => emblemed -> IO Icon -- | Gets the list of emblems for the icon. emblemedIconGetEmblems :: EmblemedIconClass emblemed => emblemed -> IO [Emblem] -- | Adds emblem to the Emblem. emblemedIconAddEmblem :: EmblemedIconClass emblemed => emblemed -> Emblem -> IO () module System.GIO.Icons.Emblem newtype Emblem Emblem :: (ForeignPtr (Emblem)) -> Emblem class GObjectClass o => EmblemClass o -- | EmblemOrigin is used to add information about the origin of the -- emblem to Emblem. data EmblemOrigin EmblemOriginUnknown :: EmblemOrigin EmblemOriginDevice :: EmblemOrigin EmblemOriginLivemetadata :: EmblemOrigin EmblemOriginTag :: EmblemOrigin -- | Creates a new emblem for icon. emblemNew :: IconClass icon => icon -> IO Emblem -- | Creates a new emblem for icon. emblemNewWithOrigin :: IconClass icon => icon -> EmblemOrigin -> IO Emblem -- | Gives back the icon from emblem. emblemGetIcon :: EmblemClass emblem => emblem -> IO Icon -- | Gets the origin of the emblem. emblemGetOrigin :: EmblemClass emblem => emblem -> IO EmblemOrigin module System.GIO.File.MountOperation newtype MountOperation MountOperation :: (ForeignPtr (MountOperation)) -> MountOperation class GObjectClass o => MountOperationClass o data MountOperationResult MountOperationHandled :: MountOperationResult MountOperationAborted :: MountOperationResult MountOperationUnhandled :: MountOperationResult data AskPasswordFlags AskPasswordNeedPassword :: AskPasswordFlags AskPasswordNeedUsername :: AskPasswordFlags AskPasswordNeedDomain :: AskPasswordFlags AskPasswordSavingSupported :: AskPasswordFlags AskPasswordAnonymousSupported :: AskPasswordFlags -- | PasswordSave is used to indicate the lifespan of a saved -- password. data PasswordSave PasswordSaveNever :: PasswordSave PasswordSaveForSession :: PasswordSave PasswordSavePermanently :: PasswordSave -- | Creates a new mount operation. mountOperationNew :: IO MountOperation -- | Emits the reply signal. mountOperationReply :: MountOperationClass op => op -> MountOperationResult -> IO () -- | Whether to use an anonymous user when authenticating. -- -- Default value: False mountOperationAnonymous :: MountOperationClass op => Attr op Bool -- | The index of the user's choice when a question is asked during the -- mount operation. See the askQuestion signal. -- -- Allowed values: >= 0 -- -- Default value: 0 mountOperationChoice :: MountOperationClass op => Attr op Int -- | The domain to use for the mount operation. -- -- Default value: "" mountOperationDomain :: MountOperationClass op => Attr op String -- | The password that is used for authentication when carrying out the -- mount operation. -- -- Default value: "" mountOperationPassword :: MountOperationClass op => Attr op String -- | Determines if and how the password information should be saved. -- -- Default value: PasswordSaveNever mountOperationPasswordSave :: MountOperationClass op => Attr op PasswordSave -- | The user name that is used for authentication when carrying out the -- mount operation. -- -- Default value: "" mountOperationUsername :: MountOperationClass op => Attr op String -- | Emitted by the backend when e.g. a device becomes unavailable while a -- mount operation is in progress. -- -- Implementations of MountOperation should handle this signal by -- dismissing open password dialogs. -- -- Since 2.20 mountOperationAborted :: MountOperationClass op => Signal op (IO ()) -- | Emitted when a mount operation asks the user for a password. -- -- If the message contains a line break, the first line should be -- presented as a heading. For example, it may be used as the primary -- text in a MessageDialog. mountOperationAskPassword :: MountOperationClass op => Signal op (String -> String -> String -> AskPasswordFlags -> IO ()) -- | Emitted when asking the user a question and gives a list of choices -- for the user to choose from. -- -- If the message contains a line break, the first line should be -- presented as a heading. For example, it may be used as the primary -- text in a MessageDialog. askQuestion :: MountOperationClass -- op => Signal op (String -> [String] -> IO ()) askQuestion -- Signal (after obj user -> connect_STRING_BOXED__NONE -- ask-question after obj (message choicesPtr -> do choices -- <- peekUTFString choicesPtr user str choices)) -- -- Emitted when the user has replied to the mount operation. mountOperationReplySignal :: MountOperationClass op => Signal op (MountOperationResult -> IO ()) module System.GIO.File.IOError -- | Error codes returned by GIO functions. data IOErrorEnum IoErrorFailed :: IOErrorEnum IoErrorNotFound :: IOErrorEnum IoErrorExists :: IOErrorEnum IoErrorIsDirectory :: IOErrorEnum IoErrorNotDirectory :: IOErrorEnum IoErrorNotEmpty :: IOErrorEnum IoErrorNotRegularFile :: IOErrorEnum IoErrorNotSymbolicLink :: IOErrorEnum IoErrorNotMountableFile :: IOErrorEnum IoErrorFilenameTooLong :: IOErrorEnum IoErrorInvalidFilename :: IOErrorEnum IoErrorTooManyLinks :: IOErrorEnum IoErrorNoSpace :: IOErrorEnum IoErrorInvalidArgument :: IOErrorEnum IoErrorPermissionDenied :: IOErrorEnum IoErrorNotSupported :: IOErrorEnum IoErrorNotMounted :: IOErrorEnum IoErrorAlreadyMounted :: IOErrorEnum IoErrorClosed :: IOErrorEnum IoErrorCancelled :: IOErrorEnum IoErrorPending :: IOErrorEnum IoErrorReadOnly :: IOErrorEnum IoErrorCantCreateBackup :: IOErrorEnum IoErrorWrongEtag :: IOErrorEnum IoErrorTimedOut :: IOErrorEnum IoErrorWouldRecurse :: IOErrorEnum IoErrorBusy :: IOErrorEnum IoErrorWouldBlock :: IOErrorEnum IoErrorHostNotFound :: IOErrorEnum IoErrorWouldMerge :: IOErrorEnum IoErrorFailedHandled :: IOErrorEnum IoErrorTooManyOpenFiles :: IOErrorEnum IoErrorNotInitialized :: IOErrorEnum IoErrorAddressInUse :: IOErrorEnum IoErrorPartialInput :: IOErrorEnum IoErrorInvalidData :: IOErrorEnum IoErrorDbusError :: IOErrorEnum IoErrorHostUnreachable :: IOErrorEnum IoErrorNetworkUnreachable :: IOErrorEnum IoErrorConnectionRefused :: IOErrorEnum IoErrorProxyFailed :: IOErrorEnum IoErrorProxyAuthFailed :: IOErrorEnum IoErrorProxyNeedAuth :: IOErrorEnum IoErrorProxyNotAllowed :: IOErrorEnum -- | Converts errno.h error codes into GIO error codes. ioErrorFromErrno :: Int -> IO IOErrorEnum module System.GIO.File.FileMonitor newtype FileMonitor FileMonitor :: (ForeignPtr (FileMonitor)) -> FileMonitor class GObjectClass o => FileMonitorClass o -- | Specifies what type of event a monitor event is. data FileMonitorEvent FileMonitorEventChanged :: FileMonitorEvent FileMonitorEventChangesDoneHint :: FileMonitorEvent FileMonitorEventDeleted :: FileMonitorEvent FileMonitorEventCreated :: FileMonitorEvent FileMonitorEventAttributeChanged :: FileMonitorEvent FileMonitorEventPreUnmount :: FileMonitorEvent FileMonitorEventUnmounted :: FileMonitorEvent FileMonitorEventMoved :: FileMonitorEvent -- | Cancels a file monitor. fileMonitorCancel :: FileMonitorClass monitor => monitor -> IO Bool -- | Returns whether the monitor is canceled. fileMonitorIsCancelled :: FileMonitorClass monitor => monitor -> IO Bool -- | Whether the monitor has been cancelled. -- -- Default value: False fileMonitorCancelled :: FileMonitorClass monitor => ReadAttr monitor Bool -- | The limit of the monitor to watch for changes, in milliseconds. -- -- Allowed values: >= 0 -- -- Default value: 800 fileMonitorRateLimit :: FileMonitorClass monitor => Attr monitor Int fileMonitorChanged :: FileMonitorClass monitor => Signal monitor (Maybe File -> Maybe File -> FileMonitorEvent -> IO ()) module System.GIO.File.FileInfo newtype FileInfo FileInfo :: (ForeignPtr (FileInfo)) -> FileInfo class GObjectClass o => FileInfoClass o -- | Used by fileSetAttributesFromInfo when setting file -- attributes. data FileAttributeStatus FileAttributeStatusUnset :: FileAttributeStatus FileAttributeStatusSet :: FileAttributeStatus FileAttributeStatusErrorSetting :: FileAttributeStatus -- | Creates a new file info structure. fileInfoNew :: IO FileInfo -- | Duplicates a file info structure. fileInfoDup :: FileInfoClass info => info -> IO FileInfo -- | Copies all of the FileAttributes from srcInfo to -- destInfo. fileInfoCopyInto :: (FileInfoClass srcInfo, FileInfoClass destInfo) => srcInfo -> destInfo -> IO () -- | Checks if a file info structure has an attribute named attribute. fileInfoHasAttribute :: FileInfoClass info => info -> String -> Bool -- | Checks if a file info structure has an attribute in the specified -- nameSpace. fileInfoHasNamespace :: FileInfoClass info => info -> String -> Bool -- | Lists the file info structure's attributes. fileInfoListAttributes :: FileInfoClass info => info -> String -> IO [String] -- | Gets the attribute type for an attribute key. fileInfoGetAttributeType :: FileInfoClass info => info -> String -> IO FileAttributeType -- | Removes all cases of attribute from info if it exists. fileInfoRemoveAttribute :: FileInfoClass info => info -> String -> IO () -- | Gets the value of a attribute, formated as a string. This escapes -- things as needed to make the string valid utf8. fileInfoGetAttributeAsString :: FileInfoClass info => info -> String -> IO String -- | Gets the attribute status for an attribute key. fileInfoGetAttributeStatus :: FileInfoClass info => info -> String -> IO FileAttributeStatus -- | Gets the value of a string attribute. fileInfoGetAttributeString :: FileInfoClass info => info -> String -> IO String -- | Gets the value of a stringv attribute. If the attribute does not -- contain a stringv fileInfoGetAttributeStringList :: FileInfoClass info => info -> String -> IO [String] -- | Gets the value of a byte string attribute. fileInfoGetAttributeByteString :: FileInfoClass info => info -> String -> IO ByteString -- | Gets the value of a boolean attribute. fileInfoGetAttributeBool :: FileInfoClass info => info -> String -> IO Bool -- | Gets an Word32 contained within the attribute. fileInfoGetAttributeWord32 :: FileInfoClass info => info -> String -> IO Word32 -- | Gets an Int32 contained within the attribute. fileInfoGetAttributeInt32 :: FileInfoClass info => info -> String -> IO Int32 -- | Gets an Word64 contained within the attribute. fileInfoGetAttributeWord64 :: FileInfoClass info => info -> String -> IO Word64 -- | Gets an Int64 contained within the attribute. fileInfoGetAttributeInt64 :: FileInfoClass info => info -> String -> IO Int64 -- | Gets the value of a GObject attribute. fileInfoGetAttributeObject :: FileInfoClass info => info -> String -> IO (Maybe GObject) -- | 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. fileInfoSetAttributeStatus :: FileInfoClass info => info -> String -> FileAttributeStatus -> IO Bool -- | Sets the attribute to contain the given attrValue, if -- possible. fileInfoSetAttributeString :: FileInfoClass info => info -> String -> String -> IO () -- | Sets the attribute to contain the given attrValue, if -- possible. fileInfoSetAttributeStringList :: FileInfoClass info => info -> String -> [String] -> IO () -- | Sets the attribute to contain the given attrValue, if -- possible. fileInfoSetAttributeByteString :: FileInfoClass info => info -> String -> ByteString -> IO () -- | Sets the attribute to contain the given attrValue, if -- possible. fileInfoSetAttributeBool :: FileInfoClass info => info -> String -> Bool -> IO () -- | Sets the attribute to contain the given attrValue, if -- possible. fileInfoSetAttributeWord32 :: FileInfoClass info => info -> String -> Word32 -> IO () -- | Sets the attribute to contain the given attrValue, if -- possible. fileInfoSetAttributeInt32 :: FileInfoClass info => info -> String -> Int32 -> IO () -- | Sets the attribute to contain the given attrValue, if -- possible. fileInfoSetAttributeWord64 :: FileInfoClass info => info -> String -> Word64 -> IO () -- | Sets the attribute to contain the given attrValue, if -- possible. fileInfoSetAttributeInt64 :: FileInfoClass info => info -> String -> Int64 -> IO () -- | Sets the attribute to contain the given attrValue, if -- possible. fileInfoSetAttributeObject :: FileInfoClass info => info -> String -> GObject -> IO () -- | Clears the status information from info. fileInfoClearStatus :: FileInfoClass info => info -> IO () -- | Gets a file's type (whether it is a regular file, symlink, etc). This -- is different from the file's content type, see -- fileInfoGetContentType. fileInfoGetFileType :: FileInfoClass info => info -> FileType -- | Checks if a file is hidden. fileInfoGetIsHidden :: FileInfoClass info => info -> Bool -- | Checks if a file is a backup file. fileInfoGetIsBackup :: FileInfoClass info => info -> Bool -- | Checks if a file is a symlink file. fileInfoGetIsSymlink :: FileInfoClass info => info -> Bool -- | Gets the name for a file. fileInfoGetName :: FileInfoClass info => info -> Maybe ByteString -- | Gets the display name for a file. fileInfoGetDisplayName :: FileInfoClass info => info -> Maybe String -- | Gets the edit name for a file. fileInfoGetEditName :: FileInfoClass info => info -> Maybe String -- | Gets the icon for a file. fileInfoGetIcon :: FileInfoClass info => info -> IO Icon -- | Gets the file's content type. fileInfoGetContentType :: FileInfoClass info => info -> Maybe String -- | Gets the modification time of the current info and sets it in result. fileInfoGetModificationTime :: FileInfoClass info => info -> GTimeVal -- | Gets the file's size. fileInfoGetSize :: FileInfoClass info => info -> Int64 -- | Gets the symlink target for a given FileInfo. fileInfoGetSymlinkTarget :: FileInfoClass info => info -> Maybe String -- | Gets the entity tag for a given FileInfo. See -- FileAttributeEtagValue. fileInfoGetEtag :: FileInfoClass info => info -> Maybe String -- | Gets the value of the sortOrder attribute from the -- FileInfo. See FileAttributeStandardSortOrder. fileInfoGetSortOrder :: FileInfoClass info => info -> Int -- | Unsets a mask set by fileInfoSetAttributeMask, if one is set. fileInfoUnsetAttributeMask :: FileInfoClass info => info -> IO () -- | Sets the file type in a FileInfo to type. See -- FileAttributeStandardType. fileInfoSetFileType :: FileInfoClass info => info -> FileType -> IO () -- | Sets the isHidden attribute in a FileInfo according to -- isSymlink. See FileAttributeStandardIsHidden. fileInfoSetIsHidden :: FileInfoClass info => info -> Bool -> IO () -- | Sets the isSymlink attribute in a FileInfo according -- to isSymlink. See FileAttributeStandardIsSymlink. fileInfoSetIsSymlink :: FileInfoClass info => info -> Bool -> IO () -- | Sets the name attribute for the current FileInfo. See -- FileAttributeStandardName. fileInfoSetName :: FileInfoClass info => info -> ByteString -> IO () -- | Sets the display name for the current FileInfo. See -- FileAttributeStandardDisplayName. fileInfoSetDisplayName :: FileInfoClass info => info -> String -> IO () -- | Sets the edit name for the current FileInfo. See -- FileAttributeStandardEditName. fileInfoSetEditName :: FileInfoClass info => info -> String -> IO () -- | Sets the icon for a given FileInfo. See -- FileAttributeStandardIcon. fileInfoSetIcon :: FileInfoClass info => info -> Icon -> IO () -- | Sets the content type attribute for a given FileInfo. See -- FileAttributeStandardContentType. fileInfoSetContentType :: FileInfoClass info => info -> String -> IO () -- | Sets the FileAttributeTimeModified attribute in the file info -- to the given time value. fileInfoSetModificationTime :: FileInfoClass info => info -> GTimeVal -> IO () -- | Sets the FileAttributeStandardSize attribute in the file info -- to the given size. fileInfoSetSize :: FileInfoClass info => info -> Int64 -> 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. fileInfoSetSortOrder :: FileInfoClass info => info -> Int -> IO () module System.GIO.File.ContentType -- | Compares two content types for equality. contentTypeEquals :: String -> String -> Bool -- | Determines if type is a subset of supertype. contentTypeIsA :: String -> String -> Bool -- | Checks if the content type is the generic unknown type. On 1 -- this is the application/octet-stream mimetype, while on win32 -- it is "*". contentTypeIsUnknown :: String -> Bool -- | Gets the human readable description of the content type. contentTypeGetDescription :: String -> String -- | Gets the mime-type for the content type. If one is registered contentTypeGetMimeType :: String -> String -- | Gets the icon for a content type. contentTypeGetIcon :: String -> Icon -- | Checks if a content type can be executable. Note that for instance -- things like text files can be executables (i.e. scripts and batch -- files). contentTypeCanBeExecutable :: String -> Bool -- | Tries to find a content type based on the mime type name. contentTypeFromMimeType :: String -> String -- | Guesses the content type based on example data. If the function is -- uncertain, resultUncertain will be set to True. Either -- filename or data may be Nothing, in which case the guess will -- be based solely on the other argument. contentTypeGuess :: String -> String -> Int -> IO (Bool, String) -- | Tries to guess the type of the tree with root root, by looking at the -- files it contains. The result is an array of content types, with the -- best guess coming first. -- -- The types returned all have the form x-contentfoo, e.g. -- x-contentaudio-cdda (for audio CDs) or x-content/image-dcf (for a -- camera memory card). See the shared-mime-info specification for more -- on x-content types. -- -- This function is useful in the implementation of -- mountGuessContentType. contentTypeGuessForTree :: FileClass file => file -> IO [String] -- | Gets a list of strings containing all the registered content types -- known to the system. contentTypesGetRegistered :: IO [String] module System.GIO.File.AppInfo data AppInfo class GObjectClass o => AppInfoClass o data AppLaunchContext class FileInfoClass o => AppLaunchContextClass o -- | Flags used when creating a AppInfo. data AppInfoCreateFlags AppInfoCreateNone :: AppInfoCreateFlags AppInfoCreateNeedsTerminal :: AppInfoCreateFlags AppInfoCreateSupportsUris :: AppInfoCreateFlags AppInfoCreateSupportsStartupNotification :: AppInfoCreateFlags -- | Creates a new AppInfo from the given information. appInfoCreateFromCommandline :: String -> Maybe String -> [AppInfoCreateFlags] -> IO AppInfo -- | Creates a duplicate of a AppInfo. appInfoDup :: AppInfoClass appinfo => appinfo -> IO AppInfo -- | Checks if two AppInfos are equal. appInfoEqual :: (AppInfoClass info1, AppInfoClass info2) => info1 -> info2 -> Bool -- | Gets the ID of an application. An id is a string that identifies the -- application. The exact format of the id is platform dependent. For -- instance, on Unix this is the desktop file id from the xdg menu -- specification. -- -- Note that the returned ID may be Nothing, depending on how the -- appinfo has been constructed. appInfoGetId :: AppInfoClass appinfo => appinfo -> IO (Maybe String) -- | Gets the installed name of the application. appInfoGetName :: AppInfoClass appinfo => appinfo -> String -- | Gets the installed name of the application. appInfoGetDisplayName :: AppInfoClass appinfo => appinfo -> String -- | Gets a human-readable description of an installed application. appInfoGetDescription :: AppInfoClass appinfo => appinfo -> Maybe String -- | Gets the executable's name for the installed application. appInfoGetExecutable :: AppInfoClass appinfo => appinfo -> String -- | Gets the commandline with which the application will be started. appInfoGetCommandline :: AppInfoClass appinfo => appinfo -> Maybe ByteString -- | Gets the icon for the application. appInfoGetIcon :: AppInfoClass appinfo => appinfo -> IO (Maybe Icon) -- | Launches the application. Passes files to the launched application as -- arguments, using the optional launchContext to get -- information about the details of the launcher (like what screen it is -- on). Throws a GError if an error occurs -- -- To lauch the application without arguments pass a emtpy files list. -- -- Note that even if the launch is successful the application launched -- can fail to start if it runs into problems during startup. There is no -- way to detect this. -- -- Some URIs can be changed when passed through a File (for -- instance unsupported uris with strange formats like mailto:), so if -- you have a textual uri you want to pass in as argument, consider using -- appInfoLaunchUris instead. appInfoLaunch :: AppInfoClass appinfo => appinfo -> [File] -> Maybe AppLaunchContext -> IO () -- | Checks if the application accepts files as arguments. appInfoSupportsFiles :: AppInfoClass appinfo => appinfo -> IO Bool -- | Checks if the application accepts uris as arguments. appInfoSupportsUris :: AppInfoClass appinfo => appinfo -> IO Bool -- | Launches the application. Passes uris to the launched application as -- arguments, using the optional launchContext to get -- information about the details of the launcher (like what screen it is -- on). Throws a GError if an error occurs. -- -- To lauch the application without arguments pass a empty uris list. -- -- Note that even if the launch is successful the application launched -- can fail to start if it runs into problems during startup. There is no -- way to detect this. appInfoLaunchUris :: AppInfoClass appinfo => appinfo -> [String] -> Maybe AppLaunchContext -> IO () -- | Checks if the application info should be shown in menus that list -- available applications. appInfoShouldShow :: AppInfoClass appinfo => appinfo -> IO Bool -- | Obtains the information whether the AppInfo can be deleted. See -- appInfoDelete. appInfoCanDelete :: AppInfoClass appinfo => appinfo -> IO Bool -- | Tries to delete a AppInfo. -- -- On some platforms, there may be a difference between user-defined -- AppInfos which can be deleted, and system-wide ones which -- cannot. See appInfoCanDelete. appInfoDelete :: AppInfoClass appinfo => appinfo -> IO Bool -- | Removes all changes to the type associations done by -- appInfoSetAsDefaultForType, -- appInfoSetAsDefaultForExtension or -- appInfoRemoveSupportsType. appInfoResetTypeAssociations :: String -> IO () -- | Sets the application as the default handler for a given type. Throws a -- GError if an error occurs. appInfoSetAsDefaultForType :: AppInfoClass appinfo => appinfo -> String -> IO () -- | Sets the application as the default handler for a given extension. -- Throws a GError if an error occurs. appInfoSetAsDefaultForExtension :: AppInfoClass appinfo => appinfo -> String -> IO () -- | Adds a content type to the application information to indicate the -- application is capable of opening files with the given content type. -- Throws a GError if an error occurs. appInfoAddSupportsType :: AppInfoClass appinfo => appinfo -> String -> IO () -- | Checks if a supported content type can be removed from an application. appInfoCanRemoveSupportsType :: AppInfoClass appinfo => appinfo -> IO Bool -- | Removes a supported type from an application, if possible. Throws a -- GError if an error occurs. appInfoRemoveSupportsType :: AppInfoClass appinfo => appinfo -> String -> IO () -- | Gets a list of all of the applications currently registered on this -- system. -- -- For desktop files, this includes applications that have NoDisplay=true -- set or are excluded from display by means of OnlyShowIn or NotShowIn. -- See appInfoShouldShow. The returned list does not include -- applications which have the Hidden key set. appInfoGetAll :: IO [AppInfo] -- | Gets a list of all AppInfos for a given content type. appInfoGetAllForType :: String -> IO [AppInfo] -- | Gets the AppInfo that corresponds to a given content type. appInfoGetDefaultForType :: String -> Bool -> IO (Maybe AppInfo) -- | Gets the default application for launching applications using this URI -- scheme. A URI scheme is the initial part of the URI, up to but not -- including the :, e.g. http, ftp or sip. appInfoGetDefaultForUriScheme :: String -> IO (Maybe AppInfo) -- | Utility function that launches the default application registered to -- handle the specified uri. Synchronous I/O is done on the uri to detect -- the type of the file if required. Throws a GError if an error -- occurs. appInfoLaunchDefaultForUri :: String -> AppLaunchContext -> IO () -- | Gets the display string for the display. This is used to ensure new -- applications are started on the same display as the launching -- application. appLaunchContextGetDisplay :: AppInfoClass appinfo => AppLaunchContext -> appinfo -> [File] -> IO String -- | Initiates startup notification for the application and returns the -- DesktopStartupId for the launched operation, if supported. -- -- Startup notification IDs are defined in the FreeDesktop.Org Startup -- Notifications standard. appLaunchContextGetStartupNotifyId :: AppInfoClass appinfo => AppLaunchContext -> appinfo -> [File] -> IO (Maybe String) -- | Called when an application has failed to launch, so that it can cancel -- the application startup notification started in -- appLaunchContextGetStartupNotifyId. appLaunchContextLaunchFailed :: AppLaunchContext -> String -> IO () -- | Creates a new application launch context. This is not normally used, -- instead you instantiate a subclass of this, such as -- AppLaunchContext. appLaunchContextNew :: IO AppLaunchContext module System.GIO.Async.Cancellable newtype Cancellable Cancellable :: (ForeignPtr (Cancellable)) -> Cancellable class GObjectClass o => CancellableClass o -- | Creates a new Cancellable object. -- -- Applications that want to start one or more operations that should be -- cancellable should create a Cancellable and pass it to the -- operations. -- -- One Cancellable can be used in multiple consecutive operations, -- but not in multiple concurrent operations. cancellableNew :: IO Cancellable -- | Checks if a cancellable job has been cancelled. cancellableIsCancelled :: Cancellable -> IO Bool -- | If the cancellable is cancelled, throws a GError to notify that -- the operation was cancelled. cancellableThrowErrorIfCancelled :: Cancellable -> IO () -- | Gets the top cancellable from the stack. cancellableGetCurrent :: IO (Maybe Cancellable) -- | Pops cancellable off the cancellable stack (verifying that cancellable -- is on the top of the stack). cancellablePopCurrent :: Maybe Cancellable -> IO () -- | Pushes cancellable onto the cancellable stack. The current cancllable -- can then be recieved using cancellableGetCurrent . -- -- This is useful when implementing cancellable operations in code that -- does not allow you to pass down the cancellable object. -- -- This is typically called automatically by e.g. File operations, -- so you rarely have to call this yourself. cancellablePushCurrent :: Maybe Cancellable -> IO () -- | Resets cancellable to its uncancelled state. cancellableReset :: Cancellable -> IO () -- | Will set cancellable to cancelled, and will emit the cancelled -- signal. (However, see the warning about race conditions in the -- documentation for that signal if you are planning to connect to it.) -- -- This function is thread-safe. In other words, you can safely call it -- from a thread other than the one running the operation that was passed -- the cancellable. -- -- The convention within gio is that cancelling an asynchronous operation -- causes it to complete asynchronously. That is, if you cancel the -- operation from the same thread in which it is running, then the -- operation's AsyncReadyCallback will not be invoked until the -- application returns to the main loop. cancellableCancel :: Cancellable -> IO () -- | Emitted when the operation has been cancelled. -- -- Can be used by implementations of cancellable operations. If the -- operation is cancelled from another thread, the signal will be emitted -- in the thread that cancelled the operation, not the thread that is -- running the operation. -- -- Note that disconnecting from this signal (or any signal) in a -- multi-threaded program is prone to race conditions. For instance it is -- possible that a signal handler may be invoked even after a call to -- signalHandlerDisconnect for that handler has already -- returned. -- -- There is also a problem when cancellation happen right before -- connecting to the signal. If this happens the signal will unexpectedly -- not be emitted, and checking before connecting to the signal leaves a -- race condition where this is still happening. cancellableCancelled :: Signal Cancellable (IO ()) module System.GIO.Async.AsyncResult data AsyncResult class GObjectClass o => AsyncResultClass o type AsyncReadyCallback = GObject -> AsyncResult -> IO () marshalAsyncReadyCallback :: AsyncReadyCallback -> IO GAsyncReadyCallback module System.GIO.File.File newtype File File :: (ForeignPtr (File)) -> File class GObjectClass o => FileClass o type FileProgressCallback = Offset -> Offset -> IO () type FileReadMoreCallback = ByteString -> IO Bool type Offset = CLLong data FileInputStream class InputStreamClass o => FileInputStreamClass o data FileOutputStream class OutputStreamClass o => FileOutputStreamClass o data InputStream class GObjectClass o => InputStreamClass o data OutputStream class GObjectClass o => OutputStreamClass o data BufferedInputStream class FilterInputStreamClass o => BufferedInputStreamClass o data BufferedOutputStream class FilterOutputStreamClass o => BufferedOutputStreamClass o data MemoryInputStream class InputStreamClass o => MemoryInputStreamClass o data MemoryOutputStream class OutputStreamClass o => MemoryOutputStreamClass o data FilterInputStream class InputStreamClass o => FilterInputStreamClass o data FilterOutputStream class OutputStreamClass o => FilterOutputStreamClass o data DataInputStream class BufferedInputStreamClass o => DataInputStreamClass o data DataOutputStream class FilterOutputStreamClass o => DataOutputStreamClass o -- | Indicates the file's on-disk type. data FileType FileTypeUnknown :: FileType FileTypeRegular :: FileType FileTypeDirectory :: FileType FileTypeSymbolicLink :: FileType FileTypeSpecial :: FileType FileTypeShortcut :: FileType FileTypeMountable :: FileType -- | Flags used when copying or moving files. data FileCopyFlags FileCopyNone :: FileCopyFlags FileCopyOverwrite :: FileCopyFlags FileCopyBackup :: FileCopyFlags FileCopyNofollowSymlinks :: FileCopyFlags FileCopyAllMetadata :: FileCopyFlags FileCopyNoFallbackForMove :: FileCopyFlags FileCopyTargetDefaultPerms :: FileCopyFlags -- | Flags used when querying a FileInfo. data FileQueryInfoFlags FileQueryInfoNone :: FileQueryInfoFlags FileQueryInfoNofollowSymlinks :: FileQueryInfoFlags data FileCreateFlags FileCreateNone :: FileCreateFlags FileCreatePrivate :: FileCreateFlags FileCreateReplaceDestination :: FileCreateFlags -- | Flags used to set what a FileMonitor will watch for. data FileMonitorFlags FileMonitorNone :: FileMonitorFlags FileMonitorWatchMounts :: FileMonitorFlags FileMonitorSendMoved :: FileMonitorFlags -- | Flags used when mounting a mount. data MountMountFlags MountMountNone :: MountMountFlags -- | Flags used when an unmounting a mount. data MountUnmountFlags MountUnmountNone :: MountUnmountFlags MountUnmountForce :: MountUnmountFlags -- | Constructs a File for a given path. This operation never fails, -- but the returned object might not support any I/O operation if path is -- malformed. fileFromPath :: ByteString -> File -- | Constructs a File for a given URI. This operation never fails, -- but the returned object might not support any I/O operation if uri is -- malformed or if the uri type is not supported. fileFromURI :: String -> File -- | Creates a File with the given argument from the command line. -- The value of arg can be either a URI, an absolute path or a relative -- path resolved relative to the current working directory. This -- operation never fails, but the returned object might not support any -- I/O operation if arg points to a malformed path. fileFromCommandlineArg :: ByteString -> File -- | Constructs a File with the given name (i.e. something given by -- fileParseName. This operation never fails, but the returned -- object might not support any I/O operation if the parseName -- cannot be parsed. fileFromParseName :: String -> File -- | Compare two file descriptors for equality. This test is also used to -- implement the '(==)' function, that is, comparing two descriptions -- will compare their content, not the pointers to the two structures. fileEqual :: (FileClass file1, FileClass file2) => file1 -> file2 -> Bool -- | Gets the base name (the last component of the path) for a given -- File. -- -- If called for the top level of a system (such as the filesystem root -- or a uri like sftp: will return a single directory separator (and on -- Windows, possibly a drive letter). -- -- The base name is a byte string (*not* UTF-8). It has no defined -- encoding or rules other than it may not contain zero bytes. If you -- want to use filenames in a user interface you should use the display -- name that you can get by requesting the -- FileAttributeStandardDisplayName attribute with -- fileQueryInfo. -- -- This call does no blocking i/o. fileBasename :: FileClass file => file -> ByteString -- | Gets the local pathname for File, if one exists. -- -- This call does no blocking i/o. filePath :: FileClass file => file -> ByteString -- | Checks if file has a parent, and optionally, if it is parent. -- -- If parent is Nothing then this function returns True if -- file has any parent at all. If parent is non-Nothing then -- True is only returned if file is a child of parent. fileHasParent :: FileClass file => file -> Maybe File -> Bool -- | Gets the URI for the file. -- -- This call does no blocking i/o. fileURI :: FileClass file => file -> String -- | Gets the parse name of the file. A parse name is a UTF-8 string that -- describes the file such that one can get the File back using -- fileParseName. -- -- This is generally used to show the File as a nice full-pathname -- kind of string in a user interface, like in a location entry. -- -- For local files with names that can safely be converted to UTF8 the -- pathname is used, otherwise the IRI is used (a form of URI that allows -- UTF8 characters unescaped). -- -- This call does no blocking i/o. fileParseName :: FileClass file => file -> String -- | Gets a child of file with basename equal to name. -- -- Note that the file with that specific name might not exist, but you -- can still have a File that points to it. You can use this for -- instance to create that file. -- -- This call does no blocking i/o. fileGetChild :: FileClass file => file -> ByteString -> File -- | Gets the child of file for a given 'name (i.e. a UTF8 version of the -- name)'. If this function fails, it throws a GError. This is very -- useful when constructing a File for a new file and the user -- entered the filename in the user interface, for instance when you -- select a directory and type a filename in the file selector. -- -- This call does no blocking i/o. fileGetChildForDisplayName :: FileClass file => file -> String -> File -- | Checks whether file has the prefix specified by prefix. In other word, -- if the names of inital elements of files pathname match prefix. Only -- full pathname elements are matched, so a path like foo is not -- considered a prefix of foobar, only of foobar. -- -- This call does no i/o, as it works purely on names. As such it can -- sometimes return False even if file is inside a prefix (from a -- filesystem point of view), because the prefix of file is an alias of -- prefix. fileHasPrefix :: (FileClass file1, FileClass file2) => file1 -> file2 -> Bool -- | Gets the path for descendant relative to parent. -- -- This call does no blocking i/o. fileGetRelativePath :: (FileClass file1, FileClass file2) => file1 -> file2 -> Maybe ByteString -- | Resolves a relative path for file to an absolute path. -- -- This call does no blocking i/o. fileResolveRelativePath :: FileClass file => file -> ByteString -> Maybe File -- | Checks to see if a file is native to the platform. -- -- A native file s one expressed in the platform-native filename format, -- e.g. "C:Windows" or "usrbin/". This does not mean the file is -- local, as it might be on a locally mounted remote filesystem. -- -- On some systems non-native files may be available using the native -- filesystem via a userspace filesystem (FUSE), in these cases this call -- will return False, but fileGetPath will still return a -- native path. -- -- This call does no blocking i/o. fileIsNative :: FileClass file => file -> Bool -- | Checks to see if a File has a given URI scheme. -- -- This call does no blocking i/o. fileHasURIScheme :: FileClass file => file -> String -> Bool -- | Gets the URI scheme for a File. RFC 3986 decodes the scheme as: -- -- URI = scheme : hier-part [ ? query ] [ # fragment -- ] -- -- Common schemes include file, http, ftp, etc. -- -- This call does no blocking i/o. fileURIScheme :: FileClass file => file -> String -- | Opens a file for reading. The result is a FileInputStream that -- can be used to read the contents of the file. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. -- -- If the file does not exist, the IoErrorNotFound error will be -- returned. If the file is a directory, the IoErrorIsDirectory -- error will be returned. Other errors are possible too, and depend on -- what kind of filesystem the file is on. fileRead :: FileClass file => file -> Maybe Cancellable -> IO FileInputStream -- | Asynchronously opens file for reading. -- -- For more details, see fileRead which is the synchronous version -- of this call. -- -- When the operation is finished, callback will be called. You can then -- call fileReadFinish to get the result of the operation. fileReadAsync :: FileClass file => file -> Int -> Maybe Cancellable -> AsyncReadyCallback -> IO () -- | Finishes an asynchronous file read operation started with -- fileReadAsync. fileReadFinish :: FileClass file => file -> AsyncResult -> IO FileInputStream -- | Gets an output stream for appending data to the file. If the file -- doesn't already exist it is created. -- -- By default files created are generally readable by everyone, but if -- you pass FileCreatePrivate in flags the file will be made -- readable only to the current user, to the level that is supported on -- the target filesystem. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. -- -- Some file systems don't allow all file names, and may return an -- IoErrorInvalidFilename error. If the file is a directory the -- IoErrorIsDirectory error will be returned. Other errors are -- possible too, and depend on what kind of filesystem the file is on. fileAppendTo :: FileClass file => file -> [FileCreateFlags] -> Maybe Cancellable -> IO FileOutputStream -- | Creates a new file and returns an output stream for writing to it. The -- file must not already exist. -- -- By default files created are generally readable by everyone, but if -- you pass FileCreatePrivate in flags the file will be made -- readable only to the current user, to the level that is supported on -- the target filesystem. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. -- -- If a file or directory with this name already exists the -- IoErrorExists error will be returned. Some file systems don't -- allow all file names, and may return an IoErrorInvalidFilename -- error, and if the name is to long IoErrorFilenameTooLong will -- be returned. Other errors are possible too, and depend on what kind of -- filesystem the file is on. fileCreate :: FileClass file => file -> [FileCreateFlags] -> Maybe Cancellable -> IO FileOutputStream -- | Returns an output stream for overwriting the file, possibly creating a -- backup copy of the file first. If the file doesn't exist, it will be -- created. -- -- This will try to replace the file in the safest way possible so that -- any errors during the writing will not affect an already existing copy -- of the file. For instance, for local files it may write to a temporary -- file and then atomically rename over the destination when the stream -- is closed. -- -- By default files created are generally readable by everyone, but if -- you pass FileCreatePrivate in flags the file will be made -- readable only to the current user, to the level that is supported on -- the target filesystem. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. -- -- If you pass in a non-Nothing etag value, then this value is -- compared to the current entity tag of the file, and if they differ an -- IoErrorWrongEtag error is returned. This generally means that -- the file has been changed since you last read it. You can get the new -- etag from fileOutputStreamGetEtag after you've finished -- writing and closed the FileOutputStream. When you load a new -- file you can use fileInputStreamQueryInfo to get the etag of -- the file. -- -- If makeBackup is True, this function will attempt to -- make a backup of the current file before overwriting it. If this fails -- a IoErrorCantCreateBackup error will be returned. If you want -- to replace anyway, try again with makeBackup set to -- False. -- -- If the file is a directory the IoErrorIsDirectory error will be -- returned, and if the file is some other form of non-regular file then -- a IoErrorNotRegularFile error will be returned. Some file -- systems don't allow all file names, and may return an -- IoErrorInvalidFilename error, and if the name is to long -- IoErrorFilenameTooLong will be returned. Other errors are -- possible too, and depend on what kind of filesystem the file is on. fileReplace :: FileClass file => file -> Maybe String -> Bool -> [FileCreateFlags] -> Maybe Cancellable -> IO FileOutputStream -- | Asynchronously opens file for appending. -- -- For more details, see fileAppendTo which is the synchronous -- version of this call. -- -- When the operation is finished, callback will be called. You can then -- call fileAppendToFinish to get the result of the operation. fileAppendToAsync :: FileClass file => file -> [FileCreateFlags] -> Int -> Maybe Cancellable -> AsyncReadyCallback -> IO () -- | Finishes an asynchronous file append operation started with -- fileAppendToAsync. fileAppendToFinish :: FileClass file => file -> AsyncResult -> IO FileOutputStream -- | Asynchronously creates a new file and returns an output stream for -- writing to it. The file must not already exist. -- -- For more details, see fileCreate which is the synchronous -- version of this call. -- -- When the operation is finished, callback will be called. You can then -- call fileCreateFinish to get the result of the operation. fileCreateAsync :: FileClass file => file -> [FileCreateFlags] -> Int -> Maybe Cancellable -> AsyncReadyCallback -> IO () -- | Finishes an asynchronous file create operation started with -- fileCreateAsync. fileCreateFinish :: FileClass file => file -> AsyncResult -> IO FileOutputStream -- | Asynchronously overwrites the file, replacing the contents, possibly -- creating a backup copy of the file first. -- -- For more details, see fileReplace which is the synchronous -- version of this call. -- -- When the operation is finished, callback will be called. You can then -- call fileReplaceFinish to get the result of the operation. fileReplaceAsync :: FileClass file => file -> String -> Bool -> [FileCreateFlags] -> Int -> Maybe Cancellable -> AsyncReadyCallback -> IO () -- | Finishes an asynchronous file replace operation started with -- fileReplaceAsync. fileReplaceFinish :: FileClass file => file -> AsyncResult -> IO FileOutputStream -- | Gets the requested information about specified file. The result is a -- FileInfo object that contains key-value attributes (such as the -- type or size of the file). -- -- The attribute value is a string that specifies the file attributes -- that should be gathered. It is not an error if it's not possible to -- read a particular requested attribute from a file - it just won't be -- set. attribute should be a comma-separated list of attribute or -- attribute wildcards. The wildcard "*" means all attributes, and a -- wildcard like "standard::*" means all attributes in the standard -- namespace. An example attribute query be "standard::*,user". -- The standard attributes are available as defines, like -- FileAttributeStandardName. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. -- -- For symlinks, normally the information about the target of the symlink -- is returned, rather than information about the symlink itself. However -- if you pass FileQueryInfoNofollowSymlinks in flags the -- information about the symlink itself will be returned. Also, for -- symlinks that point to non-existing files the information about the -- symlink itself will be returned. -- -- If the file does not exist, the IoErrorNotFound error will be -- returned. Other errors are possible too, and depend on what kind of -- filesystem the file is on. fileQueryInfo :: FileClass file => file -> String -> [FileQueryInfoFlags] -> Maybe Cancellable -> IO FileInfo -- | Asynchronously gets the requested information about specified file. -- The result is a FileInfo object that contains key-value -- attributes (such as type or size for the file). -- -- For more details, see fileQueryInfo which is the synchronous -- version of this call. -- -- When the operation is finished, callback will be called. You can then -- call fileQueryInfoFinish to get the result of the operation. fileQueryInfoAsync :: FileClass file => file -> String -> [FileQueryInfoFlags] -> Int -> Maybe Cancellable -> AsyncReadyCallback -> IO () -- | Finishes an asynchronous file info query. See -- fileQueryInfoAsync. fileQueryInfoFinish :: FileClass file => file -> AsyncResult -> IO FileInfo -- | Utility function to check if a particular file exists. This is -- implemented using fileQueryInfo and as such does blocking I/O. -- -- Note that in many cases it is racy to first check for file existence -- and then execute something based on the outcome of that, because the -- file might have been created or removed in between the operations. The -- general approach to handling that is to not check, but just do the -- operation and handle the errors as they come. -- -- As an example of race-free checking, take the case of reading a file, -- and if it doesn't exist, creating it. There are two racy versions: -- read it, and on error create it; and: check if it exists, if not -- create it. These can both result in two processes creating the file -- (with perhaps a partially written file as the result). The correct -- approach is to always try to create the file with fileCreate -- which will either atomically create the file or fail with a -- IoErrorExists error. -- -- However, in many cases an existence check is useful in a user -- interface, for instance to make a menu item sensitive/ insensitive, so -- that you don't have to fool users that something is possible and then -- just show and error dialog. If you do this, you should make sure to -- also handle the errors that can happen due to races when you execute -- the operation. fileQueryExists :: FileClass file => file -> Maybe Cancellable -> Bool -- | Utility function to inspect the FileType of a file. This is -- implemented using fileQueryInfo and as such does blocking I/O. -- -- The primary use case of this method is to check if a file is a regular -- file, directory, or symlink. fileQueryFileType :: FileClass file => file -> [FileQueryInfoFlags] -> Maybe Cancellable -> FileType -- | Similar to fileQueryInfo, but obtains information about the -- filesystem the file is on, rather than the file itself. For instance -- the amount of space available and the type of the filesystem. -- -- The attribute value is a string that specifies the file attributes -- that should be gathered. It is not an error if it's not possible to -- read a particular requested attribute from a file - it just won't be -- set. attribute should be a comma-separated list of attribute or -- attribute wildcards. The wildcard "*" means all attributes, and a -- wildcard like fs:* means all attributes in the fs namespace. -- The standard namespace for filesystem attributes is fs. Common -- attributes of interest are 'FILEAttributeFilesystemSize (The Total -- Size Of The Filesystem In Bytes)', 'FILEAttributeFilesystemFree -- (Number Of Bytes Available)', and FileAttributeFilesystemType -- (type of the filesystem). -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. -- -- If the file does not exist, the IoErrorNotFound error will be -- returned. Other errors are possible too, and depend on what kind of -- filesystem the file is on. fileQueryFilesystemInfo :: FileClass file => file -> String -> Maybe Cancellable -> IO FileInfo -- | Asynchronously gets the requested information about the filesystem -- that the specified file is on. The result is a FileInfo object -- that contains key-value attributes (such as type or size for the -- file). -- -- For more details, see fileQueryFilesystemInfo which is the -- synchronous version of this call. -- -- When the operation is finished, callback will be called. You can then -- call fileQueryInfoFinish to get the result of the operation. fileQueryFilesystemInfoAsync :: FileClass file => file -> String -> Int -> Maybe Cancellable -> AsyncReadyCallback -> IO () -- | Finishes an asynchronous filesystem info query. See -- fileQueryFilesystemInfoAsync. fileQueryFilesystemInfoFinish :: FileClass file => file -> AsyncResult -> IO FileInfo -- | Returns the AppInfo that is registered as the default -- application to handle the file specified by file. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. fileQueryDefaultHandler :: FileClass file => file -> Maybe Cancellable -> IO AppInfo -- | Gets a Mount for the File. -- -- If the FileIface for file does not have a mount (e.g. -- possibly a remote share), error will be set to IoErrorNotFound -- and Nothing will be returned. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. fileFindEnclosingMount :: FileClass file => file -> Maybe Cancellable -> IO Mount -- | Asynchronously gets the mount for the file. -- -- For more details, see fileFindEnclosingMount which is the -- synchronous version of this call. -- -- When the operation is finished, callback will be called. You can then -- call fileFindEnclosingMountFinish to get the result of the -- operation. fileFindEnclosingMountAsync :: FileClass file => file -> Int -> Maybe Cancellable -> AsyncReadyCallback -> IO () -- | Finishes an asynchronous find mount request. See -- fileFindEnclosingMountAsync. fileFindEnclosingMountFinish :: FileClass file => file -> AsyncResult -> IO Mount -- | Gets the requested information about the files in a directory. The -- result is a FileEnumerator object that will give out -- FileInfo objects for all the files in the directory. -- -- The attribute value is a string that specifies the file attributes -- that should be gathered. It is not an error if it's not possible to -- read a particular requested attribute from a file - it just won't be -- set. attribute should be a comma-separated list of attribute or -- attribute wildcards. The wildcard "*" means all attributes, and a -- wildcard like "standard::*" means all attributes in the standard -- namespace. An example attribute query be "standard::*,user". -- The standard attributes are available as defines, like -- FileAttributeStandardName. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. -- -- If the file does not exist, the IoErrorNotFound error will be -- returned. If the file is not a directory, the FileErrorNotdir -- error will be returned. Other errors are possible too. fileEnumerateChildren :: FileClass file => file -> String -> [FileQueryInfoFlags] -> Maybe Cancellable -> IO FileEnumerator -- | Asynchronously gets the requested information about the files in a -- directory. The result is a FileEnumerator object that will give -- out FileInfo objects for all the files in the directory. -- -- For more details, see fileEnumerateChildren which is the -- synchronous version of this call. -- -- When the operation is finished, callback will be called. You can then -- call fileEnumerateChildrenFinish to get the result of the -- operation. fileEnumerateChildrenAsync :: FileClass file => file -> String -> [FileQueryInfoFlags] -> Int -> Maybe Cancellable -> AsyncReadyCallback -> IO () -- | Finishes an async enumerate children operation. See -- fileEnumerateChildrenAsync. fileEnumerateChildrenFinish :: FileClass file => file -> AsyncResult -> IO FileEnumerator -- | Renames file to the specified display name. -- -- The display name is converted from UTF8 to the correct encoding for -- the target filesystem if possible and the file is renamed to this. -- -- If you want to implement a rename operation in the user interface the -- edit name (FileAttributeStandardEditName) should be used as -- the initial value in the rename widget, and then the result after -- editing should be passed to fileSetDisplayName. -- -- On success the resulting converted filename is returned. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. fileSetDisplayName :: FileClass file => file -> String -> Maybe Cancellable -> IO File -- | Asynchronously sets the display name for a given File. -- -- For more details, see fileSetDisplayName which is the -- synchronous version of this call. -- -- When the operation is finished, callback will be called. You can then -- call fileSetDisplayNameFinish to get the result of the -- operation. fileSetDisplayNameAsync :: FileClass file => file -> String -> Int -> Maybe Cancellable -> AsyncReadyCallback -> IO () -- | Finishes setting a display name started with -- fileSetDisplayNameAsync. fileSetDisplayNameFinish :: FileClass file => file -> AsyncResult -> IO File -- | Deletes a file. If the file is a directory, it will only be deleted if -- it is empty. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. fileDelete :: FileClass file => file -> Maybe Cancellable -> IO () -- | Sends file to the Trashcan, if possible. This is similar to -- deleting it, but the user can recover it before emptying the trashcan. -- Not all file systems support trashing, so this call can return the -- IoErrorNotSupported error. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. fileTrash :: FileClass file => file -> Maybe Cancellable -> IO () -- | Copies the file source to the location specified by destination. Can -- not handle recursive copies of directories. -- -- If the flag FileCopyOverwrite is specified an already existing -- destination file is overwritten. -- -- If the flag FileCopyNofollowSymlinks is specified then symlinks -- will be copied as symlinks, otherwise the target of the source symlink -- will be copied. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. -- -- If progressCallback is not Nothing, then the operation -- can be monitored by setting this to a FileProgressCallback -- function. progressCallbackData will be passed to this -- function. It is guaranteed that this callback will be called after all -- data has been transferred with the total number of bytes copied during -- the operation. -- -- If the source file does not exist then the IoErrorNotFound -- error is returned, independent on the status of the destination. -- -- If FileCopyOverwrite is not specified and the target exists, -- then the error IoErrorExists is returned. -- -- If trying to overwrite a file over a directory the -- IoErrorIsDirectory error is returned. If trying to overwrite a -- directory with a directory the IoErrorWouldMerge error is -- returned. -- -- If the source is a directory and the target does not exist, or -- FileCopyOverwrite is specified and the target is a file, then -- the IoErrorWouldRecurse error is returned. -- -- If you are interested in copying the File object itself (not -- the on-disk file), see fileDup. fileCopy :: (FileClass source, FileClass destination) => source -> destination -> [FileCopyFlags] -> Maybe Cancellable -> Maybe FileProgressCallback -> IO () -- | Copies the file source to the location specified by destination -- asynchronously. For details of the behaviour, see fileCopy. -- -- If progressCallback is not Nothing, then that function -- that will be called just like in fileCopy, however the callback -- will run in the main loop, not in the thread that is doing the I/O -- operation. -- -- When the operation is finished, callback will be called. You can then -- call fileCopyFinish to get the result of the operation. fileCopyAsync :: (FileClass source, FileClass destination) => source -> destination -> [FileCopyFlags] -> Int -> Maybe Cancellable -> Maybe FileProgressCallback -> AsyncReadyCallback -> IO () -- | Finishes copying the file started with fileCopyAsync. -- -- Throws a GError if an error occurs. fileCopyFinish :: FileClass file => file -> AsyncResult -> IO () -- | Tries to move the file or directory source to the location specified -- by destination. If native move operations are supported then this is -- used, otherwise a copy + delete fallback is used. The native -- implementation may support moving directories (for instance on moves -- inside the same filesystem), but the fallback code does not. -- -- If the flag FileCopyOverwrite is specified an already existing -- destination file is overwritten. -- -- If the flag FileCopyNofollowSymlinks is specified then symlinks -- will be copied as symlinks, otherwise the target of the source symlink -- will be copied. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. -- -- If progressCallback is not Nothing, then the operation -- can be monitored by setting this to a FileProgressCallback -- function. progressCallbackData will be passed to this -- function. It is guaranteed that this callback will be called after all -- data has been transferred with the total number of bytes copied during -- the operation. -- -- If the source file does not exist then the IoErrorNotFound -- error is returned, independent on the status of the destination. -- -- If FileCopyOverwrite is not specified and the target exists, -- then the error IoErrorExists is returned. -- -- If trying to overwrite a file over a directory the -- IoErrorIsDirectory error is returned. If trying to overwrite a -- directory with a directory the IoErrorWouldMerge error is -- returned. -- -- If the source is a directory and the target does not exist, or -- FileCopyOverwrite is specified and the target is a file, then -- the IoErrorWouldRecurse error may be returned (if the native -- move operation isn't available). fileMove :: (FileClass source, FileClass destination) => source -> destination -> [FileCopyFlags] -> Maybe Cancellable -> Maybe FileProgressCallback -> IO () -- | Creates a directory. Note that this will only create a child directory -- of the immediate parent directory of the path or URI given by the -- File. To recursively create directories, see -- fileMakeDirectoryWithParents. This function will fail if the -- parent directory does not exist, setting error to -- IoErrorNotFound. If the file system doesn't support creating -- directories, this function will fail, setting error to -- IoErrorNotSupported. -- -- For a local File the newly created directory will have the -- default (current) ownership and permissions of the current process. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. fileMakeDirectory :: FileClass file => file -> Maybe Cancellable -> IO () -- | Creates a directory and any parent directories that may not exist -- similar to 'mkdir -p'. If the file system does not support creating -- directories, this function will fail, setting error to -- IoErrorNotSupported. -- -- For a local File the newly created directories will have the -- default (current) ownership and permissions of the current process. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. fileMakeDirectoryWithParents :: FileClass file => file -> Maybe Cancellable -> IO () -- | Creates a symbolic link. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. fileMakeSymbolicLink :: FileClass file => file -> ByteString -> Maybe Cancellable -> IO () -- | Obtain the list of settable attributes for the file. -- -- Returns the type and full attribute name of all the attributes that -- can be set on this file. This doesn't mean setting it will always -- succeed though, you might get an access failure, or some specific file -- may not support a specific attribute. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. fileQuerySettableAttributes :: FileClass file => file -> Maybe Cancellable -> IO [FileAttributeInfo] -- | Obtain the list of attribute namespaces where new attributes can be -- created by a user. An example of this is extended attributes (in the -- xattr namespace). -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. fileQueryWritableNamespaces :: FileClass file => file -> Maybe Cancellable -> IO [FileAttributeInfo] -- | Tries to set all attributes in the FileInfo on the target -- values, not stopping on the first error. -- -- If there is any error during this operation then error will be set to -- the first error. Error on particular fields are flagged by setting the -- status field in the attribute value to -- FileAttributeStatusErrorSetting, which means you can also -- detect further errors. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. fileSetAttributesFromInfo :: FileClass file => file -> FileInfo -> [FileQueryInfoFlags] -> Maybe Cancellable -> IO () -- | Asynchronously sets the attributes of file with info. -- -- For more details, see fileSetAttributesFromInfo which is the -- synchronous version of this call. -- -- When the operation is finished, callback will be called. You can then -- call fileSetAttributesFinish to get the result of the -- operation. fileSetAttributesFromInfoAsync :: FileClass file => file -> FileInfo -> [FileQueryInfoFlags] -> Int -> Maybe Cancellable -> AsyncReadyCallback -> IO () -- | Finishes setting an attribute started in -- fileSetAttributesAsync. -- -- Throws a GError if an error occurs. fileSetAttributesFinish :: FileClass file => file -> AsyncResult -> FileInfo -> IO () -- | Sets attribute of type FileAttributeTypeString to value. If -- attribute is of a different type, this operation will fail. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. fileSetAttributeString :: FileClass file => file -> String -> String -> [FileQueryInfoFlags] -> Maybe Cancellable -> IO () -- | Sets attribute of type FileAttributeTypeByteString to value. If -- attribute is of a different type, this operation will fail, returning -- False. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. fileSetAttributeByteString :: FileClass file => file -> String -> String -> [FileQueryInfoFlags] -> Maybe Cancellable -> IO () -- | Sets attribute of type FileAttributeTypeUint32 to value. If -- attribute is of a different type, this operation will fail. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. fileSetAttributeWord32 :: FileClass file => file -> String -> Word32 -> [FileQueryInfoFlags] -> Maybe Cancellable -> IO () -- | Sets attribute of type FileAttributeTypeInt32 to value. If -- attribute is of a different type, this operation will fail. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. fileSetAttributeInt32 :: FileClass file => file -> String -> Int32 -> [FileQueryInfoFlags] -> Maybe Cancellable -> IO () -- | Sets attribute of type FileAttributeTypeUint64 to value. If -- attribute is of a different type, this operation will fail. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. fileSetAttributeWord64 :: FileClass file => file -> String -> Word64 -> [FileQueryInfoFlags] -> Maybe Cancellable -> IO () -- | Sets attribute of type FileAttributeTypeInt64 to value. If -- attribute is of a different type, this operation will fail. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. fileSetAttributeInt64 :: FileClass file => file -> String -> Int64 -> [FileQueryInfoFlags] -> Maybe Cancellable -> IO () -- | Copies the file attributes from source to destination. -- -- Normally only a subset of the file attributes are copied, those that -- are copies in a normal file copy operation (which for instance does -- not include e.g. owner). However if FileCopyAllMetadata is -- specified in flags, then all the metadata that is possible to copy is -- copied. This is useful when implementing move by copy + delete source. fileCopyAttributes :: (FileClass source, FileClass destination) => source -> destination -> [FileCopyFlags] -> Maybe Cancellable -> IO () -- | Obtains a directory monitor for the given file. This may fail if -- directory monitoring is not supported. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. fileMonitorDirectory :: FileClass file => file -> [FileMonitorFlags] -> Maybe Cancellable -> IO FileMonitor -- | Obtains a file monitor for the given file. If no file notification -- mechanism exists, then regular polling of the file is used. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. fileMonitorFile :: FileClass file => file -> [FileMonitorFlags] -> Maybe Cancellable -> IO FileMonitor -- | Obtains a file or directory monitor for the given file, depending on -- the type of the file. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. fileMonitor :: FileClass file => file -> [FileMonitorFlags] -> Maybe Cancellable -> IO FileMonitor -- | Mounts a file of type FileTypeMountable. Using -- mountOperation, you can request callbacks when, for instance, -- passwords are needed during authentication. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. -- -- When the operation is finished, callback will be called. You can then -- call fileMountMountableFinish to get the result of the -- operation. fileMountMountable :: FileClass file => file -> [MountMountFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO () -- | Finishes a mount operation. See fileMountMountable for details. -- -- Finish an asynchronous mount operation that was started with -- fileMountMountable. fileMountMountableFinish :: FileClass file => file -> AsyncResult -> IO File -- | Unmounts a file of type FileTypeMountable. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. -- -- When the operation is finished, callback will be called. You can then -- call fileUnmountMountableFinish to get the result of the -- operation. fileUnmountMountableWithOperation :: FileClass file => file -> [MountUnmountFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO () -- | Finishes an unmount operation, see -- fileUnmountMountableWithOperation for details. -- -- Finish an asynchronous unmount operation that was started with -- fileUnmountMountableWithOperation. -- -- Throws a GError if an error occurs. fileUnmountMountableWithOperationFinish :: FileClass file => file -> AsyncResult -> IO () -- | Starts an asynchronous eject on a mountable. When this operation has -- completed, callback will be called with userUser data, and -- the operation can be finalized with -- fileEjectMountableWithOperationFinish. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. fileEjectMountableWithOperation :: FileClass file => file -> [MountUnmountFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO () -- | Finishes an asynchronous eject operation started by -- fileEjectMountableWithOperation. -- -- Throws a GError if an error occurs. fileEjectMountableWithOperationFinish :: FileClass file => file -> AsyncResult -> IO () -- | Starts a file of type FileTypeMountable. Using -- startOperation, you can request callbacks when, for instance, -- passwords are needed during authentication. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. -- -- When the operation is finished, callback will be called. You can then -- call fileMountMountableFinish to get the result of the -- operation. fileStartMountable :: FileClass file => file -> [DriveStartFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO () -- | Finishes a start operation. See fileStartMountable for details. -- -- Finish an asynchronous start operation that was started with -- fileStartMountable. -- -- Throws a GError if an error occurs. fileStartMountableFinish :: FileClass file => file -> AsyncResult -> IO () -- | Stops a file of type FileTypeMountable. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. -- -- When the operation is finished, callback will be called. You can then -- call fileStopMountableFinish to get the result of the -- operation. fileStopMountable :: FileClass file => file -> [MountUnmountFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO () -- | Finishes a stop operation. See fileStopMountable for details. -- -- Finish an asynchronous stop operation that was stoped with -- fileStopMountable. -- -- Throws a GError if an error occurs. fileStopMountableFinish :: FileClass file => file -> AsyncResult -> IO () -- | Polls a file of type FileTypeMountable. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. -- -- When the operation is finished, callback will be called. You can then -- call fileMountMountableFinish to get the result of the -- operation. filePollMountable :: FileClass file => file -> Maybe Cancellable -> AsyncReadyCallback -> IO () -- | Finishes a poll operation. See filePollMountable for details. -- -- Finish an asynchronous poll operation that was polled with -- filePollMountable. filePollMountableFinish :: FileClass file => file -> AsyncResult -> IO Bool -- | Starts a mountOperation, mounting the volume that contains -- the file location. -- -- When this operation has completed, callback will be called with -- userUser data, and the operation can be finalized with -- fileMountEnclosingVolumeFinish. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned. fileMountEnclosingVolume :: FileClass file => file -> [MountMountFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO () -- | Finishes a mount operation started by fileMountEnclosingVolume. fileMountEnclosingVolumeFinish :: FileClass file => file -> AsyncResult -> IO Bool -- | Checks if file supports thread-default contexts. If this returns -- False, you cannot perform asynchronous operations on file in a -- thread that has a thread-default context. fileSupportsThreadContexts :: FileClass file => file -> IO Bool instance Eq File module System.GIO.File.FileEnumerator newtype FileEnumerator FileEnumerator :: (ForeignPtr (FileEnumerator)) -> FileEnumerator class GObjectClass o => FileEnumeratorClass o -- | Returns information for the next file in the enumerated object. Will -- block until the information is available. The FileInfo returned -- from this function will contain attributes that match the attribute -- string that was passed when the FileEnumerator was created. -- -- On error, a GError is thrown. If the enumerator is at the end, -- Nothing will be returned. fileEnumeratorNextFile :: FileEnumeratorClass enumerator => enumerator -> Maybe Cancellable -> IO (Maybe FileInfo) -- | Releases all resources used by this enumerator, making the enumerator -- return GIoErrorClosed on all calls. -- -- This will be automatically called when the last reference is dropped, -- but you might want to call this function to make sure resources are -- released as early as possible. -- -- Throws a GError if an error occurs. fileEnumeratorClose :: FileEnumeratorClass enumerator => enumerator -> Maybe Cancellable -> IO () -- | Request information for a number of files from the enumerator -- asynchronously. When all i/o for the operation is finished the -- callback will be called with the requested information. -- -- The callback can be called with less than numFiles files in -- case of error or at the end of the enumerator. In case of a partial -- error the callback will be called with any succeeding items and no -- error, and on the next request the error will be reported. If a -- request is cancelled the callback will be called with -- IoErrorCancelled. -- -- During an async request no other sync and async calls are allowed, and -- will result in IoErrorPending errors. -- -- Any outstanding i/o request with higher priority (lower numerical -- value) will be executed before an outstanding request with lower -- priority. Default priority is GPriorityDefault. fileEnumeratorNextFilesAsync :: FileEnumeratorClass enumerator => enumerator -> Int -> Int -> Maybe Cancellable -> AsyncReadyCallback -> IO () -- | Finishes the asynchronous operation started with -- fileEnumeratorNextFilesAsync. fileEnumeratorNextFilesFinish :: FileEnumeratorClass enumerator => enumerator -> AsyncResult -> IO [FileInfo] -- | Asynchronously closes the file enumerator. -- -- If cancellable is not Nothing, then the operation can be -- cancelled by triggering the cancellable object from another thread. If -- the operation was cancelled, the error IoErrorCancelled will be -- returned in fileEnumeratorCloseFinish. fileEnumeratorCloseAsync :: FileEnumeratorClass enumerator => enumerator -> Int -> Maybe Cancellable -> AsyncReadyCallback -> IO () -- | Finishes closing a file enumerator, started from -- fileEnumeratorCloseAsync. -- -- If the file enumerator was already closed when -- fileEnumeratorCloseAsync was called, then this function will -- report GIoErrorClosed in error, and return False. If the file -- enumerator had pending operation when the close operation was started, -- then this function will report IoErrorPending, and return -- False. If cancellable was not Nothing, then the -- operation may have been cancelled by triggering the cancellable object -- from another thread. If the operation was cancelled, the GError -- IoErrorCancelled will be thrown. fileEnumeratorCloseFinish :: FileEnumeratorClass enumerator => enumerator -> AsyncResult -> IO () -- | Checks if the file enumerator has been closed. fileEnumeratorIsClosed :: FileEnumeratorClass enumerator => enumerator -> IO Bool -- | Checks if the file enumerator has pending operations. fileEnumeratorHasPending :: FileEnumeratorClass enumerator => enumerator -> IO Bool -- | Sets the file enumerator as having pending operations. fileEnumeratorSetPending :: FileEnumeratorClass enumerator => enumerator -> Bool -> IO () -- | Get the File container which is being enumerated. fileEnumeratorGetContainer :: FileEnumeratorClass enumerator => enumerator -> IO File module System.GIO.Volumes.Drive newtype Drive Drive :: (ForeignPtr (Drive)) -> Drive class GObjectClass o => DriveClass o -- | Enumeration describing how a drive can be started/stopped. data DriveStartStopType DriveStartStopTypeUnknown :: DriveStartStopType DriveStartStopTypeShutdown :: DriveStartStopType DriveStartStopTypeNetwork :: DriveStartStopType DriveStartStopTypeMultidisk :: DriveStartStopType DriveStartStopTypePassword :: DriveStartStopType -- | Flags used when starting a drive. data DriveStartFlags DriveStartNone :: DriveStartFlags -- | Gets the name of drive. driveGetName :: DriveClass drive => drive -> IO String -- | Gets the icon for drive. driveGetIcon :: DriveClass drive => drive -> IO Icon -- | Check if drive has any mountable volumes. driveHasVolumes :: DriveClass drive => drive -> IO Bool -- | Get a list of mountable volumes for drive. driveGetVolumes :: DriveClass drive => drive -> IO [Volume] -- | Checks if drive can be eject. driveCanEject :: DriveClass drive => drive -> IO Bool -- | Gets a hint about how a drive can be started/stopped. driveGetStartStopType :: DriveClass drive => drive -> IO DriveStartStopType -- | Checks if a drive can be started. driveCanStart :: DriveClass drive => drive -> IO Bool -- | Checks if a drive can be started degraded. driveCanStartDegraded :: DriveClass drive => drive -> IO Bool -- | Checks if a drive can be stoped. driveCanStop :: DriveClass drive => drive -> IO Bool -- | Checks if a drive can be polled for media changes. driveCanPollForMedia :: DriveClass drive => drive -> IO Bool -- | Asynchronously polls drive to see if media has been inserted or -- removed. -- -- When the operation is finished, callback will be called. You can then -- call drivePollForMediaFinish to obtain the result of the -- operation. drivePollForMedia :: DriveClass drive => drive -> Maybe Cancellable -> AsyncReadyCallback -> IO () -- | Checks if the drive has media. Note that the OS may not be polling the -- drive for media changes; see driveIsMediaCheckAutomatic for -- more details. driveHasMedia :: DriveClass drive => drive -> IO Bool -- | Checks if drive is capabable of automatically detecting media changes. driveIsMediaCheckAutomatic :: DriveClass drive => drive -> IO Bool -- | Checks if the drive supports removable media. driveIsMediaRemovable :: DriveClass drive => drive -> IO Bool -- | Ejects a drive. This is an asynchronous operation, and is finished by -- calling driveEjectWithOperationFinish with the drive and -- AsyncResult data returned in the callback. driveEjectWithOperation :: DriveClass drive => drive -> [MountUnmountFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO () -- | Finishes ejecting a drive. If any errors occurred during the -- operation, error will be set to contain the errors and False -- will be returned. -- -- Throws a GError if an error occurs. driveEjectWithOperationFinish :: DriveClass drive => drive -> AsyncResult -> IO () -- | Asynchronously starts a drive. -- -- When the operation is finished, callback will be called. You can then -- call driveStartFinish to obtain the result of the operation. driveStart :: DriveClass drive => drive -> [DriveStartFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO () -- | Finishes starting a drive. -- -- Throws a GError if an error occurs. driveStartFinish :: DriveClass drive => drive -> AsyncResult -> IO () -- | Finishes stoping a drive. -- -- Throws a GError if an error occurs. driveStopFinish :: DriveClass drive => drive -> AsyncResult -> IO () -- | Gets the kinds of identifiers that drive has. Use -- driveGetIdentifer to obtain the identifiers themselves. driveEnumerateIdentifiers :: DriveClass drive => drive -> IO [String] -- | Gets the identifier of the given kind for drive. See the introduction -- for more information about drive identifiers. driveGetIdentifier :: DriveClass drive => drive -> String -> IO String -- | Emitted when a drive changes. driveChanged :: DriveClass drive => Signal drive (Drive -> IO ()) -- | Emitted when a drive changes. driveDisconnected :: DriveClass drive => Signal drive (Drive -> IO ()) -- | Emitted when the eject button is pressed on drive. driveEjectButton :: DriveClass drive => Signal drive (Drive -> IO ()) -- | Emitted when the stop button is pressed on drive. driveStopButton :: DriveClass drive => Signal drive (Drive -> IO ()) module System.GIO.Volumes.Mount newtype Mount Mount :: (ForeignPtr (Mount)) -> Mount class GObjectClass o => MountClass o -- | Gets the name of mount. mountGetName :: MountClass mount => mount -> IO String -- | Gets the UUID for the mount. The reference is typically based on the -- file system UUID for the mount in question and should be considered an -- opaque string. Returns Nothing if there is no UUID available. mountGetUUID :: MountClass mount => mount -> IO (Maybe String) -- | Gets the icon for mount. mountGetIcon :: MountClass mount => mount -> IO Icon -- | Gets the drive for the mount. -- -- This is a convenience method for getting the Volume and then -- using that object to get the Drive. mountGetDrive :: MountClass mount => mount -> IO (Maybe Drive) -- | Gets the root directory on mount. mountGetRoot :: MountClass mount => mount -> IO File -- | Gets the volume directory on mount. mountGetVolume :: MountClass mount => mount -> IO (Maybe Volume) -- | Gets the default location of mount. The default location of the given -- mount is a path that reflects the main entry point for the user (e.g. -- the home directory, or the root of the volume). | Gets the root -- directory on mount. mountGetDefaultLocation :: MountClass mount => mount -> IO File -- | Checks if mount can be mounted. mountCanUnmount :: MountClass mount => mount -> IO Bool -- | Unmounts a mount. This is an asynchronous operation, and is finished -- by calling mountUnmountWithOperationFinish with the mount and -- AsyncResult data returned in the callback. mountUnmountWithOperation :: MountClass mount => mount -> [MountUnmountFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO () -- | Finishes unmounting a mount. If any errors occurred during the -- operation, error will be set to contain the errors and False -- will be returned. -- -- Throws a GError if an error occurs. mountUnmountWithOperationFinish :: MountClass mount => mount -> AsyncResult -> IO () -- | Remounts a mount. This is an asynchronous operation, and is finished -- by calling mountRemountFinish with the mount and -- AsyncResults data returned in the callback. -- -- Remounting is useful when some setting affecting the operation of the -- volume has been changed, as these may need a remount to take affect. -- While this is semantically equivalent with unmounting and then -- remounting not all backends might need to actually be unmounted. mountRemount :: MountClass mount => mount -> [MountMountFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO () -- | Finishes remounting a mount. If any errors occurred during the -- operation, error will be set to contain the errors and False -- will be returned. -- -- Throws a GError if an error occurs. mountRemountFinish :: MountClass mount => mount -> AsyncResult -> IO () -- | Checks if mount can be eject. mountCanEject :: MountClass mount => mount -> IO Bool -- | Ejects a mount. This is an asynchronous operation, and is finished by -- calling mountEjectWithOperationFinish with the mount and -- AsyncResult data returned in the callback. mountEjectWithOperation :: MountClass mount => mount -> [MountUnmountFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO () -- | Finishes ejecting a mount. If any errors occurred during the -- operation. -- -- Throws a GError if an error occurs. mountEjectWithOperationFinish :: MountClass mount => mount -> AsyncResult -> IO () -- | Tries to guess the type of content stored on mount. Returns one or -- more textual identifiers of well-known content types (typically -- prefixed with "x-content\"), e.g. x-contentimage-dcf for camera -- memory cards. See the shared-mime-info specification for more on -- x-content types. -- -- This is an asynchronous operation (see -- mountGuessContentTypeSync for the synchronous version), and is -- finished by calling mountGuessContentTypeFinish with the mount -- and AsyncResult data returned in the callback. mountGuessContentType :: MountClass mount => mount -> Bool -> Maybe Cancellable -> AsyncReadyCallback -> IO () -- | Finishes guessing content types of mount. If any errors occured during -- the operation, error will be set to contain the errors and -- False will be returned. In particular, you may get an -- IoErrorNotSupported if the mount does not support content -- guessing. mountGuessContentTypeFinish :: MountClass mount => mount -> AsyncResult -> IO [String] -- | Tries to guess the type of content stored on mount. Returns one or -- more textual identifiers of well-known content types (typically -- prefixed with "x-content\"), e.g. x-contentimage-dcf for camera -- memory cards. See the shared-mime-info specification for more on -- x-content types. -- -- This is an synchronous operation and as such may block doing IO; see -- mountGuessContentType for the asynchronous version. mountGuessContentTypeSync :: MountClass mount => mount -> Bool -> Maybe Cancellable -> IO [String] -- | Determines if mount is shadowed. Applications or libraries should -- avoid displaying mount in the user interface if it is shadowed. -- -- A mount is said to be shadowed if there exists one or more user -- visible objects (currently Mount objects) with a root that is -- inside the root of mount. -- -- One application of shadow mounts is when exposing a single file system -- that is used to address several logical volumes. In this situation, a -- VolumeMonitor implementation would create two Volume -- objects (for example, one for the camera functionality of the device -- and one for a SD card reader on the device) with activation URIs -- gphoto2: gphoto2: mounted, said VolumeMonitor implementation -- would create two Mount objects (each with their root matching -- the corresponding volume activation root) that would shadow the -- original mount. -- -- The proxy monitor in GVfs 2.26 and later, automatically creates and -- manage shadow mounts (and shadows the underlying mount) if the -- activation root on a Volume is set. mountIsShadowed :: MountClass mount => mount -> IO Bool -- | Increments the shadow count on mount. Usually used by -- VolumeMonitor implementations when creating a shadow mount for -- mount, see mountIsShadowed for more information. The caller -- will need to emit the changed signal on mount manually. mountShadow :: MountClass mount => mount -> IO () -- | Decrements the shadow count on mount. Usually used by -- VolumeMonitor implementations when destroying a shadow mount -- for mount, see mountIsShadowed for more information. The caller -- will need to emit the changed signal on mount manually. mountUnshadow :: MountClass mount => mount -> IO () -- | Emitted when the mount has been changed. mountChanged :: MountClass mount => Signal mount (IO ()) -- | This signal is emitted when the Mount is about to be unmounted. mountPreUnmount :: MountClass mount => Signal mount (IO ()) -- | This signal is emitted when the Mount have been unmounted. If -- the recipient is holding references to the object they should release -- them so the object can be finalized. mountUnmounted :: MountClass mount => Signal mount (IO ()) module System.GIO.Volumes.Volume newtype Volume Volume :: (ForeignPtr (Volume)) -> Volume class GObjectClass o => VolumeClass o -- | Gets the name of volume. volumeGetName :: VolumeClass volume => volume -> IO String -- | Gets the UUID for the volume. The reference is typically based on the -- file system UUID for the volume in question and should be considered -- an opaque string. Returns Nothing if there is no UUID -- available. volumeGetUUID :: VolumeClass volume => volume -> IO (Maybe String) -- | Gets the icon for volume. volumeGetIcon :: VolumeClass volume => volume -> IO Icon -- | Gets the drive for the volume. volumeGetDrive :: VolumeClass volume => volume -> IO (Maybe Drive) -- | Gets the mount for the volume. volumeGetMount :: VolumeClass volume => volume -> IO (Maybe Mount) -- | Checks if a volume can be mounted. volumeCanMount :: VolumeClass volume => volume -> IO Bool -- | Returns whether the volume should be automatically mounted. volumeShouldAutomount :: VolumeClass volume => volume -> IO Bool -- | Gets the activation root for a Volume if it is known ahead of -- mount time. Returns Nothing otherwise. If not Nothing -- and if volume is mounted, then the result of mountGetRoot on -- the Mount object obtained from volumeGetMount will -- always either be equal or a prefix of what this function returns. volumeGetActivationRoot :: VolumeClass volume => volume -> IO (Maybe File) -- | Mounts a volume. This is an asynchronous operation, and is finished by -- calling volumeMountFinish with the volume and -- AsyncResult returned in the callback. volumeMount :: VolumeClass volume => volume -> [MountMountFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO () -- | Finishes mounting a volume. If any errors occured during the -- operation, error will be set to contain the errors and False -- will be returned. -- -- If the mount operation succeeded, volumeGetMount on volume is -- guaranteed to return the mount right after calling this function; -- there's no need to listen for the 'mount-added' signal on -- VolumeMonitor. -- -- Throws a GError if an error occurs. volumeMountFinish :: VolumeClass volume => volume -> AsyncResult -> IO () -- | Checks if a volume can be ejected. volumeCanEject :: VolumeClass volume => volume -> IO Bool -- | Ejects a volume. This is an asynchronous operation, and is finished by -- calling volumeEjectWithOperationFinish with the volume and -- AsyncResult data returned in the callback. volumeEjectWithOperation :: VolumeClass volume => volume -> [MountUnmountFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO () -- | Finishes ejecting a volume. If any errors occurred during the -- operation, error will be set to contain the errors and False -- will be returned. -- -- Throws a GError if an error occurs. volumeEjectWithOperationFinish :: VolumeClass volume => volume -> AsyncResult -> IO () -- | Gets the kinds of identifiers that volume has. Use -- volumeGetIdentifer to obtain the identifiers themselves. volumeEnumerateIdentifiers :: VolumeClass volume => volume -> IO [String] -- | Gets the identifier of the given kind for volume. See the introduction -- for more information about volume identifiers. volumeGetIdentifier :: VolumeClass volume => volume -> String -> IO String -- | Emitted when the volume has been changed. volumeChanged :: VolumeClass volume => Signal volume (IO ()) -- | This signal is emitted when the Volume have been removed. If -- the recipient is holding references to the object they should release -- them so the object can be finalized. volumeRemoved :: VolumeClass volume => Signal volume (IO ()) module System.GIO