packages feed

gio 0.11.1 → 0.12.0

raw patch · 31 files changed

+6269/−1477 lines, 31 filesdep ~glibsetup-changednew-uploaderPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: glib

API changes (from Hackage documentation)

- System.GIO.Async.Cancellable: data Cancellable
- System.GIO.Base: FileAttributeInfoCopyWhenMoved :: FileAttributeInfoFlags
- System.GIO.Base: FileAttributeInfoCopyWithFile :: FileAttributeInfoFlags
- System.GIO.Base: FileAttributeInfoNone :: FileAttributeInfoFlags
- System.GIO.Base: cFromEnum :: (Integral int, Enum enum) => enum -> int
- System.GIO.Base: cFromFlags :: (Integral int, Flags flags) => [flags] -> int
- System.GIO.Base: cObjectRef :: Ptr () -> IO (Ptr ())
- System.GIO.Base: cToEnum :: (Integral int, Enum enum) => int -> enum
- System.GIO.Base: cToFlags :: (Integral int, Flags flags) => int -> [flags]
- System.GIO.Base: data FileAttributeInfoFlags
- System.GIO.Base: instance Bounded FileAttributeInfoFlags
- System.GIO.Base: instance Enum FileAttributeInfoFlags
- System.GIO.Base: instance Eq FileAttributeInfoFlags
- System.GIO.Base: instance Flags FileAttributeInfoFlags
- System.GIO.Base: instance Ord FileAttributeInfoFlags
- System.GIO.Base: instance Read FileAttributeInfoFlags
- System.GIO.Base: instance Show FileAttributeInfoFlags
- System.GIO.Base: makeAsyncReadyCallback :: CAsyncReadyCallback -> IO ((FunPtr ((Ptr ()) -> ((Ptr AsyncResult) -> ((Ptr ()) -> (IO ()))))))
- System.GIO.Base: marshalAsyncReadyCallback :: AsyncReadyCallback -> IO ((FunPtr ((Ptr ()) -> ((Ptr AsyncResult) -> ((Ptr ()) -> (IO ()))))))
- System.GIO.Base: objectFinalizer :: FunPtr (Ptr () -> IO ())
- System.GIO.Base: peekGObject :: GObjectClass obj => Ptr obj -> IO obj
- System.GIO.Base: takeGObject :: GObjectClass obj => Ptr obj -> IO obj
- System.GIO.Base: type AsyncReadyCallback = GObject -> AsyncResult -> IO ()
- System.GIO.Base: type CAsyncReadyCallback = Ptr GObject -> Ptr AsyncResult -> Ptr () -> IO ()
- System.GIO.Base: type Offset = CLLong
- System.GIO.Base: withGObject :: GObjectClass objectT => objectT -> (Ptr objectT -> IO a) -> IO a
- System.GIO.File.File: FilesystemPreviewTypeIfAlways :: FilesystemPreviewType
- System.GIO.File.File: FilesystemPreviewTypeIfLocal :: FilesystemPreviewType
- System.GIO.File.File: FilesystemPreviewTypeNever :: FilesystemPreviewType
- System.GIO.File.File: data FilesystemPreviewType
- System.GIO.File.File: instance Bounded FileCopyFlags
- System.GIO.File.File: instance Bounded FileCreateFlags
- System.GIO.File.File: instance Bounded FileMonitorFlags
- System.GIO.File.File: instance Bounded FileQueryInfoFlags
- System.GIO.File.File: instance Bounded FileType
- System.GIO.File.File: instance Bounded FilesystemPreviewType
- System.GIO.File.File: instance Enum FileCopyFlags
- System.GIO.File.File: instance Enum FileCreateFlags
- System.GIO.File.File: instance Enum FileMonitorFlags
- System.GIO.File.File: instance Enum FileQueryInfoFlags
- System.GIO.File.File: instance Enum FileType
- System.GIO.File.File: instance Enum FilesystemPreviewType
- System.GIO.File.File: instance Eq FileCopyFlags
- System.GIO.File.File: instance Eq FileCreateFlags
- System.GIO.File.File: instance Eq FileMonitorFlags
- System.GIO.File.File: instance Eq FileQueryInfoFlags
- System.GIO.File.File: instance Eq FileType
- System.GIO.File.File: instance Eq FilesystemPreviewType
- System.GIO.File.File: instance Flags FileCopyFlags
- System.GIO.File.File: instance Flags FileCreateFlags
- System.GIO.File.File: instance Flags FileMonitorFlags
- System.GIO.File.File: instance Flags FileQueryInfoFlags
- System.GIO.File.File: instance Ord FileCopyFlags
- System.GIO.File.File: instance Ord FileCreateFlags
- System.GIO.File.File: instance Ord FileMonitorFlags
- System.GIO.File.File: instance Ord FileQueryInfoFlags
- System.GIO.File.File: instance Ord FileType
- System.GIO.File.File: instance Ord FilesystemPreviewType
- System.GIO.File.File: instance Show FileCopyFlags
- System.GIO.File.File: instance Show FileCreateFlags
- System.GIO.File.File: instance Show FileMonitorFlags
- System.GIO.File.File: instance Show FileQueryInfoFlags
- System.GIO.File.File: instance Show FileType
- System.GIO.File.File: instance Show FilesystemPreviewType
- System.GIO.File.File: instance Typeable FileCopyFlags
- System.GIO.File.File: instance Typeable FileCreateFlags
- System.GIO.File.File: instance Typeable FileMonitorFlags
- System.GIO.File.File: instance Typeable FileQueryInfoFlags
- System.GIO.File.File: instance Typeable FileType
- System.GIO.File.File: instance Typeable FilesystemPreviewType
+ System.GIO.Async.AsyncResult: marshalAsyncReadyCallback :: AsyncReadyCallback -> IO GAsyncReadyCallback
+ System.GIO.Async.Cancellable: Cancellable :: (ForeignPtr (Cancellable)) -> Cancellable
+ System.GIO.Async.Cancellable: class GObjectClass o => CancellableClass o
+ System.GIO.Async.Cancellable: newtype Cancellable
+ System.GIO.Enums: AppInfoCreateNeedsTerminal :: AppInfoCreateFlags
+ System.GIO.Enums: AppInfoCreateNone :: AppInfoCreateFlags
+ System.GIO.Enums: AppInfoCreateSupportsStartupNotification :: AppInfoCreateFlags
+ System.GIO.Enums: AppInfoCreateSupportsUris :: AppInfoCreateFlags
+ System.GIO.Enums: AskPasswordAnonymousSupported :: AskPasswordFlags
+ System.GIO.Enums: AskPasswordNeedDomain :: AskPasswordFlags
+ System.GIO.Enums: AskPasswordNeedPassword :: AskPasswordFlags
+ System.GIO.Enums: AskPasswordNeedUsername :: AskPasswordFlags
+ System.GIO.Enums: AskPasswordSavingSupported :: AskPasswordFlags
+ System.GIO.Enums: DriveStartNone :: DriveStartFlags
+ System.GIO.Enums: DriveStartStopTypeMultidisk :: DriveStartStopType
+ System.GIO.Enums: DriveStartStopTypeNetwork :: DriveStartStopType
+ System.GIO.Enums: DriveStartStopTypePassword :: DriveStartStopType
+ System.GIO.Enums: DriveStartStopTypeShutdown :: DriveStartStopType
+ System.GIO.Enums: DriveStartStopTypeUnknown :: DriveStartStopType
+ System.GIO.Enums: EmblemOriginDevice :: EmblemOrigin
+ System.GIO.Enums: EmblemOriginLivemetadata :: EmblemOrigin
+ System.GIO.Enums: EmblemOriginTag :: EmblemOrigin
+ System.GIO.Enums: EmblemOriginUnknown :: EmblemOrigin
+ System.GIO.Enums: FileAttributeInfoCopyWhenMoved :: FileAttributeInfoFlags
+ System.GIO.Enums: FileAttributeInfoCopyWithFile :: FileAttributeInfoFlags
+ System.GIO.Enums: FileAttributeInfoNone :: FileAttributeInfoFlags
+ System.GIO.Enums: FileAttributeStatusErrorSetting :: FileAttributeStatus
+ System.GIO.Enums: FileAttributeStatusSet :: FileAttributeStatus
+ System.GIO.Enums: FileAttributeStatusUnset :: FileAttributeStatus
+ System.GIO.Enums: FileCopyAllMetadata :: FileCopyFlags
+ System.GIO.Enums: FileCopyBackup :: FileCopyFlags
+ System.GIO.Enums: FileCopyNoFallbackForMove :: FileCopyFlags
+ System.GIO.Enums: FileCopyNofollowSymlinks :: FileCopyFlags
+ System.GIO.Enums: FileCopyNone :: FileCopyFlags
+ System.GIO.Enums: FileCopyOverwrite :: FileCopyFlags
+ System.GIO.Enums: FileCopyTargetDefaultPerms :: FileCopyFlags
+ System.GIO.Enums: FileCreateNone :: FileCreateFlags
+ System.GIO.Enums: FileCreatePrivate :: FileCreateFlags
+ System.GIO.Enums: FileCreateReplaceDestination :: FileCreateFlags
+ System.GIO.Enums: FileMonitorEventAttributeChanged :: FileMonitorEvent
+ System.GIO.Enums: FileMonitorEventChanged :: FileMonitorEvent
+ System.GIO.Enums: FileMonitorEventChangesDoneHint :: FileMonitorEvent
+ System.GIO.Enums: FileMonitorEventCreated :: FileMonitorEvent
+ System.GIO.Enums: FileMonitorEventDeleted :: FileMonitorEvent
+ System.GIO.Enums: FileMonitorEventMoved :: FileMonitorEvent
+ System.GIO.Enums: FileMonitorEventPreUnmount :: FileMonitorEvent
+ System.GIO.Enums: FileMonitorEventUnmounted :: FileMonitorEvent
+ System.GIO.Enums: FileMonitorNone :: FileMonitorFlags
+ System.GIO.Enums: FileMonitorSendMoved :: FileMonitorFlags
+ System.GIO.Enums: FileMonitorWatchMounts :: FileMonitorFlags
+ System.GIO.Enums: FileQueryInfoNofollowSymlinks :: FileQueryInfoFlags
+ System.GIO.Enums: FileQueryInfoNone :: FileQueryInfoFlags
+ System.GIO.Enums: FileTypeDirectory :: FileType
+ System.GIO.Enums: FileTypeMountable :: FileType
+ System.GIO.Enums: FileTypeRegular :: FileType
+ System.GIO.Enums: FileTypeShortcut :: FileType
+ System.GIO.Enums: FileTypeSpecial :: FileType
+ System.GIO.Enums: FileTypeSymbolicLink :: FileType
+ System.GIO.Enums: FileTypeUnknown :: FileType
+ System.GIO.Enums: FilesystemPreviewTypeIfAlways :: FilesystemPreviewType
+ System.GIO.Enums: FilesystemPreviewTypeIfLocal :: FilesystemPreviewType
+ System.GIO.Enums: FilesystemPreviewTypeNever :: FilesystemPreviewType
+ System.GIO.Enums: IoErrorAddressInUse :: IOErrorEnum
+ System.GIO.Enums: IoErrorAlreadyMounted :: IOErrorEnum
+ System.GIO.Enums: IoErrorBusy :: IOErrorEnum
+ System.GIO.Enums: IoErrorCancelled :: IOErrorEnum
+ System.GIO.Enums: IoErrorCantCreateBackup :: IOErrorEnum
+ System.GIO.Enums: IoErrorClosed :: IOErrorEnum
+ System.GIO.Enums: IoErrorConnectionRefused :: IOErrorEnum
+ System.GIO.Enums: IoErrorDbusError :: IOErrorEnum
+ System.GIO.Enums: IoErrorExists :: IOErrorEnum
+ System.GIO.Enums: IoErrorFailed :: IOErrorEnum
+ System.GIO.Enums: IoErrorFailedHandled :: IOErrorEnum
+ System.GIO.Enums: IoErrorFilenameTooLong :: IOErrorEnum
+ System.GIO.Enums: IoErrorHostNotFound :: IOErrorEnum
+ System.GIO.Enums: IoErrorHostUnreachable :: IOErrorEnum
+ System.GIO.Enums: IoErrorInvalidArgument :: IOErrorEnum
+ System.GIO.Enums: IoErrorInvalidData :: IOErrorEnum
+ System.GIO.Enums: IoErrorInvalidFilename :: IOErrorEnum
+ System.GIO.Enums: IoErrorIsDirectory :: IOErrorEnum
+ System.GIO.Enums: IoErrorNetworkUnreachable :: IOErrorEnum
+ System.GIO.Enums: IoErrorNoSpace :: IOErrorEnum
+ System.GIO.Enums: IoErrorNotDirectory :: IOErrorEnum
+ System.GIO.Enums: IoErrorNotEmpty :: IOErrorEnum
+ System.GIO.Enums: IoErrorNotFound :: IOErrorEnum
+ System.GIO.Enums: IoErrorNotInitialized :: IOErrorEnum
+ System.GIO.Enums: IoErrorNotMountableFile :: IOErrorEnum
+ System.GIO.Enums: IoErrorNotMounted :: IOErrorEnum
+ System.GIO.Enums: IoErrorNotRegularFile :: IOErrorEnum
+ System.GIO.Enums: IoErrorNotSupported :: IOErrorEnum
+ System.GIO.Enums: IoErrorNotSymbolicLink :: IOErrorEnum
+ System.GIO.Enums: IoErrorPartialInput :: IOErrorEnum
+ System.GIO.Enums: IoErrorPending :: IOErrorEnum
+ System.GIO.Enums: IoErrorPermissionDenied :: IOErrorEnum
+ System.GIO.Enums: IoErrorProxyAuthFailed :: IOErrorEnum
+ System.GIO.Enums: IoErrorProxyFailed :: IOErrorEnum
+ System.GIO.Enums: IoErrorProxyNeedAuth :: IOErrorEnum
+ System.GIO.Enums: IoErrorProxyNotAllowed :: IOErrorEnum
+ System.GIO.Enums: IoErrorReadOnly :: IOErrorEnum
+ System.GIO.Enums: IoErrorTimedOut :: IOErrorEnum
+ System.GIO.Enums: IoErrorTooManyLinks :: IOErrorEnum
+ System.GIO.Enums: IoErrorTooManyOpenFiles :: IOErrorEnum
+ System.GIO.Enums: IoErrorWouldBlock :: IOErrorEnum
+ System.GIO.Enums: IoErrorWouldMerge :: IOErrorEnum
+ System.GIO.Enums: IoErrorWouldRecurse :: IOErrorEnum
+ System.GIO.Enums: IoErrorWrongEtag :: IOErrorEnum
+ System.GIO.Enums: MountMountNone :: MountMountFlags
+ System.GIO.Enums: MountOperationAborted :: MountOperationResult
+ System.GIO.Enums: MountOperationHandled :: MountOperationResult
+ System.GIO.Enums: MountOperationUnhandled :: MountOperationResult
+ System.GIO.Enums: MountUnmountForce :: MountUnmountFlags
+ System.GIO.Enums: MountUnmountNone :: MountUnmountFlags
+ System.GIO.Enums: PasswordSaveForSession :: PasswordSave
+ System.GIO.Enums: PasswordSaveNever :: PasswordSave
+ System.GIO.Enums: PasswordSavePermanently :: PasswordSave
+ System.GIO.Enums: data AppInfoCreateFlags
+ System.GIO.Enums: data AskPasswordFlags
+ System.GIO.Enums: data DriveStartFlags
+ System.GIO.Enums: data DriveStartStopType
+ System.GIO.Enums: data EmblemOrigin
+ System.GIO.Enums: data FileAttributeInfoFlags
+ System.GIO.Enums: data FileAttributeStatus
+ System.GIO.Enums: data FileCopyFlags
+ System.GIO.Enums: data FileCreateFlags
+ System.GIO.Enums: data FileMonitorEvent
+ System.GIO.Enums: data FileMonitorFlags
+ System.GIO.Enums: data FileQueryInfoFlags
+ System.GIO.Enums: data FileType
+ System.GIO.Enums: data FilesystemPreviewType
+ System.GIO.Enums: data IOErrorEnum
+ System.GIO.Enums: data MountMountFlags
+ System.GIO.Enums: data MountOperationResult
+ System.GIO.Enums: data MountUnmountFlags
+ System.GIO.Enums: data PasswordSave
+ System.GIO.Enums: instance Bounded AppInfoCreateFlags
+ System.GIO.Enums: instance Bounded AskPasswordFlags
+ System.GIO.Enums: instance Bounded DriveStartFlags
+ System.GIO.Enums: instance Bounded DriveStartStopType
+ System.GIO.Enums: instance Bounded EmblemOrigin
+ System.GIO.Enums: instance Bounded FileAttributeInfoFlags
+ System.GIO.Enums: instance Bounded FileAttributeStatus
+ System.GIO.Enums: instance Bounded FileCopyFlags
+ System.GIO.Enums: instance Bounded FileCreateFlags
+ System.GIO.Enums: instance Bounded FileMonitorEvent
+ System.GIO.Enums: instance Bounded FileMonitorFlags
+ System.GIO.Enums: instance Bounded FileQueryInfoFlags
+ System.GIO.Enums: instance Bounded FileType
+ System.GIO.Enums: instance Bounded FilesystemPreviewType
+ System.GIO.Enums: instance Bounded IOErrorEnum
+ System.GIO.Enums: instance Bounded MountMountFlags
+ System.GIO.Enums: instance Bounded MountOperationResult
+ System.GIO.Enums: instance Bounded MountUnmountFlags
+ System.GIO.Enums: instance Bounded PasswordSave
+ System.GIO.Enums: instance Enum AppInfoCreateFlags
+ System.GIO.Enums: instance Enum AskPasswordFlags
+ System.GIO.Enums: instance Enum DriveStartFlags
+ System.GIO.Enums: instance Enum DriveStartStopType
+ System.GIO.Enums: instance Enum EmblemOrigin
+ System.GIO.Enums: instance Enum FileAttributeInfoFlags
+ System.GIO.Enums: instance Enum FileAttributeStatus
+ System.GIO.Enums: instance Enum FileCopyFlags
+ System.GIO.Enums: instance Enum FileCreateFlags
+ System.GIO.Enums: instance Enum FileMonitorEvent
+ System.GIO.Enums: instance Enum FileMonitorFlags
+ System.GIO.Enums: instance Enum FileQueryInfoFlags
+ System.GIO.Enums: instance Enum FileType
+ System.GIO.Enums: instance Enum FilesystemPreviewType
+ System.GIO.Enums: instance Enum IOErrorEnum
+ System.GIO.Enums: instance Enum MountMountFlags
+ System.GIO.Enums: instance Enum MountOperationResult
+ System.GIO.Enums: instance Enum MountUnmountFlags
+ System.GIO.Enums: instance Enum PasswordSave
+ System.GIO.Enums: instance Eq AppInfoCreateFlags
+ System.GIO.Enums: instance Eq AskPasswordFlags
+ System.GIO.Enums: instance Eq DriveStartFlags
+ System.GIO.Enums: instance Eq DriveStartStopType
+ System.GIO.Enums: instance Eq EmblemOrigin
+ System.GIO.Enums: instance Eq FileAttributeInfoFlags
+ System.GIO.Enums: instance Eq FileAttributeStatus
+ System.GIO.Enums: instance Eq FileCopyFlags
+ System.GIO.Enums: instance Eq FileCreateFlags
+ System.GIO.Enums: instance Eq FileMonitorEvent
+ System.GIO.Enums: instance Eq FileMonitorFlags
+ System.GIO.Enums: instance Eq FileQueryInfoFlags
+ System.GIO.Enums: instance Eq FileType
+ System.GIO.Enums: instance Eq FilesystemPreviewType
+ System.GIO.Enums: instance Eq IOErrorEnum
+ System.GIO.Enums: instance Eq MountMountFlags
+ System.GIO.Enums: instance Eq MountOperationResult
+ System.GIO.Enums: instance Eq MountUnmountFlags
+ System.GIO.Enums: instance Eq PasswordSave
+ System.GIO.Enums: instance Flags AppInfoCreateFlags
+ System.GIO.Enums: instance Flags AskPasswordFlags
+ System.GIO.Enums: instance Flags DriveStartFlags
+ System.GIO.Enums: instance Flags FileAttributeInfoFlags
+ System.GIO.Enums: instance Flags FileCopyFlags
+ System.GIO.Enums: instance Flags FileCreateFlags
+ System.GIO.Enums: instance Flags FileMonitorFlags
+ System.GIO.Enums: instance Flags FileQueryInfoFlags
+ System.GIO.Enums: instance Flags MountMountFlags
+ System.GIO.Enums: instance Flags MountUnmountFlags
+ System.GIO.Enums: instance Ord AppInfoCreateFlags
+ System.GIO.Enums: instance Ord AskPasswordFlags
+ System.GIO.Enums: instance Ord DriveStartFlags
+ System.GIO.Enums: instance Ord DriveStartStopType
+ System.GIO.Enums: instance Ord EmblemOrigin
+ System.GIO.Enums: instance Ord FileAttributeInfoFlags
+ System.GIO.Enums: instance Ord FileAttributeStatus
+ System.GIO.Enums: instance Ord FileCopyFlags
+ System.GIO.Enums: instance Ord FileCreateFlags
+ System.GIO.Enums: instance Ord FileMonitorEvent
+ System.GIO.Enums: instance Ord FileMonitorFlags
+ System.GIO.Enums: instance Ord FileQueryInfoFlags
+ System.GIO.Enums: instance Ord FileType
+ System.GIO.Enums: instance Ord FilesystemPreviewType
+ System.GIO.Enums: instance Ord IOErrorEnum
+ System.GIO.Enums: instance Ord MountMountFlags
+ System.GIO.Enums: instance Ord MountOperationResult
+ System.GIO.Enums: instance Ord MountUnmountFlags
+ System.GIO.Enums: instance Ord PasswordSave
+ System.GIO.Enums: instance Read FileAttributeInfoFlags
+ System.GIO.Enums: instance Show AppInfoCreateFlags
+ System.GIO.Enums: instance Show AskPasswordFlags
+ System.GIO.Enums: instance Show DriveStartFlags
+ System.GIO.Enums: instance Show DriveStartStopType
+ System.GIO.Enums: instance Show EmblemOrigin
+ System.GIO.Enums: instance Show FileAttributeInfoFlags
+ System.GIO.Enums: instance Show FileAttributeStatus
+ System.GIO.Enums: instance Show FileCopyFlags
+ System.GIO.Enums: instance Show FileCreateFlags
+ System.GIO.Enums: instance Show FileMonitorEvent
+ System.GIO.Enums: instance Show FileMonitorFlags
+ System.GIO.Enums: instance Show FileQueryInfoFlags
+ System.GIO.Enums: instance Show FileType
+ System.GIO.Enums: instance Show FilesystemPreviewType
+ System.GIO.Enums: instance Show IOErrorEnum
+ System.GIO.Enums: instance Show MountMountFlags
+ System.GIO.Enums: instance Show MountOperationResult
+ System.GIO.Enums: instance Show MountUnmountFlags
+ System.GIO.Enums: instance Show PasswordSave
+ System.GIO.Enums: instance Typeable AppInfoCreateFlags
+ System.GIO.Enums: instance Typeable AskPasswordFlags
+ System.GIO.Enums: instance Typeable DriveStartFlags
+ System.GIO.Enums: instance Typeable DriveStartStopType
+ System.GIO.Enums: instance Typeable EmblemOrigin
+ System.GIO.Enums: instance Typeable FileAttributeStatus
+ System.GIO.Enums: instance Typeable FileCopyFlags
+ System.GIO.Enums: instance Typeable FileCreateFlags
+ System.GIO.Enums: instance Typeable FileMonitorEvent
+ System.GIO.Enums: instance Typeable FileMonitorFlags
+ System.GIO.Enums: instance Typeable FileQueryInfoFlags
+ System.GIO.Enums: instance Typeable FileType
+ System.GIO.Enums: instance Typeable FilesystemPreviewType
+ System.GIO.Enums: instance Typeable IOErrorEnum
+ System.GIO.Enums: instance Typeable MountMountFlags
+ System.GIO.Enums: instance Typeable MountOperationResult
+ System.GIO.Enums: instance Typeable MountUnmountFlags
+ System.GIO.Enums: instance Typeable PasswordSave
+ System.GIO.File.AppInfo: AppInfoCreateNeedsTerminal :: AppInfoCreateFlags
+ System.GIO.File.AppInfo: AppInfoCreateNone :: AppInfoCreateFlags
+ System.GIO.File.AppInfo: AppInfoCreateSupportsStartupNotification :: AppInfoCreateFlags
+ System.GIO.File.AppInfo: AppInfoCreateSupportsUris :: AppInfoCreateFlags
+ System.GIO.File.AppInfo: appInfoAddSupportsType :: AppInfoClass appinfo => appinfo -> String -> IO ()
+ System.GIO.File.AppInfo: appInfoCanDelete :: AppInfoClass appinfo => appinfo -> IO Bool
+ System.GIO.File.AppInfo: appInfoCanRemoveSupportsType :: AppInfoClass appinfo => appinfo -> IO Bool
+ System.GIO.File.AppInfo: appInfoCreateFromCommandline :: String -> Maybe String -> [AppInfoCreateFlags] -> IO AppInfo
+ System.GIO.File.AppInfo: appInfoDelete :: AppInfoClass appinfo => appinfo -> IO Bool
+ System.GIO.File.AppInfo: appInfoDup :: AppInfoClass appinfo => appinfo -> IO AppInfo
+ System.GIO.File.AppInfo: appInfoEqual :: (AppInfoClass info1, AppInfoClass info2) => info1 -> info2 -> Bool
+ System.GIO.File.AppInfo: appInfoGetAll :: IO [AppInfo]
+ System.GIO.File.AppInfo: appInfoGetAllForType :: String -> IO [AppInfo]
+ System.GIO.File.AppInfo: appInfoGetCommandline :: AppInfoClass appinfo => appinfo -> Maybe ByteString
+ System.GIO.File.AppInfo: appInfoGetDefaultForType :: String -> Bool -> IO (Maybe AppInfo)
+ System.GIO.File.AppInfo: appInfoGetDefaultForUriScheme :: String -> IO (Maybe AppInfo)
+ System.GIO.File.AppInfo: appInfoGetDescription :: AppInfoClass appinfo => appinfo -> Maybe String
+ System.GIO.File.AppInfo: appInfoGetDisplayName :: AppInfoClass appinfo => appinfo -> String
+ System.GIO.File.AppInfo: appInfoGetExecutable :: AppInfoClass appinfo => appinfo -> String
+ System.GIO.File.AppInfo: appInfoGetIcon :: AppInfoClass appinfo => appinfo -> IO (Maybe Icon)
+ System.GIO.File.AppInfo: appInfoGetId :: AppInfoClass appinfo => appinfo -> IO (Maybe String)
+ System.GIO.File.AppInfo: appInfoGetName :: AppInfoClass appinfo => appinfo -> String
+ System.GIO.File.AppInfo: appInfoLaunch :: AppInfoClass appinfo => appinfo -> [File] -> Maybe AppLaunchContext -> IO ()
+ System.GIO.File.AppInfo: appInfoLaunchDefaultForUri :: String -> AppLaunchContext -> IO ()
+ System.GIO.File.AppInfo: appInfoLaunchUris :: AppInfoClass appinfo => appinfo -> [String] -> Maybe AppLaunchContext -> IO ()
+ System.GIO.File.AppInfo: appInfoRemoveSupportsType :: AppInfoClass appinfo => appinfo -> String -> IO ()
+ System.GIO.File.AppInfo: appInfoResetTypeAssociations :: String -> IO ()
+ System.GIO.File.AppInfo: appInfoSetAsDefaultForExtension :: AppInfoClass appinfo => appinfo -> String -> IO ()
+ System.GIO.File.AppInfo: appInfoSetAsDefaultForType :: AppInfoClass appinfo => appinfo -> String -> IO ()
+ System.GIO.File.AppInfo: appInfoShouldShow :: AppInfoClass appinfo => appinfo -> IO Bool
+ System.GIO.File.AppInfo: appInfoSupportsFiles :: AppInfoClass appinfo => appinfo -> IO Bool
+ System.GIO.File.AppInfo: appInfoSupportsUris :: AppInfoClass appinfo => appinfo -> IO Bool
+ System.GIO.File.AppInfo: appLaunchContextGetDisplay :: AppInfoClass appinfo => AppLaunchContext -> appinfo -> [File] -> IO String
+ System.GIO.File.AppInfo: appLaunchContextGetStartupNotifyId :: AppInfoClass appinfo => AppLaunchContext -> appinfo -> [File] -> IO (Maybe String)
+ System.GIO.File.AppInfo: appLaunchContextLaunchFailed :: AppLaunchContext -> String -> IO ()
+ System.GIO.File.AppInfo: appLaunchContextNew :: IO AppLaunchContext
+ System.GIO.File.AppInfo: class GObjectClass o => AppInfoClass o
+ System.GIO.File.AppInfo: class FileInfoClass o => AppLaunchContextClass o
+ System.GIO.File.AppInfo: data AppInfo
+ System.GIO.File.AppInfo: data AppInfoCreateFlags
+ System.GIO.File.AppInfo: data AppLaunchContext
+ System.GIO.File.ContentType: contentTypeCanBeExecutable :: String -> Bool
+ System.GIO.File.ContentType: contentTypeEquals :: String -> String -> Bool
+ System.GIO.File.ContentType: contentTypeFromMimeType :: String -> String
+ System.GIO.File.ContentType: contentTypeGetDescription :: String -> String
+ System.GIO.File.ContentType: contentTypeGetIcon :: String -> Icon
+ System.GIO.File.ContentType: contentTypeGetMimeType :: String -> String
+ System.GIO.File.ContentType: contentTypeGuess :: String -> String -> Int -> IO (Bool, String)
+ System.GIO.File.ContentType: contentTypeGuessForTree :: FileClass file => file -> IO [String]
+ System.GIO.File.ContentType: contentTypeIsA :: String -> String -> Bool
+ System.GIO.File.ContentType: contentTypeIsUnknown :: String -> Bool
+ System.GIO.File.ContentType: contentTypesGetRegistered :: IO [String]
+ System.GIO.File.File: MountMountNone :: MountMountFlags
+ System.GIO.File.File: MountUnmountForce :: MountUnmountFlags
+ System.GIO.File.File: MountUnmountNone :: MountUnmountFlags
+ System.GIO.File.File: class FilterInputStreamClass o => BufferedInputStreamClass o
+ System.GIO.File.File: class FilterOutputStreamClass o => BufferedOutputStreamClass o
+ System.GIO.File.File: class BufferedInputStreamClass o => DataInputStreamClass o
+ System.GIO.File.File: class FilterOutputStreamClass o => DataOutputStreamClass o
+ System.GIO.File.File: class InputStreamClass o => FileInputStreamClass o
+ System.GIO.File.File: class OutputStreamClass o => FileOutputStreamClass o
+ System.GIO.File.File: class InputStreamClass o => FilterInputStreamClass o
+ System.GIO.File.File: class OutputStreamClass o => FilterOutputStreamClass o
+ System.GIO.File.File: class GObjectClass o => InputStreamClass o
+ System.GIO.File.File: class InputStreamClass o => MemoryInputStreamClass o
+ System.GIO.File.File: class OutputStreamClass o => MemoryOutputStreamClass o
+ System.GIO.File.File: class GObjectClass o => OutputStreamClass o
+ System.GIO.File.File: data BufferedInputStream
+ System.GIO.File.File: data BufferedOutputStream
+ System.GIO.File.File: data DataInputStream
+ System.GIO.File.File: data DataOutputStream
+ System.GIO.File.File: data FileInputStream
+ System.GIO.File.File: data FileOutputStream
+ System.GIO.File.File: data FilterInputStream
+ System.GIO.File.File: data FilterOutputStream
+ System.GIO.File.File: data InputStream
+ System.GIO.File.File: data MemoryInputStream
+ System.GIO.File.File: data MemoryOutputStream
+ System.GIO.File.File: data MountMountFlags
+ System.GIO.File.File: data MountUnmountFlags
+ System.GIO.File.File: data OutputStream
+ System.GIO.File.File: fileCopyAttributes :: (FileClass source, FileClass destination) => source -> destination -> [FileCopyFlags] -> Maybe Cancellable -> IO ()
+ System.GIO.File.File: fileEjectMountableWithOperation :: FileClass file => file -> [MountUnmountFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
+ System.GIO.File.File: fileEjectMountableWithOperationFinish :: FileClass file => file -> AsyncResult -> IO ()
+ System.GIO.File.File: fileMonitor :: FileClass file => file -> [FileMonitorFlags] -> Maybe Cancellable -> IO FileMonitor
+ System.GIO.File.File: fileMonitorDirectory :: FileClass file => file -> [FileMonitorFlags] -> Maybe Cancellable -> IO FileMonitor
+ System.GIO.File.File: fileMonitorFile :: FileClass file => file -> [FileMonitorFlags] -> Maybe Cancellable -> IO FileMonitor
+ System.GIO.File.File: fileMountEnclosingVolume :: FileClass file => file -> [MountMountFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
+ System.GIO.File.File: fileMountEnclosingVolumeFinish :: FileClass file => file -> AsyncResult -> IO Bool
+ System.GIO.File.File: fileMountMountable :: FileClass file => file -> [MountMountFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
+ System.GIO.File.File: fileMountMountableFinish :: FileClass file => file -> AsyncResult -> IO File
+ System.GIO.File.File: filePollMountable :: FileClass file => file -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
+ System.GIO.File.File: filePollMountableFinish :: FileClass file => file -> AsyncResult -> IO Bool
+ System.GIO.File.File: fileSetAttributeByteString :: FileClass file => file -> String -> String -> [FileQueryInfoFlags] -> Maybe Cancellable -> IO ()
+ System.GIO.File.File: fileSetAttributeInt32 :: FileClass file => file -> String -> Int32 -> [FileQueryInfoFlags] -> Maybe Cancellable -> IO ()
+ System.GIO.File.File: fileSetAttributeInt64 :: FileClass file => file -> String -> Int64 -> [FileQueryInfoFlags] -> Maybe Cancellable -> IO ()
+ System.GIO.File.File: fileSetAttributeString :: FileClass file => file -> String -> String -> [FileQueryInfoFlags] -> Maybe Cancellable -> IO ()
+ System.GIO.File.File: fileSetAttributeWord32 :: FileClass file => file -> String -> Word32 -> [FileQueryInfoFlags] -> Maybe Cancellable -> IO ()
+ System.GIO.File.File: fileSetAttributeWord64 :: FileClass file => file -> String -> Word64 -> [FileQueryInfoFlags] -> Maybe Cancellable -> IO ()
+ System.GIO.File.File: fileSetAttributesFinish :: FileClass file => file -> AsyncResult -> FileInfo -> IO ()
+ System.GIO.File.File: fileSetAttributesFromInfo :: FileClass file => file -> FileInfo -> [FileQueryInfoFlags] -> Maybe Cancellable -> IO ()
+ System.GIO.File.File: fileSetAttributesFromInfoAsync :: FileClass file => file -> FileInfo -> [FileQueryInfoFlags] -> Int -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
+ System.GIO.File.File: fileStartMountable :: FileClass file => file -> [DriveStartFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
+ System.GIO.File.File: fileStartMountableFinish :: FileClass file => file -> AsyncResult -> IO ()
+ System.GIO.File.File: fileStopMountable :: FileClass file => file -> [MountUnmountFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
+ System.GIO.File.File: fileStopMountableFinish :: FileClass file => file -> AsyncResult -> IO ()
+ System.GIO.File.File: fileSupportsThreadContexts :: FileClass file => file -> IO Bool
+ System.GIO.File.File: fileUnmountMountableWithOperation :: FileClass file => file -> [MountUnmountFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
+ System.GIO.File.File: fileUnmountMountableWithOperationFinish :: FileClass file => file -> AsyncResult -> IO ()
+ System.GIO.File.File: type Offset = CLLong
+ System.GIO.File.FileAttribute: FileAttributeTypeStringList :: FileAttributeType
+ System.GIO.File.FileAttribute: fileAttributeDosIsMountpoint :: String
+ System.GIO.File.FileAttribute: fileAttributeMountableCanDegraded :: String
+ System.GIO.File.FileAttribute: fileAttributeMountableCanPoll :: String
+ System.GIO.File.FileAttribute: fileAttributeMountableCanStart :: String
+ System.GIO.File.FileAttribute: fileAttributeMountableCanStop :: String
+ System.GIO.File.FileAttribute: fileAttributeMountableStartStopType :: String
+ System.GIO.File.FileAttribute: fileAttributeMountableUnixDeviceFile :: String
+ System.GIO.File.FileAttribute: fileAttributePreviewIcon :: String
+ System.GIO.File.FileAttribute: fileAttributeStandardAllocatedSize :: String
+ System.GIO.File.FileAttribute: fileAttributeTrashDeletionDate :: String
+ System.GIO.File.FileAttribute: fileAttributeTrashOrigPath :: String
+ System.GIO.File.FileEnumerator: FileEnumerator :: (ForeignPtr (FileEnumerator)) -> FileEnumerator
+ System.GIO.File.FileEnumerator: class GObjectClass o => FileEnumeratorClass o
+ System.GIO.File.FileEnumerator: fileEnumeratorClose :: FileEnumeratorClass enumerator => enumerator -> Maybe Cancellable -> IO ()
+ System.GIO.File.FileEnumerator: fileEnumeratorCloseAsync :: FileEnumeratorClass enumerator => enumerator -> Int -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
+ System.GIO.File.FileEnumerator: fileEnumeratorCloseFinish :: FileEnumeratorClass enumerator => enumerator -> AsyncResult -> IO ()
+ System.GIO.File.FileEnumerator: fileEnumeratorGetContainer :: FileEnumeratorClass enumerator => enumerator -> IO File
+ System.GIO.File.FileEnumerator: fileEnumeratorHasPending :: FileEnumeratorClass enumerator => enumerator -> IO Bool
+ System.GIO.File.FileEnumerator: fileEnumeratorIsClosed :: FileEnumeratorClass enumerator => enumerator -> IO Bool
+ System.GIO.File.FileEnumerator: fileEnumeratorNextFile :: FileEnumeratorClass enumerator => enumerator -> Maybe Cancellable -> IO (Maybe FileInfo)
+ System.GIO.File.FileEnumerator: fileEnumeratorNextFilesAsync :: FileEnumeratorClass enumerator => enumerator -> Int -> Int -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
+ System.GIO.File.FileEnumerator: fileEnumeratorNextFilesFinish :: FileEnumeratorClass enumerator => enumerator -> AsyncResult -> IO [FileInfo]
+ System.GIO.File.FileEnumerator: fileEnumeratorSetPending :: FileEnumeratorClass enumerator => enumerator -> Bool -> IO ()
+ System.GIO.File.FileEnumerator: newtype FileEnumerator
+ System.GIO.File.FileInfo: FileAttributeStatusErrorSetting :: FileAttributeStatus
+ System.GIO.File.FileInfo: FileAttributeStatusSet :: FileAttributeStatus
+ System.GIO.File.FileInfo: FileAttributeStatusUnset :: FileAttributeStatus
+ System.GIO.File.FileInfo: FileInfo :: (ForeignPtr (FileInfo)) -> FileInfo
+ System.GIO.File.FileInfo: class GObjectClass o => FileInfoClass o
+ System.GIO.File.FileInfo: data FileAttributeStatus
+ System.GIO.File.FileInfo: fileInfoClearStatus :: FileInfoClass info => info -> IO ()
+ System.GIO.File.FileInfo: fileInfoCopyInto :: (FileInfoClass srcInfo, FileInfoClass destInfo) => srcInfo -> destInfo -> IO ()
+ System.GIO.File.FileInfo: fileInfoDup :: FileInfoClass info => info -> IO FileInfo
+ System.GIO.File.FileInfo: fileInfoGetAttributeAsString :: FileInfoClass info => info -> String -> IO String
+ System.GIO.File.FileInfo: fileInfoGetAttributeBool :: FileInfoClass info => info -> String -> IO Bool
+ System.GIO.File.FileInfo: fileInfoGetAttributeByteString :: FileInfoClass info => info -> String -> IO ByteString
+ System.GIO.File.FileInfo: fileInfoGetAttributeInt32 :: FileInfoClass info => info -> String -> IO Int32
+ System.GIO.File.FileInfo: fileInfoGetAttributeInt64 :: FileInfoClass info => info -> String -> IO Int64
+ System.GIO.File.FileInfo: fileInfoGetAttributeObject :: FileInfoClass info => info -> String -> IO (Maybe GObject)
+ System.GIO.File.FileInfo: fileInfoGetAttributeStatus :: FileInfoClass info => info -> String -> IO FileAttributeStatus
+ System.GIO.File.FileInfo: fileInfoGetAttributeString :: FileInfoClass info => info -> String -> IO String
+ System.GIO.File.FileInfo: fileInfoGetAttributeStringList :: FileInfoClass info => info -> String -> IO [String]
+ System.GIO.File.FileInfo: fileInfoGetAttributeType :: FileInfoClass info => info -> String -> IO FileAttributeType
+ System.GIO.File.FileInfo: fileInfoGetAttributeWord32 :: FileInfoClass info => info -> String -> IO Word32
+ System.GIO.File.FileInfo: fileInfoGetAttributeWord64 :: FileInfoClass info => info -> String -> IO Word64
+ System.GIO.File.FileInfo: fileInfoGetContentType :: FileInfoClass info => info -> Maybe String
+ System.GIO.File.FileInfo: fileInfoGetDisplayName :: FileInfoClass info => info -> Maybe String
+ System.GIO.File.FileInfo: fileInfoGetEditName :: FileInfoClass info => info -> Maybe String
+ System.GIO.File.FileInfo: fileInfoGetEtag :: FileInfoClass info => info -> Maybe String
+ System.GIO.File.FileInfo: fileInfoGetFileType :: FileInfoClass info => info -> FileType
+ System.GIO.File.FileInfo: fileInfoGetIcon :: FileInfoClass info => info -> IO Icon
+ System.GIO.File.FileInfo: fileInfoGetIsBackup :: FileInfoClass info => info -> Bool
+ System.GIO.File.FileInfo: fileInfoGetIsHidden :: FileInfoClass info => info -> Bool
+ System.GIO.File.FileInfo: fileInfoGetIsSymlink :: FileInfoClass info => info -> Bool
+ System.GIO.File.FileInfo: fileInfoGetModificationTime :: FileInfoClass info => info -> GTimeVal
+ System.GIO.File.FileInfo: fileInfoGetName :: FileInfoClass info => info -> Maybe ByteString
+ System.GIO.File.FileInfo: fileInfoGetSize :: FileInfoClass info => info -> Int64
+ System.GIO.File.FileInfo: fileInfoGetSortOrder :: FileInfoClass info => info -> Int
+ System.GIO.File.FileInfo: fileInfoGetSymlinkTarget :: FileInfoClass info => info -> Maybe String
+ System.GIO.File.FileInfo: fileInfoHasAttribute :: FileInfoClass info => info -> String -> Bool
+ System.GIO.File.FileInfo: fileInfoHasNamespace :: FileInfoClass info => info -> String -> Bool
+ System.GIO.File.FileInfo: fileInfoListAttributes :: FileInfoClass info => info -> String -> IO [String]
+ System.GIO.File.FileInfo: fileInfoNew :: IO FileInfo
+ System.GIO.File.FileInfo: fileInfoRemoveAttribute :: FileInfoClass info => info -> String -> IO ()
+ System.GIO.File.FileInfo: fileInfoSetAttributeBool :: FileInfoClass info => info -> String -> Bool -> IO ()
+ System.GIO.File.FileInfo: fileInfoSetAttributeByteString :: FileInfoClass info => info -> String -> ByteString -> IO ()
+ System.GIO.File.FileInfo: fileInfoSetAttributeInt32 :: FileInfoClass info => info -> String -> Int32 -> IO ()
+ System.GIO.File.FileInfo: fileInfoSetAttributeInt64 :: FileInfoClass info => info -> String -> Int64 -> IO ()
+ System.GIO.File.FileInfo: fileInfoSetAttributeObject :: FileInfoClass info => info -> String -> GObject -> IO ()
+ System.GIO.File.FileInfo: fileInfoSetAttributeStatus :: FileInfoClass info => info -> String -> FileAttributeStatus -> IO Bool
+ System.GIO.File.FileInfo: fileInfoSetAttributeString :: FileInfoClass info => info -> String -> String -> IO ()
+ System.GIO.File.FileInfo: fileInfoSetAttributeStringList :: FileInfoClass info => info -> String -> [String] -> IO ()
+ System.GIO.File.FileInfo: fileInfoSetAttributeWord32 :: FileInfoClass info => info -> String -> Word32 -> IO ()
+ System.GIO.File.FileInfo: fileInfoSetAttributeWord64 :: FileInfoClass info => info -> String -> Word64 -> IO ()
+ System.GIO.File.FileInfo: fileInfoSetContentType :: FileInfoClass info => info -> String -> IO ()
+ System.GIO.File.FileInfo: fileInfoSetDisplayName :: FileInfoClass info => info -> String -> IO ()
+ System.GIO.File.FileInfo: fileInfoSetEditName :: FileInfoClass info => info -> String -> IO ()
+ System.GIO.File.FileInfo: fileInfoSetFileType :: FileInfoClass info => info -> FileType -> IO ()
+ System.GIO.File.FileInfo: fileInfoSetIcon :: FileInfoClass info => info -> Icon -> IO ()
+ System.GIO.File.FileInfo: fileInfoSetIsHidden :: FileInfoClass info => info -> Bool -> IO ()
+ System.GIO.File.FileInfo: fileInfoSetIsSymlink :: FileInfoClass info => info -> Bool -> IO ()
+ System.GIO.File.FileInfo: fileInfoSetModificationTime :: FileInfoClass info => info -> GTimeVal -> IO ()
+ System.GIO.File.FileInfo: fileInfoSetName :: FileInfoClass info => info -> ByteString -> IO ()
+ System.GIO.File.FileInfo: fileInfoSetSize :: FileInfoClass info => info -> Int64 -> IO ()
+ System.GIO.File.FileInfo: fileInfoSetSortOrder :: FileInfoClass info => info -> Int -> IO ()
+ System.GIO.File.FileInfo: fileInfoUnsetAttributeMask :: FileInfoClass info => info -> IO ()
+ System.GIO.File.FileInfo: newtype FileInfo
+ System.GIO.File.FileMonitor: FileMonitor :: (ForeignPtr (FileMonitor)) -> FileMonitor
+ System.GIO.File.FileMonitor: FileMonitorEventAttributeChanged :: FileMonitorEvent
+ System.GIO.File.FileMonitor: FileMonitorEventChanged :: FileMonitorEvent
+ System.GIO.File.FileMonitor: FileMonitorEventChangesDoneHint :: FileMonitorEvent
+ System.GIO.File.FileMonitor: FileMonitorEventCreated :: FileMonitorEvent
+ System.GIO.File.FileMonitor: FileMonitorEventDeleted :: FileMonitorEvent
+ System.GIO.File.FileMonitor: FileMonitorEventMoved :: FileMonitorEvent
+ System.GIO.File.FileMonitor: FileMonitorEventPreUnmount :: FileMonitorEvent
+ System.GIO.File.FileMonitor: FileMonitorEventUnmounted :: FileMonitorEvent
+ System.GIO.File.FileMonitor: class GObjectClass o => FileMonitorClass o
+ System.GIO.File.FileMonitor: data FileMonitorEvent
+ System.GIO.File.FileMonitor: fileMonitorCancel :: FileMonitorClass monitor => monitor -> IO Bool
+ System.GIO.File.FileMonitor: fileMonitorCancelled :: FileMonitorClass monitor => ReadAttr monitor Bool
+ System.GIO.File.FileMonitor: fileMonitorChanged :: FileMonitorClass monitor => Signal monitor (Maybe File -> Maybe File -> FileMonitorEvent -> IO ())
+ System.GIO.File.FileMonitor: fileMonitorIsCancelled :: FileMonitorClass monitor => monitor -> IO Bool
+ System.GIO.File.FileMonitor: fileMonitorRateLimit :: FileMonitorClass monitor => Attr monitor Int
+ System.GIO.File.FileMonitor: newtype FileMonitor
+ System.GIO.File.IOError: IoErrorAddressInUse :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorAlreadyMounted :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorBusy :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorCancelled :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorCantCreateBackup :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorClosed :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorConnectionRefused :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorDbusError :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorExists :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorFailed :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorFailedHandled :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorFilenameTooLong :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorHostNotFound :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorHostUnreachable :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorInvalidArgument :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorInvalidData :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorInvalidFilename :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorIsDirectory :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorNetworkUnreachable :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorNoSpace :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorNotDirectory :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorNotEmpty :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorNotFound :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorNotInitialized :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorNotMountableFile :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorNotMounted :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorNotRegularFile :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorNotSupported :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorNotSymbolicLink :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorPartialInput :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorPending :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorPermissionDenied :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorProxyAuthFailed :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorProxyFailed :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorProxyNeedAuth :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorProxyNotAllowed :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorReadOnly :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorTimedOut :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorTooManyLinks :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorTooManyOpenFiles :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorWouldBlock :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorWouldMerge :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorWouldRecurse :: IOErrorEnum
+ System.GIO.File.IOError: IoErrorWrongEtag :: IOErrorEnum
+ System.GIO.File.IOError: data IOErrorEnum
+ System.GIO.File.IOError: ioErrorFromErrno :: Int -> IO IOErrorEnum
+ System.GIO.File.MountOperation: AskPasswordAnonymousSupported :: AskPasswordFlags
+ System.GIO.File.MountOperation: AskPasswordNeedDomain :: AskPasswordFlags
+ System.GIO.File.MountOperation: AskPasswordNeedPassword :: AskPasswordFlags
+ System.GIO.File.MountOperation: AskPasswordNeedUsername :: AskPasswordFlags
+ System.GIO.File.MountOperation: AskPasswordSavingSupported :: AskPasswordFlags
+ System.GIO.File.MountOperation: MountOperation :: (ForeignPtr (MountOperation)) -> MountOperation
+ System.GIO.File.MountOperation: MountOperationAborted :: MountOperationResult
+ System.GIO.File.MountOperation: MountOperationHandled :: MountOperationResult
+ System.GIO.File.MountOperation: MountOperationUnhandled :: MountOperationResult
+ System.GIO.File.MountOperation: PasswordSaveForSession :: PasswordSave
+ System.GIO.File.MountOperation: PasswordSaveNever :: PasswordSave
+ System.GIO.File.MountOperation: PasswordSavePermanently :: PasswordSave
+ System.GIO.File.MountOperation: class GObjectClass o => MountOperationClass o
+ System.GIO.File.MountOperation: data AskPasswordFlags
+ System.GIO.File.MountOperation: data MountOperationResult
+ System.GIO.File.MountOperation: data PasswordSave
+ System.GIO.File.MountOperation: mountOperationAborted :: MountOperationClass op => Signal op (IO ())
+ System.GIO.File.MountOperation: mountOperationAnonymous :: MountOperationClass op => Attr op Bool
+ System.GIO.File.MountOperation: mountOperationAskPassword :: MountOperationClass op => Signal op (String -> String -> String -> AskPasswordFlags -> IO ())
+ System.GIO.File.MountOperation: mountOperationChoice :: MountOperationClass op => Attr op Int
+ System.GIO.File.MountOperation: mountOperationDomain :: MountOperationClass op => Attr op String
+ System.GIO.File.MountOperation: mountOperationNew :: IO MountOperation
+ System.GIO.File.MountOperation: mountOperationPassword :: MountOperationClass op => Attr op String
+ System.GIO.File.MountOperation: mountOperationPasswordSave :: MountOperationClass op => Attr op PasswordSave
+ System.GIO.File.MountOperation: mountOperationReply :: MountOperationClass op => op -> MountOperationResult -> IO ()
+ System.GIO.File.MountOperation: mountOperationReplySignal :: MountOperationClass op => Signal op (MountOperationResult -> IO ())
+ System.GIO.File.MountOperation: mountOperationUsername :: MountOperationClass op => Attr op String
+ System.GIO.File.MountOperation: newtype MountOperation
+ System.GIO.Icons.Emblem: Emblem :: (ForeignPtr (Emblem)) -> Emblem
+ System.GIO.Icons.Emblem: EmblemOriginDevice :: EmblemOrigin
+ System.GIO.Icons.Emblem: EmblemOriginLivemetadata :: EmblemOrigin
+ System.GIO.Icons.Emblem: EmblemOriginTag :: EmblemOrigin
+ System.GIO.Icons.Emblem: EmblemOriginUnknown :: EmblemOrigin
+ System.GIO.Icons.Emblem: class GObjectClass o => EmblemClass o
+ System.GIO.Icons.Emblem: data EmblemOrigin
+ System.GIO.Icons.Emblem: emblemGetIcon :: EmblemClass emblem => emblem -> IO Icon
+ System.GIO.Icons.Emblem: emblemGetOrigin :: EmblemClass emblem => emblem -> IO EmblemOrigin
+ System.GIO.Icons.Emblem: emblemNew :: IconClass icon => icon -> IO Emblem
+ System.GIO.Icons.Emblem: emblemNewWithOrigin :: IconClass icon => icon -> EmblemOrigin -> IO Emblem
+ System.GIO.Icons.Emblem: newtype Emblem
+ System.GIO.Icons.EmblemedIcon: EmblemedIcon :: (ForeignPtr (EmblemedIcon)) -> EmblemedIcon
+ System.GIO.Icons.EmblemedIcon: class GObjectClass o => EmblemedIconClass o
+ System.GIO.Icons.EmblemedIcon: emblemedIconAddEmblem :: EmblemedIconClass emblemed => emblemed -> Emblem -> IO ()
+ System.GIO.Icons.EmblemedIcon: emblemedIconGetEmblems :: EmblemedIconClass emblemed => emblemed -> IO [Emblem]
+ System.GIO.Icons.EmblemedIcon: emblemedIconGetIcon :: EmblemedIconClass emblemed => emblemed -> IO Icon
+ System.GIO.Icons.EmblemedIcon: emblemedIconNew :: (IconClass icon, EmblemClass emblem) => icon -> emblem -> IO EmblemedIcon
+ System.GIO.Icons.EmblemedIcon: newtype EmblemedIcon
+ System.GIO.Icons.FileIcon: FileIcon :: (ForeignPtr (FileIcon)) -> FileIcon
+ System.GIO.Icons.FileIcon: class GObjectClass o => FileIconClass o
+ System.GIO.Icons.FileIcon: fileIconGetFile :: FileIconClass icon => icon -> IO File
+ System.GIO.Icons.FileIcon: fileIconNew :: FileClass file => file -> IO FileIcon
+ System.GIO.Icons.FileIcon: newtype FileIcon
+ System.GIO.Icons.Icon: Icon :: (ForeignPtr (Icon)) -> Icon
+ System.GIO.Icons.Icon: class GObjectClass o => IconClass o
+ System.GIO.Icons.Icon: iconEqual :: (IconClass icon1, IconClass icon2) => icon1 -> icon2 -> IO Bool
+ System.GIO.Icons.Icon: iconNewForString :: ByteString -> IO Icon
+ System.GIO.Icons.Icon: iconToString :: IconClass icon => icon -> IO ByteString
+ System.GIO.Icons.Icon: newtype Icon
+ System.GIO.Icons.ThemedIcon: ThemedIcon :: (ForeignPtr (ThemedIcon)) -> ThemedIcon
+ System.GIO.Icons.ThemedIcon: class GObjectClass o => ThemedIconClass o
+ System.GIO.Icons.ThemedIcon: newtype ThemedIcon
+ System.GIO.Icons.ThemedIcon: themedIconAppendName :: ThemedIconClass icon => icon -> String -> IO ()
+ System.GIO.Icons.ThemedIcon: themedIconGetNames :: ThemedIconClass icon => icon -> IO [String]
+ System.GIO.Icons.ThemedIcon: themedIconNew :: ByteString -> IO ThemedIcon
+ System.GIO.Icons.ThemedIcon: themedIconNewFromNames :: [String] -> IO ThemedIcon
+ System.GIO.Icons.ThemedIcon: themedIconPrependName :: ThemedIconClass icon => icon -> String -> IO ()
+ System.GIO.Volumes.Drive: Drive :: (ForeignPtr (Drive)) -> Drive
+ System.GIO.Volumes.Drive: DriveStartNone :: DriveStartFlags
+ System.GIO.Volumes.Drive: DriveStartStopTypeMultidisk :: DriveStartStopType
+ System.GIO.Volumes.Drive: DriveStartStopTypeNetwork :: DriveStartStopType
+ System.GIO.Volumes.Drive: DriveStartStopTypePassword :: DriveStartStopType
+ System.GIO.Volumes.Drive: DriveStartStopTypeShutdown :: DriveStartStopType
+ System.GIO.Volumes.Drive: DriveStartStopTypeUnknown :: DriveStartStopType
+ System.GIO.Volumes.Drive: class GObjectClass o => DriveClass o
+ System.GIO.Volumes.Drive: data DriveStartFlags
+ System.GIO.Volumes.Drive: data DriveStartStopType
+ System.GIO.Volumes.Drive: driveCanEject :: DriveClass drive => drive -> IO Bool
+ System.GIO.Volumes.Drive: driveCanPollForMedia :: DriveClass drive => drive -> IO Bool
+ System.GIO.Volumes.Drive: driveCanStart :: DriveClass drive => drive -> IO Bool
+ System.GIO.Volumes.Drive: driveCanStartDegraded :: DriveClass drive => drive -> IO Bool
+ System.GIO.Volumes.Drive: driveCanStop :: DriveClass drive => drive -> IO Bool
+ System.GIO.Volumes.Drive: driveChanged :: DriveClass drive => Signal drive (Drive -> IO ())
+ System.GIO.Volumes.Drive: driveDisconnected :: DriveClass drive => Signal drive (Drive -> IO ())
+ System.GIO.Volumes.Drive: driveEjectButton :: DriveClass drive => Signal drive (Drive -> IO ())
+ System.GIO.Volumes.Drive: driveEjectWithOperation :: DriveClass drive => drive -> [MountUnmountFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
+ System.GIO.Volumes.Drive: driveEjectWithOperationFinish :: DriveClass drive => drive -> AsyncResult -> IO ()
+ System.GIO.Volumes.Drive: driveEnumerateIdentifiers :: DriveClass drive => drive -> IO [String]
+ System.GIO.Volumes.Drive: driveGetIcon :: DriveClass drive => drive -> IO Icon
+ System.GIO.Volumes.Drive: driveGetIdentifier :: DriveClass drive => drive -> String -> IO String
+ System.GIO.Volumes.Drive: driveGetName :: DriveClass drive => drive -> IO String
+ System.GIO.Volumes.Drive: driveGetStartStopType :: DriveClass drive => drive -> IO DriveStartStopType
+ System.GIO.Volumes.Drive: driveGetVolumes :: DriveClass drive => drive -> IO [Volume]
+ System.GIO.Volumes.Drive: driveHasMedia :: DriveClass drive => drive -> IO Bool
+ System.GIO.Volumes.Drive: driveHasVolumes :: DriveClass drive => drive -> IO Bool
+ System.GIO.Volumes.Drive: driveIsMediaCheckAutomatic :: DriveClass drive => drive -> IO Bool
+ System.GIO.Volumes.Drive: driveIsMediaRemovable :: DriveClass drive => drive -> IO Bool
+ System.GIO.Volumes.Drive: drivePollForMedia :: DriveClass drive => drive -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
+ System.GIO.Volumes.Drive: driveStart :: DriveClass drive => drive -> [DriveStartFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
+ System.GIO.Volumes.Drive: driveStartFinish :: DriveClass drive => drive -> AsyncResult -> IO ()
+ System.GIO.Volumes.Drive: driveStopButton :: DriveClass drive => Signal drive (Drive -> IO ())
+ System.GIO.Volumes.Drive: driveStopFinish :: DriveClass drive => drive -> AsyncResult -> IO ()
+ System.GIO.Volumes.Drive: newtype Drive
+ System.GIO.Volumes.Mount: Mount :: (ForeignPtr (Mount)) -> Mount
+ System.GIO.Volumes.Mount: class GObjectClass o => MountClass o
+ System.GIO.Volumes.Mount: mountCanEject :: MountClass mount => mount -> IO Bool
+ System.GIO.Volumes.Mount: mountCanUnmount :: MountClass mount => mount -> IO Bool
+ System.GIO.Volumes.Mount: mountChanged :: MountClass mount => Signal mount (IO ())
+ System.GIO.Volumes.Mount: mountEjectWithOperation :: MountClass mount => mount -> [MountUnmountFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
+ System.GIO.Volumes.Mount: mountEjectWithOperationFinish :: MountClass mount => mount -> AsyncResult -> IO ()
+ System.GIO.Volumes.Mount: mountGetDefaultLocation :: MountClass mount => mount -> IO File
+ System.GIO.Volumes.Mount: mountGetDrive :: MountClass mount => mount -> IO (Maybe Drive)
+ System.GIO.Volumes.Mount: mountGetIcon :: MountClass mount => mount -> IO Icon
+ System.GIO.Volumes.Mount: mountGetName :: MountClass mount => mount -> IO String
+ System.GIO.Volumes.Mount: mountGetRoot :: MountClass mount => mount -> IO File
+ System.GIO.Volumes.Mount: mountGetUUID :: MountClass mount => mount -> IO (Maybe String)
+ System.GIO.Volumes.Mount: mountGetVolume :: MountClass mount => mount -> IO (Maybe Volume)
+ System.GIO.Volumes.Mount: mountGuessContentType :: MountClass mount => mount -> Bool -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
+ System.GIO.Volumes.Mount: mountGuessContentTypeFinish :: MountClass mount => mount -> AsyncResult -> IO [String]
+ System.GIO.Volumes.Mount: mountGuessContentTypeSync :: MountClass mount => mount -> Bool -> Maybe Cancellable -> IO [String]
+ System.GIO.Volumes.Mount: mountIsShadowed :: MountClass mount => mount -> IO Bool
+ System.GIO.Volumes.Mount: mountPreUnmount :: MountClass mount => Signal mount (IO ())
+ System.GIO.Volumes.Mount: mountRemount :: MountClass mount => mount -> [MountMountFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
+ System.GIO.Volumes.Mount: mountRemountFinish :: MountClass mount => mount -> AsyncResult -> IO ()
+ System.GIO.Volumes.Mount: mountShadow :: MountClass mount => mount -> IO ()
+ System.GIO.Volumes.Mount: mountUnmountWithOperation :: MountClass mount => mount -> [MountUnmountFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
+ System.GIO.Volumes.Mount: mountUnmountWithOperationFinish :: MountClass mount => mount -> AsyncResult -> IO ()
+ System.GIO.Volumes.Mount: mountUnmounted :: MountClass mount => Signal mount (IO ())
+ System.GIO.Volumes.Mount: mountUnshadow :: MountClass mount => mount -> IO ()
+ System.GIO.Volumes.Mount: newtype Mount
+ System.GIO.Volumes.Volume: Volume :: (ForeignPtr (Volume)) -> Volume
+ System.GIO.Volumes.Volume: class GObjectClass o => VolumeClass o
+ System.GIO.Volumes.Volume: newtype Volume
+ System.GIO.Volumes.Volume: volumeCanEject :: VolumeClass volume => volume -> IO Bool
+ System.GIO.Volumes.Volume: volumeCanMount :: VolumeClass volume => volume -> IO Bool
+ System.GIO.Volumes.Volume: volumeChanged :: VolumeClass volume => Signal volume (IO ())
+ System.GIO.Volumes.Volume: volumeEjectWithOperation :: VolumeClass volume => volume -> [MountUnmountFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
+ System.GIO.Volumes.Volume: volumeEjectWithOperationFinish :: VolumeClass volume => volume -> AsyncResult -> IO ()
+ System.GIO.Volumes.Volume: volumeEnumerateIdentifiers :: VolumeClass volume => volume -> IO [String]
+ System.GIO.Volumes.Volume: volumeGetActivationRoot :: VolumeClass volume => volume -> IO (Maybe File)
+ System.GIO.Volumes.Volume: volumeGetDrive :: VolumeClass volume => volume -> IO (Maybe Drive)
+ System.GIO.Volumes.Volume: volumeGetIcon :: VolumeClass volume => volume -> IO Icon
+ System.GIO.Volumes.Volume: volumeGetIdentifier :: VolumeClass volume => volume -> String -> IO String
+ System.GIO.Volumes.Volume: volumeGetMount :: VolumeClass volume => volume -> IO (Maybe Mount)
+ System.GIO.Volumes.Volume: volumeGetName :: VolumeClass volume => volume -> IO String
+ System.GIO.Volumes.Volume: volumeGetUUID :: VolumeClass volume => volume -> IO (Maybe String)
+ System.GIO.Volumes.Volume: volumeMount :: VolumeClass volume => volume -> [MountMountFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
+ System.GIO.Volumes.Volume: volumeMountFinish :: VolumeClass volume => volume -> AsyncResult -> IO ()
+ System.GIO.Volumes.Volume: volumeRemoved :: VolumeClass volume => Signal volume (IO ())
+ System.GIO.Volumes.Volume: volumeShouldAutomount :: VolumeClass volume => volume -> IO Bool
+ System.GIO.Volumes.VolumeMonitor: VolumeMonitor :: (ForeignPtr (VolumeMonitor)) -> VolumeMonitor
+ System.GIO.Volumes.VolumeMonitor: class GObjectClass o => VolumeMonitorClass o
+ System.GIO.Volumes.VolumeMonitor: newtype VolumeMonitor
+ System.GIO.Volumes.VolumeMonitor: vmDriveChanged :: VolumeMonitorClass monitor => Signal monitor (Drive -> IO ())
+ System.GIO.Volumes.VolumeMonitor: vmDriveConnected :: VolumeMonitorClass monitor => Signal monitor (Drive -> IO ())
+ System.GIO.Volumes.VolumeMonitor: vmDriveDisconnected :: VolumeMonitorClass monitor => Signal monitor (Drive -> IO ())
+ System.GIO.Volumes.VolumeMonitor: vmDriveEjectButton :: VolumeMonitorClass monitor => Signal monitor (Drive -> IO ())
+ System.GIO.Volumes.VolumeMonitor: vmDriveStopButton :: VolumeMonitorClass monitor => Signal monitor (Drive -> IO ())
+ System.GIO.Volumes.VolumeMonitor: vmMountAdded :: VolumeMonitorClass monitor => Signal monitor (Mount -> IO ())
+ System.GIO.Volumes.VolumeMonitor: vmMountChanged :: VolumeMonitorClass monitor => Signal monitor (Mount -> IO ())
+ System.GIO.Volumes.VolumeMonitor: vmMountPreUnmount :: VolumeMonitorClass monitor => Signal monitor (Mount -> IO ())
+ System.GIO.Volumes.VolumeMonitor: vmMountRemoved :: VolumeMonitorClass monitor => Signal monitor (Mount -> IO ())
+ System.GIO.Volumes.VolumeMonitor: vmVolumeAdded :: VolumeMonitorClass monitor => Signal monitor (Volume -> IO ())
+ System.GIO.Volumes.VolumeMonitor: vmVolumeChanged :: VolumeMonitorClass monitor => Signal monitor (Volume -> IO ())
+ System.GIO.Volumes.VolumeMonitor: vmVolumeRemoved :: VolumeMonitorClass monitor => Signal monitor (Volume -> IO ())
+ System.GIO.Volumes.VolumeMonitor: volumeMonitorGet :: IO VolumeMonitor
+ System.GIO.Volumes.VolumeMonitor: volumeMonitorGetConnectedDrives :: VolumeMonitorClass monitor => monitor -> IO [Drive]
+ System.GIO.Volumes.VolumeMonitor: volumeMonitorGetMountForUUID :: VolumeMonitorClass monitor => monitor -> String -> IO (Maybe Mount)
+ System.GIO.Volumes.VolumeMonitor: volumeMonitorGetMounts :: VolumeMonitorClass monitor => monitor -> IO [Drive]
+ System.GIO.Volumes.VolumeMonitor: volumeMonitorGetVolumeForUUID :: VolumeMonitorClass monitor => monitor -> String -> IO (Maybe Volume)
+ System.GIO.Volumes.VolumeMonitor: volumeMonitorGetVolumes :: VolumeMonitorClass monitor => monitor -> IO [Drive]
- System.GIO.File.File: fileBasename :: FileClass file => file -> String
+ System.GIO.File.File: fileBasename :: FileClass file => file -> ByteString
- System.GIO.File.File: fileCopy :: (FileClass source, FileClass destination) => source -> destination -> [FileCopyFlags] -> Maybe Cancellable -> Maybe FileProgressCallback -> IO Bool
+ System.GIO.File.File: fileCopy :: (FileClass source, FileClass destination) => source -> destination -> [FileCopyFlags] -> Maybe Cancellable -> Maybe FileProgressCallback -> IO ()
- System.GIO.File.File: fileCopyFinish :: FileClass file => file -> AsyncResult -> IO Bool
+ System.GIO.File.File: fileCopyFinish :: FileClass file => file -> AsyncResult -> IO ()
- System.GIO.File.File: fileFromCommandlineArg :: String -> File
+ System.GIO.File.File: fileFromCommandlineArg :: ByteString -> File
- System.GIO.File.File: fileFromPath :: FilePath -> File
+ System.GIO.File.File: fileFromPath :: ByteString -> File
- System.GIO.File.File: fileGetChild :: FileClass file => file -> String -> File
+ System.GIO.File.File: fileGetChild :: FileClass file => file -> ByteString -> File
- System.GIO.File.File: fileGetChildForDisplayName :: FileClass file => file -> String -> Maybe File
+ System.GIO.File.File: fileGetChildForDisplayName :: FileClass file => file -> String -> File
- System.GIO.File.File: fileGetRelativePath :: (FileClass file1, FileClass file2) => file1 -> file2 -> Maybe FilePath
+ System.GIO.File.File: fileGetRelativePath :: (FileClass file1, FileClass file2) => file1 -> file2 -> Maybe ByteString
- System.GIO.File.File: fileMakeSymbolicLink :: FileClass file => file -> String -> Maybe Cancellable -> IO ()
+ System.GIO.File.File: fileMakeSymbolicLink :: FileClass file => file -> ByteString -> Maybe Cancellable -> IO ()
- System.GIO.File.File: fileMove :: (FileClass source, FileClass destination) => source -> destination -> [FileCopyFlags] -> Maybe Cancellable -> Maybe FileProgressCallback -> IO Bool
+ System.GIO.File.File: fileMove :: (FileClass source, FileClass destination) => source -> destination -> [FileCopyFlags] -> Maybe Cancellable -> Maybe FileProgressCallback -> IO ()
- System.GIO.File.File: filePath :: FileClass file => file -> FilePath
+ System.GIO.File.File: filePath :: FileClass file => file -> ByteString
- System.GIO.File.File: fileQueryExists :: FileClass file => file -> Maybe Cancellable -> IO Bool
+ System.GIO.File.File: fileQueryExists :: FileClass file => file -> Maybe Cancellable -> Bool
- System.GIO.File.File: fileQueryFileType :: FileClass file => file -> [FileQueryInfoFlags] -> Maybe Cancellable -> IO FileType
+ System.GIO.File.File: fileQueryFileType :: FileClass file => file -> [FileQueryInfoFlags] -> Maybe Cancellable -> FileType
- System.GIO.File.File: fileResolveRelativePath :: FileClass file => file -> FilePath -> Maybe File
+ System.GIO.File.File: fileResolveRelativePath :: FileClass file => file -> ByteString -> Maybe File

Files

Gtk2HsSetup.hs view
@@ -23,16 +23,24 @@         CABAL_VERSION_MICRO) #else #warning Setup.hs is guessing the version of Cabal. If compilation of Setup.hs fails use -DCABAL_VERSION_MINOR=x for Cabal version 1.x.0 when building (prefixed by --ghc-option= when using the 'cabal' command)+#if (__GLASGOW_HASKELL__ >= 700)+#define CABAL_VERSION CABAL_VERSION_ENCODE(1,10,0)+#else #if (__GLASGOW_HASKELL__ >= 612) #define CABAL_VERSION CABAL_VERSION_ENCODE(1,8,0) #else #define CABAL_VERSION CABAL_VERSION_ENCODE(1,6,0) #endif #endif+#endif  -- | Build a Gtk2hs package. ---module Gtk2HsSetup ( gtk2hsUserHooks, getPkgConfigPackages ) where+module Gtk2HsSetup ( +  gtk2hsUserHooks, +  getPkgConfigPackages, +  checkGtk2hsBuildtools+  ) where  import Distribution.Simple import Distribution.Simple.PreProcess@@ -65,7 +73,7 @@ import Distribution.Simple.Compiler  ( Compiler(..) ) import Distribution.Simple.Program (   Program(..), ConfiguredProgram(..),-  rawSystemProgramConf, rawSystemProgramStdoutConf,+  rawSystemProgramConf, rawSystemProgramStdoutConf, programName,   c2hsProgram, pkgConfigProgram, requireProgram, ghcPkgProgram,   simpleProgram, lookupProgram, rawSystemProgramStdout, ProgArg) import Distribution.ModuleName ( ModuleName, components, toFilePath )@@ -83,10 +91,11 @@ #endif import Distribution.Text ( simpleParse, display ) import System.FilePath-import System.Directory ( doesFileExist )+import System.Exit (exitFailure)+import System.Directory ( doesFileExist, getDirectoryContents, doesDirectoryExist ) import Distribution.Version (Version(..)) import Distribution.Verbosity-import Control.Monad (when, unless, filterM)+import Control.Monad (when, unless, filterM, liftM, forM, forM_) import Data.Maybe ( isJust, isNothing, fromMaybe, maybeToList ) import Data.List (isPrefixOf, isSuffixOf, nub) import Data.Char (isAlpha)@@ -94,7 +103,6 @@ import qualified Data.Set as S  import Control.Applicative ((<$>))-import System.Directory (getDirectoryContents, doesDirectoryExist)  -- the name of the c2hs pre-compiled header file precompFile = "precompchs.bin"@@ -103,13 +111,13 @@     hookedPrograms = [typeGenProgram, signalGenProgram, c2hsLocal],     hookedPreProcessors = [("chs", ourC2hs)],     confHook = \pd cf ->-      confHook simpleUserHooks pd cf >>= return . adjustLocalBuildInfo,+      (fmap adjustLocalBuildInfo (confHook simpleUserHooks pd cf)),     postConf = \args cf pd lbi -> do       genSynthezisedFiles (fromFlag (configVerbosity cf)) pd lbi       postConf simpleUserHooks args cf pd lbi,     buildHook = \pd lbi uh bf -> fixDeps pd >>= \pd ->-                                 (buildHook simpleUserHooks) pd lbi uh bf,-    copyHook = \pd lbi uh flags -> (copyHook simpleUserHooks) pd lbi uh flags >>+                                 buildHook simpleUserHooks pd lbi uh bf,+    copyHook = \pd lbi uh flags -> copyHook simpleUserHooks pd lbi uh flags >>       installCHI pd lbi (fromFlag (copyVerbosity flags)) (fromFlag (copyDest flags)),     instHook = \pd lbi uh flags -> #if defined(mingw32_HOST_OS) || defined(__MINGW32__)@@ -187,7 +195,11 @@      _ | modeGenerateRegFile   -> die "Generate Reg File not supported"        | modeGenerateRegScript -> die "Generate Reg Script not supported"        | otherwise             -> registerPackage verbosity+#if CABAL_VERSION_CHECK(1,10,0)+                                    installedPkgInfo pkg lbi inplace [packageDb]+#else                                     installedPkgInfo pkg lbi inplace packageDb+#endif    where     modeGenerateRegFile = isJust (flagToMaybe (regGenPkgConf regFlags))@@ -298,7 +310,7 @@ getCppOptions bi lbi     = nub $       ["-I" ++ dir | dir <- PD.includeDirs bi]-   ++ [opt | opt@('-':c:_) <- (PD.cppOptions bi ++ PD.ccOptions bi), c `elem` "DIU"]+   ++ [opt | opt@('-':c:_) <- PD.cppOptions bi ++ PD.ccOptions bi, c `elem` "DIU"]  installCHI :: PackageDescription -- ^information from the .cabal file         -> LocalBuildInfo -- ^information from the configure step@@ -308,14 +320,13 @@   let InstallDirs { libdir = libPref } = absoluteInstallDirs pkg lbi copydest   -- cannot use the recommended 'findModuleFiles' since it fails if there exists   -- a modules that does not have a .chi file-  mFiles <- mapM (findFileWithExtension' ["chi"] [buildDir lbi])-                 (map toFilePath+  mFiles <- mapM (findFileWithExtension' ["chi"] [buildDir lbi] . toFilePath) #if CABAL_VERSION_CHECK(1,8,0)                    (PD.libModules lib) #else                    (PD.libModules pkg) #endif-                 )+                    let files = [ f | Just f <- mFiles ] #if CABAL_VERSION_CHECK(1,8,0)   installOrdinaryFiles verbosity libPref files@@ -331,13 +342,13 @@ ------------------------------------------------------------------------------  typeGenProgram :: Program-typeGenProgram = (simpleProgram "gtk2hsTypeGen")+typeGenProgram = simpleProgram "gtk2hsTypeGen"  signalGenProgram :: Program-signalGenProgram = (simpleProgram "gtk2hsHookGenerator")+signalGenProgram = simpleProgram "gtk2hsHookGenerator"  c2hsLocal :: Program-c2hsLocal = (simpleProgram "gtk2hsC2hs")+c2hsLocal = simpleProgram "gtk2hsC2hs"  genSynthezisedFiles :: Verbosity -> PackageDescription -> LocalBuildInfo -> IO () genSynthezisedFiles verb pd lbi = do@@ -370,7 +381,7 @@          res <- rawSystemProgramStdoutConf verb prog (withPrograms lbi) args          rewriteFile outFile res -  (flip mapM_) (filter (\(tag,_) -> "x-types-" `isPrefixOf` tag && "file" `isSuffixOf` tag) xList) $+  forM_ (filter (\(tag,_) -> "x-types-" `isPrefixOf` tag && "file" `isSuffixOf` tag) xList) $     \(fileTag, f) -> do       let tag = reverse (drop 4 (reverse fileTag))       info verb ("Ensuring that class hierarchy in "++f++" is up-to-date.")@@ -391,7 +402,7 @@   sequence     [ do version <- pkgconfig ["--modversion", display pkgname]          case simpleParse version of-           Nothing -> die $ "parsing output of pkg-config --modversion failed"+           Nothing -> die "parsing output of pkg-config --modversion failed"            Just v  -> return (PackageIdentifier pkgname v)     | Dependency pkgname _ <- concatMap pkgconfigDepends (allBuildInfo pkg) ]   where@@ -456,9 +467,9 @@ extractDeps :: ModDep -> IO ModDep extractDeps md@ModDep { mdLocation = Nothing } = return md extractDeps md@ModDep { mdLocation = Just f } = withUTF8FileContents f $ \con -> do-  let findImports acc (('{':'#':xs):xxs) = case (dropWhile ((==) ' ') xs) of+  let findImports acc (('{':'#':xs):xxs) = case (dropWhile (' ' ==) xs) of         ('i':'m':'p':'o':'r':'t':' ':ys) ->-          case simpleParse (takeWhile ((/=) '#') ys) of+          case simpleParse (takeWhile ('#' /=) ys) of             Just m -> findImports (m:acc) xxs              Nothing -> die ("cannot parse chs import in "++f++":\n"++                             "offending line is {#"++xs)@@ -484,3 +495,17 @@         Just md -> (md:out', visited')           where             (out',visited') = foldl visit (out, m `S.insert` visited) (mdRequires md)++-- Check user whether install gtk2hs-buildtools correctly.+checkGtk2hsBuildtools :: [String] -> IO ()+checkGtk2hsBuildtools programs = do+  programInfos <- mapM (\ name -> do+                         location <- programFindLocation (simpleProgram name) normal+                         return (name, location)+                      ) programs+  let printError name = do+        putStrLn $ "Cannot find " ++ name ++ "\n" +                 ++ "Please install `gtk2hs-buildtools` first and check that the install directory is in your PATH (e.g. HOME/.cabal/bin)."+        exitFailure+  forM_ programInfos $ \ (name, location) ->+    when (isNothing location) (printError name) 
Setup.hs view
@@ -1,7 +1,10 @@ -- Setup file for a Gtk2Hs module. Contains only adjustments specific to this module, -- all Gtk2Hs-specific boilerplate is stored in Gtk2HsSetup.hs which should be kept -- identical across all modules.-import Gtk2HsSetup ( gtk2hsUserHooks )+import Gtk2HsSetup ( gtk2hsUserHooks, checkGtk2hsBuildtools ) import Distribution.Simple ( defaultMainWithHooks ) -main = defaultMainWithHooks gtk2hsUserHooks+main = do+  checkGtk2hsBuildtools ["gtk2hsC2hs", "gtk2hsTypeGen", "gtk2hsHookGenerator"]+  defaultMainWithHooks gtk2hsUserHooks+  
System/GIO.hs view
@@ -29,10 +29,47 @@ module System.GIO (     module System.GIO.Async.AsyncResult,     module System.GIO.Async.Cancellable,-    module System.GIO.File.File++    module System.GIO.File.AppInfo,+    module System.GIO.File.ContentType,+    module System.GIO.File.File,+    module System.GIO.File.FileEnumerator,+    module System.GIO.File.FileInfo,+    module System.GIO.File.FileMonitor,+    module System.GIO.File.IOError,+    module System.GIO.File.MountOperation,++    module System.GIO.Icons.Emblem,+    module System.GIO.Icons.EmblemedIcon,+    module System.GIO.Icons.FileIcon,+    module System.GIO.Icons.Icon,+    module System.GIO.Icons.ThemedIcon,++    module System.GIO.Volumes.Drive,+    module System.GIO.Volumes.Mount,+    module System.GIO.Volumes.Volume,+    module System.GIO.Volumes.VolumeMonitor,     ) where  import System.GIO.Async.AsyncResult import System.GIO.Async.Cancellable++import System.GIO.File.AppInfo+import System.GIO.File.ContentType import System.GIO.File.File+import System.GIO.File.FileEnumerator+import System.GIO.File.FileInfo+import System.GIO.File.FileMonitor+import System.GIO.File.IOError+import System.GIO.File.MountOperation +import System.GIO.Icons.Emblem+import System.GIO.Icons.EmblemedIcon+import System.GIO.Icons.FileIcon+import System.GIO.Icons.Icon+import System.GIO.Icons.ThemedIcon++import System.GIO.Volumes.Drive+import System.GIO.Volumes.Mount+import System.GIO.Volumes.Volume+import System.GIO.Volumes.VolumeMonitor
System/GIO/Async/AsyncResult.chs view
@@ -28,13 +28,31 @@ --   Stability   : alpha --   Portability : portable (depends on GHC) module System.GIO.Async.AsyncResult (+-- * Types     AsyncResult,     AsyncResultClass,-    AsyncReadyCallback+    AsyncReadyCallback,++-- * Methods+    marshalAsyncReadyCallback,     ) where +import Control.Monad import System.Glib.FFI--import System.GIO.Base+import System.Glib.GObject {#import System.GIO.Types#} +type AsyncReadyCallback = GObject -> AsyncResult -> IO ()++{#pointer GAsyncReadyCallback#}++foreign import ccall "wrapper" mkAsyncReadyCallback :: +    (Ptr GObject -> Ptr AsyncResult -> Ptr () -> IO ()) -> IO GAsyncReadyCallback++marshalAsyncReadyCallback :: AsyncReadyCallback -> IO GAsyncReadyCallback+marshalAsyncReadyCallback asyncReadyCallback = +    mkAsyncReadyCallback $ \ cObject cAsyncResult cCallback -> do+      object <- (makeNewGObject mkGObject . return) cObject+      asyncResult <- (makeNewGObject mkAsyncResult . return) cAsyncResult+      asyncReadyCallback object asyncResult+      freeHaskellFunPtr (castPtrToFunPtr cCallback)
System/GIO/Async/Cancellable.chs view
@@ -28,7 +28,15 @@ --   Stability   : alpha --   Portability : portable (depends on GHC) module System.GIO.Async.Cancellable (-    Cancellable,+-- * Details+-- | 'Cancellable' is a thread-safe operation cancellation stack used throughout GIO to allow for+-- cancellation of synchronous and asynchronous operations.++-- * Types  +    Cancellable (..),+    CancellableClass,++-- * Methods         cancellableNew,     cancellableIsCancelled,     cancellableThrowErrorIfCancelled,@@ -37,56 +45,103 @@     cancellablePushCurrent,     cancellableReset,     cancellableCancel,++-- * Signals     cancellableCancelled     ) where  import Control.Monad-+import Data.Maybe (fromMaybe) import System.Glib.FFI import System.Glib.GError+import System.Glib.GObject+import System.Glib.Signals {#import System.GIO.Signals#}--import System.GIO.Base {#import System.GIO.Types#}  {# context lib = "gio" prefix = "g" #} +-- | 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 cancellableNew =-    {# call cancellable_new #} >>= takeGObject+    wrapNewGObject mkCancellable $+    {# call cancellable_new #} -cancellableIsCancelled :: Cancellable -> IO Bool+-- | Checks if a cancellable job has been cancelled.+cancellableIsCancelled :: Cancellable + -> IO Bool -- ^ returns 'True' if cancellable is cancelled, 'False' if called with 'Nothing' or if item is not cancelled. cancellableIsCancelled =     liftM toBool . {# call cancellable_is_cancelled #} +-- | If the cancellable is cancelled, throws a 'GError' to notify that the operation was cancelled. cancellableThrowErrorIfCancelled :: Cancellable -> IO () cancellableThrowErrorIfCancelled cancellable =     propagateGError $ \gErrorPtr -> do       {# call cancellable_set_error_if_cancelled #} cancellable gErrorPtr       return () -cancellableGetCurrent :: IO (Maybe Cancellable)+-- | Gets the top cancellable from the stack.+cancellableGetCurrent :: +  IO (Maybe Cancellable)  -- ^ returns a 'Cancellable' from the top of the stack, or 'Nothing' if the stack is empty. cancellableGetCurrent =-    {# call cancellable_get_current #} >>= maybePeek takeGObject+    maybeNull (makeNewGObject mkCancellable) $+    {# call cancellable_get_current #}  +-- | Pops cancellable off the cancellable stack (verifying that cancellable is on the top of the stack). cancellablePopCurrent :: Maybe Cancellable -> IO () cancellablePopCurrent cancellable =-    maybeWith withGObject cancellable g_cancellable_pop_current-    where-      _ = {# call cancellable_pop_current #}+      {# call cancellable_pop_current #}+         (fromMaybe (Cancellable nullForeignPtr) cancellable)  +-- | 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 () cancellablePushCurrent cancellable =-    maybeWith withGObject cancellable g_cancellable_push_current-    where-      _ = {# call cancellable_push_current #}+      {# call cancellable_push_current #}+         (fromMaybe (Cancellable nullForeignPtr) cancellable)  +-- | Resets cancellable to its uncancelled state. cancellableReset :: Cancellable -> IO () cancellableReset = {# call cancellable_reset #} +-- | 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 () cancellableCancel = {# call cancellable_cancel #} +-- | 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 ()) cancellableCancelled =     Signal $ connect_NONE__NONE "cancelled"
− System/GIO/Base.chs
@@ -1,104 +0,0 @@-{-# LANGUAGE CPP #-}---  GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*-------  Author : Peter Gavin---  Created: 13-Oct-2008------  Copyright (c) 2008 Peter Gavin------  This library is free software: you can redistribute it and/or---  modify it under the terms of the GNU Lesser General Public License---  as published by the Free Software Foundation, either version 3 of---  the License, or (at your option) any later version.---  ---  This library is distributed in the hope that it will be useful,---  but WITHOUT ANY WARRANTY; without even the implied warranty of---  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU---  Lesser General Public License for more details.---  ---  You should have received a copy of the GNU Lesser General Public---  License along with this program.  If not, see---  <http://www.gnu.org/licenses/>.---  ---  GIO, the C library which this Haskell library depends on, is---  available under LGPL Version 2. The documentation included with---  this library is based on the original GIO documentation.---  --- | Maintainer  : gtk2hs-devel@lists.sourceforge.net---   Stability   : alpha---   Portability : portable (depends on GHC)-module System.GIO.Base where--import Control.Monad--import System.Glib.FFI-import System.Glib.Flags-import System.Glib.GObject--{#import System.GIO.Types#}--type Offset = {# type goffset #}--cToFlags :: (Integral int, Flags flags)-         => int-         -> [flags]-cToFlags = toFlags . fromIntegral-cFromFlags :: (Integral int, Flags flags)-           => [flags]-           -> int-cFromFlags = fromIntegral . fromFlags--cToEnum :: (Integral int, Enum enum)-        => int-        -> enum-cToEnum = toEnum . fromIntegral-cFromEnum :: (Integral int, Enum enum)-           => enum-           -> int-cFromEnum = fromIntegral . fromEnum--withGObject :: GObjectClass objectT-            => objectT-            -> (Ptr objectT -> IO a)-            -> IO a-withGObject object action =-    let objectFPtr = unGObject $ toGObject object-    in withForeignPtr (castForeignPtr objectFPtr) action--peekGObject :: GObjectClass obj-            => Ptr obj-            -> IO obj-peekGObject cObject = do-  do cObjectRef $ castPtr cObject-     takeGObject cObject-foreign import ccall unsafe "&g_object_unref"-  objectFinalizer :: FunPtr (Ptr () -> IO ())-foreign import ccall unsafe "g_object_ref"-  cObjectRef :: Ptr ()-             -> IO (Ptr ())--takeGObject :: GObjectClass obj-            => Ptr obj-            -> IO obj-takeGObject cObject =-    liftM (unsafeCastGObject . GObject . castForeignPtr) $-        do newForeignPtr (castPtr cObject) objectFinalizer--type AsyncReadyCallback = GObject -> AsyncResult -> IO ()-type CAsyncReadyCallback = Ptr GObject -> Ptr AsyncResult -> Ptr () -> IO ()-foreign import ccall "wrapper"-    makeAsyncReadyCallback :: CAsyncReadyCallback-                           -> IO {# type GAsyncReadyCallback #}--marshalAsyncReadyCallback :: AsyncReadyCallback -> IO {# type GAsyncReadyCallback #}-marshalAsyncReadyCallback asyncReadyCallback =-    makeAsyncReadyCallback cAsyncReadyCallback-    where cAsyncReadyCallback :: CAsyncReadyCallback-          cAsyncReadyCallback cObject cAsyncResult cCallback = do-            object <- peekGObject cObject-            asyncResult <- peekGObject cAsyncResult-            asyncReadyCallback object asyncResult-            freeHaskellFunPtr (castPtrToFunPtr cCallback)--{# enum GFileAttributeInfoFlags as FileAttributeInfoFlags {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Read, Show) #}-instance Flags FileAttributeInfoFlags
+ System/GIO/Enums.chs view
@@ -0,0 +1,145 @@+{-# LANGUAGE CPP, DeriveDataTypeable #-}+--  GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*-+--+--  Author : Andy Stewart+--  Created: 30-April-2010+--+--  Copyright (c) 2010 Andy Stewart+--+--  This library is free software: you can redistribute it and/or+--  modify it under the terms of the GNU Lesser General Public License+--  as published by the Free Software Foundation, either version 3 of+--  the License, or (at your option) any later version.+--  +--  This library is distributed in the hope that it will be useful,+--  but WITHOUT ANY WARRANTY; without even the implied warranty of+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU+--  Lesser General Public License for more details.+--  +--  You should have received a copy of the GNU Lesser General Public+--  License along with this program.  If not, see+--  <http://www.gnu.org/licenses/>.+--  +--  GIO, the C library which this Haskell library depends on, is+--  available under LGPL Version 2. The documentation included with+--  this library is based on the original GIO documentation.+--  +-- | Maintainer  : gtk2hs-devel@lists.sourceforge.net+--   Stability   : alpha+--   Portability : portable (depends on GHC)+module System.GIO.Enums (+-- * Enums+    FileQueryInfoFlags(..),+    FileCreateFlags(..),+    FileCopyFlags(..),+    FileMonitorFlags(..),+    FilesystemPreviewType(..),+    FileType(..),+    FileAttributeStatus(..),+    FileAttributeInfoFlags(..),++    AskPasswordFlags(..),+    PasswordSave(..),+    MountOperationResult(..),++    IOErrorEnum(..),++    FileMonitorEvent(..),+    MountMountFlags(..),+    MountUnmountFlags(..),++#if GLIB_CHECK_VERSION(2,22,0)+    DriveStartFlags(..),+    DriveStartStopType(..),+#endif++#if GLIB_CHECK_VERSION(2,18,0)+    EmblemOrigin(..),+#endif++    AppInfoCreateFlags(..),+    ) where++import Control.Monad+import Data.Typeable+import System.Glib.FFI+import System.Glib.Flags+import System.Glib.GError+import System.Glib.GObject+import System.Glib.UTFString++{# context lib = "gio" prefix = "g" #}++-- | Flags used when querying a 'FileInfo'.+{# enum GFileQueryInfoFlags as FileQueryInfoFlags {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}+instance Flags FileQueryInfoFlags++-- | Flags used when an operation may create a file.+{# enum GFileCreateFlags as FileCreateFlags {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}+instance Flags FileCreateFlags++-- | Flags used when copying or moving files.+{# enum GFileCopyFlags as FileCopyFlags {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}+instance Flags FileCopyFlags++-- | Flags used to set what a 'FileMonitor' will watch for.+{# enum GFileMonitorFlags as FileMonitorFlags {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}+instance Flags FileMonitorFlags++-- | Indicates a hint from the file system whether files should be previewed in a file manager. Returned+-- as the value of the key 'FileAttributeFilesystemUsePreview'.+{# enum GFilesystemPreviewType as FilesystemPreviewType {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}++-- | Indicates the file's on-disk type.+{# enum GFileType as FileType {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}++-- | Used by 'fileSetAttributesFromInfo' when setting file attributes.+{# enum GFileAttributeStatus as FileAttributeStatus {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}++-- | Flags specifying the behaviour of an attribute.+{# enum GFileAttributeInfoFlags as FileAttributeInfoFlags {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Read, Show) #}+instance Flags FileAttributeInfoFlags++-- | 'AskPasswordFlags' are used to request specific information from the user, or to notify the user of+-- their choices in an authentication situation.+{# enum GAskPasswordFlags as AskPasswordFlags {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}+instance Flags AskPasswordFlags++-- | 'PasswordSave' is used to indicate the lifespan of a saved password.+{# enum GPasswordSave as PasswordSave {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}++-- | 'MountOperationResult' is returned as a result when a request for information is send by the mounting+-- operation.+{# enum GMountOperationResult as MountOperationResult {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}++-- | Error codes returned by GIO functions.+{# enum GIOErrorEnum as IOErrorEnum {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}++-- | Specifies what type of event a monitor event is.+{# enum GFileMonitorEvent as FileMonitorEvent {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}++-- | Flags used when mounting a mount.+{# enum GMountMountFlags as MountMountFlags {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}+instance Flags MountMountFlags++-- | Flags used when an unmounting a mount.+{# enum GMountUnmountFlags as MountUnmountFlags {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}+instance Flags MountUnmountFlags++#if GLIB_CHECK_VERSION(2,22,0)+-- | Flags used when starting a drive.+{# enum GDriveStartFlags as DriveStartFlags {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}+instance Flags DriveStartFlags++-- | Enumeration describing how a drive can be started/stopped.+{# enum GDriveStartStopType as DriveStartStopType {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}+#endif++#if GLIB_CHECK_VERSION(2,18,0)+-- | 'EmblemOrigin' is used to add information about the origin of the emblem to 'Emblem'.+{# enum GEmblemOrigin as EmblemOrigin {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}+#endif++-- | Flags used when creating a 'AppInfo'.+{# enum GAppInfoCreateFlags as AppInfoCreateFlags {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}+instance Flags AppInfoCreateFlags
+ System/GIO/File/AppInfo.chs view
@@ -0,0 +1,482 @@+{-# LANGUAGE CPP #-}+--  GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*-+--+--  Author : Andy Stewart+--  Created: 30-Apirl-2010+--+--  Copyright (c) 2010 Andy Stewart+--+--  This library is free software: you can redistribute it and/or+--  modify it under the terms of the GNU Lesser General Public License+--  as published by the Free Software Foundation, either version 3 of+--  the License, or (at your option) any later version.+--  +--  This library is distributed in the hope that it will be useful,+--  but WITHOUT ANY WARRANTY; without even the implied warranty of+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU+--  Lesser General Public License for more details.+--  +--  You should have received a copy of the GNU Lesser General Public+--  License along with this program.  If not, see+--  <http://www.gnu.org/licenses/>.+--  +--  GIO, the C library which this Haskell library depends on, is+--  available under LGPL Version 2. The documentation included with+--  this library is based on the original GIO documentation.+--  +-- | Maintainer  : gtk2hs-devel@lists.sourceforge.net+--   Stability   : alpha+--   Portability : portable (depends on GHC)+module System.GIO.File.AppInfo (+-- * Details+-- | 'AppInfo' and 'AppLaunchContext' are used for describing and launching applications installed on the+-- system.+-- +-- As of GLib 2.20, URIs will always be converted to POSIX paths (using 'fileGetPath' when using+-- 'appInfoLaunch' even if the application requested an URI and not a POSIX path. For example for+-- an desktop-file based application with Exec key totem %U and a single URI, sftp://foo/file.avi, then+-- /home/user/.gvfs/sftp on foo/file.avi will be passed. This will only work if a set of suitable GIO+-- extensions (such as gvfs 2.26 compiled with FUSE support), is available and operational; if this is+-- not the case, the URI will be passed unmodified to the application. Some URIs, such as mailto:, of+-- course cannot be mapped to a POSIX path (in gvfs there's no FUSE mount for it); such URIs will be+-- passed unmodified to the application.+-- +-- Specifically for gvfs 2.26 and later, the POSIX URI will be mapped back to the GIO URI in the 'File'+-- constructors (since gvfs implements the GVfs extension point). As such, if the application needs to+-- examine the URI, it needs to use 'fileGetUri' or similar on 'File'. In other words, an+-- application cannot assume that the URI passed to e.g. 'fileNewForCommandlineArg ' is equal to+-- the result of 'fileGetUri'.    ++-- * Types  +  AppInfo,+  AppInfoClass,+  AppLaunchContext,+  AppLaunchContextClass,++-- * Enums+  AppInfoCreateFlags (..),++-- * Methods+  appInfoCreateFromCommandline,+  appInfoDup,+  appInfoEqual,+  appInfoGetId,+  appInfoGetName,+#if GLIB_CHECK_VERSION(2,24,0)+  appInfoGetDisplayName,+#endif+  appInfoGetDescription,+  appInfoGetExecutable,+#if GLIB_CHECK_VERSION(2,20,0)+  appInfoGetCommandline,+#endif+  appInfoGetIcon,+  appInfoLaunch,+  appInfoSupportsFiles,+  appInfoSupportsUris,+  appInfoLaunchUris,+  appInfoShouldShow,+#if GLIB_CHECK_VERSION(2,20,0)+  appInfoCanDelete,+  appInfoDelete,+  appInfoResetTypeAssociations,+#endif+  appInfoSetAsDefaultForType,+  appInfoSetAsDefaultForExtension,+  appInfoAddSupportsType,+  appInfoCanRemoveSupportsType,+  appInfoRemoveSupportsType,+  appInfoGetAll,+  appInfoGetAllForType,+  appInfoGetDefaultForType,+  appInfoGetDefaultForUriScheme,+  appInfoLaunchDefaultForUri,+  appLaunchContextGetDisplay,+  appLaunchContextGetStartupNotifyId,+  appLaunchContextLaunchFailed,+  appLaunchContextNew+  ) where++import Control.Monad+import Data.Maybe (fromMaybe)+import Data.ByteString (ByteString)+import Data.ByteString.Unsafe (unsafePackCStringFinalizer)+import System.GIO.Enums+import System.Glib.FFI+import System.Glib.Flags+import System.Glib.GError+import System.Glib.GList+import System.Glib.GObject+import System.Glib.UTFString+{#import System.GIO.Types#}++{# context lib = "gio" prefix = "g" #}++-- | Creates a new 'AppInfo' from the given information.+appInfoCreateFromCommandline :: String -- ^ @commandline@      the commandline to use+ -> Maybe String             -- ^ @applicationName@ the application name, or 'Nothing' to use commandline+ -> [AppInfoCreateFlags] -- ^ @flags@            flags that can specify details of the created 'AppInfo'        + -> IO AppInfo      -- ^ returns          new 'AppInfo' for given command.                               +appInfoCreateFromCommandline commandline applicationName flags =+    wrapNewGObject mkAppInfo $+    withUTFString commandline $ \ commandlinePtr -> +        maybeWith withUTFString applicationName $ \ applicationNamePtr -> +            propagateGError ({#call g_app_info_create_from_commandline #}+                             commandlinePtr +                             applicationNamePtr+                             ((fromIntegral . fromFlags) flags)) ++-- | Creates a duplicate of a 'AppInfo'.+appInfoDup :: AppInfoClass appinfo => appinfo -> IO AppInfo+appInfoDup appinfo = +    wrapNewGObject mkAppInfo $+    {#call g_app_info_dup #} (toAppInfo appinfo)++-- | Checks if two 'AppInfo's are equal.+appInfoEqual :: (AppInfoClass info1, AppInfoClass info2) => info1 -> info2+ -> Bool  -- ^ returns  'True' if appinfo1 is equal to appinfo2. 'False' otherwise. +appInfoEqual info1 info2 = +  unsafePerformIO $ liftM toBool $+  {#call g_app_info_equal #} (toAppInfo info1) (toAppInfo info2)++-- | 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)+appInfoGetId appinfo = +  {#call g_app_info_get_id#} (toAppInfo appinfo)+  >>= maybePeek readUTFString++-- | Gets the installed name of the application.+appInfoGetName :: AppInfoClass appinfo => appinfo+ -> String -- ^ returns the name of the application for appinfo. +appInfoGetName appinfo = +  unsafePerformIO $+  {#call g_app_info_get_name#} (toAppInfo appinfo)+  >>= readCString++#if GLIB_CHECK_VERSION(2,24,0)+-- | Gets the installed name of the application.+appInfoGetDisplayName :: AppInfoClass appinfo => appinfo+ -> String -- ^ returns the display name of the application for appinfo, or the name if no display name is available.+appInfoGetDisplayName appinfo = +  unsafePerformIO $+  {#call g_app_info_get_display_name#} (toAppInfo appinfo)+  >>= readUTFString+#endif++-- | Gets a human-readable description of an installed application.+appInfoGetDescription :: AppInfoClass appinfo => appinfo+ -> Maybe String -- ^ returns a string containing a description of the application appinfo, or 'Nothing' if none.+appInfoGetDescription appinfo = +  unsafePerformIO $ do+  {#call g_app_info_get_description#} (toAppInfo appinfo)+  >>= maybePeek peekUTFString++-- | Gets the executable's name for the installed application.+appInfoGetExecutable :: AppInfoClass appinfo => appinfo+ -> String -- ^ returns the executable of the application for appinfo. +appInfoGetExecutable appinfo = +  unsafePerformIO $+  {#call g_app_info_get_executable#} (toAppInfo appinfo)+  >>= peekUTFString++#if GLIB_CHECK_VERSION(2,20,0)+-- | Gets the commandline with which the application will be started.+appInfoGetCommandline :: AppInfoClass appinfo => appinfo+ -> Maybe ByteString -- ^ returns a string containing the appinfo's commandline, or 'Nothing' if this information is not available+appInfoGetCommandline appinfo = +  unsafePerformIO $ do+  sPtr <- {#call g_app_info_get_commandline#} (toAppInfo appinfo)+  if sPtr == nullPtr+     then return Nothing+     else do+       sLen <- lengthArray0 0 sPtr+       liftM Just $ unsafePackCStringFinalizer (castPtr sPtr) (fromIntegral sLen)+                        ({#call unsafe g_free#} (castPtr sPtr))+#endif++-- | Gets the icon for the application.+appInfoGetIcon :: AppInfoClass appinfo => appinfo + -> IO (Maybe Icon)              -- ^ returns the default 'Icon' for appinfo or 'Nothing'+appInfoGetIcon appinfo =+  maybeNull (makeNewGObject mkIcon) $+  {#call g_app_info_get_icon#} (toAppInfo appinfo)++-- | 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]  -- ^ @files@          a list of 'File' objects                     + -> Maybe AppLaunchContext  -- ^ @launchContext@ a 'AppLaunchContext' or 'Nothing'                 + -> IO ()+appInfoLaunch appinfo files launchContext = +    withForeignPtrs (map unFile files) $ \wFilePtr ->+    withGList wFilePtr $ \filesPtr ->+        propagateGError (\gErrorPtr -> do+                          {#call g_app_info_launch#} +                           (toAppInfo appinfo) +                           filesPtr +                           (fromMaybe (AppLaunchContext nullForeignPtr) launchContext)+                           gErrorPtr +                          return ()) ++-- | Checks if the application accepts files as arguments.+appInfoSupportsFiles :: AppInfoClass appinfo => appinfo + -> IO Bool  -- ^ returns 'True' if the appinfo supports files. +appInfoSupportsFiles appinfo =+  liftM toBool $+  {#call g_app_info_supports_files #} (toAppInfo appinfo)++-- | Checks if the application accepts uris as arguments.+appInfoSupportsUris :: AppInfoClass appinfo => appinfo + -> IO Bool  -- ^ returns 'True' if the appinfo supports uris. +appInfoSupportsUris appinfo =+  liftM toBool $+  {#call g_app_info_supports_uris #} (toAppInfo appinfo)++-- | 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] -- ^ @uris@           a list containing URIs to launch.          + -> Maybe AppLaunchContext -- ^ @launchContext@ a 'AppLaunchContext' or 'Nothing'                 + -> IO ()+appInfoLaunchUris appinfo uris launchContext = +    withUTFStringArray uris $ \urisPtr ->+        propagateGError (\gErrorPtr -> do+                           {#call g_app_info_launch_uris#} +                             (toAppInfo appinfo)+                             (castPtr urisPtr) +                             (fromMaybe (AppLaunchContext nullForeignPtr) launchContext)+                             gErrorPtr+                           return ()) ++-- | Checks if the application info should be shown in menus that list available applications.+appInfoShouldShow :: AppInfoClass appinfo => appinfo+ -> IO Bool  -- ^ returns 'True' if the appinfo should be shown, 'False' otherwise. +appInfoShouldShow appinfo = +  liftM toBool $+  {#call g_app_info_should_show#} (toAppInfo appinfo)++#if GLIB_CHECK_VERSION(2,20,0)+-- | Obtains the information whether the 'AppInfo' can be deleted. See 'appInfoDelete'.+appInfoCanDelete :: AppInfoClass appinfo => appinfo+ -> IO Bool -- ^ returns 'True' if appinfo can be deleted +appInfoCanDelete appinfo = +  liftM toBool $+  {#call g_app_info_can_delete#} (toAppInfo appinfo)++-- | Tries to delete a 'AppInfo'.+-- +-- On some platforms, there may be a difference between user-defined 'AppInfo's which can be deleted,+-- and system-wide ones which cannot. See 'appInfoCanDelete'.+appInfoDelete :: AppInfoClass appinfo => appinfo+ -> IO Bool -- ^ returns 'True' if appinfo has been deleted +appInfoDelete appinfo = +  liftM toBool $+  {#call g_app_info_delete#} (toAppInfo appinfo)++-- | Removes all changes to the type associations done by 'appInfoSetAsDefaultForType',+-- 'appInfoSetAsDefaultForExtension' or+-- 'appInfoRemoveSupportsType'.+appInfoResetTypeAssociations :: +   String  -- ^ @contentType@ a content type+ -> IO ()+appInfoResetTypeAssociations contentType =+  withUTFString contentType $ \ contentTypePtr -> +  {#call g_app_info_reset_type_associations#} (castPtr contentTypePtr)+#endif++-- | Sets the application as the default handler for a given type.+-- Throws a 'GError' if an error occurs.+appInfoSetAsDefaultForType :: AppInfoClass appinfo => appinfo + -> String -- ^ @contentType@ the content type.                + -> IO ()+appInfoSetAsDefaultForType appinfo contentType =+  withUTFString contentType $ \ contentTypePtr -> +      propagateGError (\gErrorPtr -> do+                         {#call g_app_info_set_as_default_for_type#} +                            (toAppInfo appinfo)+                            (castPtr contentTypePtr)+                            gErrorPtr+                         return ())  ++-- | Sets the application as the default handler for a given extension.+-- Throws a 'GError' if an error occurs.+appInfoSetAsDefaultForExtension :: AppInfoClass appinfo => appinfo + -> String -- ^ @extension@ a string containing the file extension (without the dot). + -> IO ()+appInfoSetAsDefaultForExtension appinfo extension =+  withUTFString extension $ \ extensionPtr -> +      propagateGError (\gErrorPtr -> do+                         {#call g_app_info_set_as_default_for_extension #}+                             (toAppInfo appinfo)+                             (castPtr extensionPtr)+                             gErrorPtr+                         return ())  ++-- | 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 -- ^ @contentType@ a string.                        + -> IO ()+appInfoAddSupportsType appinfo extension =+  withUTFString extension $ \ extensionPtr -> +      propagateGError (\gErrorPtr -> do+                         {#call g_app_info_add_supports_type#}+                           (toAppInfo appinfo)+                           (castPtr extensionPtr)+                           gErrorPtr+                         return ())  ++-- | Checks if a supported content type can be removed from an application.+appInfoCanRemoveSupportsType :: AppInfoClass appinfo => appinfo+ -> IO Bool -- ^ returns 'True' if it is possible to remove supported content types from a given appinfo, 'False' if not.+appInfoCanRemoveSupportsType appinfo = +  liftM toBool $+  {#call g_app_info_can_remove_supports_type#} (toAppInfo appinfo)++-- | Removes a supported type from an application, if possible.+-- Throws a 'GError' if an error occurs.+appInfoRemoveSupportsType :: AppInfoClass appinfo => appinfo + -> String -- ^ @contentType@ a string.                        + -> IO ()+appInfoRemoveSupportsType appinfo extension =+  withUTFString extension $ \ extensionPtr -> +      propagateGError (\gErrorPtr -> do+                          {#call g_app_info_remove_supports_type#}+                            (toAppInfo appinfo)+                            (castPtr extensionPtr)+                            gErrorPtr+                          return ())  ++-- | 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]+appInfoGetAll = do+  glistPtr <- {# call g_app_info_get_all #} +  list <- fromGList glistPtr+  mapM (wrapNewGObject mkAppInfo . return) list       ++-- | Gets a list of all 'AppInfo's for a given content type.+appInfoGetAllForType :: +   String  -- ^ @contentType@ the content type to find a 'AppInfo' for                     + -> IO [AppInfo] -- ^ returns list of 'AppInfo's for given @contentType@ or 'empty' on error. +appInfoGetAllForType contentType = +  withUTFString contentType $ \ contentTypePtr -> do+    glistPtr <- {# call g_app_info_get_all_for_type #} (castPtr contentTypePtr)+    if glistPtr == nullPtr+       then return []+       else do +         list <- fromGList glistPtr+         mapM (wrapNewGObject mkAppInfo . return) list       ++-- | Gets the 'AppInfo' that corresponds to a given content type.+appInfoGetDefaultForType :: +   String  -- ^ @contentType@ the content type to find a 'AppInfo' for                     + -> Bool  -- ^ @mustSupportUris@ if 'True', the 'AppInfo' is expected to support URIs + -> IO (Maybe AppInfo)         -- ^ returns list of 'AppInfo's for given @contentType@ or 'Nothing' on error. +appInfoGetDefaultForType contentType mustSupportUris = +  maybeNull (wrapNewGObject mkAppInfo) $+  withUTFString contentType $ \ contentTypePtr -> do+  {# call g_app_info_get_default_for_type #} +             (castPtr contentTypePtr)+             (fromBool mustSupportUris)++-- | 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 -- ^ @uriScheme@ a string containing a URI scheme.               + -> IO (Maybe AppInfo)         -- ^ returns list of 'AppInfo's for given @contentType@ or 'Nothing' on error. +appInfoGetDefaultForUriScheme uriScheme = +  maybeNull (wrapNewGObject mkAppInfo) $+  withUTFString uriScheme $ \ uriSchemePtr -> +    {# call g_app_info_get_default_for_uri_scheme #} (castPtr uriSchemePtr)++-- | 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  -- ^ @uri@            the uri to show                  + -> AppLaunchContext -- ^ @launchContext@ an optional 'AppLaunchContext'.   + -> IO ()+appInfoLaunchDefaultForUri uri launchContext = +  withUTFString uri $ \ uriPtr -> +      propagateGError (\gErrorPtr -> do+                         {#call g_app_info_launch_default_for_uri#}+                            (castPtr uriPtr)+                            launchContext+                            gErrorPtr+                         return ())++-- | 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]  -- ^ @files@          a list of 'File' objects                     + -> IO String -- ^ returns a display string for the display. +appLaunchContextGetDisplay launchContext appinfo files = +    withForeignPtrs (map unFile files) $ \wFilePtr ->+    withGList wFilePtr $ \filesPtr ->+        {#call g_app_launch_context_get_display#} +          (toAppLaunchContext launchContext)+          (toAppInfo appinfo)+          filesPtr+        >>= readUTFString++-- | 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]  -- ^ @files@          a list of 'File' objects                     + -> IO (Maybe String) -- ^ returns a startup notification ID for the application, or 'Nothing' if not supported.+appLaunchContextGetStartupNotifyId launchContext appinfo files = +    withForeignPtrs (map unFile files) $ \wFilePtr ->+    withGList wFilePtr $ \filesPtr -> +        {#call g_app_launch_context_get_startup_notify_id #} +                (toAppLaunchContext launchContext)+                (toAppInfo appinfo)+                filesPtr+        >>= maybePeek readUTFString++-- | Called when an application has failed to launch, so that it can cancel the application startup+-- notification started in 'appLaunchContextGetStartupNotifyId'.+appLaunchContextLaunchFailed :: AppLaunchContext+ -> String -- ^ @startupNotifyId@ the startup notification id that was returned by 'appLaunchContextGetStartupNotifyId'.+ -> IO ()+appLaunchContextLaunchFailed launchContext startupNotifyId = +  withUTFString startupNotifyId $ \ startupNotifyIdPtr -> +  {#call g_app_launch_context_launch_failed#} +  (toAppLaunchContext launchContext)+  (castPtr startupNotifyIdPtr)++-- | Creates a new application launch context. This is not normally used, instead you instantiate a+-- subclass of this, such as 'AppLaunchContext'.+appLaunchContextNew :: IO AppLaunchContext+appLaunchContextNew =+    wrapNewGObject mkAppLaunchContext $+    {#call g_app_launch_context_new#}
+ System/GIO/File/ContentType.chs view
@@ -0,0 +1,192 @@+{-# LANGUAGE CPP #-}+--  GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*-+--+--  Author : Andy Stewart+--  Created: 30-Apirl-2010+--+--  Copyright (c) 2010 Andy Stewart+--+--  This library is free software: you can redistribute it and/or+--  modify it under the terms of the GNU Lesser General Public License+--  as published by the Free Software Foundation, either version 3 of+--  the License, or (at your option) any later version.+--  +--  This library is distributed in the hope that it will be useful,+--  but WITHOUT ANY WARRANTY; without even the implied warranty of+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU+--  Lesser General Public License for more details.+--  +--  You should have received a copy of the GNU Lesser General Public+--  License along with this program.  If not, see+--  <http://www.gnu.org/licenses/>.+--  +--  GIO, the C library which this Haskell library depends on, is+--  available under LGPL Version 2. The documentation included with+--  this library is based on the original GIO documentation.+--  +-- | Maintainer  : gtk2hs-devel@lists.sourceforge.net+--   Stability   : alpha+--   Portability : portable (depends on GHC)+module System.GIO.File.ContentType (+-- * Details+--+-- | A content type is a platform specific string that defines the type of a file. On unix it is a mime+-- type, on win32 it is an extension string like ".doc", ".txt" or a percieved string like+-- "audio". Such strings can be looked up in the registry at HkeyClassesRoot.++-- * Methods+    contentTypeEquals,+    contentTypeIsA,+    contentTypeIsUnknown,+    contentTypeGetDescription,+    contentTypeGetMimeType,+    contentTypeGetIcon,+    contentTypeCanBeExecutable,+#if GLIB_CHECK_VERSION(2,18,0)+    contentTypeFromMimeType,+#endif+    contentTypeGuess,+#if GLIB_CHECK_VERSION(2,18,0)+    contentTypeGuessForTree,+#endif+    contentTypesGetRegistered,+    ) where++import Control.Monad+import System.GIO.Enums+import System.Glib.FFI+import System.Glib.Flags+import System.Glib.GError+import System.Glib.GList+import System.Glib.GObject+import System.Glib.UTFString+{#import System.GIO.Types#}++{# context lib = "gio" prefix = "g" #}++-- | Compares two content types for equality.+contentTypeEquals :: +   String + -> String + -> Bool -- ^ returns 'True' if the two strings are identical or equivalent, 'False' otherwise.+contentTypeEquals type1 type2 = +  toBool $ unsafePerformIO $+  withUTFString type1 $ \ type1Ptr -> +  withUTFString type2 $ \ type2Ptr -> +  {#call g_content_type_equals#} type1Ptr type2Ptr++-- | Determines if type is a subset of supertype.+contentTypeIsA :: +   String + -> String + -> Bool -- ^ returns   'True' if type is a kind of supertype, 'False' otherwise. +contentTypeIsA type1 supertype = +  toBool $ unsafePerformIO $+  withUTFString type1 $ \ type1Ptr -> +  withUTFString supertype $ \ supertypePtr -> +  {#call g_content_type_equals#} type1Ptr supertypePtr++-- | Checks if the content type is the generic "unknown" type. On unix this is the+-- "application/octet-stream" mimetype, while on win32 it is \"*\".+contentTypeIsUnknown :: String+ -> Bool  -- ^ returns 'True' if the type is the unknown type. +contentTypeIsUnknown typ =+  toBool $ unsafePerformIO $+  withUTFString typ $ \ typPtr -> +  {#call g_content_type_is_unknown#} typPtr++-- | Gets the human readable description of the content type.+contentTypeGetDescription :: +   String + -> String  -- ^ returns a short description of the content type type. +contentTypeGetDescription typ = +  unsafePerformIO $+  withUTFString typ $ \ typPtr -> +  {#call g_content_type_get_description#} typPtr+  >>= readUTFString++-- | Gets the mime-type for the content type. If one is registered+contentTypeGetMimeType :: +   String + -> String -- ^ returns the registered mime-type for the given type, or 'Nothing' if unknown. +contentTypeGetMimeType typ = +  unsafePerformIO $+  withUTFString typ $ \ typPtr -> +  {#call g_content_type_get_mime_type#} typPtr+  >>= readUTFString++-- | Gets the icon for a content type.+contentTypeGetIcon :: String + -> Icon  -- ^ returns 'Icon' corresponding to the content type. +contentTypeGetIcon typ = +  unsafePerformIO $ wrapNewGObject mkIcon $+  withUTFString typ $ \ typPtr -> +  {#call g_content_type_get_icon#} typPtr++-- | 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  -- ^ returns 'True' if the file type corresponds to a type that can be executable, 'False' otherwise.+contentTypeCanBeExecutable typ =+  toBool $ unsafePerformIO $+  withUTFString typ $ \ typPtr -> +  {#call g_content_type_can_be_executable#} typPtr++#if GLIB_CHECK_VERSION(2,18,0)+-- | Tries to find a content type based on the mime type name.+contentTypeFromMimeType :: +   String -- ^ @mimeType@ a mime type string.                                                 + -> String +contentTypeFromMimeType mimeType =+  unsafePerformIO $+  withUTFString mimeType $ \ mimeTypePtr -> +  {#call g_content_type_from_mime_type#} mimeTypePtr+  >>= readUTFString+#endif++-- | 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  -- ^ @data@             a stream of data,+ -> Int -- ^ @dataSize@        the size of data                                              + -> IO (Bool, String)  -- ^ returns          a string indicating a guessed content type for the given data.+contentTypeGuess filename dat dataSize  =+  withUTFString filename $ \ filenamePtr -> +  withUTFString dat $ \ datPtr -> +  alloca $ \ resultUncertainPtr -> do+  strPtr <- {#call g_content_type_guess#} +           filenamePtr +           (castPtr datPtr)+           (fromIntegral dataSize)+           (castPtr resultUncertainPtr)+  resultUncertain <- peek resultUncertainPtr+  str <- readUTFString strPtr+  return (resultUncertain, str)++#if GLIB_CHECK_VERSION(2,18,0)+-- | 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-content/foo, e.g. x-content/audio-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  -- ^ @root@    the root of the tree to guess a type for                                               + -> IO [String]  -- ^ returns a list of possible content types+contentTypeGuessForTree root =+  {#call g_content_type_guess_for_tree#} (toFile root)+  >>= readUTFStringArray0+#endif++-- | Gets a list of strings containing all the registered content types known to the system. +contentTypesGetRegistered :: + IO [String]  -- ^ returns GList of the registered content types. +contentTypesGetRegistered = do+  glistPtr <- {#call g_content_types_get_registered#}  +  strPtrs <- fromGList glistPtr+  mapM readUTFString strPtrs++  
System/GIO/File/File.chs view
@@ -31,1324 +31,1943 @@ module System.GIO.File.File ( -- * Details ----- | GFile is a high level abstraction for manipulating files on a virtual file system. GFiles are--- lightweight, immutable objects that do no I/O upon creation. It is necessary to understand that--- GFile objects do not represent files, merely an identifier for a file. All file content I/O is--- implemented as streaming operations (see GInputStream and GOutputStream).--- --- To construct a GFile, you can use: 'fileNewForPath' if--- you have a URI.  'fileNewForCommandlineArg'--- from a utf8 string gotten from 'fileGetParseName'.--- --- One way to think of a GFile is as an abstraction of a pathname. For normal files the system pathname--- is what is stored internally, but as GFiles are extensible it could also be something else that--- corresponds to a pathname in a userspace implementation of a filesystem.--- --- GFiles make up hierarchies of directories and files that correspond to the files on a--- filesystem. You can move through the file system with GFile using 'fileGetParent' to get an--- identifier for the parent directory, 'fileGetChild' to get a child within a directory,--- 'fileResolveRelativePath' to resolve a relative path between two GFiles. There can be multiple--- hierarchies, so you may not end up at the same root if you repeatedly call 'fileGetParent' on--- two different files.--- --- All GFiles have a basename (get with 'fileGetBasename'. These names are byte strings that are--- used to identify the file on the filesystem (relative to its parent directory) and there is no--- guarantees that they have any particular charset encoding or even make any sense at all. If you want--- to use filenames in a user interface you should use the display name that you can get by requesting--- the GFileAttributeStandardDisplayName attribute with 'fileQueryInfo'. This is guaranteed to--- be in utf8 and can be used in a user interface. But always store the real basename or the GFile to--- use to actually access the file, because there is no way to go from a display name to the actual--- name.--- --- Using GFile as an identifier has the same weaknesses as using a path in that there may be multiple--- aliases for the same file. For instance, hard or soft links may cause two different GFiles to refer--- to the same file. Other possible causes for aliases are: case insensitive filesystems, short and--- long names on Fat/NTFS, or bind mounts in Linux. If you want to check if two GFiles point to the--- same file you can query for the GFileAttributeIdFile attribute. Note that GFile does some--- trivial canonicalization of pathnames passed in, so that trivial differences in the path string used--- at creation (duplicated slashes, slash at end of path, "." or ".." path segments, etc) does not--- create different GFiles.--- --- Many GFile operations have both synchronous and asynchronous versions to suit your--- application. Asynchronous versions of synchronous functions simply have _async() appended to their--- function names. The asynchronous I/O functions call a GAsyncReadyCallback which is then used to--- finalize the operation, producing a GAsyncResult which is then passed to the function's matching--- _finish() operation.--- --- Some GFile operations do not have synchronous analogs, as they may take a very long time to finish,--- and blocking may leave an application unusable. Notable cases include: 'fileMountMountable' to--- mount a mountable file.  'fileUnmountMountableWithOperation' to unmount a mountable--- file. 'fileEjectMountableWithOperation' to eject a mountable file.--- --- One notable feature of GFiles are entity tags, or "etags" for short. Entity tags are somewhat like a--- more abstract version of the traditional mtime, and can be used to quickly determine if the file has--- been modified from the version on the file system. See the HTTP 1.1 specification for HTTP Etag--- headers, which are a very similar concept.---- * Types.-    FileProgressCallback,-    FileReadMoreCallback,-    FileClass,---- * Enums-    File(..),-    FileQueryInfoFlags(..),-    FileCreateFlags(..),-    FileCopyFlags(..),-    FileMonitorFlags(..),-    FilesystemPreviewType(..),-    FileType(..),---- * Methods-    fileFromPath,-    fileFromURI,-    fileFromCommandlineArg,-    fileFromParseName,-    fileEqual,-    fileBasename,-    filePath,-#if GLIB_CHECK_VERSION(2,24,0)-    fileHasParent,-#endif-    fileURI,-    fileParseName,-    fileGetChild,-    fileGetChildForDisplayName,-    fileHasPrefix,-    fileGetRelativePath,-    fileResolveRelativePath,-    fileIsNative,-    fileHasURIScheme,-    fileURIScheme,-    fileRead,-    fileReadAsync,-    fileReadFinish,-    fileAppendTo,-    fileCreate,-    fileReplace,-    fileAppendToAsync,-    fileAppendToFinish,-    fileCreateAsync,-    fileCreateFinish,-    fileReplaceAsync,-    fileReplaceFinish,-    fileQueryInfo,-    fileQueryInfoAsync,-    fileQueryInfoFinish,-    fileQueryExists,-#if GLIB_CHECK_VERSION(2,18,0)-    fileQueryFileType,-#endif-    fileQueryFilesystemInfo,-    fileQueryFilesystemInfoAsync,-    fileQueryFilesystemInfoFinish,-    fileQueryDefaultHandler,-    fileFindEnclosingMount,-    fileFindEnclosingMountAsync,-    fileFindEnclosingMountFinish,-    fileEnumerateChildren,-    fileEnumerateChildrenAsync,-    fileEnumerateChildrenFinish,-    fileSetDisplayName,-    fileSetDisplayNameAsync,-    fileSetDisplayNameFinish,-    fileDelete,-    fileTrash,-    fileCopy,-    fileCopyAsync,-    fileCopyFinish,-    fileMove,-    fileMakeDirectory,-#if GLIB_CHECK_VERSION(2,18,0)-    fileMakeDirectoryWithParents,-#endif-    fileMakeSymbolicLink,-    fileQuerySettableAttributes,-    fileQueryWritableNamespaces-    ) where--import Control.Monad-import qualified Data.ByteString as BS-import Data.Typeable--import System.Glib.FFI-import System.Glib.Flags-import System.Glib.GError-import System.Glib.UTFString-import System.Glib.GObject--{#import System.GIO.Base#}-{#import System.GIO.Types#}-import System.GIO.File.FileAttribute--{# context lib = "gio" prefix = "g" #}--{# enum GFileQueryInfoFlags as FileQueryInfoFlags {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}-instance Flags FileQueryInfoFlags--{# enum GFileCreateFlags as FileCreateFlags {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}-instance Flags FileCreateFlags--{# enum GFileCopyFlags as FileCopyFlags {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}-instance Flags FileCopyFlags--{# enum GFileMonitorFlags as FileMonitorFlags {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}-instance Flags FileMonitorFlags--{# enum GFilesystemPreviewType as FilesystemPreviewType {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}--{# enum GFileType as FileType {underscoreToCase} with prefix = "G" deriving (Eq, Ord, Bounded, Show, Typeable) #}--type FileProgressCallback = Offset -> Offset -> IO ()-type CFileProgressCallback = {# type goffset #} -> {# type goffset #} -> Ptr () -> IO ()-foreign import ccall "wrapper"-    makeFileProgressCallback :: CFileProgressCallback-                             -> IO {# type GFileProgressCallback #}--marshalFileProgressCallback :: FileProgressCallback -> IO {# type GFileProgressCallback #}-marshalFileProgressCallback fileProgressCallback =-    makeFileProgressCallback cFileProgressCallback-    where cFileProgressCallback :: CFileProgressCallback-          cFileProgressCallback cCurrentNumBytes cTotalNumBytes _ = do-            fileProgressCallback (fromIntegral cCurrentNumBytes)-                                 (fromIntegral cTotalNumBytes)--type FileReadMoreCallback = BS.ByteString -> IO Bool---- | Constructs a GFile for a given path. This operation never fails, but the returned object might not--- support any I/O operation if path is malformed.-fileFromPath :: FilePath -> File-fileFromPath path =-    unsafePerformIO $ withUTFString path $ \cPath -> {# call file_new_for_path #} cPath >>= takeGObject---- | Constructs a GFile 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-fileFromURI uri =-    unsafePerformIO $ withUTFString uri $ \cURI -> {# call file_new_for_uri #} cURI >>= takeGObject---- | Creates a GFile 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 :: String -> File-fileFromCommandlineArg arg =-    unsafePerformIO $ withUTFString arg $ \cArg -> {# call file_new_for_commandline_arg #} cArg >>= takeGObject---- | Constructs a GFile with the given 'name (i.e. something given by gFileGetParseName'. This--- operation never fails, but the returned object might not support any I/O operation if the @parseName@--- cannot be parsed.-fileFromParseName :: String -> File-fileFromParseName parseName =-    unsafePerformIO $ withUTFString parseName $ \cParseName -> {# call file_parse_name #} cParseName >>= takeGObject---- | 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-fileEqual file1 file2 =-    unsafePerformIO $ liftM toBool $ {# call file_equal #} (toFile file1) (toFile file2)--instance Eq File where-    (==) = fileEqual---- | Gets the base name (the last component of the path) for a given GFile.--- --- If called for the top level of a system (such as the filesystem root or a uri like sftp://host/) it--- 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 GFileAttributeStandardDisplayName attribute with--- 'fileQueryInfo'.--- --- This call does no blocking i/o.-fileBasename :: FileClass file => file -> String-fileBasename file =-    unsafePerformIO $ {# call file_get_basename #} (toFile file) >>= readUTFString---- | Gets the local pathname for GFile, if one exists.--- --- This call does no blocking i/o.-filePath :: FileClass file => file -> FilePath-filePath file =-    unsafePerformIO $ {# call file_get_path #} (toFile file) >>= readUTFString---- | Gets the URI for the file.--- --- This call does no blocking i/o.-fileURI :: FileClass file => file -> String-fileURI file =-    unsafePerformIO $ {# call file_get_uri #} (toFile file) >>= readUTFString---- | 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 GFile back using 'fileParseName'.--- --- This is generally used to show the GFile 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-fileParseName file =-    unsafePerformIO $ {# call file_get_parse_name #} (toFile file) >>= readUTFString---- | Gets the parent directory for the file. If the file represents the root directory of the file--- system, then 'Nothing' will be returned.--- --- This call does no blocking i/o.-fileParent :: FileClass file => file -> Maybe File-fileParent file =-    unsafePerformIO $ {# call file_get_parent #} (toFile file) >>= maybePeek takeGObject--#if GLIB_CHECK_VERSION(2,24,0)--- | 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 -fileHasParent file parent = -    unsafePerformIO $ liftM toBool $-    withGObject (toFile file) $ \cFile ->-        maybeWith withGObject parent $ \parentPtr ->-                  g_file_has_parent cFile parentPtr-    where _ = {#call file_has_parent #}-#endif---- | 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 GFile 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 -> String -> File-fileGetChild file name =-    unsafePerformIO $-        withUTFString name $ \cName ->-        {# call file_get_child #} (toFile file) cName >>= takeGObject---- | Gets the child of file for a given 'name (i.e. a UTF8 version of the name)'. If this function--- fails, it returns 'Nothing' and error will be set. This is very useful when constructing a GFile 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 -> Maybe File-fileGetChildForDisplayName file displayName =-    unsafePerformIO $-        withUTFString displayName $ \cDisplayName ->-        propagateGError ({# call file_get_child_for_display_name #} (toFile file) cDisplayName) >>=-        maybePeek takeGObject---- | 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 / foo/bar.--- --- 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-fileHasPrefix file1 file2 =-    unsafePerformIO $-        liftM toBool $ {# call file_has_prefix #} (toFile file1) (toFile file2)---- | Gets the path for descendant relative to parent.--- --- This call does no blocking i/o.-fileGetRelativePath :: (FileClass file1, FileClass file2) => file1 -> file2 -> Maybe FilePath-fileGetRelativePath file1 file2 =-    unsafePerformIO $-        {# call file_get_relative_path #} (toFile file1) (toFile file2) >>=-        maybePeek readUTFString---- | Resolves a relative path for file to an absolute path.--- --- This call does no blocking i/o.-fileResolveRelativePath :: FileClass file => file -> FilePath -> Maybe File-fileResolveRelativePath file relativePath =-    unsafePerformIO $-        withUTFString relativePath $ \cRelativePath ->-        {# call file_resolve_relative_path #} (toFile file) cRelativePath >>=-        maybePeek takeGObject---- | 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--- \"/usr/bin/\". 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-fileIsNative =-    unsafePerformIO .-        liftM toBool . {# call file_is_native #} . toFile---- | Checks to see if a 'GFile' has a given URI scheme.--- --- This call does no blocking i/o.-fileHasURIScheme :: FileClass file => file -> String -> Bool-fileHasURIScheme file uriScheme =-    unsafePerformIO $-        withUTFString uriScheme $ \cURIScheme ->-        liftM toBool $ {# call file_has_uri_scheme #} (toFile file) cURIScheme---- | Gets the URI scheme for a GFile. 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-fileURIScheme file =-    unsafePerformIO $ {# call file_get_uri_scheme #} (toFile file) >>= readUTFString---- | Opens a file for reading. The result is a GFileInputStream 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 GIoErrorCancelled will be--- returned.--- --- If the file does not exist, the GIoErrorNotFound error will be returned. If the file is a--- directory, the GIoErrorIsDirectory 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-fileRead file (Just cancellable) = constructNewGObject mkFileInputStream $-    propagateGError $ {# call file_read #} (toFile file) cancellable-fileRead file Nothing = constructNewGObject mkFileInputStream $-    propagateGError $ {# call file_read #} (toFile file) (Cancellable nullForeignPtr)---- | 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 ()-fileReadAsync file ioPriority mbCancellable callback =-    withGObject (toFile file) $ \cFile ->-        maybeWith withGObject mbCancellable $ \cCancellable -> do-          cCallback <- marshalAsyncReadyCallback callback-          g_file_read_async cFile-                            (fromIntegral ioPriority)-                            cCancellable-                            cCallback-                            (castFunPtrToPtr cCallback)-    where _ = {# call file_read_async #}---- | Finishes an asynchronous file read operation started with 'fileReadAsync'.-fileReadFinish :: FileClass file-               => file-               -> AsyncResult-               -> IO FileInputStream-fileReadFinish file asyncResult =-    propagateGError ({# call file_read_finish #} (toFile file) asyncResult) >>= takeGObject---- | 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 GFileCreatePrivate--- 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 GIoErrorCancelled will be--- returned.--- --- Some file systems don't allow all file names, and may return an GIoErrorInvalidFilename--- error. If the file is a directory the GIoErrorIsDirectory 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-fileAppendTo file flags cancellable =-    withGObject (toFile file) $ \cFile ->-        maybeWith withGObject cancellable $ \cCancellable ->-        propagateGError (g_file_append_to cFile (cFromFlags flags) cCancellable) >>=-        takeGObject-    where _ = {# call file_append_to #}---- | 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 GFileCreatePrivate--- 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 GIoErrorCancelled will be--- returned.--- --- If a file or directory with this name already exists the GIoErrorExists error will be--- returned. Some file systems don't allow all file names, and may return an--- GIoErrorInvalidFilename error, and if the name is to long GIoErrorFilenameTooLong 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-fileCreate file flags cancellable =-    withGObject (toFile file) $ \cFile ->-        maybeWith withGObject cancellable $ \cCancellable ->-        propagateGError (g_file_create cFile (cFromFlags flags) cCancellable) >>=-        takeGObject-    where _ = {# call file_create #}---- | 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 GFileCreatePrivate--- 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 GIoErrorCancelled 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 GIoErrorWrongEtag 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 GFileOutputStream.--- 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 GIoErrorCantCreateBackup error will be returned. If you want to--- replace anyway, try again with @makeBackup@ set to 'False'.--- --- If the file is a directory the GIoErrorIsDirectory error will be returned, and if the file is--- some other form of non-regular file then a GIoErrorNotRegularFile error will be returned. Some--- file systems don't allow all file names, and may return an GIoErrorInvalidFilename error, and if--- the name is to long GIoErrorFilenameTooLong 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-fileReplace file etag makeBackup flags cancellable =-    withGObject (toFile file) $ \cFile ->-        maybeWith withUTFString etag $ \cEtag ->-        maybeWith withGObject cancellable $ \cCancellable ->-        propagateGError (g_file_replace cFile-                                        cEtag-                                        (fromBool makeBackup)-                                        (cFromFlags flags) cCancellable) >>=-        takeGObject-    where _ = {# call file_replace #}---- | 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 ()-fileAppendToAsync file flags ioPriority cancellable callback =-    withGObject (toFile file) $ \cFile ->-        maybeWith withGObject cancellable $ \cCancellable -> do-          cCallback <- marshalAsyncReadyCallback callback-          g_file_append_to_async cFile-                                 (cFromFlags flags)-                                 (fromIntegral ioPriority)-                                 cCancellable-                                 cCallback-                                 (castFunPtrToPtr cCallback)-    where _ = {# call file_append_to_async #}---- | Finishes an asynchronous file append operation started with 'fileAppendToAsync'.-fileAppendToFinish :: FileClass file-                   => file-                   -> AsyncResult-                   -> IO FileOutputStream-fileAppendToFinish file asyncResult =-    propagateGError ({# call file_append_to_finish #} (toFile file) asyncResult) >>= takeGObject---- | 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 ()-fileCreateAsync file flags ioPriority cancellable callback =-    withGObject (toFile file) $ \cFile ->-        maybeWith withGObject cancellable $ \cCancellable -> do-          cCallback <- marshalAsyncReadyCallback callback-          g_file_create_async cFile-                              (cFromFlags flags)-                              (fromIntegral ioPriority)-                              cCancellable-                              cCallback-                              (castFunPtrToPtr cCallback)-    where _ = {# call file_create_async #}---- | Finishes an asynchronous file create operation started with 'fileCreateAsync'.-fileCreateFinish :: FileClass file-                   => file-                   -> AsyncResult-                   -> IO FileOutputStream-fileCreateFinish file asyncResult =-    propagateGError ({# call file_create_finish #} (toFile file) asyncResult) >>= takeGObject---- | 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 ()-fileReplaceAsync file etag makeBackup flags ioPriority cancellable callback =-    withGObject (toFile file) $ \cFile ->-        withUTFString etag $ \cEtag ->-        maybeWith withGObject cancellable $ \cCancellable -> do-          cCallback <- marshalAsyncReadyCallback callback-          g_file_replace_async cFile-                               cEtag-                               (fromBool makeBackup)-                               (cFromFlags flags)-                               (fromIntegral ioPriority)-                               cCancellable-                               cCallback-                               (castFunPtrToPtr cCallback)-    where _ = {# call file_replace_async #}---- | Finishes an asynchronous file replace operation started with 'fileReplaceAsync'.-fileReplaceFinish :: FileClass file-                  => file-                  -> AsyncResult-                  -> IO FileOutputStream-fileReplaceFinish file asyncResult =-    propagateGError ({# call file_replace_finish #} (toFile file) asyncResult) >>= takeGObject---- | Gets the requested information about specified file. The result is a 'GFileInfo' 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 'GFileAttributeStandardName'.--- --- 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 'GIoErrorCancelled' 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 'GFileQueryInfoNofollowSymlinks' 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 'GIoErrorNotFound' 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-fileQueryInfo file attributes flags cancellable =-    withGObject (toFile file) $ \cFile ->-        withUTFString attributes $ \cAttributes ->-        maybeWith withGObject cancellable $ \cCancellable ->-        propagateGError (g_file_query_info cFile cAttributes (cFromFlags flags) cCancellable) >>=-        takeGObject-    where _ = {# call file_query_info #}---- | Asynchronously gets the requested information about specified file. The--- result is a 'GFileInfo' 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 ()-fileQueryInfoAsync file attributes flags ioPriority cancellable callback =-    withGObject (toFile file) $ \cFile ->-        withUTFString attributes $ \cAttributes ->-        maybeWith withGObject cancellable $ \cCancellable -> do-          cCallback <- marshalAsyncReadyCallback callback-          g_file_query_info_async cFile-                                  cAttributes-                                  (cFromFlags flags)-                                  (fromIntegral ioPriority)-                                  cCancellable-                                  cCallback-                                  (castFunPtrToPtr cCallback)-    where _ = {# call file_query_info_async #}---- | Finishes an asynchronous file info query. See 'fileQueryInfoAsync'.-fileQueryInfoFinish :: FileClass file-                    => file-                    -> AsyncResult-                    -> IO FileInfo-fileQueryInfoFinish file asyncResult =-    propagateGError ({#call file_query_info_finish #} (toFile file) asyncResult) >>= takeGObject---- | 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 GIoErrorExists 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-                -> IO Bool-fileQueryExists file cancellable =-    withGObject (toFile file) $ \cFile ->-        maybeWith withGObject cancellable $ \cCancellable ->-            liftM toBool $ g_file_query_exists cFile cCancellable-    where _ = {# call file_query_exists #}--#if GLIB_CHECK_VERSION(2,18,0)--- | Utility function to inspect the GFileType 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-                    -> IO FileType-fileQueryFileType file flags cancellable = -    liftM (toEnum . fromIntegral) $-    withGObject (toFile file) $ \cFile ->-        maybeWith withGObject cancellable $ \cCancellable ->-        (g_file_query_file_type cFile (cFromFlags flags) cCancellable)-    where _ = {# call file_query_file_type #}-#endif---- | 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 GFileAttributeFilesystemType--- (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 GIoErrorCancelled will be--- returned.--- --- If the file does not exist, the GIoErrorNotFound 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-fileQueryFilesystemInfo file attributes cancellable =-    withGObject (toFile file) $ \cFile ->-        withUTFString attributes $ \cAttributes ->-        maybeWith withGObject cancellable $ \cCancellable ->-        propagateGError (g_file_query_filesystem_info cFile cAttributes cCancellable) >>=-        takeGObject-    where _ = {# call file_query_filesystem_info #}---- | Asynchronously gets the requested information about the filesystem that the specified file is--- on. The result is a GFileInfo 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 ()-fileQueryFilesystemInfoAsync file attributes ioPriority cancellable callback =-    withGObject (toFile file) $ \cFile ->-        withUTFString attributes $ \cAttributes ->-        maybeWith withGObject cancellable $ \cCancellable -> do-          cCallback <- marshalAsyncReadyCallback callback-          g_file_query_filesystem_info_async cFile-                                             cAttributes-                                             (fromIntegral ioPriority)-                                             cCancellable-                                             cCallback-                                             (castFunPtrToPtr cCallback)-    where _ = {# call file_query_filesystem_info_async #}---- | Finishes an asynchronous filesystem info query. See 'fileQueryFilesystemInfoAsync'.-fileQueryFilesystemInfoFinish :: FileClass file-                              => file-                              -> AsyncResult-                              -> IO FileInfo-fileQueryFilesystemInfoFinish file asyncResult =-    propagateGError ({# call file_query_filesystem_info_finish #} (toFile file) asyncResult) >>=-        takeGObject---- | Returns the GAppInfo 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 GIoErrorCancelled will be--- returned.-fileQueryDefaultHandler :: FileClass file-                        => file-                        -> Maybe Cancellable-                        -> IO AppInfo-fileQueryDefaultHandler file cancellable =-    withGObject (toFile file) $ \cFile ->-        maybeWith withGObject cancellable $ \cCancellable ->-        propagateGError (g_file_query_default_handler cFile cCancellable) >>=-        takeGObject-    where _ = {# call file_query_default_handler #}---- | Gets a GMount for the GFile.--- --- If the GFileIface for file does not have a mount (e.g. possibly a remote share), error will be set--- to GIoErrorNotFound 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 GIoErrorCancelled will be--- returned.-fileFindEnclosingMount :: FileClass file-                       => file-                       -> Maybe Cancellable-                       -> IO Mount-fileFindEnclosingMount file cancellable =-    withGObject (toFile file) $ \cFile ->-        maybeWith withGObject cancellable $ \cCancellable ->-        propagateGError (g_file_find_enclosing_mount cFile cCancellable) >>=-        takeGObject-    where _ = {# call file_find_enclosing_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 ()-fileFindEnclosingMountAsync file ioPriority cancellable callback =-    withGObject (toFile file) $ \cFile ->-        maybeWith withGObject cancellable $ \cCancellable -> do-          cCallback <- marshalAsyncReadyCallback callback-          g_file_find_enclosing_mount_async cFile-                                            (fromIntegral ioPriority)-                                            cCancellable-                                            cCallback-                                            (castFunPtrToPtr cCallback)-    where _ = {# call file_find_enclosing_mount_async #}---- | Finishes an asynchronous find mount request. See 'fileFindEnclosingMountAsync'.-fileFindEnclosingMountFinish :: FileClass file-                             => file-                             -> AsyncResult-                             -> IO Mount-fileFindEnclosingMountFinish file asyncResult =-    propagateGError ({# call file_find_enclosing_mount_finish #} (toFile file) asyncResult) >>=-        takeGObject---- | Gets the requested information about the files in a directory. The result is a 'GFileEnumerator'--- object that will give out 'GFileInfo' 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 'GFileAttributeStandardName'.--- --- 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 'GIoErrorCancelled' will be--- returned.--- --- If the file does not exist, the 'GIoErrorNotFound' error will be returned. If the file is not a--- directory, the 'GFileErrorNotdir' error will be returned. Other errors are possible too.-fileEnumerateChildren :: FileClass file-                      => file-                      -> String-                      -> [FileQueryInfoFlags]-                      -> Maybe Cancellable-                      -> IO FileEnumerator-fileEnumerateChildren file attributes flags cancellable =-    withGObject (toFile file) $ \cFile ->-        withUTFString attributes $ \cAttributes ->-        maybeWith withGObject cancellable $ \cCancellable ->-        propagateGError (g_file_enumerate_children cFile cAttributes (cFromFlags flags) cCancellable) >>=-        takeGObject-    where _ = {# call file_enumerate_children #}---- | Asynchronously gets the requested information about the files in a directory. The result is a--- GFileEnumerator object that will give out GFileInfo 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 ()-fileEnumerateChildrenAsync file attributes flags ioPriority cancellable callback =-    withGObject (toFile file) $ \cFile ->-        withUTFString attributes $ \cAttributes ->-        maybeWith withGObject cancellable $ \cCancellable -> do-          cCallback <- marshalAsyncReadyCallback callback-          g_file_enumerate_children_async cFile-                                          cAttributes-                                          (cFromFlags flags)-                                          (fromIntegral ioPriority)-                                          cCancellable-                                          cCallback-                                          (castFunPtrToPtr cCallback)-    where _ = {# call file_enumerate_children_async #}---- | Finishes an async enumerate children operation. See 'fileEnumerateChildrenAsync'.-fileEnumerateChildrenFinish :: FileClass file-                             => file-                             -> AsyncResult-                             -> IO FileEnumerator-fileEnumerateChildrenFinish file asyncResult =-    propagateGError ({# call file_enumerate_children_finish #} (toFile file) asyncResult) >>=-        takeGObject---- | 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--- (GFileAttributeStandardEditName) 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 GIoErrorCancelled will be--- returned.-fileSetDisplayName :: FileClass file-                   => file-                   -> String-                   -> Maybe Cancellable-                   -> IO File-fileSetDisplayName file displayName cancellable =-    withGObject (toFile file) $ \cFile ->-        withUTFString displayName $ \cDisplayName ->-        maybeWith withGObject cancellable $ \cCancellable ->-        propagateGError (g_file_set_display_name cFile cDisplayName cCancellable) >>=-        takeGObject-    where _ = {# call file_set_display_name #}---- | Asynchronously sets the display name for a given GFile.--- --- 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 ()-fileSetDisplayNameAsync file displayName ioPriority cancellable callback =-    withGObject (toFile file) $ \cFile ->-        withUTFString displayName $ \cDisplayName ->-        maybeWith withGObject cancellable $ \cCancellable -> do-          cCallback <- marshalAsyncReadyCallback callback-          g_file_set_display_name_async cFile-                                        cDisplayName-                                        (fromIntegral ioPriority)-                                        cCancellable-                                        cCallback-                                        (castFunPtrToPtr cCallback)-    where _ = {# call file_set_display_name_async #}---- | Finishes setting a display name started with 'fileSetDisplayNameAsync'.-fileSetDisplayNameFinish :: FileClass file-                         => file-                         -> AsyncResult-                         -> IO File-fileSetDisplayNameFinish file asyncResult =-    propagateGError ({# call file_set_display_name_finish #} (toFile file) asyncResult) >>=-        takeGObject---- | 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 GIoErrorCancelled will be--- returned.-fileDelete :: FileClass file-           => file-           -> Maybe Cancellable-           -> IO ()-fileDelete file cancellable =-    withGObject (toFile file) $ \cFile ->-        maybeWith withGObject cancellable $ \cCancellable ->-        propagateGError (g_file_delete cFile cCancellable) >> return ()-    where _ = {# call file_delete #}---- | 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--- GIoErrorNotSupported 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 GIoErrorCancelled will be--- returned.-fileTrash :: FileClass file-           => file-           -> Maybe Cancellable-           -> IO ()-fileTrash file cancellable =-    withGObject (toFile file) $ \cFile ->-        maybeWith withGObject cancellable $ \cCancellable ->-        propagateGError (g_file_trash cFile cCancellable) >> return ()-    where _ = {# call file_trash #}---- | Copies the file source to the location specified by destination. Can not handle recursive copies of--- directories.--- --- If the flag GFileCopyOverwrite is specified an already existing destination file is overwritten.--- --- If the flag GFileCopyNofollowSymlinks 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 GIoErrorCancelled will be--- returned.--- --- If @progressCallback@ is not 'Nothing', then the operation can be monitored by setting this to a--- GFileProgressCallback 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 GIoErrorNotFound error is returned, independent on--- the status of the destination.--- --- If GFileCopyOverwrite is not specified and the target exists, then the error GIoErrorExists is--- returned.--- --- If trying to overwrite a file over a directory the GIoErrorIsDirectory error is returned. If--- trying to overwrite a directory with a directory the GIoErrorWouldMerge error is returned.--- --- If the source is a directory and the target does not exist, or GFileCopyOverwrite is specified--- and the target is a file, then the GIoErrorWouldRecurse error is returned.--- --- If you are interested in copying the GFile object itself (not the on-disk file), see 'fileDup'.-fileCopy :: (FileClass source, FileClass destination)-         => source-         -> destination-         -> [FileCopyFlags]-         -> Maybe Cancellable-         -> Maybe FileProgressCallback-         -> IO Bool-fileCopy source destination flags cancellable progressCallback =-    withGObject (toFile source) $ \cSource ->-        withGObject (toFile destination) $ \cDestination ->-        maybeWith withGObject cancellable $ \cCancellable -> do-          cProgressCallback <- maybe (return nullFunPtr) marshalFileProgressCallback progressCallback-          propagateGError $ \cError -> do-            ret <- g_file_copy cSource-                               cDestination-                               (cFromFlags flags)-                               cCancellable-                               cProgressCallback-                               nullPtr-                               cError-            when (cProgressCallback /= nullFunPtr) $-              freeHaskellFunPtr cProgressCallback-            return $ toBool ret-    where _ = {# call file_copy #}---- | 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 ()-fileCopyAsync source destination flags ioPriority cancellable progressCallback callback =-    withGObject (toFile source) $ \cSource ->-        withGObject (toFile destination) $ \cDestination ->-        maybeWith withGObject cancellable $ \cCancellable -> do-          cProgressCallback <- maybe (return nullFunPtr) marshalFileProgressCallback progressCallback-          cCallback <- marshalAsyncReadyCallback $ \sourceObject res -> do-                         when (cProgressCallback /= nullFunPtr) $-                           freeHaskellFunPtr cProgressCallback-                         callback sourceObject res-          g_file_copy_async cSource-                            cDestination-                            (cFromFlags flags)-                            (fromIntegral ioPriority)-                            cCancellable-                            cProgressCallback-                            nullPtr-                            cCallback-                            (castFunPtrToPtr cCallback)-    where _ = {# call file_copy_async #}---- | Finishes copying the file started with 'fileCopyAsync'.-fileCopyFinish :: FileClass file-               => file-               -> AsyncResult-               -> IO Bool-fileCopyFinish file asyncResult =-    liftM toBool $ propagateGError ({# call file_copy_finish #} (toFile file) asyncResult)---- | 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 GFileCopyOverwrite is specified an already existing destination file is overwritten.--- --- If the flag GFileCopyNofollowSymlinks 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 GIoErrorCancelled will be--- returned.--- --- If @progressCallback@ is not 'Nothing', then the operation can be monitored by setting this to a--- GFileProgressCallback 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 GIoErrorNotFound error is returned, independent on--- the status of the destination.--- --- If GFileCopyOverwrite is not specified and the target exists, then the error GIoErrorExists is--- returned.--- --- If trying to overwrite a file over a directory the GIoErrorIsDirectory error is returned. If--- trying to overwrite a directory with a directory the GIoErrorWouldMerge error is returned.--- --- If the source is a directory and the target does not exist, or GFileCopyOverwrite is specified--- and the target is a file, then the GIoErrorWouldRecurse 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 Bool-fileMove source destination flags cancellable progressCallback =-    withGObject (toFile source) $ \cSource ->-        withGObject (toFile destination) $ \cDestination ->-        maybeWith withGObject cancellable $ \cCancellable -> do-          cProgressCallback <- maybe (return nullFunPtr) marshalFileProgressCallback progressCallback-          propagateGError $ \cError -> do-            ret <- g_file_move cSource-                               cDestination-                               (cFromFlags flags)-                               cCancellable-                               cProgressCallback-                               nullPtr-                               cError-            when (cProgressCallback /= nullFunPtr) $-              freeHaskellFunPtr cProgressCallback-            return $ toBool ret-    where _ = {# call file_move #}---- | 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 GFile. To recursively create directories, see--- 'fileMakeDirectoryWithParents'. This function will fail if the parent directory does not--- exist, setting error to GIoErrorNotFound. If the file system doesn't support creating--- directories, this function will fail, setting error to GIoErrorNotSupported.--- --- For a local GFile 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 GIoErrorCancelled will be--- returned.-fileMakeDirectory :: FileClass file-                  => file-                  -> Maybe Cancellable-                  -> IO ()-fileMakeDirectory file cancellable =-    withGObject (toFile file) $ \cFile ->-        maybeWith withGObject cancellable $ \cCancellable -> do-          propagateGError $ g_file_make_directory cFile cCancellable-          return ()-    where _ = {# call file_make_directory #}--#if GLIB_CHECK_VERSION(2,18,0)--- | 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--- GIoErrorNotSupported.--- --- For a local GFile 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 GIoErrorCancelled will be--- returned.-fileMakeDirectoryWithParents :: FileClass file-                             => file-                             -> Maybe Cancellable-                             -> IO ()-fileMakeDirectoryWithParents file cancellable =-    withGObject (toFile file) $ \cFile ->-        maybeWith withGObject cancellable $ \cCancellable -> do-          propagateGError $ g_file_make_directory_with_parents cFile cCancellable-          return ()-    where _ = {# call file_make_directory_with_parents #}-#endif---- | 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 GIoErrorCancelled will be--- returned.-fileMakeSymbolicLink :: FileClass file-                     => file-                     -> String-                     -> Maybe Cancellable-                     -> IO ()-fileMakeSymbolicLink file symlinkValue cancellable =-    withGObject (toFile file) $ \cFile ->-        withUTFString symlinkValue $ \cSymlinkValue ->-        maybeWith withGObject cancellable $ \cCancellable -> do-          propagateGError $ g_file_make_symbolic_link cFile cSymlinkValue cCancellable-          return ()-    where _ = {# call file_make_symbolic_link #}--{# pointer *FileAttributeInfoList newtype #}-takeFileAttributeInfoList :: Ptr FileAttributeInfoList-                          -> IO [FileAttributeInfo]-takeFileAttributeInfoList ptr =-    do cInfos <- liftM castPtr $ {# get FileAttributeInfoList->infos #} ptr-       cNInfos <- {# get FileAttributeInfoList->n_infos #} ptr-       infos <- peekArray (fromIntegral cNInfos) cInfos-       g_file_attribute_info_list_unref ptr-       return infos-    where _ = {# call file_attribute_info_list_unref #}---- | 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 GIoErrorCancelled will be--- returned.-fileQuerySettableAttributes :: FileClass file-                            => file-                            -> Maybe Cancellable-                            -> IO [FileAttributeInfo]-fileQuerySettableAttributes file cancellable =-    withGObject (toFile file) $ \cFile ->-        maybeWith withGObject cancellable $ \cCancellable -> do-          ptr <- propagateGError $ g_file_query_settable_attributes cFile cCancellable-          infos <- takeFileAttributeInfoList ptr-          return infos-    where _ = {# call file_query_settable_attributes #}---- | 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 GIoErrorCancelled will be--- returned.-fileQueryWritableNamespaces :: FileClass file-                            => file-                            -> Maybe Cancellable-                            -> IO [FileAttributeInfo]-fileQueryWritableNamespaces file cancellable =-    withGObject (toFile file) $ \cFile ->-        maybeWith withGObject cancellable $ \cCancellable -> do-          ptr <- propagateGError $ g_file_query_writable_namespaces cFile cCancellable-          infos <- takeFileAttributeInfoList ptr-          return infos-    where _ = {# call file_query_writable_namespaces #}-+-- | 'File' is a high level abstraction for manipulating files on a virtual file system. 'File's are+-- lightweight, immutable objects that do no I/O upon creation. It is necessary to understand that+-- 'File' objects do not represent files, merely an identifier for a file. All file content I/O is+-- implemented as streaming operations (see GInputStream and GOutputStream).+-- +-- To construct a 'File', you can use: 'fileFromPath' if+-- you have a URI.  'fileNewForCommandlineArg'+-- from a utf8 string gotten from 'fileGetParseName'.+-- +-- One way to think of a 'File' is as an abstraction of a pathname. For normal files the system pathname+-- is what is stored internally, but as 'File's are extensible it could also be something else that+-- corresponds to a pathname in a userspace implementation of a filesystem.+-- +-- 'File's make up hierarchies of directories and files that correspond to the files on a+-- filesystem. You can move through the file system with 'File' using 'fileGetParent' to get an+-- identifier for the parent directory, 'fileGetChild' to get a child within a directory,+-- 'fileResolveRelativePath' to resolve a relative path between two 'File's. There can be multiple+-- hierarchies, so you may not end up at the same root if you repeatedly call 'fileGetParent' on+-- two different files.+-- +-- All 'File's have a basename (get with 'fileGetBasename'. These names are byte strings that are+-- used to identify the file on the filesystem (relative to its parent directory) and there is no+-- guarantees that they have any particular charset encoding or even make any sense at all. 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 is guaranteed to+-- be in utf8 and can be used in a user interface. But always store the real basename or the 'File' to+-- use to actually access the file, because there is no way to go from a display name to the actual+-- name.+-- +-- Using 'File' as an identifier has the same weaknesses as using a path in that there may be multiple+-- aliases for the same file. For instance, hard or soft links may cause two different 'File's to refer+-- to the same file. Other possible causes for aliases are: case insensitive filesystems, short and+-- long names on Fat/NTFS, or bind mounts in Linux. If you want to check if two 'File's point to the+-- same file you can query for the 'FileAttributeIdFile' attribute. Note that 'File' does some+-- trivial canonicalization of pathnames passed in, so that trivial differences in the path string used+-- at creation (duplicated slashes, slash at end of path, "." or ".." path segments, etc) does not+-- create different 'File's.+-- +-- Many 'File' operations have both synchronous and asynchronous versions to suit your+-- application. Asynchronous versions of synchronous functions simply have _async() appended to their+-- function names. The asynchronous I/O functions call a 'AsyncReadyCallback' which is then used to+-- finalize the operation, producing a 'AsyncResult' which is then passed to the function's matching+-- _finish() operation.+-- +-- Some 'File' operations do not have synchronous analogs, as they may take a very long time to finish,+-- and blocking may leave an application unusable. Notable cases include: 'fileMountMountable' to+-- mount a mountable file.  'fileUnmountMountableWithOperation' to unmount a mountable+-- file. 'fileEjectMountableWithOperation' to eject a mountable file.+-- +-- One notable feature of 'File's are entity tags, or "etags" for short. Entity tags are somewhat like a+-- more abstract version of the traditional mtime, and can be used to quickly determine if the file has+-- been modified from the version on the file system. See the HTTP 1.1 specification for HTTP Etag+-- headers, which are a very similar concept.++-- * Types.+    File(..),+    FileClass,+    FileProgressCallback,+    FileReadMoreCallback,+    Offset,+    FileInputStream,+    FileInputStreamClass,+    FileOutputStream,+    FileOutputStreamClass,+    InputStream,+    InputStreamClass,+    OutputStream,+    OutputStreamClass,+    BufferedInputStream,+    BufferedInputStreamClass,+    BufferedOutputStream,+    BufferedOutputStreamClass,+    MemoryInputStream,+    MemoryInputStreamClass,+    MemoryOutputStream,+    MemoryOutputStreamClass,+    FilterInputStream,+    FilterInputStreamClass,+    FilterOutputStream,+    FilterOutputStreamClass,+    DataInputStream,+    DataInputStreamClass,+    DataOutputStream,+    DataOutputStreamClass,++-- * Enums+    FileType (..),+    FileCopyFlags (..),+    FileQueryInfoFlags (..),+    FileCreateFlags (..),+    FileMonitorFlags (..),+    MountMountFlags (..),+    MountUnmountFlags (..),++-- * Methods+    fileFromPath,+    fileFromURI,+    fileFromCommandlineArg,+    fileFromParseName,+    fileEqual,+    fileBasename,+    filePath,+#if GLIB_CHECK_VERSION(2,24,0)+    fileHasParent,+#endif+    fileURI,+    fileParseName,+    fileGetChild,+    fileGetChildForDisplayName,+    fileHasPrefix,+    fileGetRelativePath,+    fileResolveRelativePath,+    fileIsNative,+    fileHasURIScheme,+    fileURIScheme,+    fileRead,+    fileReadAsync,+    fileReadFinish,+    fileAppendTo,+    fileCreate,+    fileReplace,+    fileAppendToAsync,+    fileAppendToFinish,+    fileCreateAsync,+    fileCreateFinish,+    fileReplaceAsync,+    fileReplaceFinish,+    fileQueryInfo,+    fileQueryInfoAsync,+    fileQueryInfoFinish,+    fileQueryExists,+#if GLIB_CHECK_VERSION(2,18,0)+    fileQueryFileType,+#endif+    fileQueryFilesystemInfo,+    fileQueryFilesystemInfoAsync,+    fileQueryFilesystemInfoFinish,+    fileQueryDefaultHandler,+    fileFindEnclosingMount,+    fileFindEnclosingMountAsync,+    fileFindEnclosingMountFinish,+    fileEnumerateChildren,+    fileEnumerateChildrenAsync,+    fileEnumerateChildrenFinish,+    fileSetDisplayName,+    fileSetDisplayNameAsync,+    fileSetDisplayNameFinish,+    fileDelete,+    fileTrash,+    fileCopy,+    fileCopyAsync,+    fileCopyFinish,+    fileMove,+    fileMakeDirectory,+#if GLIB_CHECK_VERSION(2,18,0)+    fileMakeDirectoryWithParents,+#endif+    fileMakeSymbolicLink,+    fileQuerySettableAttributes,+    fileQueryWritableNamespaces,++    fileSetAttributesFromInfo,+    fileSetAttributesFromInfoAsync,+    fileSetAttributesFinish,+    fileSetAttributeString,+    fileSetAttributeByteString,+    fileSetAttributeWord32,+    fileSetAttributeInt32,+    fileSetAttributeWord64,+    fileSetAttributeInt64,+    fileCopyAttributes,++    fileMonitorDirectory,+    fileMonitorFile,+#if GLIB_CHECK_VERSION(2,18,0)+    fileMonitor,+#endif++    fileMountMountable,+    fileMountMountableFinish,+#if GLIB_CHECK_VERSION(2,22,0)+    fileUnmountMountableWithOperation,+    fileUnmountMountableWithOperationFinish,+    fileEjectMountableWithOperation,+    fileEjectMountableWithOperationFinish,+    fileStartMountable,+    fileStartMountableFinish,+    fileStopMountable,+    fileStopMountableFinish,+    filePollMountable,+    filePollMountableFinish,+    fileMountEnclosingVolume,+    fileMountEnclosingVolumeFinish,+    fileSupportsThreadContexts,+#endif+) where++import Control.Monad+import Data.Typeable+import Data.Maybe (fromMaybe)+import Data.ByteString (ByteString)+import Data.ByteString (useAsCString)+import Data.ByteString.Unsafe (unsafePackCStringFinalizer)+import System.GIO.Enums+import System.GIO.File.FileAttribute+import System.Glib.FFI+import System.Glib.Flags+import System.Glib.GError+import System.Glib.GObject+import System.Glib.UTFString+{#import System.GIO.Async.AsyncResult#}+{#import System.GIO.Types#}++import qualified Data.ByteString as BS++{# context lib = "gio" prefix = "g" #}++type Offset = {# type goffset #}++{#pointer GFileProgressCallback #}++type FileProgressCallback = Offset -> Offset -> IO ()++foreign import ccall "wrapper" mkFileProgressCallback ::+     ({#type goffset #} -> {#type goffset #} -> Ptr () -> IO ()) -> IO GFileProgressCallback++marshalFileProgressCallback :: FileProgressCallback -> IO GFileProgressCallback+marshalFileProgressCallback fileProgressCallback =+    mkFileProgressCallback $ \ cCurrentNumBytes cTotalNumBytes _ -> do+      fileProgressCallback +        (fromIntegral cCurrentNumBytes)+        (fromIntegral cTotalNumBytes)++type FileReadMoreCallback = BS.ByteString -> IO Bool++-- | 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+fileFromPath path =+    unsafePerformIO $ wrapNewGObject mkFile $ +    useAsCString path $ \cPath -> {# call file_new_for_path #} cPath++-- | 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+fileFromURI uri =+    unsafePerformIO $ wrapNewGObject mkFile $ +    withUTFString uri $ \cURI -> {# call file_new_for_uri #} cURI ++-- | 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+fileFromCommandlineArg arg =+    unsafePerformIO $ wrapNewGObject mkFile $ +    useAsCString arg $ \cArg -> {# call file_new_for_commandline_arg #} cArg ++-- | 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+fileFromParseName parseName =+    unsafePerformIO $ wrapNewGObject mkFile $ +    withUTFString parseName $ \cParseName -> {# call file_parse_name #} cParseName ++-- | 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+fileEqual file1 file2 =+    unsafePerformIO $ liftM toBool $ {# call file_equal #} (toFile file1) (toFile file2)++instance Eq File where+    (==) = fileEqual++-- | 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://host/) it+-- 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+fileBasename file =+    unsafePerformIO $ do+    sPtr <- {# call file_get_basename #} +               (toFile file)+    sLen <- lengthArray0 0 sPtr+    unsafePackCStringFinalizer (castPtr sPtr) (fromIntegral sLen)+        ({#call unsafe g_free#} (castPtr sPtr))++-- | Gets the local pathname for 'File', if one exists.+-- +-- This call does no blocking i/o.+filePath :: FileClass file => file -> ByteString+filePath file =+    unsafePerformIO $ do+    sPtr <- {# call file_get_path #} +                (toFile file)+    sLen <- lengthArray0 0 sPtr+    unsafePackCStringFinalizer (castPtr sPtr) (fromIntegral sLen)+        ({#call unsafe g_free#} (castPtr sPtr))++-- | Gets the URI for the file.+-- +-- This call does no blocking i/o.+fileURI :: FileClass file => file -> String+fileURI file =+    unsafePerformIO $ {# call file_get_uri #} (toFile file) >>= readUTFString++-- | 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+fileParseName file =+    unsafePerformIO $ {# call file_get_parse_name #} (toFile file) >>= readUTFString++-- | Gets the parent directory for the file. If the file represents the root directory of the file+-- system, then 'Nothing' will be returned.+-- +-- This call does no blocking i/o.+fileParent :: FileClass file => file -> Maybe File+fileParent file =+    unsafePerformIO $ maybeNull (wrapNewGObject mkFile) $ +    {# call file_get_parent #} (toFile file) ++#if GLIB_CHECK_VERSION(2,24,0)+-- | 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 +fileHasParent file parent = +    unsafePerformIO $ liftM toBool $+    {#call g_file_has_parent#} +    (toFile file)+    (fromMaybe (File nullForeignPtr) parent)+#endif++-- | 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+fileGetChild file name =+    unsafePerformIO $ wrapNewGObject mkFile $+        useAsCString name $ \cName ->+        {# call file_get_child #} (toFile file) cName++-- | 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+fileGetChildForDisplayName file displayName =+    unsafePerformIO $ (wrapNewGObject mkFile) $+        withUTFString displayName $ \cDisplayName ->+        propagateGError ({# call file_get_child_for_display_name #} (toFile file) cDisplayName)++-- | 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 / foo/bar.+-- +-- 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+fileHasPrefix file1 file2 =+    unsafePerformIO $+        liftM toBool $ {# call file_has_prefix #} (toFile file1) (toFile file2)++-- | Gets the path for descendant relative to parent.+-- +-- This call does no blocking i/o.+fileGetRelativePath :: (FileClass file1, FileClass file2) => file1 -> file2 -> Maybe ByteString+fileGetRelativePath file1 file2 =+    unsafePerformIO $ do+    sPtr <- {# call file_get_relative_path #} (toFile file1) (toFile file2)+    if sPtr == nullPtr+       then return Nothing+       else do+         sLen <- lengthArray0 0 sPtr+         liftM Just $ unsafePackCStringFinalizer (castPtr sPtr) (fromIntegral sLen)+                          ({#call unsafe g_free#} (castPtr sPtr))++-- | Resolves a relative path for file to an absolute path.+-- +-- This call does no blocking i/o.+fileResolveRelativePath :: FileClass file => file -> ByteString -> Maybe File+fileResolveRelativePath file relativePath =+    unsafePerformIO $ maybeNull (wrapNewGObject mkFile) $+        useAsCString relativePath $ \cRelativePath ->+        {# call file_resolve_relative_path #} (toFile file) cRelativePath++-- | 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+-- \"/usr/bin/\". 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+fileIsNative =+    unsafePerformIO .+        liftM toBool . {# call file_is_native #} . toFile++-- | Checks to see if a 'File' has a given URI scheme.+-- +-- This call does no blocking i/o.+fileHasURIScheme :: FileClass file => file -> String -> Bool+fileHasURIScheme file uriScheme =+    unsafePerformIO $+        withUTFString uriScheme $ \cURIScheme ->+        liftM toBool $ {# call file_has_uri_scheme #} (toFile file) cURIScheme++-- | 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+fileURIScheme file =+    unsafePerformIO $ {# call file_get_uri_scheme #} (toFile file) >>= readUTFString++-- | 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+fileRead file cancellable =+    wrapNewGObject mkFileInputStream $+            propagateGError ({#call g_file_read#} +                              (toFile file)+                              (fromMaybe (Cancellable nullForeignPtr) cancellable)) ++-- | 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 ()+fileReadAsync file ioPriority mbCancellable callback = do+  cCallback <- marshalAsyncReadyCallback callback+  {#call g_file_read_async#} +     (toFile file)+     (fromIntegral ioPriority)+     (fromMaybe (Cancellable nullForeignPtr) mbCancellable) +     cCallback+     (castFunPtrToPtr cCallback)++-- | Finishes an asynchronous file read operation started with 'fileReadAsync'.+fileReadFinish :: FileClass file+               => file+               -> AsyncResult+               -> IO FileInputStream+fileReadFinish file asyncResult =+    wrapNewGObject mkFileInputStream $+    propagateGError ({# call file_read_finish #} (toFile file) asyncResult)++-- | 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+fileAppendTo file flags cancellable =+    wrapNewGObject mkFileOutputStream $+        propagateGError ({#call g_file_append_to #} +                           (toFile file) +                           ((fromIntegral . fromFlags) flags) +                           (fromMaybe (Cancellable nullForeignPtr) cancellable) +                        )++-- | 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+fileCreate file flags cancellable =+    wrapNewGObject mkFileOutputStream $+        propagateGError ({#call g_file_create #} +                          (toFile file) +                         ((fromIntegral . fromFlags) flags) +                         (fromMaybe (Cancellable nullForeignPtr) cancellable) +                        )++-- | 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+fileReplace file etag makeBackup flags cancellable =+    wrapNewGObject mkFileOutputStream $+        maybeWith withUTFString etag $ \cEtag ->+        propagateGError ({#call g_file_replace#} +                           (toFile file)+                           cEtag+                           (fromBool makeBackup)+                           ((fromIntegral . fromFlags) flags) +                           (fromMaybe (Cancellable nullForeignPtr) cancellable))++-- | 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 ()+fileAppendToAsync file flags ioPriority cancellable callback = do+          cCallback <- marshalAsyncReadyCallback callback+          {#call g_file_append_to_async#} +            (toFile file)+            ((fromIntegral . fromFlags) flags)+            (fromIntegral ioPriority)+            (fromMaybe (Cancellable nullForeignPtr) cancellable) +            cCallback+            (castFunPtrToPtr cCallback)++-- | Finishes an asynchronous file append operation started with 'fileAppendToAsync'.+fileAppendToFinish :: FileClass file+                   => file+                   -> AsyncResult+                   -> IO FileOutputStream+fileAppendToFinish file asyncResult =+    wrapNewGObject mkFileOutputStream $+    propagateGError ({# call file_append_to_finish #} (toFile file) asyncResult)++-- | 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 ()+fileCreateAsync file flags ioPriority cancellable callback = do+          cCallback <- marshalAsyncReadyCallback callback+          {#call g_file_create_async #} +            (toFile file)+            ((fromIntegral . fromFlags) flags)+            (fromIntegral ioPriority)+            (fromMaybe (Cancellable nullForeignPtr) cancellable) +            cCallback+            (castFunPtrToPtr cCallback)++-- | Finishes an asynchronous file create operation started with 'fileCreateAsync'.+fileCreateFinish :: FileClass file+                   => file+                   -> AsyncResult+                   -> IO FileOutputStream+fileCreateFinish file asyncResult =+    wrapNewGObject mkFileOutputStream $+    propagateGError ({# call file_create_finish #} (toFile file) asyncResult)++-- | 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 ()+fileReplaceAsync file etag makeBackup flags ioPriority cancellable callback =+        withUTFString etag $ \cEtag -> do+          cCallback <- marshalAsyncReadyCallback callback+          {#call g_file_replace_async #} +            (toFile file)+            cEtag+            (fromBool makeBackup)+            ((fromIntegral . fromFlags) flags)+            (fromIntegral ioPriority)+            (fromMaybe (Cancellable nullForeignPtr) cancellable) +            cCallback+            (castFunPtrToPtr cCallback)++-- | Finishes an asynchronous file replace operation started with 'fileReplaceAsync'.+fileReplaceFinish :: FileClass file+                  => file+                  -> AsyncResult+                  -> IO FileOutputStream+fileReplaceFinish file asyncResult =+    wrapNewGObject mkFileOutputStream $+    propagateGError ({# call file_replace_finish #} (toFile file) asyncResult)++-- | 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+fileQueryInfo file attributes flags cancellable =+    makeNewGObject mkFileInfo $+        withUTFString attributes $ \cAttributes ->+        propagateGError ({#call g_file_query_info #} +                           (toFile file) +                           cAttributes +                           ((fromIntegral . fromFlags) flags) +                           (fromMaybe (Cancellable nullForeignPtr) cancellable) +                        )++-- | 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 ()+fileQueryInfoAsync file attributes flags ioPriority cancellable callback =+        withUTFString attributes $ \cAttributes -> do+          cCallback <- marshalAsyncReadyCallback callback+          {#call g_file_query_info_async #} +            (toFile file)+            cAttributes+            ((fromIntegral . fromFlags) flags)+            (fromIntegral ioPriority)+            (fromMaybe (Cancellable nullForeignPtr) cancellable) +            cCallback+            (castFunPtrToPtr cCallback)++-- | Finishes an asynchronous file info query. See 'fileQueryInfoAsync'.+fileQueryInfoFinish :: FileClass file+                    => file+                    -> AsyncResult+                    -> IO FileInfo+fileQueryInfoFinish file asyncResult =+    makeNewGObject mkFileInfo $+    propagateGError ({#call file_query_info_finish #} (toFile file) asyncResult)++-- | 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+fileQueryExists file cancellable =+    unsafePerformIO $+    liftM toBool $ +              {#call g_file_query_exists #} +                (toFile file) +                (fromMaybe (Cancellable nullForeignPtr) cancellable) ++#if GLIB_CHECK_VERSION(2,18,0)+-- | 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+fileQueryFileType file flags cancellable = +    (toEnum . fromIntegral) $+    unsafePerformIO $ +        ({#call g_file_query_file_type #} +           (toFile file) +           ((fromIntegral . fromFlags) flags) +           (fromMaybe (Cancellable nullForeignPtr) cancellable) )++#endif++-- | 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+fileQueryFilesystemInfo file attributes cancellable =+    makeNewGObject mkFileInfo $+        withUTFString attributes $ \cAttributes ->+        propagateGError ({#call g_file_query_filesystem_info #} +                           (toFile file) +                           cAttributes +                           (fromMaybe (Cancellable nullForeignPtr) cancellable) )++-- | 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 ()+fileQueryFilesystemInfoAsync file attributes ioPriority cancellable callback =+        withUTFString attributes $ \cAttributes -> do+          cCallback <- marshalAsyncReadyCallback callback+          {#call g_file_query_filesystem_info_async #} +            (toFile file)+            cAttributes+            (fromIntegral ioPriority)+            (fromMaybe (Cancellable nullForeignPtr) cancellable) +            cCallback+            (castFunPtrToPtr cCallback)++-- | Finishes an asynchronous filesystem info query. See 'fileQueryFilesystemInfoAsync'.+fileQueryFilesystemInfoFinish :: FileClass file+                              => file+                              -> AsyncResult+                              -> IO FileInfo+fileQueryFilesystemInfoFinish file asyncResult =+    makeNewGObject mkFileInfo $+    propagateGError ({# call file_query_filesystem_info_finish #} (toFile file) asyncResult)++-- | 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+fileQueryDefaultHandler file cancellable =+    wrapNewGObject mkAppInfo $+        propagateGError ({#call g_file_query_default_handler #} +                           (toFile file)+                           (fromMaybe (Cancellable nullForeignPtr) cancellable) )++-- | 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+fileFindEnclosingMount file cancellable =+    wrapNewGObject mkMount $+        propagateGError ({#call g_file_find_enclosing_mount #} +                           (toFile file)+                           (fromMaybe (Cancellable nullForeignPtr) cancellable) +                        )++-- | 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 ()+fileFindEnclosingMountAsync file ioPriority cancellable callback = do+          cCallback <- marshalAsyncReadyCallback callback+          {#call g_file_find_enclosing_mount_async #} +            (toFile file)+            (fromIntegral ioPriority)+            (fromMaybe (Cancellable nullForeignPtr) cancellable) +            cCallback+            (castFunPtrToPtr cCallback)++-- | Finishes an asynchronous find mount request. See 'fileFindEnclosingMountAsync'.+fileFindEnclosingMountFinish :: FileClass file+                             => file+                             -> AsyncResult+                             -> IO Mount+fileFindEnclosingMountFinish file asyncResult =+    wrapNewGObject mkMount $+    propagateGError ({# call file_find_enclosing_mount_finish #} (toFile file) asyncResult)++-- | 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+fileEnumerateChildren file attributes flags cancellable =+    wrapNewGObject mkFileEnumerator $+        withCString attributes $ \cAttributes ->+        propagateGError ({#call g_file_enumerate_children #} +                           (toFile file) +                           cAttributes +                           ((fromIntegral . fromFlags) flags) +                           (fromMaybe (Cancellable nullForeignPtr) cancellable) +                        )++-- | 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 ()+fileEnumerateChildrenAsync file attributes flags ioPriority cancellable callback =+        withUTFString attributes $ \cAttributes -> do+          cCallback <- marshalAsyncReadyCallback callback+          {#call g_file_enumerate_children_async #} +            (toFile file)+            cAttributes+            ((fromIntegral . fromFlags) flags)+            (fromIntegral ioPriority)+            (fromMaybe (Cancellable nullForeignPtr) cancellable) +            cCallback+            (castFunPtrToPtr cCallback)++-- | Finishes an async enumerate children operation. See 'fileEnumerateChildrenAsync'.+fileEnumerateChildrenFinish :: FileClass file+                             => file+                             -> AsyncResult+                             -> IO FileEnumerator+fileEnumerateChildrenFinish file asyncResult =+    wrapNewGObject mkFileEnumerator $+    propagateGError ({# call file_enumerate_children_finish #} (toFile file) asyncResult)++-- | 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+fileSetDisplayName file displayName cancellable =+    wrapNewGObject mkFile $+        withUTFString displayName $ \cDisplayName ->+        propagateGError ({#call g_file_set_display_name #} +                           (toFile file) +                           cDisplayName +                           (fromMaybe (Cancellable nullForeignPtr) cancellable) )++-- | 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 ()+fileSetDisplayNameAsync file displayName ioPriority cancellable callback =+        withUTFString displayName $ \cDisplayName -> do+          cCallback <- marshalAsyncReadyCallback callback+          {#call g_file_set_display_name_async #} +             (toFile file)+             cDisplayName+             (fromIntegral ioPriority)+             (fromMaybe (Cancellable nullForeignPtr) cancellable) +             cCallback+             (castFunPtrToPtr cCallback)++-- | Finishes setting a display name started with 'fileSetDisplayNameAsync'.+fileSetDisplayNameFinish :: FileClass file+                         => file+                         -> AsyncResult+                         -> IO File+fileSetDisplayNameFinish file asyncResult =+    wrapNewGObject mkFile $+    propagateGError ({# call file_set_display_name_finish #} (toFile file) asyncResult)++-- | 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 ()+fileDelete file cancellable =+        propagateGError ({#call g_file_delete #}+                           (toFile file)+                           (fromMaybe (Cancellable nullForeignPtr) cancellable) +                        ) >> return ()++-- | 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 ()+fileTrash file cancellable =+        propagateGError ({#call g_file_trash #}+                           (toFile file)+                           (fromMaybe (Cancellable nullForeignPtr) cancellable) +                        ) >> return ()++-- | 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 ()+fileCopy source destination flags cancellable progressCallback = do+          cProgressCallback <- maybe (return nullFunPtr) marshalFileProgressCallback progressCallback+          propagateGError $ \cError -> do+            {#call g_file_copy #} +                      (toFile source)+                      (toFile destination)+                      ((fromIntegral . fromFlags) flags)+                      (fromMaybe (Cancellable nullForeignPtr) cancellable) +                      cProgressCallback+                      nullPtr+                      cError+            when (cProgressCallback /= nullFunPtr) $+              freeHaskellFunPtr cProgressCallback++-- | 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 ()+fileCopyAsync source destination flags ioPriority cancellable progressCallback callback = do+          cProgressCallback <- maybe (return nullFunPtr) marshalFileProgressCallback progressCallback+          cCallback <- marshalAsyncReadyCallback $ \sourceObject res -> do+                         when (cProgressCallback /= nullFunPtr) $+                           freeHaskellFunPtr cProgressCallback+                         callback sourceObject res+          {#call g_file_copy_async #}+            (toFile source)+            (toFile destination)+            ((fromIntegral . fromFlags) flags)+            (fromIntegral ioPriority)+            (fromMaybe (Cancellable nullForeignPtr) cancellable) +            cProgressCallback+            nullPtr+            cCallback+            (castFunPtrToPtr cCallback)++-- | Finishes copying the file started with 'fileCopyAsync'.+--+-- Throws a 'GError' if an error occurs.+fileCopyFinish :: FileClass file+               => file+               -> AsyncResult+               -> IO ()+fileCopyFinish file asyncResult =+    propagateGError (\gErrorPtr -> do+                       {# call file_copy_finish #} +                         (toFile file) +                         asyncResult+                         gErrorPtr+                       return ())++-- | 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 ()+fileMove source destination flags cancellable progressCallback = do+          cProgressCallback <- maybe (return nullFunPtr) marshalFileProgressCallback progressCallback+          propagateGError $ \cError -> do+            {#call g_file_move #} +                    (toFile source)+                    (toFile destination)+                    ((fromIntegral . fromFlags) flags)+                    (fromMaybe (Cancellable nullForeignPtr) cancellable) +                    cProgressCallback+                    nullPtr+                    cError+            when (cProgressCallback /= nullFunPtr) $+              freeHaskellFunPtr cProgressCallback++-- | 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 ()+fileMakeDirectory file cancellable = do+          propagateGError $ {#call g_file_make_directory #}+                              (toFile file)+                              (fromMaybe (Cancellable nullForeignPtr) cancellable) +          return ()++#if GLIB_CHECK_VERSION(2,18,0)+-- | 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 ()+fileMakeDirectoryWithParents file cancellable = do+          propagateGError $ {#call g_file_make_directory_with_parents #}+                           (toFile file)+                           (fromMaybe (Cancellable nullForeignPtr) cancellable) +          return ()+#endif++-- | 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 ()+fileMakeSymbolicLink file symlinkValue cancellable =+        useAsCString symlinkValue $ \cSymlinkValue -> do+          propagateGError $ {#call g_file_make_symbolic_link #} +                              (toFile file) +                              cSymlinkValue +                              (fromMaybe (Cancellable nullForeignPtr) cancellable) +          return ()++{# pointer *FileAttributeInfoList newtype #}+takeFileAttributeInfoList :: Ptr FileAttributeInfoList+                          -> IO [FileAttributeInfo]+takeFileAttributeInfoList ptr =+    do cInfos <- liftM castPtr $ {# get FileAttributeInfoList->infos #} ptr+       cNInfos <- {# get FileAttributeInfoList->n_infos #} ptr+       infos <- peekArray (fromIntegral cNInfos) cInfos+       return infos++-- | 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]+fileQuerySettableAttributes file cancellable = do+          ptr <- propagateGError $ +                {#call g_file_query_settable_attributes #}+                   (toFile file)+                   (fromMaybe (Cancellable nullForeignPtr) cancellable) +          infos <- takeFileAttributeInfoList ptr+          return infos++-- | 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]+fileQueryWritableNamespaces file cancellable = do+          ptr <- propagateGError $ +                {#call g_file_query_writable_namespaces #}+                           (toFile file)+                           (fromMaybe (Cancellable nullForeignPtr) cancellable) +          infos <- takeFileAttributeInfoList ptr+          return infos++-- | 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 -- ^ @cancellable@ optional 'Cancellable' object, 'Nothing' to ignore. + -> IO ()+fileSetAttributesFromInfo file fileInfo flags cancellable =+    propagateGError (\gErrorPtr -> do+                       {#call g_file_set_attributes_from_info #} +                            (toFile file) +                            (toFileInfo fileInfo)+                            ((fromIntegral . fromFlags) flags) +                            (fromMaybe (Cancellable nullForeignPtr) cancellable) +                            gErrorPtr+                       return ())++-- | 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  -- ^ @ioPriority@ the I/O priority of the request.              + -> Maybe Cancellable -- ^ @cancellable@ optional 'Cancellable' object, 'Nothing' to ignore. + -> AsyncReadyCallback+ -> IO () -- ^ returns     'True' if there was any error, 'False' otherwise. +fileSetAttributesFromInfoAsync file fileInfo flags ioPriority cancellable callback = do+            cCallback <- marshalAsyncReadyCallback callback+            {#call g_file_set_attributes_async #} +              (toFile file)+              (toFileInfo fileInfo)+              ((fromIntegral . fromFlags) flags) +              (fromIntegral ioPriority)+              (fromMaybe (Cancellable nullForeignPtr) cancellable) +              cCallback+              (castFunPtrToPtr cCallback)++-- | Finishes setting an attribute started in 'fileSetAttributesAsync'.+--+-- Throws a 'GError' if an error occurs.+fileSetAttributesFinish :: FileClass file+ => file+ -> AsyncResult+ -> FileInfo+ -> IO ()+fileSetAttributesFinish file asyncResult fileInfo =+    withForeignPtr (unFileInfo fileInfo) $ \cFileInfo ->+    propagateGError (\gErrorPtr -> do+                       {# call g_file_set_attributes_finish #} +                        (toFile file) +                        asyncResult +                        cFileInfo+                        gErrorPtr+                       return ())++-- | 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 -- ^ @attribute@   a string containing the attribute's name.                    + -> String -- ^ @value@       a string containing the attribute's value.                   + -> [FileQueryInfoFlags] -- ^ @flags@       'FileQueryInfoFlags'.                                         + -> Maybe Cancellable -- ^ @cancellable@ optional 'Cancellable' object, 'Nothing' to ignore.                + -> IO ()+fileSetAttributeString  file attribute value flags cancellable =+    withUTFString attribute $ \ attributePtr -> +    withUTFString value $ \ valuePtr -> do+            propagateGError (\gErrorPtr -> do+                               {#call g_file_set_attribute_string #} +                                   (toFile file)+                                   attributePtr+                                   valuePtr+                                   ((fromIntegral . fromFlags) flags) +                                   (fromMaybe (Cancellable nullForeignPtr) cancellable) +                                   gErrorPtr+                               return ())++-- | 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 -- ^ @attribute@   a string containing the attribute's name.                    + -> String -- ^ @value@       a string containing the attribute's value.                   + -> [FileQueryInfoFlags] -- ^ @flags@       'FileQueryInfoFlags'.                                         + -> Maybe Cancellable -- ^ @cancellable@ optional 'Cancellable' object, 'Nothing' to ignore.                + -> IO ()+fileSetAttributeByteString  file attribute value flags cancellable =+    withUTFString attribute $ \ attributePtr -> +    withUTFString value $ \ valuePtr -> do+            propagateGError (\gErrorPtr -> do+                                {#call g_file_set_attribute_byte_string #} +                                   (toFile file)+                                   attributePtr+                                   valuePtr+                                   ((fromIntegral . fromFlags) flags) +                                   (fromMaybe (Cancellable nullForeignPtr) cancellable) +                                   gErrorPtr+                                return ())++-- | 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 -- ^ @attribute@   a string containing the attribute's name.                    + -> Word32 -- ^ @value@       a Word32 containing the attribute's new value.                                  + -> [FileQueryInfoFlags] -- ^ @flags@       'FileQueryInfoFlags'.                                         + -> Maybe Cancellable -- ^ @cancellable@ optional 'Cancellable' object, 'Nothing' to ignore.                + -> IO ()+fileSetAttributeWord32  file attribute value flags cancellable =+    withUTFString attribute $ \ attributePtr -> +            propagateGError (\gErrorPtr -> do+                                {#call g_file_set_attribute_uint32 #} +                                  (toFile file)+                                  attributePtr+                                  (fromIntegral value)+                                  ((fromIntegral . fromFlags) flags) +                                  (fromMaybe (Cancellable nullForeignPtr) cancellable) +                                  gErrorPtr+                                return ())++-- | 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 -- ^ @attribute@   a string containing the attribute's name.                    + -> Int32 -- ^ @value@       a Int32 containing the attribute's new value.                                  + -> [FileQueryInfoFlags] -- ^ @flags@       'FileQueryInfoFlags'.                                         + -> Maybe Cancellable -- ^ @cancellable@ optional 'Cancellable' object, 'Nothing' to ignore.                + -> IO ()+fileSetAttributeInt32  file attribute value flags cancellable =+    withUTFString attribute $ \ attributePtr -> +            propagateGError (\gErrorPtr -> do+                                {#call g_file_set_attribute_int32 #} +                                   (toFile file)+                                   attributePtr+                                   (fromIntegral value)+                                   ((fromIntegral . fromFlags) flags) +                                   (fromMaybe (Cancellable nullForeignPtr) cancellable) +                                   gErrorPtr+                                return ())++-- | 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 -- ^ @attribute@   a string containing the attribute's name.                    + -> Word64 -- ^ @value@       a Word64 containing the attribute's new value.                                  + -> [FileQueryInfoFlags] -- ^ @flags@       'FileQueryInfoFlags'.                                         + -> Maybe Cancellable -- ^ @cancellable@ optional 'Cancellable' object, 'Nothing' to ignore.                + -> IO ()+fileSetAttributeWord64  file attribute value flags cancellable =+    withUTFString attribute $ \ attributePtr -> +            propagateGError (\gErrorPtr -> do+                               {#call g_file_set_attribute_uint64 #} +                                   (toFile file)+                                   attributePtr+                                   (fromIntegral value)+                                   ((fromIntegral . fromFlags) flags) +                                   (fromMaybe (Cancellable nullForeignPtr) cancellable) +                                   gErrorPtr+                               return ())++-- | 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 -- ^ @attribute@   a string containing the attribute's name.                    + -> Int64 -- ^ @value@       a Int64 containing the attribute's new value.                                  + -> [FileQueryInfoFlags] -- ^ @flags@       'FileQueryInfoFlags'.                                         + -> Maybe Cancellable -- ^ @cancellable@ optional 'Cancellable' object, 'Nothing' to ignore.                + -> IO ()+fileSetAttributeInt64  file attribute value flags cancellable =+    withUTFString attribute $ \ attributePtr -> +            propagateGError (\gErrorPtr -> do+                               {#call g_file_set_attribute_int64 #} +                                   (toFile file)+                                   attributePtr+                                   (fromIntegral value)+                                   ((fromIntegral . fromFlags) flags) +                                   (fromMaybe (Cancellable nullForeignPtr) cancellable) +                                   gErrorPtr+                               return ())++-- | 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 -- ^ @source@      a 'File' with attributes.                                         + -> destination -- ^ @destination@ a 'File' to copy attributes to.                                   + -> [FileCopyFlags] -- ^ @flags@       a set of 'FileCopyFlags'.                                         + -> Maybe Cancellable -- ^ @cancellable@ optional 'Cancellable' object, 'Nothing' to ignore.                    + -> IO ()+fileCopyAttributes source destination flags cancellable = +    propagateGError (\gErrorPtr -> do+                       {#call g_file_copy_attributes #} +                           (toFile source) +                           (toFile destination) +                           ((fromIntegral . fromFlags) flags) +                           (fromMaybe (Cancellable nullForeignPtr) cancellable) +                           gErrorPtr+                       return ())++-- | 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+fileMonitorDirectory file flags cancellable =+    wrapNewGObject mkFileMonitor $+        propagateGError ({#call g_file_monitor_directory #} +                           (toFile file) +                           ((fromIntegral . fromFlags) flags) +                           (fromMaybe (Cancellable nullForeignPtr) cancellable) +                        )++-- | 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+fileMonitorFile file flags cancellable =+    wrapNewGObject mkFileMonitor $+        propagateGError ({#call g_file_monitor_file #}+                           (toFile file) +                           ((fromIntegral . fromFlags) flags) +                           (fromMaybe (Cancellable nullForeignPtr) cancellable) +                        )++#if GLIB_CHECK_VERSION(2,18,0)+-- | 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+fileMonitor file flags cancellable =+    wrapNewGObject mkFileMonitor $+        propagateGError ({#call g_file_monitor #} +                           (toFile file) +                           ((fromIntegral . fromFlags) flags) +                           (fromMaybe (Cancellable nullForeignPtr) cancellable) +                        )+#endif++-- | 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] -- ^ @flags@           flags affecting the operation                        + -> Maybe MountOperation -- ^ @mountOperation@ a 'MountOperation' or 'Nothing' to avoid user interaction. + -> Maybe Cancellable -- ^ @cancellable@     optional 'Cancellable' object, 'Nothing' to ignore.        + -> AsyncReadyCallback -- ^ @callback@        a 'AsyncReadyCallback'+ -> IO ()+fileMountMountable file flags mountOperation cancellable callback = do+      cCallback <- marshalAsyncReadyCallback callback+      {#call g_file_mount_mountable #} +        (toFile file)+        ((fromIntegral . fromFlags) flags)+        (fromMaybe (MountOperation nullForeignPtr) mountOperation)+        (fromMaybe (Cancellable nullForeignPtr) cancellable) +        cCallback+        (castFunPtrToPtr cCallback)++-- | Finishes a mount operation. See 'fileMountMountable' for details.+-- +-- Finish an asynchronous mount operation that was started with 'fileMountMountable'.+fileMountMountableFinish :: FileClass file => file+ -> AsyncResult -- ^ @result@  a 'AsyncResult'                                         + -> IO File+fileMountMountableFinish file result =+    wrapNewGObject mkFile $+    propagateGError ({#call g_file_mount_mountable_finish#} (toFile file) result)++#if GLIB_CHECK_VERSION(2,22,0)+-- | 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] -- ^ @flags@           flags affecting the operation                        + -> Maybe MountOperation -- ^ @mountOperation@ a 'MountOperation' or 'Nothing' to avoid user interaction. + -> Maybe Cancellable -- ^ @cancellable@     optional 'Cancellable' object, 'Nothing' to ignore.        + -> AsyncReadyCallback -- ^ @callback@        a 'AsyncReadyCallback'+ -> IO ()+fileUnmountMountableWithOperation file flags mountOperation cancellable callback = do+      cCallback <- marshalAsyncReadyCallback callback+      {#call g_file_unmount_mountable_with_operation #} +          (toFile file)+          ((fromIntegral . fromFlags) flags)+          (fromMaybe (MountOperation nullForeignPtr) mountOperation)+          (fromMaybe (Cancellable nullForeignPtr) cancellable) +          cCallback+          (castFunPtrToPtr cCallback)++-- | 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 -- ^ @result@  a 'AsyncResult'                                         + -> IO ()+fileUnmountMountableWithOperationFinish file result =+    propagateGError (\gErrorPtr -> do+                       {#call g_file_unmount_mountable_with_operation_finish#} +                          (toFile file) +                          result+                          gErrorPtr+                       return ())++-- | 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] -- ^ @flags@           flags affecting the operation                        + -> Maybe MountOperation -- ^ @mountOperation@ a 'MountOperation' or 'Nothing' to avoid user interaction. + -> Maybe Cancellable -- ^ @cancellable@     optional 'Cancellable' object, 'Nothing' to ignore.        + -> AsyncReadyCallback -- ^ @callback@        a 'AsyncReadyCallback'+ -> IO ()+fileEjectMountableWithOperation file flags mountOperation cancellable callback = do+      cCallback <- marshalAsyncReadyCallback callback+      {#call g_file_eject_mountable_with_operation #}+          (toFile file)+          ((fromIntegral . fromFlags) flags)+          (fromMaybe (MountOperation nullForeignPtr) mountOperation)+          (fromMaybe (Cancellable nullForeignPtr) cancellable) +          cCallback+          (castFunPtrToPtr cCallback)++-- | Finishes an asynchronous eject operation started by 'fileEjectMountableWithOperation'.+--+-- Throws a 'GError' if an error occurs.+fileEjectMountableWithOperationFinish :: FileClass file => file+ -> AsyncResult -- ^ @result@  a 'AsyncResult'                                         + -> IO ()+fileEjectMountableWithOperationFinish file result =+    propagateGError (\gErrorPtr -> do+                        {#call g_file_eject_mountable_with_operation_finish#} +                              (toFile file) +                              result+                              gErrorPtr+                        return ())++-- | 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] -- ^ @flags@           flags affecting the start operation.                 + -> Maybe MountOperation -- ^ @mountOperation@ a 'MountOperation' or 'Nothing' to avoid user interaction. + -> Maybe Cancellable -- ^ @cancellable@     optional 'Cancellable' object, 'Nothing' to ignore.        + -> AsyncReadyCallback -- ^ @callback@        a 'AsyncReadyCallback'+ -> IO ()+fileStartMountable file flags mountOperation cancellable callback = do+      cCallback <- marshalAsyncReadyCallback callback+      {#call g_file_start_mountable #} +        (toFile file)+        ((fromIntegral . fromFlags) flags)+        (fromMaybe (MountOperation nullForeignPtr) mountOperation)+        (fromMaybe (Cancellable nullForeignPtr) cancellable) +        cCallback+        (castFunPtrToPtr cCallback)++-- | 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 -- ^ @result@  a 'AsyncResult'.+ -> IO ()+fileStartMountableFinish file result =+    propagateGError (\gErrorPtr -> do+                       {#call g_file_start_mountable_finish #} +                          (toFile file) +                          result+                          gErrorPtr+                       return ())++-- | 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] -- ^ @flags@           flags affecting the stop operation.                 + -> Maybe MountOperation -- ^ @mountOperation@ a 'MountOperation' or 'Nothing' to avoid user interaction. + -> Maybe Cancellable -- ^ @cancellable@     optional 'Cancellable' object, 'Nothing' to ignore.        + -> AsyncReadyCallback -- ^ @callback@        a 'AsyncReadyCallback'+ -> IO ()+fileStopMountable file flags mountOperation cancellable callback = do+      cCallback <- marshalAsyncReadyCallback callback+      {#call g_file_stop_mountable #} +        (toFile file)+        ((fromIntegral . fromFlags) flags)+        (fromMaybe (MountOperation nullForeignPtr) mountOperation)+        (fromMaybe (Cancellable nullForeignPtr) cancellable) +        cCallback+        (castFunPtrToPtr cCallback)++-- | 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 -- ^ @result@  a 'AsyncResult'.+ -> IO ()+fileStopMountableFinish file result =+    propagateGError (\gErrorPtr -> do+                       {#call g_file_stop_mountable_finish #} +                          (toFile file) +                          result+                          gErrorPtr+                       return ())++-- | 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 ()+filePollMountable file cancellable callback = do+      cCallback <- marshalAsyncReadyCallback callback+      {#call g_file_poll_mountable #} +          (toFile file)+          (fromMaybe (Cancellable nullForeignPtr) cancellable) +          cCallback+          (castFunPtrToPtr cCallback)++-- | Finishes a poll operation. See 'filePollMountable' for details.+-- +-- Finish an asynchronous poll operation that was polled with 'filePollMountable'.+filePollMountableFinish :: FileClass file + => file+ -> AsyncResult -- ^ @result@  a 'AsyncResult'.+ -> IO Bool -- ^ returns 'True' if the file was successfully ejected. 'False' otherwise.   +filePollMountableFinish file result =+  liftM toBool $+    propagateGError ({#call g_file_poll_mountable_finish #} (toFile file) result)+#endif++-- | 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] -- ^ @flags@           flags affecting the operation                        + -> Maybe MountOperation -- ^ @mountOperation@ a 'MountOperation' or 'Nothing' to avoid user interaction. + -> Maybe Cancellable -- ^ @cancellable@     optional 'Cancellable' object, 'Nothing' to ignore.        + -> AsyncReadyCallback -- ^ @callback@        a 'AsyncReadyCallback'+ -> IO ()+fileMountEnclosingVolume file flags mountOperation cancellable callback = do+      cCallback <- marshalAsyncReadyCallback callback+      {#call g_file_mount_enclosing_volume #} +        (toFile file)+        ((fromIntegral . fromFlags) flags)+        (fromMaybe (MountOperation nullForeignPtr) mountOperation)+        (fromMaybe (Cancellable nullForeignPtr) cancellable) +        cCallback+        (castFunPtrToPtr cCallback)++-- | Finishes a mount operation started by 'fileMountEnclosingVolume'.+fileMountEnclosingVolumeFinish :: FileClass file + => file+ -> AsyncResult -- ^ @result@  a 'AsyncResult'.+ -> IO Bool -- ^ returns 'True' if the file was successfully ejected. 'False' otherwise.   +fileMountEnclosingVolumeFinish file result =+  liftM toBool $+    propagateGError ({#call g_file_mount_enclosing_volume_finish #} (toFile file) result)++#if GLIB_CHECK_VERSION(2,22,0)+-- | 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  -- ^ returns Whether or not file supports thread-default contexts. +fileSupportsThreadContexts file =+  liftM toBool $+  {#call g_file_supports_thread_contexts#} (toFile file)+#endif 
System/GIO/File/FileAttribute.hsc view
@@ -1,13 +1,16 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE ScopedTypeVariables #-}+-- -*-haskell-*-  #include <gio/gio.h>-+          --  GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*- -----  Author : Peter Gavin+--  Author : Peter Gavin, Andy Stewart --  Created: 13-Oct-2008 -- --  Copyright (c) 2008 Peter Gavin+--  Copyright (c) 2010 Andy Stewart -- --  This library is free software: you can redistribute it and/or --  modify it under the terms of the GNU Lesser General Public License@@ -31,9 +34,33 @@ --   Stability   : alpha --   Portability : portable (depends on GHC) module System.GIO.File.FileAttribute (+-- * Details                                      +-- | File attributes in GIO consist of a list of key-value pairs.+-- +-- Keys are strings that contain a key namespace and a key name, separated by a colon,+-- e.g. "namespace:keyname". Namespaces are included to sort key-value pairs by namespaces for+-- relevance. Keys can be retrived using wildcards, e.g. \"standard::*\" will return all of the keys in+-- the "standard" namespace.+-- +-- Values are stored within the list in 'FileAttributeValue' structures. Values can store different+-- types, listed in the enum 'FileAttributeType'. Upon creation of a 'FileAttributeValue', the type will+-- be set to 'FileAttributeTypeInvalid'.+-- +-- The list of possible attributes for a filesystem (pointed to by a 'File') is availible as a+-- 'FileAttributeInfoList'. This list is queryable by key names as indicated earlier.+-- +-- Classes that implement 'FileIface' will create a 'FileAttributeInfoList' and install default keys and+-- values for their given file system, architecture, and other possible implementation details (e.g.,+-- on a UNIX system, a file attribute key will be registered for the user id for a given file).+                                      +-- * Types                                           FileAttributeType (..),     FileAttributeInfo (..),+                      +-- * Enums                           FileAttributeInfoFlags (..),+                           +-- * Methods                                fileAttributeStandardType,     fileAttributeStandardIsHidden,     fileAttributeStandardIsBackup,@@ -47,6 +74,9 @@     fileAttributeStandardContentType,     fileAttributeStandardFastContentType,     fileAttributeStandardSize,+#if GLIB_CHECK_VERSION(2,20,0)+    fileAttributeStandardAllocatedSize,+#endif                                           fileAttributeStandardSymlinkTarget,     fileAttributeStandardTargetURI,     fileAttributeStandardSortOrder,@@ -63,6 +93,14 @@     fileAttributeMountableCanUnmount,     fileAttributeMountableCanEject,     fileAttributeMountableUnixDevice,+#if GLIB_CHECK_VERSION(2,22,0)+    fileAttributeMountableUnixDeviceFile,+    fileAttributeMountableCanStart,                                        +    fileAttributeMountableCanDegraded,+    fileAttributeMountableCanStop,                                     +    fileAttributeMountableStartStopType,+    fileAttributeMountableCanPoll,+#endif                                             fileAttributeMountableHalUDI,     fileAttributeTimeModified,     fileAttributeTimeModifiedUSec,@@ -81,6 +119,7 @@     fileAttributeUnixRDev,     fileAttributeUnixBlockSize,     fileAttributeUnixBlocks,+    fileAttributeDosIsMountpoint,     fileAttributeDosIsArchive,     fileAttributeDosIsSystem,     fileAttributeOwnerUser,@@ -88,6 +127,9 @@     fileAttributeOwnerGroup,     fileAttributeThumbnailPath,     fileAttributeThumbnailingFailed,+#if GLIB_CHECK_VERSION(2,20,0)+    fileAttributePreviewIcon,+#endif                                 fileAttributeFilesystemSize,     fileAttributeFilesystemFree,     fileAttributeFilesystemType,@@ -97,12 +139,18 @@     fileAttributeTrashItemCount,     fileAttributeFilesystemUsePreview,     fileAttributeStandardDescription,+#if GLIB_CHECK_VERSION(2,24,0)+    fileAttributeTrashOrigPath,+    fileAttributeTrashDeletionDate,+#endif                                         ) where + import System.Glib.FFI import System.Glib.UTFString+import System.Glib.Flags -import System.GIO.Base+import System.GIO.Enums  data FileAttributeType = FileAttributeTypeInvalid                        | FileAttributeTypeString@@ -113,6 +161,9 @@                        | FileAttributeTypeWord64                        | FileAttributeTypeInt64                        | FileAttributeTypeObject+#if GLIB_CHECK_VERSION(2,22,0)+                       | FileAttributeTypeStringList+#endif                                                   deriving (Eq, Ord, Bounded, Show, Read) instance Enum FileAttributeType where     toEnum #{const G_FILE_ATTRIBUTE_TYPE_INVALID}     = FileAttributeTypeInvalid@@ -124,6 +175,9 @@     toEnum #{const G_FILE_ATTRIBUTE_TYPE_UINT64}      = FileAttributeTypeWord64     toEnum #{const G_FILE_ATTRIBUTE_TYPE_INT64}       = FileAttributeTypeInt64     toEnum #{const G_FILE_ATTRIBUTE_TYPE_OBJECT}      = FileAttributeTypeObject+#if GLIB_CHECK_VERSION(2,22,0)+    toEnum #{const G_FILE_ATTRIBUTE_TYPE_STRINGV}     = FileAttributeTypeStringList+#endif                                                                  fromEnum FileAttributeTypeInvalid    = #{const G_FILE_ATTRIBUTE_TYPE_INVALID}     fromEnum FileAttributeTypeString     = #{const G_FILE_ATTRIBUTE_TYPE_STRING}@@ -134,6 +188,9 @@     fromEnum FileAttributeTypeWord64     = #{const G_FILE_ATTRIBUTE_TYPE_UINT64}     fromEnum FileAttributeTypeInt64      = #{const G_FILE_ATTRIBUTE_TYPE_INT64}     fromEnum FileAttributeTypeObject     = #{const G_FILE_ATTRIBUTE_TYPE_OBJECT}+#if GLIB_CHECK_VERSION(2,22,0)+    fromEnum FileAttributeTypeStringList = #{const G_FILE_ATTRIBUTE_TYPE_STRINGV}+#endif  data FileAttributeInfo =     FileAttributeInfo@@ -146,9 +203,9 @@     sizeOf _ = #{size GFileAttributeInfo}     alignment _ = alignment (undefined :: Ptr ())     peek ptr = do-      retName <- #{peek GFileAttributeInfo, name} ptr >>= peekUTFString-      retType <- (#{peek GFileAttributeInfo, type} ptr :: IO CInt) >>= return . cToEnum-      retFlags <- (#{peek GFileAttributeInfo, flags} ptr :: IO CInt) >>= return . cToFlags+      retName <- #{peek GFileAttributeInfo, name} ptr >>= readUTFString+      retType <- (#{peek GFileAttributeInfo, type} ptr :: IO CInt) >>= return . (toEnum . fromIntegral)+      retFlags <- (#{peek GFileAttributeInfo, flags} ptr :: IO CInt) >>= return . (toFlags . fromIntegral)       return $ FileAttributeInfo                { fileAttributeInfoName = retName                , fileAttributeInfoType = retType@@ -169,6 +226,9 @@     fileAttributeStandardContentType,     fileAttributeStandardFastContentType,     fileAttributeStandardSize,+#if GLIB_CHECK_VERSION(2,20,0)+    fileAttributeStandardAllocatedSize,+#endif                                           fileAttributeStandardSymlinkTarget,     fileAttributeStandardTargetURI,     fileAttributeStandardSortOrder,@@ -185,6 +245,14 @@     fileAttributeMountableCanUnmount,     fileAttributeMountableCanEject,     fileAttributeMountableUnixDevice,+#if GLIB_CHECK_VERSION(2,22,0)+    fileAttributeMountableUnixDeviceFile,+    fileAttributeMountableCanStart,+    fileAttributeMountableCanDegraded,+    fileAttributeMountableCanStop,+    fileAttributeMountableStartStopType,+    fileAttributeMountableCanPoll,+#endif                                             fileAttributeMountableHalUDI,     fileAttributeTimeModified,     fileAttributeTimeModifiedUSec,@@ -203,6 +271,7 @@     fileAttributeUnixRDev,     fileAttributeUnixBlockSize,     fileAttributeUnixBlocks,+    fileAttributeDosIsMountpoint,     fileAttributeDosIsArchive,     fileAttributeDosIsSystem,     fileAttributeOwnerUser,@@ -210,6 +279,9 @@     fileAttributeOwnerGroup,     fileAttributeThumbnailPath,     fileAttributeThumbnailingFailed,+#if GLIB_CHECK_VERSION(2,20,0)+    fileAttributePreviewIcon,                                   +#endif                                 fileAttributeFilesystemSize,     fileAttributeFilesystemFree,     fileAttributeFilesystemType,@@ -218,6 +290,10 @@     fileAttributeSELinuxContext,     fileAttributeTrashItemCount,     fileAttributeFilesystemUsePreview,+#if GLIB_CHECK_VERSION(2,24,0)+    fileAttributeTrashOrigPath,+    fileAttributeTrashDeletionDate,+#endif                                         fileAttributeStandardDescription     :: String fileAttributeStandardType            = #{const_str G_FILE_ATTRIBUTE_STANDARD_TYPE}@@ -233,6 +309,9 @@ fileAttributeStandardContentType     = #{const_str G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE} fileAttributeStandardFastContentType = #{const_str G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE} fileAttributeStandardSize            = #{const_str G_FILE_ATTRIBUTE_STANDARD_SIZE}+#if GLIB_CHECK_VERSION(2,20,0)+fileAttributeStandardAllocatedSize   = #{const_str G_FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE}+#endif                                        fileAttributeStandardSymlinkTarget   = #{const_str G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET} fileAttributeStandardTargetURI       = #{const_str G_FILE_ATTRIBUTE_STANDARD_TARGET_URI} fileAttributeStandardSortOrder       = #{const_str G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER}@@ -249,6 +328,15 @@ fileAttributeMountableCanUnmount     = #{const_str G_FILE_ATTRIBUTE_MOUNTABLE_CAN_UNMOUNT} fileAttributeMountableCanEject       = #{const_str G_FILE_ATTRIBUTE_MOUNTABLE_CAN_EJECT} fileAttributeMountableUnixDevice     = #{const_str G_FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE}+#if GLIB_CHECK_VERSION(2,22,0)+fileAttributeMountableUnixDeviceFile = #{const_str G_FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE_FILE}+fileAttributeMountableCanStart       = #{const_str G_FILE_ATTRIBUTE_MOUNTABLE_CAN_START}+fileAttributeMountableCanDegraded    = #{const_str G_FILE_ATTRIBUTE_MOUNTABLE_CAN_START_DEGRADED}+fileAttributeMountableCanStop        = #{const_str G_FILE_ATTRIBUTE_MOUNTABLE_CAN_STOP}+fileAttributeMountableStartStopType  = #{const_str G_FILE_ATTRIBUTE_MOUNTABLE_START_STOP_TYPE}+fileAttributeMountableCanPoll        = #{const_str G_FILE_ATTRIBUTE_MOUNTABLE_CAN_POLL}+fileAttributeMountableIsMediaCheckAutomatic = #{const_str G_FILE_ATTRIBUTE_MOUNTABLE_IS_MEDIA_CHECK_AUTOMATIC}+#endif                                        fileAttributeMountableHalUDI         = #{const_str G_FILE_ATTRIBUTE_MOUNTABLE_HAL_UDI} fileAttributeTimeModified            = #{const_str G_FILE_ATTRIBUTE_TIME_MODIFIED} fileAttributeTimeModifiedUSec        = #{const_str G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC}@@ -267,6 +355,7 @@ fileAttributeUnixRDev                = #{const_str G_FILE_ATTRIBUTE_UNIX_RDEV} fileAttributeUnixBlockSize           = #{const_str G_FILE_ATTRIBUTE_UNIX_BLOCK_SIZE} fileAttributeUnixBlocks              = #{const_str G_FILE_ATTRIBUTE_UNIX_BLOCKS}+fileAttributeDosIsMountpoint         = #{const_str G_FILE_ATTRIBUTE_UNIX_IS_MOUNTPOINT} fileAttributeDosIsArchive            = #{const_str G_FILE_ATTRIBUTE_DOS_IS_ARCHIVE} fileAttributeDosIsSystem             = #{const_str G_FILE_ATTRIBUTE_DOS_IS_SYSTEM} fileAttributeOwnerUser               = #{const_str G_FILE_ATTRIBUTE_OWNER_USER}@@ -274,6 +363,9 @@ fileAttributeOwnerGroup              = #{const_str G_FILE_ATTRIBUTE_OWNER_GROUP} fileAttributeThumbnailPath           = #{const_str G_FILE_ATTRIBUTE_THUMBNAIL_PATH} fileAttributeThumbnailingFailed      = #{const_str G_FILE_ATTRIBUTE_THUMBNAILING_FAILED}+#if GLIB_CHECK_VERSION(2,20,0)+fileAttributePreviewIcon             = #{const_str G_FILE_ATTRIBUTE_PREVIEW_ICON}+#endif                                        fileAttributeFilesystemSize          = #{const_str G_FILE_ATTRIBUTE_FILESYSTEM_SIZE} fileAttributeFilesystemFree          = #{const_str G_FILE_ATTRIBUTE_FILESYSTEM_FREE} fileAttributeFilesystemType          = #{const_str G_FILE_ATTRIBUTE_FILESYSTEM_TYPE}@@ -283,3 +375,7 @@ fileAttributeTrashItemCount          = #{const_str G_FILE_ATTRIBUTE_TRASH_ITEM_COUNT} fileAttributeFilesystemUsePreview    = #{const_str G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW} fileAttributeStandardDescription     = #{const_str G_FILE_ATTRIBUTE_STANDARD_DESCRIPTION}+#if GLIB_CHECK_VERSION(2,24,0)+fileAttributeTrashOrigPath           = #{const_str G_FILE_ATTRIBUTE_TRASH_ORIG_PATH}+fileAttributeTrashDeletionDate       = #{const_str G_FILE_ATTRIBUTE_TRASH_DELETION_DATE}+#endif                                    
+ System/GIO/File/FileEnumerator.chs view
@@ -0,0 +1,222 @@+{-# LANGUAGE CPP #-}+--  GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*-+--+--  Author : Andy Stewart+--  Created: 30-Apirl-2010+--+--  Copyright (c) 2010 Andy Stewart+--+--  This library is free software: you can redistribute it and/or+--  modify it under the terms of the GNU Lesser General Public License+--  as published by the Free Software Foundation, either version 3 of+--  the License, or (at your option) any later version.+--  +--  This library is distributed in the hope that it will be useful,+--  but WITHOUT ANY WARRANTY; without even the implied warranty of+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU+--  Lesser General Public License for more details.+--  +--  You should have received a copy of the GNU Lesser General Public+--  License along with this program.  If not, see+--  <http://www.gnu.org/licenses/>.+--  +--  GIO, the C library which this Haskell library depends on, is+--  available under LGPL Version 2. The documentation included with+--  this library is based on the original GIO documentation.+--  +-- | Maintainer  : gtk2hs-devel@lists.sourceforge.net+--   Stability   : alpha+--   Portability : portable (depends on GHC)+module System.GIO.File.FileEnumerator (+-- * Details+--+-- | 'FileEnumerator' allows you to operate on a set of 'File's, returning a 'FileInfo' structure for each+-- file enumerated (e.g.  'fileEnumerateChildren' will return a 'FileEnumerator' for each of the+-- children within a directory).+-- +-- To get the next file's information from a 'FileEnumerator', use 'fileEnumeratorNextFile' or its+-- asynchronous version, 'fileEnumeratorNextFilesAsync'. Note that the asynchronous version will+-- return a list of 'FileInfo', whereas the synchronous will only return the next file in the+-- enumerator.+-- +-- To close a 'FileEnumerator', use 'fileEnumeratorClose', or its asynchronous version,+-- 'fileEnumeratorCloseAsync'.  +--+-- * Types+    FileEnumerator (..),+    FileEnumeratorClass,++-- * Methods+    fileEnumeratorNextFile,+    fileEnumeratorClose,+    fileEnumeratorNextFilesAsync,+    fileEnumeratorNextFilesFinish,+    fileEnumeratorCloseAsync,+    fileEnumeratorCloseFinish,+    fileEnumeratorIsClosed,+    fileEnumeratorHasPending,+    fileEnumeratorSetPending,+#if GLIB_CHECK_VERSION(2,18,0)+    fileEnumeratorGetContainer,+#endif+    ) where++import Control.Monad+import Data.Maybe (fromMaybe)+import System.GIO.Enums+import System.Glib.FFI+import System.Glib.Flags+import System.Glib.GError+import System.Glib.GList+import System.Glib.GObject+import System.Glib.UTFString+{#import System.GIO.Async.AsyncResult#}+{#import System.GIO.Types#}++{# context lib = "gio" prefix = "g" #}++-- | 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 -- ^ @cancellable@ optional 'Cancellable' object, 'Nothing' to ignore.+ -> IO (Maybe FileInfo)     -- ^ returns     A 'FileInfo' or 'Nothing' on error or end of enumerator. +fileEnumeratorNextFile enumerator cancellable =+    checkGError ( \gErrorPtr -> +                      maybeNull (makeNewGObject mkFileInfo) $+                          {#call g_file_enumerator_next_file #} +                            (toFileEnumerator enumerator) +                            (fromMaybe (Cancellable nullForeignPtr) cancellable) +                            gErrorPtr)+                (\ _ -> return Nothing)+                 ++-- | 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 -- ^ @cancellable@ optional 'Cancellable' object, 'Nothing' to ignore.           + -> IO ()+fileEnumeratorClose enumerator cancellable =+    propagateGError $ \gErrorPtr -> do+        {#call g_file_enumerator_close#} +          (toFileEnumerator enumerator) +          (fromMaybe (Cancellable nullForeignPtr) cancellable) +          gErrorPtr+        return ()++-- | 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  -- ^ @numFiles@   the number of file info objects to request                  + -> Int -- ^ @ioPriority@ the io priority of the request.                             + -> Maybe Cancellable -- ^ @cancellable@ optional 'Cancellable' object, 'Nothing' to ignore.               + -> AsyncReadyCallback -- ^ @callback@    a 'AsyncReadyCallback' to call when the request is satisfied + -> IO ()+fileEnumeratorNextFilesAsync enumerator numFiles ioPriority cancellable callback = do+    cCallback <- marshalAsyncReadyCallback callback+    {#call g_file_enumerator_next_files_async #}+      (toFileEnumerator enumerator)+      (fromIntegral numFiles)+      (fromIntegral ioPriority)+      (fromMaybe (Cancellable nullForeignPtr) cancellable) +      cCallback+      (castFunPtrToPtr cCallback)+  +-- | Finishes the asynchronous operation started with 'fileEnumeratorNextFilesAsync'.+fileEnumeratorNextFilesFinish :: FileEnumeratorClass enumerator => enumerator+ -> AsyncResult+ -> IO [FileInfo]+fileEnumeratorNextFilesFinish enumerator asyncResult = +    propagateGError ({# call g_file_enumerator_next_files_finish #} (toFileEnumerator enumerator) asyncResult) +      >>= \glistPtr -> do+        infoPtrs <- fromGList glistPtr+        mapM (makeNewGObject mkFileInfo . return) infoPtrs+        +-- | 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 -- ^ @ioPriority@ the I/O priority of the request.                            + -> Maybe Cancellable -- ^ @cancellable@ optional 'Cancellable' object, 'Nothing' to ignore.               + -> AsyncReadyCallback -- ^ @callback@    a 'AsyncReadyCallback' to call when the request is satisfied + -> IO ()+fileEnumeratorCloseAsync enumerator ioPriority mbCancellable callback = do+    cCallback <- marshalAsyncReadyCallback callback+    {#call g_file_enumerator_close_async #}+      (toFileEnumerator enumerator) +      (fromIntegral ioPriority)+      (fromMaybe (Cancellable nullForeignPtr) mbCancellable) +      cCallback+      (castFunPtrToPtr cCallback)++-- | 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 ()+fileEnumeratorCloseFinish enumerator asyncResult = +    propagateGError (\gErrorPtr -> do+                       {# call g_file_enumerator_close_finish #} +                          (toFileEnumerator enumerator) +                          asyncResult+                          gErrorPtr+                       return ()) ++-- | Checks if the file enumerator has been closed.+fileEnumeratorIsClosed :: FileEnumeratorClass enumerator => enumerator+ -> IO Bool  -- ^ returns    'True' if the enumerator is closed. +fileEnumeratorIsClosed enumerator =+  liftM toBool $+  {#call g_file_enumerator_is_closed#} (toFileEnumerator enumerator)++-- | Checks if the file enumerator has pending operations.+fileEnumeratorHasPending :: FileEnumeratorClass enumerator => enumerator+ -> IO Bool -- ^ returns    'True' if the enumerator has pending operations. +fileEnumeratorHasPending enumerator =+  liftM toBool $+  {#call g_file_enumerator_has_pending#} (toFileEnumerator enumerator)++-- | Sets the file enumerator as having pending operations.+fileEnumeratorSetPending :: FileEnumeratorClass enumerator => enumerator+ -> Bool+ -> IO ()+fileEnumeratorSetPending enumerator pending =+  {#call g_file_enumerator_set_pending#} (toFileEnumerator enumerator) (fromBool pending)++#if GLIB_CHECK_VERSION(2,18,0)+-- | Get the 'File' container which is being enumerated.+fileEnumeratorGetContainer :: FileEnumeratorClass enumerator => enumerator+ -> IO File+fileEnumeratorGetContainer enumerator =+    makeNewGObject mkFile $+    {#call g_file_enumerator_get_container#} (toFileEnumerator enumerator)+#endif
+ System/GIO/File/FileInfo.chs view
@@ -0,0 +1,630 @@+{-# LANGUAGE CPP #-}+--  GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*-+--+--  Author : Andy Stewart+--  Created: 30-Apirl-2010+--+--  Copyright (c) 2010 Andy Stewart+--+--  This library is free software: you can redistribute it and/or+--  modify it under the terms of the GNU Lesser General Public License+--  as published by the Free Software Foundation, either version 3 of+--  the License, or (at your option) any later version.+--  +--  This library is distributed in the hope that it will be useful,+--  but WITHOUT ANY WARRANTY; without even the implied warranty of+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU+--  Lesser General Public License for more details.+--  +--  You should have received a copy of the GNU Lesser General Public+--  License along with this program.  If not, see+--  <http://www.gnu.org/licenses/>.+--  +--  GIO, the C library which this Haskell library depends on, is+--  available under LGPL Version 2. The documentation included with+--  this library is based on the original GIO documentation.+--  +-- | Maintainer  : gtk2hs-devel@lists.sourceforge.net+--   Stability   : alpha+--   Portability : portable (depends on GHC)+module System.GIO.File.FileInfo (+-- * Details+--+-- | Functionality for manipulating basic metadata for files. 'FileInfo' implements methods for getting+-- information that all files should contain, and allows for manipulation of extended attributes.+-- +-- See 'FileAttribute' for more information on how GIO handles file attributes.+-- +-- To obtain a 'FileInfo' for a 'File', use 'fileQueryInfo'. To obtain a+-- 'FileInfo' for a file input or output stream, use 'fileInputStreamQueryInfo' or+-- 'fileOutputStreamQueryInfo'.+-- +-- To change the actual attributes of a file, you should then set the attribute in the 'FileInfo' and+-- call 'fileSetAttributesFromInfo' on a 'File'.+-- +-- However, not all attributes can be changed in the file. For instance, the actual size of a file+-- cannot be changed via 'fileInfoSetSize' and+-- 'fileQueryWritableNamespaces' to discover the settable attributes of a particular file at+-- runtime.+-- +-- 'FileAttributeMatcher' allows for searching through a 'FileInfo' for attributes.++-- * Types+    FileInfo(..),+    FileInfoClass,++-- * Enums,+    FileAttributeStatus (..),++-- * Methods+    fileInfoNew,+    fileInfoDup,+    fileInfoCopyInto,+    fileInfoHasAttribute,+#if GLIB_CHECK_VERSION(2,22,0)+    fileInfoHasNamespace,+#endif+    fileInfoListAttributes,+    fileInfoGetAttributeType,+    fileInfoRemoveAttribute,+    fileInfoGetAttributeAsString,+    fileInfoGetAttributeStatus,+    fileInfoGetAttributeString,+#if GLIB_CHECK_VERSION(2,22,0)+    fileInfoGetAttributeStringList,+#endif+    fileInfoGetAttributeByteString,+    fileInfoGetAttributeBool,+    fileInfoGetAttributeWord32,+    fileInfoGetAttributeInt32,+    fileInfoGetAttributeWord64,+    fileInfoGetAttributeInt64,+    fileInfoGetAttributeObject,+#if GLIB_CHECK_VERSION(2,22,0)+    fileInfoSetAttributeStatus,+#endif+    fileInfoSetAttributeString,+#if GLIB_CHECK_VERSION(2,22,0)+    fileInfoSetAttributeStringList,+#endif+    fileInfoSetAttributeByteString,+    fileInfoSetAttributeBool,+    fileInfoSetAttributeWord32,+    fileInfoSetAttributeInt32,+    fileInfoSetAttributeWord64,+    fileInfoSetAttributeInt64,+    fileInfoSetAttributeObject,++    fileInfoClearStatus,+    fileInfoGetFileType,+    fileInfoGetIsHidden,+    fileInfoGetIsBackup,+    fileInfoGetIsSymlink,+    fileInfoGetName,+    fileInfoGetDisplayName,+    fileInfoGetEditName,+    fileInfoGetIcon,+    fileInfoGetContentType,+    fileInfoGetModificationTime,+    fileInfoGetSize,+    fileInfoGetSymlinkTarget,+    fileInfoGetEtag,+    fileInfoGetSortOrder,+    fileInfoUnsetAttributeMask,+    fileInfoSetFileType,+    fileInfoSetIsHidden,+    fileInfoSetIsSymlink,+    fileInfoSetName,+    fileInfoSetDisplayName,+    fileInfoSetEditName,+    fileInfoSetIcon,+    fileInfoSetContentType,+    fileInfoSetModificationTime,+    fileInfoSetSize,++    -- 'fileInfoSetSymlinkTarget' use *static string* that we don't understand the purpose of this function.+    -- If someone know how to use it, uncomment it and fix documentation.+    -- fileInfoSetSymlinkTarget,++    fileInfoSetSortOrder,+    ) where++import Control.Monad++import Data.ByteString (ByteString)+import Data.ByteString (useAsCString)+import Data.ByteString.Unsafe (unsafePackCStringFinalizer)+import System.Glib.FFI+import System.Glib.Flags+import System.Glib.GError+import System.Glib.UTFString+import System.Glib.GObject+import System.Glib.GDateTime++import System.GIO.Enums+import System.GIO.File.FileAttribute+{#import System.GIO.Types#}++{# context lib = "gio" prefix = "g" #}++-- | Creates a new file info structure.+fileInfoNew :: IO FileInfo+fileInfoNew = +    wrapNewGObject mkFileInfo $+    {#call g_file_info_new#}++-- | Duplicates a file info structure.+fileInfoDup :: FileInfoClass info => info -> IO FileInfo+fileInfoDup info =+    wrapNewGObject mkFileInfo $+    {#call g_file_info_dup#} (toFileInfo info)++-- | Copies all of the 'FileAttributes' from @srcInfo@ to @destInfo@.+fileInfoCopyInto :: (FileInfoClass srcInfo, FileInfoClass destInfo) + => srcInfo  -- ^ @srcInfo@  source to copy attributes from.    + -> destInfo  -- ^ @destInfo@ destination to copy attributes to. + -> IO ()+fileInfoCopyInto srcInfo destInfo =+  {#call g_file_info_copy_into#} (toFileInfo srcInfo) (toFileInfo destInfo)++-- | Checks if a file info structure has an attribute named attribute.+fileInfoHasAttribute :: FileInfoClass info => info+ -> String  -- ^ @attribute@ a file attribute key.                                           + -> Bool  -- ^ returns   'True' if Ginfo has an attribute named attribute, 'False' otherwise.+fileInfoHasAttribute info attribute =+  toBool $ unsafePerformIO $+  withUTFString attribute $ \ attributePtr -> +  {#call g_file_info_has_attribute#} (toFileInfo info) attributePtr++#if GLIB_CHECK_VERSION(2,22,0)+-- | Checks if a file info structure has an attribute in the specified @nameSpace@.+fileInfoHasNamespace :: FileInfoClass info => info+ -> String  -- ^ @namespace@ a file namespace key.                                           + -> Bool  -- ^ returns   'True' if Ginfo has an namespace named namespace, 'False' otherwise.+fileInfoHasNamespace info namespace =+  toBool $ unsafePerformIO $+  withUTFString namespace $ \ namespacePtr -> +  {#call g_file_info_has_namespace#} (toFileInfo info) namespacePtr+#endif++-- | Lists the file info structure's attributes.+fileInfoListAttributes :: FileInfoClass info => info+ -> String -- ^ @nameSpace@ a file attribute key's namespace.+ -> IO [String]-- ^ returns a array of strings of all of the possible attribute types for the given @nameSpace@+fileInfoListAttributes info nameSpace =+  withUTFString nameSpace $ \ nameSpacePtr -> +  {#call g_file_info_list_attributes#} (toFileInfo info) nameSpacePtr+  >>= readUTFStringArray0++-- | Gets the attribute type for an attribute key.+fileInfoGetAttributeType :: FileInfoClass info => info+ -> String -- ^ @attribute@ a file attribute key.+ -> IO FileAttributeType -- ^ returns a 'FileAttributeType' for the given attribute, or 'FileAttributeTypeInvalid' if the key is not set.+fileInfoGetAttributeType info attribute =+  liftM (toEnum . fromIntegral) $+  withUTFString attribute $ \ attributePtr -> +  {#call g_file_info_get_attribute_type#} (toFileInfo info) attributePtr++-- | Removes all cases of attribute from info if it exists.+fileInfoRemoveAttribute :: FileInfoClass info => info+ -> String -- ^ @attribute@ a file attribute key.+ -> IO ()+fileInfoRemoveAttribute info attribute =+  withUTFString attribute $ \ attributePtr -> +  {#call g_file_info_remove_attribute#} (toFileInfo info) attributePtr++-- | 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 -- ^ @attribute@ a file attribute key.+ -> IO String -- ^ returns   a UTF-8 string associated with the given attribute. +fileInfoGetAttributeAsString info attribute =+  withUTFString attribute $ \ attributePtr -> +  {#call g_file_info_get_attribute_as_string#} (toFileInfo info) attributePtr+  >>= readUTFString++-- | Gets the attribute status for an attribute key.+fileInfoGetAttributeStatus :: FileInfoClass info => info+ -> String -- ^ @attribute@ a file attribute key.+ -> IO FileAttributeStatus -- ^ returns   a 'FileAttributeStatus' for the given attribute, or 'FileAttributeStatusUnset' if the key is invalid.+fileInfoGetAttributeStatus info attribute =+  liftM (toEnum . fromIntegral) $+  withUTFString attribute $ \ attributePtr -> +  {#call g_file_info_get_attribute_status#} (toFileInfo info) attributePtr++-- | Gets the value of a string attribute. +fileInfoGetAttributeString :: FileInfoClass info => info+ -> String -- ^ @attribute@ a file attribute key.+ -> IO String -- ^ returns   the contents of the attribute value as a string+fileInfoGetAttributeString info attribute =+  withUTFString attribute $ \ attributePtr -> +  {#call g_file_info_get_attribute_string#} (toFileInfo info) attributePtr+  >>= readUTFString++#if GLIB_CHECK_VERSION(2,22,0)+-- | Gets the value of a stringv attribute. If the attribute does not contain a stringv+fileInfoGetAttributeStringList :: FileInfoClass info => info+ -> String -- ^ @attribute@ a file attribute key.+ -> IO [String] -- ^ returns   the contents of the attribute value as a string list+fileInfoGetAttributeStringList info attribute =+  withUTFString attribute $ \ attributePtr -> +  {#call g_file_info_get_attribute_stringv#} (toFileInfo info) attributePtr+  >>= readUTFStringArray0+#endif++-- | Gets the value of a byte string attribute. +fileInfoGetAttributeByteString :: FileInfoClass info => info+ -> String -- ^ @attribute@ a file attribute key.+ -> IO ByteString -- ^ returns   the contents of the attribute value as a ByteString+fileInfoGetAttributeByteString info attribute =+  withUTFString attribute $ \ attributePtr -> do+  sPtr <- {#call g_file_info_get_attribute_byte_string#} (toFileInfo info) attributePtr+  sLen <- lengthArray0 0 sPtr+  unsafePackCStringFinalizer (castPtr sPtr) (fromIntegral sLen)+        ({#call unsafe g_free#} (castPtr sPtr))++-- | Gets the value of a boolean attribute.+fileInfoGetAttributeBool :: FileInfoClass info => info+ -> String -- ^ @attribute@ a file attribute key.+ -> IO Bool -- ^ returns   the contents of the attribute value as a bool+fileInfoGetAttributeBool info attribute =+  liftM toBool $+  withUTFString attribute $ \ attributePtr -> +  {#call g_file_info_get_attribute_boolean#} (toFileInfo info) attributePtr++-- | Gets an Word32 contained within the attribute. +fileInfoGetAttributeWord32 :: FileInfoClass info => info+ -> String -- ^ @attribute@ a file attribute key.+ -> IO Word32 -- ^ returns   the contents of the attribute value as a bool+fileInfoGetAttributeWord32 info attribute =+  liftM fromIntegral $+  withUTFString attribute $ \ attributePtr -> do+  {#call g_file_info_get_attribute_uint32#} (toFileInfo info) attributePtr+  +-- | Gets an Int32 contained within the attribute. +fileInfoGetAttributeInt32 :: FileInfoClass info => info+ -> String -- ^ @attribute@ a file attribute key.+ -> IO Int32 -- ^ returns   the contents of the attribute value as a bool+fileInfoGetAttributeInt32 info attribute =+  liftM fromIntegral $+  withUTFString attribute $ \ attributePtr -> do+  {#call g_file_info_get_attribute_int32#} (toFileInfo info) attributePtr++-- | Gets an Word64 contained within the attribute. +fileInfoGetAttributeWord64 :: FileInfoClass info => info+ -> String -- ^ @attribute@ a file attribute key.+ -> IO Word64 -- ^ returns   the contents of the attribute value as a bool+fileInfoGetAttributeWord64 info attribute =+  liftM fromIntegral $+  withUTFString attribute $ \ attributePtr -> do+  {#call g_file_info_get_attribute_uint64#} (toFileInfo info) attributePtr+  +-- | Gets an Int64 contained within the attribute. +fileInfoGetAttributeInt64 :: FileInfoClass info => info+ -> String -- ^ @attribute@ a file attribute key.+ -> IO Int64 -- ^ returns   the contents of the attribute value as a bool+fileInfoGetAttributeInt64 info attribute =+  liftM fromIntegral $+  withUTFString attribute $ \ attributePtr -> do+  {#call g_file_info_get_attribute_int64#} (toFileInfo info) attributePtr++-- | Gets the value of a GObject attribute.+fileInfoGetAttributeObject :: FileInfoClass info => info+ -> String -- ^ @attribute@ a file attribute key.+ -> IO (Maybe GObject)                 -- ^ returns   the contents of the attribute value as a object+fileInfoGetAttributeObject info attribute =+  withUTFString attribute $ \ attributePtr -> +    {#call g_file_info_get_attribute_object#} (toFileInfo info) attributePtr+    >>= \x -> maybeNull (makeNewGObject mkGObject) (return $ castPtr x)++#if GLIB_CHECK_VERSION(2,22,0)+-- | 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 -- ^ @attribute@ a file attribute key                                          + -> FileAttributeStatus -- ^ @status@    a 'FileAttributeStatus'                                        + -> IO Bool -- ^ returns   'True' if the status was changed, 'False' if the key was not set. +fileInfoSetAttributeStatus info attribute status =+   liftM toBool $+   withUTFString attribute $ \ attributePtr -> +   {#call g_file_info_set_attribute_status#}+     (toFileInfo info)+     attributePtr+     ((fromIntegral . fromEnum) status)+#endif++-- | Sets the attribute to contain the given @attrValue@, if possible.+fileInfoSetAttributeString :: FileInfoClass info => info+ -> String -- ^ @attribute@  a file attribute key. + -> String -- ^ @attrValue@ a string.             + -> IO ()+fileInfoSetAttributeString info attribute attrValue =+  withUTFString attribute $ \ attributePtr -> +  withUTFString attrValue $ \ attrValuePtr -> +  {#call g_file_info_set_attribute_string#} (toFileInfo info) attributePtr attrValuePtr++#if GLIB_CHECK_VERSION(2,22,0)+-- | Sets the attribute to contain the given @attrValue@, if possible.+fileInfoSetAttributeStringList :: FileInfoClass info => info+ -> String -- ^ @attribute@  a file attribute key. + -> [String] -- ^ @attrValue@ a string.             + -> IO ()+fileInfoSetAttributeStringList info attribute attrValue =+  withUTFString attribute $ \ attributePtr -> +  withUTFStringArray0 attrValue $ \ attrValuePtr -> +  {#call g_file_info_set_attribute_stringv#} (toFileInfo info) attributePtr attrValuePtr+#endif++-- | Sets the attribute to contain the given @attrValue@, if possible.+fileInfoSetAttributeByteString :: FileInfoClass info => info+ -> String -- ^ @attribute@  a file attribute key. + -> ByteString -- ^ @attrValue@ a string.             + -> IO ()+fileInfoSetAttributeByteString info attribute attrValue =+  withUTFString attribute $ \ attributePtr -> +  useAsCString attrValue $ \ attrValuePtr -> +  {#call g_file_info_set_attribute_byte_string#} (toFileInfo info) attributePtr attrValuePtr++-- | Sets the attribute to contain the given @attrValue@, if possible.+fileInfoSetAttributeBool :: FileInfoClass info => info+ -> String -- ^ @attribute@  a file attribute key. + -> Bool -- ^ @attrValue@ a string.             + -> IO ()+fileInfoSetAttributeBool info attribute attrValue =+  withUTFString attribute $ \ attributePtr -> +  {#call g_file_info_set_attribute_boolean#} (toFileInfo info) attributePtr (fromBool attrValue)++-- | Sets the attribute to contain the given @attrValue@, if possible.+fileInfoSetAttributeWord32 :: FileInfoClass info => info+ -> String -- ^ @attribute@  a file attribute key.       + -> Word32  -- ^ @attrValue@ an Word32+ -> IO ()+fileInfoSetAttributeWord32 info attribute attrValue =+  withUTFString attribute $ \ attributePtr -> +  {#call g_file_info_set_attribute_uint32#} (toFileInfo info) attributePtr (fromIntegral attrValue)++-- | Sets the attribute to contain the given @attrValue@, if possible.+fileInfoSetAttributeInt32 :: FileInfoClass info => info+ -> String -- ^ @attribute@  a file attribute key.       + -> Int32  -- ^ @attrValue@ an Int32+ -> IO ()+fileInfoSetAttributeInt32 info attribute attrValue =+  withUTFString attribute $ \ attributePtr -> +  {#call g_file_info_set_attribute_int32#} (toFileInfo info) attributePtr (fromIntegral attrValue)++-- | Sets the attribute to contain the given @attrValue@, if possible.+fileInfoSetAttributeWord64 :: FileInfoClass info => info+ -> String -- ^ @attribute@  a file attribute key.       + -> Word64  -- ^ @attrValue@ an Word64+ -> IO ()+fileInfoSetAttributeWord64 info attribute attrValue =+  withUTFString attribute $ \ attributePtr -> +  {#call g_file_info_set_attribute_uint64#} (toFileInfo info) attributePtr (fromIntegral attrValue)++-- | Sets the attribute to contain the given @attrValue@, if possible.+fileInfoSetAttributeInt64 :: FileInfoClass info => info+ -> String -- ^ @attribute@  a file attribute key.       + -> Int64  -- ^ @attrValue@ an Int64+ -> IO ()+fileInfoSetAttributeInt64 info attribute attrValue =+  withUTFString attribute $ \ attributePtr -> +  {#call g_file_info_set_attribute_int64#} (toFileInfo info) attributePtr (fromIntegral attrValue)++-- | Sets the attribute to contain the given @attrValue@, if possible.+fileInfoSetAttributeObject :: FileInfoClass info => info+ -> String+ -> GObject+ -> IO ()+fileInfoSetAttributeObject info attribute (GObject attrValue) =+  withUTFString attribute $ \ attributePtr -> +  withForeignPtr attrValue $ \attrValuePtr -> +  {#call g_file_info_set_attribute_object#} (toFileInfo info) attributePtr (castPtr attrValuePtr)++-- | Clears the status information from info.+--+fileInfoClearStatus :: FileInfoClass info => info -> IO ()+fileInfoClearStatus info =+  {#call g_file_info_clear_status #} (toFileInfo info)++-- | 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  -- ^ returns a 'FileType' for the given file.+fileInfoGetFileType info =+    (toEnum . fromIntegral) $ unsafePerformIO $+        {#call g_file_info_get_file_type#} (toFileInfo info) ++-- | Checks if a file is hidden.+fileInfoGetIsHidden :: FileInfoClass info => info +                    -> Bool -- ^ returns 'True' if the file is a hidden file, 'False' otherwise.+fileInfoGetIsHidden info =+    toBool $ unsafePerformIO $+          {#call g_file_info_get_is_hidden#} (toFileInfo info)++-- | Checks if a file is a backup file.+fileInfoGetIsBackup :: FileInfoClass info => info +                    -> Bool -- ^ returns 'True' if the file is a backup file, 'False' otherwise.+fileInfoGetIsBackup info =+    toBool $ unsafePerformIO $+          {#call g_file_info_get_is_backup#} (toFileInfo info)++-- | Checks if a file is a symlink file.+fileInfoGetIsSymlink :: FileInfoClass info => info +                    -> Bool -- ^ returns 'True' if the file is a symlink file, 'False' otherwise.+fileInfoGetIsSymlink info =+    toBool $ unsafePerformIO $+          {#call g_file_info_get_is_symlink#} (toFileInfo info)++-- | Gets the name for a file.+fileInfoGetName :: FileInfoClass info => info+                -> Maybe ByteString   -- ^ returns a string containing the file name. +fileInfoGetName info = +    unsafePerformIO $ do+    sPtr <- {#call g_file_info_get_name#} (toFileInfo info)+    if sPtr == nullPtr+       then return Nothing+       else do+         sLen <- lengthArray0 0 sPtr+         liftM Just $ unsafePackCStringFinalizer (castPtr sPtr) (fromIntegral sLen)+                          ({#call unsafe g_free#} (castPtr sPtr))++-- | Gets the display name for a file.+fileInfoGetDisplayName :: FileInfoClass info => info+                -> Maybe String   -- ^ returns a string containing the display name. +fileInfoGetDisplayName info =+    unsafePerformIO $+    {#call g_file_info_get_display_name#} (toFileInfo info)+    >>= maybePeek readUTFString++-- | Gets the edit name for a file.+fileInfoGetEditName :: FileInfoClass info => info+                -> Maybe String   -- ^ returns a string containing the edit name. +fileInfoGetEditName info =+    unsafePerformIO $+    {#call g_file_info_get_edit_name#} (toFileInfo info)+    >>= maybePeek readUTFString++-- | Gets the icon for a file.+fileInfoGetIcon :: FileInfoClass info => info+                -> IO Icon   -- ^ returns 'Icon' for the given info. +fileInfoGetIcon info =+    makeNewGObject mkIcon $+    {#call g_file_info_get_icon#} (toFileInfo info)++-- | Gets the file's content type.+fileInfoGetContentType :: FileInfoClass info => info+                       -> Maybe String -- ^ returns a string containing the file's content type. +fileInfoGetContentType info =+  unsafePerformIO $+  {#call g_file_info_get_content_type#} (toFileInfo info)+  >>= maybePeek peekUTFString++-- | Gets the modification time of the current info and sets it in result.+fileInfoGetModificationTime :: FileInfoClass info => info+ -> GTimeVal+fileInfoGetModificationTime info = +  unsafePerformIO $+  alloca $ \ timeValPtr -> do+     {#call g_file_info_get_modification_time#} (toFileInfo info) (castPtr timeValPtr)+     peek timeValPtr++-- | Gets the file's size.+fileInfoGetSize :: FileInfoClass info => info+                -> Int64  -- ^ returns a 'Offset' containing the file's size. +fileInfoGetSize info = +  fromIntegral $ unsafePerformIO $+  {#call g_file_info_get_size#} (toFileInfo info)++-- | Gets the symlink target for a given 'FileInfo'.+fileInfoGetSymlinkTarget :: FileInfoClass info => info+                         -> Maybe String -- ^ returns a string containing the symlink target. +fileInfoGetSymlinkTarget info =+  unsafePerformIO $+  {#call g_file_info_get_symlink_target#} (toFileInfo info)+  >>= maybePeek readUTFString++-- | Gets the entity tag for a given 'FileInfo'. See 'FileAttributeEtagValue'.+fileInfoGetEtag :: FileInfoClass info => info+                -> Maybe String -- ^ returns a string containing the value of the "etag:value" attribute. +fileInfoGetEtag info = +  unsafePerformIO $+  {#call g_file_info_get_etag#} (toFileInfo info)+  >>= maybePeek readUTFString++-- | Gets the value of the @sortOrder@ attribute from the 'FileInfo'. See+-- 'FileAttributeStandardSortOrder'.+fileInfoGetSortOrder :: FileInfoClass info => info+                     -> Int  -- ^ returns the value of the \"standard::sort_order\" attribute.+fileInfoGetSortOrder info = +  fromIntegral $ unsafePerformIO $+  {#call g_file_info_get_sort_order#} (toFileInfo info)++-- | Unsets a mask set by 'fileInfoSetAttributeMask', if one is set.+fileInfoUnsetAttributeMask :: FileInfoClass info => info -> IO ()+fileInfoUnsetAttributeMask info =+  {#call g_file_info_unset_attribute_mask#} (toFileInfo info)++-- | Sets the file type in a 'FileInfo' to type. See 'FileAttributeStandardType'.+fileInfoSetFileType :: FileInfoClass info => info -> FileType -> IO ()+fileInfoSetFileType info fType = +  {#call g_file_info_set_file_type#} +  (toFileInfo info)+  ((fromIntegral . fromEnum) fType)++-- | Sets the @isHidden@ attribute in a 'FileInfo' according to @isSymlink@. See+-- 'FileAttributeStandardIsHidden'.+fileInfoSetIsHidden :: FileInfoClass info => info -> Bool -> IO ()+fileInfoSetIsHidden info isHidden = +  {#call g_file_info_set_is_hidden#} (toFileInfo info) (fromBool isHidden)++-- | Sets the @isSymlink@ attribute in a 'FileInfo' according to @isSymlink@. See+-- 'FileAttributeStandardIsSymlink'.+fileInfoSetIsSymlink :: FileInfoClass info => info -> Bool -> IO ()+fileInfoSetIsSymlink info isSymlink = +  {#call g_file_info_set_is_symlink#} (toFileInfo info) (fromBool isSymlink)++-- | Sets the name attribute for the current 'FileInfo'. See 'FileAttributeStandardName'.+fileInfoSetName :: FileInfoClass info => info -> ByteString -> IO ()+fileInfoSetName info name = +  useAsCString name $ \ namePtr -> +  {#call g_file_info_set_name#} (toFileInfo info) namePtr++-- | Sets the display name for the current 'FileInfo'. See 'FileAttributeStandardDisplayName'.+fileInfoSetDisplayName :: FileInfoClass info => info -> String -> IO ()+fileInfoSetDisplayName info displayName = +  withUTFString displayName $ \ displayNamePtr -> +  {#call g_file_info_set_display_name#} (toFileInfo info) displayNamePtr++-- | Sets the edit name for the current 'FileInfo'. See 'FileAttributeStandardEditName'.+fileInfoSetEditName :: FileInfoClass info => info -> String -> IO ()+fileInfoSetEditName info editName = +  withUTFString editName $ \ editNamePtr -> +  {#call g_file_info_set_edit_name#} (toFileInfo info) editNamePtr++-- | Sets the icon for a given 'FileInfo'. See 'FileAttributeStandardIcon'.+fileInfoSetIcon :: FileInfoClass info => info -> Icon -> IO ()+fileInfoSetIcon info icon =+    {#call g_file_info_set_icon#} (toFileInfo info) (toIcon icon)++-- | Sets the content type attribute for a given 'FileInfo'. See 'FileAttributeStandardContentType'.+fileInfoSetContentType :: FileInfoClass info => info +                       -> String   -- ^ @contentType@ a content type. See GContentType. +                       -> IO ()+fileInfoSetContentType info contentType = +  withUTFString contentType $ \ contentTypePtr -> +  {#call g_file_info_set_content_type#} (toFileInfo info) contentTypePtr++-- | Sets the 'FileAttributeTimeModified' attribute in the file info to the given time value.+fileInfoSetModificationTime :: FileInfoClass info => info+ -> GTimeVal+ -> IO ()+fileInfoSetModificationTime info mtime =+  with mtime $ \ mtimePtr -> +  {#call g_file_info_set_modification_time#} (toFileInfo info) (castPtr mtimePtr)++-- | Sets the 'FileAttributeStandardSize' attribute in the file info to the given size.+fileInfoSetSize :: FileInfoClass info => info +                -> Int64  -- ^ @size@ a goffset containing the file's size. +                -> IO ()+fileInfoSetSize info size =+  {#call g_file_info_set_size#} (toFileInfo info) (fromIntegral size)++-- | 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 -> +--   {#call g_file_info_set_symlink_target#} (toFileInfo info) symlinkTargetPtr++-- | Sets the sort order attribute in the file info structure. See 'FileAttributeStandardSortOrder'.+fileInfoSetSortOrder :: FileInfoClass info => info +                     -> Int   -- ^ @sortOrder@ a sort order integer. +                     -> IO ()+fileInfoSetSortOrder info sortOrder =+  {#call g_file_info_set_sort_order#} (toFileInfo info) (fromIntegral sortOrder)
+ System/GIO/File/FileMonitor.chs view
@@ -0,0 +1,109 @@+{-# LANGUAGE CPP #-}+--  GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*-+--+--  Author : Andy Stewart+--  Created: 30-Apirl-2010+--+--  Copyright (c) 2010 Andy Stewart+--+--  This library is free software: you can redistribute it and/or+--  modify it under the terms of the GNU Lesser General Public License+--  as published by the Free Software Foundation, either version 3 of+--  the License, or (at your option) any later version.+--  +--  This library is distributed in the hope that it will be useful,+--  but WITHOUT ANY WARRANTY; without even the implied warranty of+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU+--  Lesser General Public License for more details.+--  +--  You should have received a copy of the GNU Lesser General Public+--  License along with this program.  If not, see+--  <http://www.gnu.org/licenses/>.+--  +--  GIO, the C library which this Haskell library depends on, is+--  available under LGPL Version 2. The documentation included with+--  this library is based on the original GIO documentation.+--  +-- | Maintainer  : gtk2hs-devel@lists.sourceforge.net+--   Stability   : alpha+--   Portability : portable (depends on GHC)+module System.GIO.File.FileMonitor (+-- * Details+--+-- | Monitors a file or directory for changes.+-- +-- To obtain a 'FileMonitor' for a file or directory, use 'fileMonitor', or+-- 'fileMonitorDirectory' .+-- +-- To get informed about changes to the file or directory you are monitoring, connect to the "changed"+-- signal. The signal will be emitted in the thread-default main context of the thread that the monitor+-- was created in (though if the global default main context is blocked, this may cause notifications+-- to be blocked even if the thread-default context is still running).++-- * Types+   FileMonitor(..),+   FileMonitorClass,++-- * Enums+   FileMonitorEvent(..),++-- * Methods  +    fileMonitorCancel,+    fileMonitorIsCancelled,++-- * Attributes+    fileMonitorCancelled,+    fileMonitorRateLimit,++-- * Signals+    fileMonitorChanged,+    ) where++import Control.Monad+import System.GIO.Enums+import System.Glib.Attributes+import System.Glib.FFI+import System.Glib.Flags+import System.Glib.GError+import System.Glib.GObject+import System.Glib.Properties+import System.Glib.Signals+import System.Glib.UTFString+{#import System.GIO.Signals#}+{#import System.GIO.Types#}++--------------------+-- Methods+-- | Cancels a file monitor.+fileMonitorCancel :: FileMonitorClass monitor => monitor+                  -> IO Bool  -- ^ returns 'True' if monitor was cancelled.+fileMonitorCancel monitor =+  liftM toBool $ {#call g_file_monitor_cancel #} (toFileMonitor monitor)++-- | Returns whether the monitor is canceled.+fileMonitorIsCancelled :: FileMonitorClass monitor => monitor+                       -> IO Bool -- ^ returns 'True' if monitor is canceled. 'False' otherwise.+fileMonitorIsCancelled monitor = +  liftM toBool $ {#call g_file_monitor_is_cancelled#} (toFileMonitor monitor)++--------------------+-- Attributes+-- | Whether the monitor has been cancelled.+-- +-- Default value: 'False'+fileMonitorCancelled :: FileMonitorClass monitor => ReadAttr monitor Bool+fileMonitorCancelled = readAttrFromBoolProperty "cancelled"++-- | The limit of the monitor to watch for changes, in milliseconds.+-- +-- Allowed values: >= 0+-- +-- Default value: 800+fileMonitorRateLimit :: FileMonitorClass monitor => Attr monitor Int+fileMonitorRateLimit = newAttrFromIntProperty "rate-limit"++--------------------+-- Signals+fileMonitorChanged :: FileMonitorClass monitor => Signal monitor (Maybe File -> Maybe File -> FileMonitorEvent -> IO ())+fileMonitorChanged = Signal (connect_MOBJECT_MOBJECT_ENUM__NONE "changed")+
+ System/GIO/File/IOError.chs view
@@ -0,0 +1,53 @@+{-# LANGUAGE CPP #-}+--  GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*-+--+--  Author : Andy Stewart+--  Created: 30-Apirl-2010+--+--  Copyright (c) 2010 Andy Stewart+--+--  This library is free software: you can redistribute it and/or+--  modify it under the terms of the GNU Lesser General Public License+--  as published by the Free Software Foundation, either version 3 of+--  the License, or (at your option) any later version.+--  +--  This library is distributed in the hope that it will be useful,+--  but WITHOUT ANY WARRANTY; without even the implied warranty of+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU+--  Lesser General Public License for more details.+--  +--  You should have received a copy of the GNU Lesser General Public+--  License along with this program.  If not, see+--  <http://www.gnu.org/licenses/>.+--  +--  GIO, the C library which this Haskell library depends on, is+--  available under LGPL Version 2. The documentation included with+--  this library is based on the original GIO documentation.+--  +-- | Maintainer  : gtk2hs-devel@lists.sourceforge.net+--   Stability   : alpha+--   Portability : portable (depends on GHC)+module System.GIO.File.IOError (+-- * Details+--+-- | Contains helper functions for reporting errors to the user.++-- * Enums+   IOErrorEnum(..),++-- * Methods  +   ioErrorFromErrno,+   ) where++import Control.Monad+import System.GIO.Enums+import System.Glib.FFI++--------------------+-- Methods++-- | Converts errno.h error codes into GIO error codes.+ioErrorFromErrno :: Int  -- ^ @err@ Error number as defined in errno.h.                    +                 -> IO IOErrorEnum  -- ^ returns 'IOErrorEnum' value for the given errno.h error number. +ioErrorFromErrno err =+  liftM (toEnum . fromIntegral) $ {#call g_io_error_from_errno#} (fromIntegral err)
+ System/GIO/File/MountOperation.chs view
@@ -0,0 +1,183 @@+{-# LANGUAGE CPP #-}+--  GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*-+--+--  Author : Andy Stewart+--  Created: 30-Apirl-2010+--+--  Copyright (c) 2010 Andy Stewart+--+--  This library is free software: you can redistribute it and/or+--  modify it under the terms of the GNU Lesser General Public License+--  as published by the Free Software Foundation, either version 3 of+--  the License, or (at your option) any later version.+--  +--  This library is distributed in the hope that it will be useful,+--  but WITHOUT ANY WARRANTY; without even the implied warranty of+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU+--  Lesser General Public License for more details.+--  +--  You should have received a copy of the GNU Lesser General Public+--  License along with this program.  If not, see+--  <http://www.gnu.org/licenses/>.+--  +--  GIO, the C library which this Haskell library depends on, is+--  available under LGPL Version 2. The documentation included with+--  this library is based on the original GIO documentation.+--  +-- | Maintainer  : gtk2hs-devel@lists.sourceforge.net+--   Stability   : alpha+--   Portability : portable (depends on GHC)+module System.GIO.File.MountOperation (+-- * Details+--+-- | 'MountOperation' provides a mechanism for interacting with the user. It can be used for+-- authenticating mountable operations, such as loop mounting files, hard drive partitions or server+-- locations. It can also be used to ask the user questions or show a list of applications preventing+-- unmount or eject operations from completing.+-- +-- Note that 'Mount'Operation is used for more than just 'Mount' objects – for example it is also used in+-- 'driveStart'.+-- +-- Users should instantiate a subclass of this that implements all the various callbacks to show the+-- required dialogs, such as 'MountOperation'. If no user interaction is desired (for example when+-- automounting filesystems at login time), usually 'Nothing' can be passed, see each method taking a+-- 'MountOperation' for details.++-- * Types+   MountOperation(..),+   MountOperationClass,++-- * Enums+   MountOperationResult(..),+   AskPasswordFlags(..),+   PasswordSave(..),++-- * Methods+    mountOperationNew,+    mountOperationReply,++-- * Attributes+    mountOperationAnonymous,+    mountOperationChoice,+    mountOperationDomain,+    mountOperationPassword,+    mountOperationPasswordSave,+    mountOperationUsername,++-- * Signals+#if GLIB_CHECK_VERSION(2,20,0)    +    mountOperationAborted,+    mountOperationAskPassword,+    -- askQuestion,+    mountOperationReplySignal,+    -- showProcesses,+#endif+    ) where++#include <gio/gio.h>++import Control.Monad+import System.GIO.Enums+import System.Glib.Attributes+import System.Glib.FFI+import System.Glib.Flags+import System.Glib.GError+import System.Glib.GObject+import System.Glib.Properties+import System.Glib.Signals+import System.Glib.UTFString+{#import System.GIO.Signals#}+{#import System.GIO.Types#}++{# context lib = "gio" prefix = "g" #}++--------------------+-- Methods++-- | Creates a new mount operation.+mountOperationNew :: IO MountOperation+mountOperationNew =+    wrapNewGObject mkMountOperation $+    {# call g_mount_operation_new #}++-- | Emits the "reply" signal.+mountOperationReply :: MountOperationClass op => op -> MountOperationResult -> IO ()+mountOperationReply op result = +  {#call g_mount_operation_reply#} (toMountOperation op) ((fromIntegral . fromEnum) result)++--------------------+-- Attributes+-- | Whether to use an anonymous user when authenticating.+-- +-- Default value: 'False'+mountOperationAnonymous :: MountOperationClass op => Attr op Bool+mountOperationAnonymous = newAttrFromBoolProperty "anonymous"++-- | 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+mountOperationChoice = newAttrFromIntProperty "choice"++-- | The domain to use for the mount operation.+-- +-- Default value: \"\"+mountOperationDomain :: MountOperationClass op => Attr op String+mountOperationDomain = newAttrFromStringProperty "domain"++-- | The password that is used for authentication when carrying out the mount operation.+-- +-- Default value: \"\"+mountOperationPassword :: MountOperationClass op => Attr op String+mountOperationPassword = newAttrFromStringProperty "password"++-- | Determines if and how the password information should be saved.+-- +-- Default value: 'PasswordSaveNever'+mountOperationPasswordSave :: MountOperationClass op => Attr op PasswordSave+mountOperationPasswordSave = newAttrFromEnumProperty "password-save"+               {#call pure unsafe g_password_save_get_type #}++-- | The user name that is used for authentication when carrying out the mount operation.+-- +-- Default value: \"\"+mountOperationUsername :: MountOperationClass op => Attr op String+mountOperationUsername = newAttrFromStringProperty "username"++--------------------+-- Signals+#if GLIB_CHECK_VERSION(2,20,0)    +-- | 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 ())+mountOperationAborted = Signal (connect_NONE__NONE "aborted")+#endif++-- | 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 ())+mountOperationAskPassword = Signal (connect_STRING_STRING_STRING_ENUM__NONE "ask-password")++-- | 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 ())+mountOperationReplySignal = Signal (connect_ENUM__NONE "reply")+
+ System/GIO/Icons/Emblem.chs view
@@ -0,0 +1,98 @@+{-# LANGUAGE CPP #-}+--  GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*-+--+--  Author : Andy Stewart+--  Created: 30-Apirl-2010+--+--  Copyright (c) 2010 Andy Stewart+--+--  This library is free software: you can redistribute it and/or+--  modify it under the terms of the GNU Lesser General Public License+--  as published by the Free Software Foundation, either version 3 of+--  the License, or (at your option) any later version.+--  +--  This library is distributed in the hope that it will be useful,+--  but WITHOUT ANY WARRANTY; without even the implied warranty of+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU+--  Lesser General Public License for more details.+--  +--  You should have received a copy of the GNU Lesser General Public+--  License along with this program.  If not, see+--  <http://www.gnu.org/licenses/>.+--  +--  GIO, the C library which this Haskell library depends on, is+--  available under LGPL Version 2. The documentation included with+--  this library is based on the original GIO documentation.+--  +-- | Maintainer  : gtk2hs-devel@lists.sourceforge.net+--   Stability   : alpha+--   Portability : portable (depends on GHC)+module System.GIO.Icons.Emblem (+-- * Details+--+-- | 'Emblem' is an implementation of 'Icon' that supports having an emblem, which is an icon with+-- additional properties. It can than be added to a 'EmblemedIcon'.+-- +-- Currently, only metainformation about the emblem's origin is supported. More may be added in the+-- future.++#if GLIB_CHECK_VERSION(2,18,0)+-- * Types+    Emblem(..),+    EmblemClass,++-- * Enums+    EmblemOrigin (..),++-- * Methods    +    emblemNew,+    emblemNewWithOrigin,+    emblemGetIcon,+    emblemGetOrigin,+#endif+    ) where++import Control.Monad+import System.GIO.Enums+import System.Glib.FFI+import System.Glib.Flags+import System.Glib.GError+import System.Glib.GObject+import System.Glib.UTFString+{#import System.GIO.Types#}++{# context lib = "gio" prefix = "g" #}++#if GLIB_CHECK_VERSION(2,18,0)+-------------------+-- Methods+-- | Creates a new emblem for icon.+emblemNew :: IconClass icon => icon -> IO Emblem+emblemNew icon =+    wrapNewGObject mkEmblem $+    {#call g_emblem_new#} (toIcon icon) ++-- | Creates a new emblem for icon.+emblemNewWithOrigin :: IconClass icon + => icon  -- ^ @icon@    a 'Icon' containing the icon.                      + -> EmblemOrigin  -- ^ @origin@  a 'EmblemOrigin' enum defining the emblem's origin + -> IO Emblem+emblemNewWithOrigin icon origin =+    wrapNewGObject mkEmblem $+    {#call g_emblem_new_with_origin#} (toIcon icon) ((fromIntegral . fromEnum) origin)++-- | Gives back the icon from emblem.+emblemGetIcon :: EmblemClass emblem + => emblem  -- ^ @emblem@  a 'Emblem' from which the icon should be extracted.                                     + -> IO Icon -- ^ returns a 'Icon'. The returned object belongs to the emblem and should not be modified or freed.+emblemGetIcon emblem =+    makeNewGObject mkIcon $+    {#call g_emblem_get_icon#} (toEmblem emblem)++-- | Gets the origin of the emblem.+emblemGetOrigin :: EmblemClass emblem => emblem+ -> IO EmblemOrigin+emblemGetOrigin emblem =+  liftM (toEnum . fromIntegral) $+  {#call g_emblem_get_origin#} (toEmblem emblem)+#endif
+ System/GIO/Icons/EmblemedIcon.chs view
@@ -0,0 +1,98 @@+{-# LANGUAGE CPP #-}+--  GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*-+--+--  Author : Andy Stewart+--  Created: 30-Apirl-2010+--+--  Copyright (c) 2010 Andy Stewart+--+--  This library is free software: you can redistribute it and/or+--  modify it under the terms of the GNU Lesser General Public License+--  as published by the Free Software Foundation, either version 3 of+--  the License, or (at your option) any later version.+--  +--  This library is distributed in the hope that it will be useful,+--  but WITHOUT ANY WARRANTY; without even the implied warranty of+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU+--  Lesser General Public License for more details.+--  +--  You should have received a copy of the GNU Lesser General Public+--  License along with this program.  If not, see+--  <http://www.gnu.org/licenses/>.+--  +--  GIO, the C library which this Haskell library depends on, is+--  available under LGPL Version 2. The documentation included with+--  this library is based on the original GIO documentation.+--  +-- | Maintainer  : gtk2hs-devel@lists.sourceforge.net+--   Stability   : alpha+--   Portability : portable (depends on GHC)+module System.GIO.Icons.EmblemedIcon (+-- * Details+--+-- | 'EmblemedIcon' is an implementation of 'Icon' that supports adding an emblem to an icon. Adding+-- multiple emblems to an icon is ensured via 'emblemedIconAddEmblem'.+-- +-- Note that 'Emblem'edIcon allows no control over the position of the emblems. See also 'Emblem' for+-- more information.++#if GLIB_CHECK_VERSION(2,18,0)+-- * Types  +    EmblemedIcon(..),+    EmblemedIconClass,++-- * Methods+   emblemedIconNew,+   emblemedIconGetIcon,+   emblemedIconGetEmblems,+   emblemedIconAddEmblem,+#endif    +    ) where++import Control.Monad+import System.GIO.Enums+import System.Glib.FFI+import System.Glib.Flags+import System.Glib.GError+import System.Glib.GList+import System.Glib.GObject+import System.Glib.UTFString+{#import System.GIO.Types#}++{# context lib = "gio" prefix = "g" #}++#if GLIB_CHECK_VERSION(2,18,0)+-------------------+-- Methods+-- | Creates a new emblemed icon for icon with the emblem emblem.+emblemedIconNew :: (IconClass icon, EmblemClass emblem) => icon -> emblem -> IO EmblemedIcon+emblemedIconNew icon emblem =+  {#call g_emblemed_icon_new#} +    (toIcon icon) (toEmblem emblem)+  >>= (constructNewGObject mkEmblemedIcon . return) . castPtr++-- | Gets the main icon for emblemed.+emblemedIconGetIcon :: EmblemedIconClass emblemed => emblemed+ -> IO Icon  -- ^ returns  a 'Icon' that is owned by emblemed +emblemedIconGetIcon emblemed =+    makeNewGObject mkIcon $+    {#call g_emblemed_icon_get_icon#} (toEmblemedIcon emblemed) ++-- | Gets the list of emblems for the icon.+emblemedIconGetEmblems :: EmblemedIconClass emblemed => emblemed+ -> IO [Emblem] -- ^ returns  a list of 'Emblem' s that is owned by emblemed +emblemedIconGetEmblems emblemed = do+  glistPtr <- {#call g_emblemed_icon_get_emblems#} (toEmblemedIcon emblemed)+  emblemPtrs <- readGList glistPtr+  mapM (makeNewGObject mkEmblem . return) emblemPtrs++-- | Adds emblem to the 'Emblem'.+emblemedIconAddEmblem :: EmblemedIconClass emblemed => emblemed + -> Emblem+ -> IO ()+emblemedIconAddEmblem emblemed emblem = +  {#call g_emblemed_icon_add_emblem#}+    (toEmblemedIcon emblemed)+    emblem++#endif
+ System/GIO/Icons/FileIcon.chs view
@@ -0,0 +1,67 @@+{-# LANGUAGE CPP #-}+--  GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*-+--+--  Author : Andy Stewart+--  Created: 30-Apirl-2010+--+--  Copyright (c) 2010 Andy Stewart+--+--  This library is free software: you can redistribute it and/or+--  modify it under the terms of the GNU Lesser General Public License+--  as published by the Free Software Foundation, either version 3 of+--  the License, or (at your option) any later version.+--  +--  This library is distributed in the hope that it will be useful,+--  but WITHOUT ANY WARRANTY; without even the implied warranty of+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU+--  Lesser General Public License for more details.+--  +--  You should have received a copy of the GNU Lesser General Public+--  License along with this program.  If not, see+--  <http://www.gnu.org/licenses/>.+--  +--  GIO, the C library which this Haskell library depends on, is+--  available under LGPL Version 2. The documentation included with+--  this library is based on the original GIO documentation.+--  +-- | Maintainer  : gtk2hs-devel@lists.sourceforge.net+--   Stability   : alpha+--   Portability : portable (depends on GHC)+module System.GIO.Icons.FileIcon (+-- * Details+--+-- | 'FileIcon' specifies an icon by pointing to an image file to be used as icon.++-- * Types  +    FileIcon(..),+    FileIconClass,++-- * Methods+    fileIconNew,+    fileIconGetFile,+    ) where++import Control.Monad+import System.GIO.Enums+import System.Glib.FFI+import System.Glib.Flags+import System.Glib.GError+import System.Glib.GObject+import System.Glib.UTFString+{#import System.GIO.Types#}++{# context lib = "gio" prefix = "g" #}++-------------------+-- Methods+-- | Creates a new icon for a file.+fileIconNew :: FileClass file => file -> IO FileIcon+fileIconNew file =+  {#call g_file_icon_new#} (toFile file)+  >>= (wrapNewGObject mkFileIcon . return) . castPtr++-- | Gets the 'File' associated with the given icon.+fileIconGetFile :: FileIconClass icon => icon -> IO File+fileIconGetFile icon =+  makeNewGObject mkFile $+  {#call g_file_icon_get_file#} (toFileIcon icon)
+ System/GIO/Icons/Icon.chs view
@@ -0,0 +1,113 @@+{-# LANGUAGE CPP #-}+--  GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*-+--+--  Author : Andy Stewart+--  Created: 30-Apirl-2010+--+--  Copyright (c) 2010 Andy Stewart+--+--  This library is free software: you can redistribute it and/or+--  modify it under the terms of the GNU Lesser General Public License+--  as published by the Free Software Foundation, either version 3 of+--  the License, or (at your option) any later version.+--  +--  This library is distributed in the hope that it will be useful,+--  but WITHOUT ANY WARRANTY; without even the implied warranty of+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU+--  Lesser General Public License for more details.+--  +--  You should have received a copy of the GNU Lesser General Public+--  License along with this program.  If not, see+--  <http://www.gnu.org/licenses/>.+--  +--  GIO, the C library which this Haskell library depends on, is+--  available under LGPL Version 2. The documentation included with+--  this library is based on the original GIO documentation.+--  +-- | Maintainer  : gtk2hs-devel@lists.sourceforge.net+--   Stability   : alpha+--   Portability : portable (depends on GHC)+module System.GIO.Icons.Icon (+-- * Details+--+-- | 'Icon' is a very minimal interface for icons. It provides functions for checking the equality of two+-- icons, hashing of icons and serializing an icon to and from strings.+-- +-- 'Icon' does not provide the actual pixmap for the icon as this is out of GIO's scope, however+-- implementations of 'Icon' may contain the name of an icon (see 'ThemedIcon'), or the path to an icon+-- (see GLoadableIcon).+-- +-- To obtain a hash of a 'Icon', see 'iconHash'.+-- +-- To check if two 'Icon's are equal, see 'iconEqual'.+-- +-- For serializing a 'Icon', use 'iconToString'.+-- +-- 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'.++-- * Types+    Icon(..),+    IconClass,++-- * Methods+    iconEqual,+#if GLIB_CHECK_VERSION(2,20,0)+    iconToString,+    iconNewForString,+#endif+    ) where++import Control.Monad+import Data.ByteString (ByteString)+import Data.ByteString (useAsCString)+import Data.ByteString.Unsafe (unsafePackCStringFinalizer)+import System.GIO.Enums+import System.Glib.FFI+import System.Glib.Flags+import System.Glib.GError+import System.Glib.GObject+import System.Glib.UTFString+{#import System.GIO.Types#}++{# context lib = "gio" prefix = "g" #}++-- | Checks if two icons are equal.+iconEqual :: (IconClass icon1, IconClass icon2) => icon1 -> icon2+ -> IO Bool -- ^ returns 'True' if icon1 is equal to icon2. 'False' otherwise. +iconEqual icon1 icon2 =+   liftM toBool $+   {#call g_icon_equal#} (toIcon icon1) (toIcon icon2)++#if GLIB_CHECK_VERSION(2,20,0)+-- | 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+-- +--   * If icon is a 'FileIcon', the returned string is a native path (such as /path/to/my icon.png)+--     without escaping if the 'File' for icon is a native file. If the file is not native, the returned+--     string is the result of 'fileGetUri'.+--    +--   * If icon is a 'ThemedIcon' with exactly one name, the encoding is simply the name (such as+--   network-server).+iconToString :: IconClass icon => icon + -> IO ByteString+iconToString icon = do+   sPtr <- {#call g_icon_to_string#} (toIcon icon)  +   sLen <- lengthArray0 0 sPtr+   unsafePackCStringFinalizer (castPtr sPtr) (fromIntegral sLen)+        ({#call unsafe g_free#} (castPtr sPtr))++-- | 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+iconNewForString str =+    wrapNewGObject mkIcon $+    useAsCString str $ \ strPtr -> +    propagateGError ({# call g_icon_new_for_string #} strPtr) +#endif
+ System/GIO/Icons/ThemedIcon.chs view
@@ -0,0 +1,105 @@+{-# LANGUAGE CPP #-}+--  GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*-+--+--  Author : Andy Stewart+--  Created: 30-Apirl-2010+--+--  Copyright (c) 2010 Andy Stewart+--+--  This library is free software: you can redistribute it and/or+--  modify it under the terms of the GNU Lesser General Public License+--  as published by the Free Software Foundation, either version 3 of+--  the License, or (at your option) any later version.+--  +--  This library is distributed in the hope that it will be useful,+--  but WITHOUT ANY WARRANTY; without even the implied warranty of+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU+--  Lesser General Public License for more details.+--  +--  You should have received a copy of the GNU Lesser General Public+--  License along with this program.  If not, see+--  <http://www.gnu.org/licenses/>.+--  +--  GIO, the C library which this Haskell library depends on, is+--  available under LGPL Version 2. The documentation included with+--  this library is based on the original GIO documentation.+--  +-- | Maintainer  : gtk2hs-devel@lists.sourceforge.net+--   Stability   : alpha+--   Portability : portable (depends on GHC)+module System.GIO.Icons.ThemedIcon (+-- * Details+--+-- | 'ThemeIcon' specifies an icon by pointing to an image file to be used as icon.++-- * Types  +    ThemedIcon(..),+    ThemedIconClass,++-- * Methods+    themedIconNew,+    themedIconNewFromNames,+    themedIconPrependName,+    themedIconAppendName,+    themedIconGetNames,+    ) where++import Control.Monad+import Data.ByteString (ByteString)+import Data.ByteString (useAsCString)+import Data.ByteString.Unsafe (unsafePackCStringFinalizer)+import System.GIO.Enums+import System.Glib.FFI+import System.Glib.Flags+import System.Glib.GError+import System.Glib.GObject+import System.Glib.UTFString+{#import System.GIO.Types#}++{# context lib = "gio" prefix = "g" #}++-------------------+-- Methods+-- | Creates a new icon for a file.+themedIconNew :: ByteString -- ^ @iconname@ a string containing an icon name. + -> IO ThemedIcon+themedIconNew iconName =+  useAsCString iconName $ \ iconNamePtr -> +  {#call g_themed_icon_new#} iconNamePtr+  >>= (wrapNewGObject mkThemedIcon . return) . castPtr++-- | Creates a new themed icon for iconnames.+themedIconNewFromNames :: +  [String]  -- ^ @iconnames@ an array of strings containing icon names.                              + -> IO ThemedIcon+themedIconNewFromNames iconNames = do+  let len = if null iconNames then (-1) else length iconNames+  withUTFStringArray iconNames $ \ iconNamesPtr -> +      {#call g_themed_icon_new_from_names#} iconNamesPtr (fromIntegral len)+      >>= (wrapNewGObject mkThemedIcon . return) . castPtr++#if GLIB_CHECK_VERSION(2,18,0)+-- | Prepend a name to the list of icons from within icon.+themedIconPrependName :: ThemedIconClass icon => icon + -> String   -- ^ @iconname@ name of icon to prepend to list of icons from within icon. + -> IO ()+themedIconPrependName icon iconname =+  withUTFString iconname $ \ iconnamePtr -> +  {#call g_themed_icon_prepend_name#} (toThemedIcon icon) iconnamePtr+#endif++-- | Append a name to the list of icons from within icon.+themedIconAppendName :: ThemedIconClass icon => icon + -> String   -- ^ @iconname@ name of icon to append to list of icons from within icon. + -> IO ()+themedIconAppendName icon iconname =+  withUTFString iconname $ \ iconnamePtr -> +  {#call g_themed_icon_append_name#} (toThemedIcon icon) iconnamePtr++-- | Gets the names of icons from within icon.+themedIconGetNames :: ThemedIconClass icon => icon+ -> IO [String] -- ^ returns a list of icon names. +themedIconGetNames icon = +  {#call g_themed_icon_get_names#} (toThemedIcon icon)+  >>= readUTFStringArray0+
System/GIO/Signals.chs view
@@ -41,13 +41,18 @@   module System.Glib.Signals,    connect_NONE__NONE,+  connect_STRING_STRING_STRING_ENUM__NONE,+  connect_OBJECT_OBJECT_ENUM__NONE,+  connect_ENUM__NONE,+  connect_OBJECT__NONE,+  connect_MOBJECT_MOBJECT_ENUM__NONE,      ) where  import Control.Monad	(liftM)  import System.Glib.FFI-import System.Glib.UTFString   (peekUTFString)+import System.Glib.UTFString   (peekUTFString,maybePeekUTFString) import System.Glib.GError      (failOnGError) {#import System.Glib.Signals#} {#import System.Glib.GObject#} @@ -72,4 +77,72 @@         action _ =           failOnGError $           user++connect_STRING_STRING_STRING_ENUM__NONE :: +  (Enum d, GObjectClass obj) => SignalName ->+  ConnectAfter -> obj ->+  (String -> String -> String -> d -> IO ()) ->+  IO (ConnectId obj)+connect_STRING_STRING_STRING_ENUM__NONE signal after obj user =+  connectGeneric signal after obj action+  where action :: Ptr GObject -> CString -> CString -> CString -> Int -> IO ()+        action _ str1 str2 str3 enum4 =+          failOnGError $+          peekUTFString str3 >>= \str3' ->+          peekUTFString str2 >>= \str2' ->+          peekUTFString str1 >>= \str1' ->+          user str1' str2' str3' (toEnum enum4)++connect_OBJECT_OBJECT_ENUM__NONE :: +  (GObjectClass a', GObjectClass b', Enum c, GObjectClass obj) => SignalName ->+  ConnectAfter -> obj ->+  (a' -> b' -> c -> IO ()) ->+  IO (ConnectId obj)+connect_OBJECT_OBJECT_ENUM__NONE signal after obj user =+  connectGeneric signal after obj action+  where action :: Ptr GObject -> Ptr GObject -> Ptr GObject -> Int -> IO ()+        action _ obj1 obj2 enum3 =+          failOnGError $+          makeNewGObject (GObject, objectUnref) (return obj2) >>= \obj2' ->+          makeNewGObject (GObject, objectUnref) (return obj1) >>= \obj1' ->+          user (unsafeCastGObject obj1') (unsafeCastGObject obj2') (toEnum enum3)++connect_ENUM__NONE :: +  (Enum a, GObjectClass obj) => SignalName ->+  ConnectAfter -> obj ->+  (a -> IO ()) ->+  IO (ConnectId obj)+connect_ENUM__NONE signal after obj user =+  connectGeneric signal after obj action+  where action :: Ptr GObject -> Int -> IO ()+        action _ enum1 =+          failOnGError $+          user (toEnum enum1)++connect_OBJECT__NONE :: +  (GObjectClass a', GObjectClass obj) => SignalName ->+  ConnectAfter -> obj ->+  (a' -> IO ()) ->+  IO (ConnectId obj)+connect_OBJECT__NONE signal after obj user =+  connectGeneric signal after obj action+  where action :: Ptr GObject -> Ptr GObject -> IO ()+        action _ obj1 =+          failOnGError $+          makeNewGObject (GObject, objectUnref) (return obj1) >>= \obj1' ->+          user (unsafeCastGObject obj1')++connect_MOBJECT_MOBJECT_ENUM__NONE :: +  (GObjectClass a', GObjectClass b', Enum c, GObjectClass obj) => SignalName ->+  ConnectAfter -> obj ->+  (Maybe a' -> Maybe b' -> c -> IO ()) ->+  IO (ConnectId obj)+connect_MOBJECT_MOBJECT_ENUM__NONE signal after obj user =+  connectGeneric signal after obj action+  where action :: Ptr GObject -> Ptr GObject -> Ptr GObject -> Int -> IO ()+        action _ obj1 obj2 enum3 =+          failOnGError $+          maybeNull (makeNewGObject (GObject, objectUnref)) (return obj2) >>= \obj2' ->+          maybeNull (makeNewGObject (GObject, objectUnref)) (return obj1) >>= \obj1' ->+          user (liftM unsafeCastGObject obj1') (liftM unsafeCastGObject obj2') (toEnum enum3) 
+ System/GIO/Volumes/Drive.chs view
@@ -0,0 +1,388 @@+{-# LANGUAGE CPP #-}+--  GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*-+--+--  Author : Andy Stewart+--  Created: 30-Apirl-2010+--+--  Copyright (c) 2010 Andy Stewart+--+--  This library is free software: you can redistribute it and/or+--  modify it under the terms of the GNU Lesser General Public License+--  as published by the Free Software Foundation, either version 3 of+--  the License, or (at your option) any later version.+--  +--  This library is distributed in the hope that it will be useful,+--  but WITHOUT ANY WARRANTY; without even the implied warranty of+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU+--  Lesser General Public License for more details.+--  +--  You should have received a copy of the GNU Lesser General Public+--  License along with this program.  If not, see+--  <http://www.gnu.org/licenses/>.+--  +--  GIO, the C library which this Haskell library depends on, is+--  available under LGPL Version 2. The documentation included with+--  this library is based on the original GIO documentation.+--  +-- | Maintainer  : gtk2hs-devel@lists.sourceforge.net+--   Stability   : alpha+--   Portability : portable (depends on GHC)+module System.GIO.Volumes.Drive (+-- * Details+--+-- | 'Drive' - this represent a piece of hardware connected to the machine. It's generally only created+-- for removable hardware or hardware with removable media.+-- +-- 'Drive' is a container class for 'Volume' objects that stem from the same piece of media. As such,+-- 'Drive' abstracts a drive with (or without) removable media and provides operations for querying+-- whether media is available, determing whether media change is automatically detected and ejecting+-- the media.+-- +-- If the 'Drive' reports that media isn't automatically detected, one can poll for media; typically one+-- should not do this periodically as a poll for media operation is potententially expensive and may+-- spin up the drive creating noise.+-- +-- 'Drive' supports starting and stopping drives with authentication support for the former. This can be+-- used to support a diverse set of use cases including connecting/disconnecting iSCSI devices,+-- powering down external disk enclosures and starting/stopping multi-disk devices such as RAID+-- devices. Note that the actual semantics and side-effects of starting/ stopping a 'Drive' may vary+-- according to implementation. To choose the correct verbs in e.g. a file manager, use+-- 'driveGetStartStopType'.+-- +-- For porting from GnomeVFS note that there is no equivalent of 'Drive' in that API.++-- * Types+    Drive(..),+    DriveClass,++-- * Enums,+    DriveStartStopType (..),+    DriveStartFlags (..),++-- * Methods+    driveGetName,+    driveGetIcon,+    driveHasVolumes,+    driveGetVolumes,+    driveCanEject,+#if GLIB_CHECK_VERSION(2,22,0)+    driveGetStartStopType,+    driveCanStart,+    driveCanStartDegraded,+    driveCanStop,+#endif+    driveCanPollForMedia,+    drivePollForMedia,+    driveHasMedia,+    driveIsMediaCheckAutomatic,+    driveIsMediaRemovable,+#if GLIB_CHECK_VERSION(2,22,0)+    driveEjectWithOperation,+    driveEjectWithOperationFinish,+    driveStart,+    driveStartFinish,+    driveStopFinish,+#endif+    driveEnumerateIdentifiers,+    driveGetIdentifier,+    +-- * Signals    +    driveChanged,+    driveDisconnected,+    driveEjectButton,+#if GLIB_CHECK_VERSION(2,22,0)+    driveStopButton,+#endif+    ) where++import Control.Monad+import Data.Maybe (fromMaybe)+import System.GIO.Enums+import System.Glib.Attributes+import System.Glib.FFI+import System.Glib.Flags+import System.Glib.GError+import System.Glib.GList+import System.Glib.GObject+import System.Glib.Properties+import System.Glib.Signals+import System.Glib.UTFString+{#import System.GIO.Async.AsyncResult#}+{#import System.GIO.Signals#}+{#import System.GIO.Types#}++{# context lib = "gio" prefix = "g" #}++--------------------+-- Methods+-- | Gets the name of drive.+driveGetName :: DriveClass drive => drive+ -> IO String  -- ^ returns the name for the given drive. +driveGetName drive = +  {#call g_drive_get_name#} (toDrive drive) +  >>= readUTFString++-- | Gets the icon for drive.+driveGetIcon :: DriveClass drive => drive+ -> IO Icon -- ^ returns a 'Icon'. +driveGetIcon drive = +  wrapNewGObject mkIcon $+  {#call g_drive_get_icon#} (toDrive drive) ++-- | Check if drive has any mountable volumes.+driveHasVolumes :: DriveClass drive => drive+ -> IO Bool  -- ^ returns 'True' if the drive contains volumes, 'False' otherwise. +driveHasVolumes drive =+  liftM toBool $+  {#call g_drive_has_volumes#} (toDrive drive)++-- | Get a list of mountable volumes for drive.+driveGetVolumes :: DriveClass drive => drive+ -> IO [Volume]+driveGetVolumes drive = do+  glistPtr <- {#call g_drive_get_volumes #} (toDrive drive)+  volumePtrs <- fromGList glistPtr+  mapM (wrapNewGObject mkVolume . return) volumePtrs++-- | Checks if drive can be eject.+driveCanEject :: DriveClass drive => drive+ -> IO Bool  -- ^ returns 'True' if the drive can be ejected. +driveCanEject drive =+  liftM toBool $+  {#call g_drive_can_eject#} (toDrive drive)++#if GLIB_CHECK_VERSION(2,22,0)+-- | Gets a hint about how a drive can be started/stopped.+driveGetStartStopType :: DriveClass drive => drive+ -> IO DriveStartStopType -- ^ returns A value from the 'DriveStartStopType' enumeration. +driveGetStartStopType drive = +  liftM (toEnum . fromIntegral) $+  {#call g_drive_get_start_stop_type#} (toDrive drive)++-- | Checks if a drive can be started.+driveCanStart :: DriveClass drive => drive + -> IO Bool  -- ^ returns 'True' if the drive can be started, 'False' otherwise. +driveCanStart drive = +  liftM toBool $+  {#call g_drive_can_start#} (toDrive drive)++-- | Checks if a drive can be started degraded.+driveCanStartDegraded :: DriveClass drive => drive + -> IO Bool -- ^ returns 'True' if the drive can be started degraded, 'False' otherwise. +driveCanStartDegraded drive = +  liftM toBool $+  {#call g_drive_can_start_degraded#} (toDrive drive)++-- | Checks if a drive can be stoped.+driveCanStop :: DriveClass drive => drive + -> IO Bool  -- ^ returns 'True' if the drive can be stoped, 'False' otherwise. +driveCanStop drive = +  liftM toBool $+  {#call g_drive_can_stop#} (toDrive drive)+#endif++-- | Checks if a drive can be polled for media changes.+driveCanPollForMedia :: DriveClass drive => drive+ -> IO Bool+driveCanPollForMedia drive = +  liftM toBool $+  {#call g_drive_can_poll_for_media#} (toDrive drive)++-- | 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 ()+drivePollForMedia drive cancellable callback = do+      cCallback <- marshalAsyncReadyCallback callback+      {#call g_drive_poll_for_media #} +        (toDrive drive)+        (fromMaybe (Cancellable nullForeignPtr) cancellable) +        cCallback+        (castFunPtrToPtr cCallback)++-- | Finishes an operation started with 'drivePollForMedia' on a drive.+--+-- Throws a 'GError' if an error occurs.+drivePollForMediaFinish :: DriveClass drive => drive+ -> AsyncResult -- ^ @result@  a 'AsyncResult'.+ -> IO ()+drivePollForMediaFinish drive result = +    propagateGError (\gErrorPtr -> do+                       {#call g_drive_poll_for_media_finish #} +                          (toDrive drive) +                          result+                          gErrorPtr+                       return ())++-- | 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  -- ^ returns 'True' if drive has media, 'False' otherwise. +driveHasMedia drive = +  liftM toBool $+  {#call g_drive_has_media#} (toDrive drive)++-- | Checks if drive is capabable of automatically detecting media changes.+driveIsMediaCheckAutomatic :: DriveClass drive => drive+ -> IO Bool -- ^ returns 'True' if the drive is capabable of automatically detecting media changes, 'False' otherwise.+driveIsMediaCheckAutomatic drive = +  liftM toBool $+  {#call g_drive_is_media_check_automatic#} (toDrive drive)++-- | Checks if the drive supports removable media.+driveIsMediaRemovable :: DriveClass drive => drive+ -> IO Bool -- ^ returns 'True' if drive supports removable media, 'False' otherwise. +driveIsMediaRemovable drive = +  liftM toBool $+  {#call g_drive_is_media_removable#} (toDrive drive)++#if GLIB_CHECK_VERSION(2,22,0)+-- | 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] -- ^ @flags@           flags affecting the unmount if required for eject    + -> Maybe MountOperation -- ^ @mountOperation@ a 'MountOperation' or 'Nothing' to avoid user interaction. + -> Maybe Cancellable -- ^ @cancellable@     optional 'Cancellable' object, 'Nothing' to ignore.        + -> AsyncReadyCallback -- ^ @callback@        a 'AsyncReadyCallback'+ -> IO ()+driveEjectWithOperation drive flags mountOperation cancellable callback = do+      cCallback <- marshalAsyncReadyCallback callback+      {#call g_drive_eject_with_operation #} +        (toDrive drive)+        ((fromIntegral . fromFlags) flags)+        (fromMaybe (MountOperation nullForeignPtr) mountOperation)+        (fromMaybe (Cancellable nullForeignPtr) cancellable) +        cCallback+        (castFunPtrToPtr cCallback)++-- | 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 -- ^ @result@  a 'AsyncResult'.+ -> IO ()+driveEjectWithOperationFinish drive result =+    propagateGError (\gErrorPtr -> do+                        {#call g_drive_eject_with_operation_finish #} +                           (toDrive drive) +                           result+                           gErrorPtr+                        return ())++-- | 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] -- ^ @flags@           flags affecting the start operation.                 + -> Maybe MountOperation -- ^ @mountOperation@ a 'MountOperation' or 'Nothing' to avoid user interaction. + -> Maybe Cancellable -- ^ @cancellable@     optional 'Cancellable' object, 'Nothing' to ignore.        + -> AsyncReadyCallback -- ^ @callback@        a 'AsyncReadyCallback'+ -> IO ()+driveStart drive flags mountOperation cancellable callback = do+      cCallback <- marshalAsyncReadyCallback callback+      {#call g_drive_start #} +        (toDrive drive)+        ((fromIntegral . fromFlags) flags)+        (fromMaybe (MountOperation nullForeignPtr) mountOperation)+        (fromMaybe (Cancellable nullForeignPtr) cancellable) +        cCallback+        (castFunPtrToPtr cCallback)++-- | Finishes starting a drive.+--+-- Throws a 'GError' if an error occurs.+driveStartFinish :: DriveClass drive + => drive+ -> AsyncResult -- ^ @result@  a 'AsyncResult'.+ -> IO ()+driveStartFinish drive result =+    propagateGError (\gErrorPtr -> do+                       {#call g_drive_start_finish #} +                           (toDrive drive) +                           result+                           gErrorPtr+                       return ())++-- | Asynchronously stops a drive.+-- +-- When the operation is finished, callback will be called. You can then call 'driveStopFinish' to+-- obtain the result of the operation.+driveStop :: DriveClass drive+ => drive+ -> [MountUnmountFlags] -- ^ @flags@           flags affecting the stop operation.                 + -> Maybe MountOperation -- ^ @mountOperation@ a 'MountOperation' or 'Nothing' to avoid user interaction. + -> Maybe Cancellable -- ^ @cancellable@     optional 'Cancellable' object, 'Nothing' to ignore.        + -> AsyncReadyCallback -- ^ @callback@        a 'AsyncReadyCallback'+ -> IO ()+driveStop drive flags mountOperation cancellable callback = do+      cCallback <- marshalAsyncReadyCallback callback+      {#call g_drive_stop #} +        (toDrive drive)+        ((fromIntegral . fromFlags) flags)+        (fromMaybe (MountOperation nullForeignPtr) mountOperation)+        (fromMaybe (Cancellable nullForeignPtr) cancellable) +        cCallback+        (castFunPtrToPtr cCallback)++-- | Finishes stoping a drive.+--+-- Throws a 'GError' if an error occurs.+driveStopFinish :: DriveClass drive + => drive+ -> AsyncResult -- ^ @result@  a 'AsyncResult'.+ -> IO ()+driveStopFinish drive result =+    propagateGError (\gErrorPtr -> do+                        {#call g_drive_stop_finish #} +                             (toDrive drive) +                             result+                             gErrorPtr+                        return ())+#endif++-- | Gets the kinds of identifiers that drive has. Use 'driveGetIdentifer' to obtain the+-- identifiers themselves.+driveEnumerateIdentifiers :: DriveClass drive => drive+                           -> IO [String]+driveEnumerateIdentifiers drive =                           +  {#call g_drive_enumerate_identifiers#} (toDrive drive)+  >>= readUTFStringArray0 ++-- | Gets the identifier of the given kind for drive. See the introduction for more information about+-- drive identifiers.+driveGetIdentifier :: DriveClass drive => drive+                    -> String  -- ^ @kind@    the kind of identifier to return+                    -> IO String+driveGetIdentifier drive kind = +  withUTFString kind $ \ kindPtr -> +  {#call g_drive_get_identifier#} (toDrive drive) kindPtr+  >>= readUTFString++--------------------+-- Signals+-- | Emitted when a drive changes.+driveChanged :: DriveClass drive => Signal drive (Drive -> IO ())+driveChanged = Signal (connect_OBJECT__NONE "drive-changed")++-- | Emitted when a drive changes.+driveDisconnected :: DriveClass drive => Signal drive (Drive -> IO ())+driveDisconnected = Signal (connect_OBJECT__NONE "drive-disconnected")++-- | Emitted when the eject button is pressed on drive.+driveEjectButton :: DriveClass drive => Signal drive (Drive -> IO ())+driveEjectButton = Signal (connect_OBJECT__NONE "drive-eject-button")++#if GLIB_CHECK_VERSION(2,22,0)+-- | Emitted when the stop button is pressed on drive.+driveStopButton :: DriveClass drive => Signal drive (Drive -> IO ())+driveStopButton = Signal (connect_OBJECT__NONE "drive-stop-button")+#endif
+ System/GIO/Volumes/Mount.chs view
@@ -0,0 +1,402 @@+{-# LANGUAGE CPP #-}+--  GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*-+--+--  Author : Andy Stewart+--  Created: 30-Apirl-2010+--+--  Copyright (c) 2010 Andy Stewart+--+--  This library is free software: you can redistribute it and/or+--  modify it under the terms of the GNU Lesser General Public License+--  as published by the Free Software Foundation, either version 3 of+--  the License, or (at your option) any later version.+--  +--  This library is distributed in the hope that it will be useful,+--  but WITHOUT ANY WARRANTY; without even the implied warranty of+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU+--  Lesser General Public License for more details.+--  +--  You should have received a copy of the GNU Lesser General Public+--  License along with this program.  If not, see+--  <http://www.gnu.org/licenses/>.+--  +--  GIO, the C library which this Haskell library depends on, is+--  available under LGPL Version 2. The documentation included with+--  this library is based on the original GIO documentation.+--  +-- | Maintainer  : gtk2hs-devel@lists.sourceforge.net+--   Stability   : alpha+--   Portability : portable (depends on GHC)+module System.GIO.Volumes.Mount (+-- * Details+--+-- | The 'Mount' interface represents user-visible mounts. Note, when porting from GnomeVFS, 'Mount' is the+-- moral equivalent of GnomeVFSVolume.+-- +-- 'Mount' is a "mounted" filesystem that you can access. Mounted is in quotes because it's not the same+-- as a unix mount, it might be a gvfs mount, but you can still access the files on it if you use+-- GIO. Might or might not be related to a volume object.+-- +-- Unmounting a 'Mount' instance is an asynchronous operation. For more information about asynchronous+-- operations, see 'AsyncReady' and GSimpleAsyncReady. To unmount a 'Mount' instance, first call+-- 'mountUnmountWithOperation' the 'Mount' instance and a 'AsyncReadyCallback'. The+-- callback will be fired when the operation has resolved (either with success or failure), and a+-- 'AsyncReady' structure will be passed to the callback. That callback should then call+-- 'mountUnmountWithOperationFinish' with the 'Mount' and the 'AsyncReady' data to see if the+-- operation was completed successfully. If an error is present when+-- 'mountUnmountWithOperationFinish' is called, then it will be filled with any error+-- information.++-- * Types+    Mount(..),+    MountClass,++-- * Methods+    mountGetName,+    mountGetUUID,+    mountGetIcon,+    mountGetDrive,+    mountGetRoot,+    mountGetVolume,+#if GLIB_CHECK_VERSION(2,24,0)+    mountGetDefaultLocation,+#endif+    mountCanUnmount,+#if GLIB_CHECK_VERSION(2,22,0)+    mountUnmountWithOperation,+    mountUnmountWithOperationFinish,+#endif+    mountRemount,+    mountRemountFinish,+    mountCanEject,+#if GLIB_CHECK_VERSION(2,22,0)+    mountEjectWithOperation,+    mountEjectWithOperationFinish,+#endif+#if GLIB_CHECK_VERSION(2,18,0)+    mountGuessContentType,+    mountGuessContentTypeFinish,+    mountGuessContentTypeSync,+#endif+#if GLIB_CHECK_VERSION(2,20,0)+    mountIsShadowed,+    mountShadow,+    mountUnshadow,+#endif++-- * Signals+    mountChanged,+#if GLIB_CHECK_VERSION(2,22,0)+    mountPreUnmount,+#endif+    mountUnmounted,+    ) where++import Control.Monad+import Data.Maybe (fromMaybe)+import System.GIO.Enums+import System.Glib.Attributes+import System.Glib.FFI+import System.Glib.Flags+import System.Glib.GError+import System.Glib.GList+import System.Glib.GObject+import System.Glib.Properties+import System.Glib.Signals+import System.Glib.UTFString+{#import System.GIO.Async.AsyncResult#}+{#import System.GIO.Signals#}+{#import System.GIO.Types#}++{# context lib = "gio" prefix = "g" #}++--------------------+-- Methods+-- | Gets the name of mount.+mountGetName :: MountClass mount => mount+ -> IO String  -- ^ returns the name for the given mount. +mountGetName mount = +  {#call g_mount_get_name#} (toMount mount) +  >>= readUTFString++-- | 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)             -- ^ returns the UUID for mount or 'Nothing' if no UUID can be computed. +mountGetUUID mount = do+  {#call g_mount_get_uuid#} (toMount mount) +  >>= maybePeek readUTFString++-- | Gets the icon for mount.+mountGetIcon :: MountClass mount => mount+ -> IO Icon -- ^ returns a 'Icon'. +mountGetIcon mount = +  wrapNewGObject mkIcon $+  {#call g_mount_get_icon#} (toMount mount) ++-- | 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)             -- ^ returns the 'Drive' for mount or 'Nothing' if no 'Drive' can be computed. +mountGetDrive mount = +  maybeNull (wrapNewGObject mkDrive) $+  {#call g_mount_get_drive#} (toMount mount) ++-- | Gets the root directory on mount.+mountGetRoot :: MountClass mount => mount+ -> IO File+mountGetRoot mount = +  wrapNewGObject mkFile $+  {#call g_mount_get_root#} (toMount mount) ++-- | Gets the volume directory on mount.+mountGetVolume :: MountClass mount => mount+ -> IO (Maybe Volume)        -- ^ returns a 'Volume' or 'Nothing' if mount is not associated with a volume. +mountGetVolume mount = +  maybeNull (wrapNewGObject mkVolume) $+  {#call g_mount_get_volume#} (toMount mount) ++#if GLIB_CHECK_VERSION(2,24,0)+-- | 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+mountGetDefaultLocation mount = +  wrapNewGObject mkFile $+  {#call g_mount_get_default_location#} (toMount mount) +#endif++-- | Checks if mount can be mounted.+mountCanUnmount :: MountClass mount => mount+ -> IO Bool -- ^ returns 'True' if the mount can be unmounted. +mountCanUnmount mount =+  liftM toBool $+  {#call g_mount_can_unmount#} (toMount mount)++#if GLIB_CHECK_VERSION(2,22,0)+-- | 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] -- ^ @flags@           flags affecting the unmount if required for eject    + -> Maybe MountOperation -- ^ @mountOperation@ a 'MountOperation' or 'Nothing' to avoid user interaction. + -> Maybe Cancellable -- ^ @cancellable@     optional 'Cancellable' object, 'Nothing' to ignore.        + -> AsyncReadyCallback -- ^ @callback@        a 'AsyncReadyCallback'+ -> IO ()+mountUnmountWithOperation mount flags mountOperation cancellable callback = do+      cCallback <- marshalAsyncReadyCallback callback+      {#call g_mount_unmount_with_operation #} +        (toMount mount)+        ((fromIntegral . fromFlags) flags)+        (fromMaybe (MountOperation nullForeignPtr) mountOperation)+        (fromMaybe (Cancellable nullForeignPtr) cancellable) +        cCallback+        (castFunPtrToPtr cCallback)++-- | 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 -- ^ @result@  a 'AsyncResult'.+ -> IO ()+mountUnmountWithOperationFinish mount result =+    propagateGError (\gErrorPtr -> do+                       {#call g_mount_unmount_with_operation_finish #} +                          (toMount mount) +                          result+                          gErrorPtr+                       return ())+#endif++-- | Remounts a mount. This is an asynchronous operation, and is finished by calling+-- 'mountRemountFinish' with the mount and 'AsyncResult's 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] -- ^ @flags@           flags affecting the unmount if required for eject    + -> Maybe MountOperation -- ^ @mountOperation@ a 'MountOperation' or 'Nothing' to avoid user interaction. + -> Maybe Cancellable -- ^ @cancellable@     optional 'Cancellable' object, 'Nothing' to ignore.        + -> AsyncReadyCallback -- ^ @callback@        a 'AsyncReadyCallback'+ -> IO ()+mountRemount mount flags mountOperation cancellable callback = do+      cCallback <- marshalAsyncReadyCallback callback+      {#call g_mount_remount #} +        (toMount mount)+        ((fromIntegral . fromFlags) flags)+        (fromMaybe (MountOperation nullForeignPtr) mountOperation)+        (fromMaybe (Cancellable nullForeignPtr) cancellable) +        cCallback+        (castFunPtrToPtr cCallback)++-- | 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 -- ^ @result@  a 'AsyncResult'.+ -> IO ()+mountRemountFinish mount result =+    propagateGError (\gErrorPtr -> do+                        {#call g_mount_remount_finish #} +                           (toMount mount) +                           result+                           gErrorPtr+                        return ())++-- | Checks if mount can be eject.+mountCanEject :: MountClass mount => mount+ -> IO Bool  -- ^ returns 'True' if the mount can be ejected. +mountCanEject mount =+  liftM toBool $+  {#call g_mount_can_eject#} (toMount mount)++#if GLIB_CHECK_VERSION(2,22,0)+-- | 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] -- ^ @flags@           flags affecting the unmount if required for eject    + -> Maybe MountOperation -- ^ @mountOperation@ a 'MountOperation' or 'Nothing' to avoid user interaction. + -> Maybe Cancellable -- ^ @cancellable@     optional 'Cancellable' object, 'Nothing' to ignore.        + -> AsyncReadyCallback -- ^ @callback@        a 'AsyncReadyCallback'+ -> IO ()+mountEjectWithOperation mount flags mountOperation cancellable callback = do+      cCallback <- marshalAsyncReadyCallback callback+      {#call g_mount_eject_with_operation #} +        (toMount mount)+        ((fromIntegral . fromFlags) flags)+        (fromMaybe (MountOperation nullForeignPtr) mountOperation)+        (fromMaybe (Cancellable nullForeignPtr) cancellable) +        cCallback+        (castFunPtrToPtr cCallback)++-- | Finishes ejecting a mount. If any errors occurred during the operation.+--+-- Throws a 'GError' if an error occurs.+mountEjectWithOperationFinish :: MountClass mount + => mount+ -> AsyncResult -- ^ @result@  a 'AsyncResult'.+ -> IO ()+mountEjectWithOperationFinish mount result =+    propagateGError (\gErrorPtr -> do+                        {#call g_mount_eject_with_operation_finish #} +                            (toMount mount) +                            result+                            gErrorPtr+                        return ())+#endif++#if GLIB_CHECK_VERSION(2,18,0)+-- | 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-content/image-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 -- ^ @forceRescan@ Whether to force a rescan of the content. Otherwise a cached result will be used if available+ -> Maybe Cancellable -- ^ @cancellable@  optional 'Cancellable' object, 'Nothing' to ignore+ -> AsyncReadyCallback -- ^ @callback@     a 'AsyncReadyCallback'+ -> IO ()+mountGuessContentType mount forceRescan cancellable callback = do+      cCallback <- marshalAsyncReadyCallback callback+      {#call g_mount_guess_content_type #} +        (toMount mount)+        (fromBool forceRescan)+        (fromMaybe (Cancellable nullForeignPtr) cancellable) +        cCallback+        (castFunPtrToPtr cCallback)++-- | 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 -- ^ @result@  a 'AsyncResult'.+ -> IO [String] -- ^ returns 'True' if the mount was successfully ejected. 'False' otherwise.   +mountGuessContentTypeFinish mount result =+    propagateGError ({#call g_mount_guess_content_type_finish #} (toMount mount) result)+    >>= readUTFStringArray0++-- | 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-content/image-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 -- ^ @forceRescan@ Whether to force a rescan of the content. Otherwise a cached result will be used if available+ -> Maybe Cancellable -- ^ @cancellable@  optional 'Cancellable' object, 'Nothing' to ignore+ -> IO [String]+mountGuessContentTypeSync mount forceRescan cancellable =+    propagateGError ({#call g_mount_guess_content_type_sync #}+                       (toMount mount) +                       (fromBool forceRescan) +                       (fromMaybe (Cancellable nullForeignPtr) cancellable) +                    )+    >>= readUTFStringArray0+#endif++#if GLIB_CHECK_VERSION(2,20,0)+-- | 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://[usb:001,002]/store1/ and+-- gphoto2://[usb:001,002]/store2/. When the underlying mount (with root gphoto2://[usb:001,002]/) is+-- 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  -- ^ returns 'True' if mount is shadowed. +mountIsShadowed mount = +  liftM toBool $+  {#call g_mount_is_shadowed#} (toMount mount)++-- | 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 ()+mountShadow mount =+  {#call g_mount_shadow#} (toMount mount)++-- | 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 ()+mountUnshadow mount =+  {#call g_mount_unshadow#} (toMount mount)+#endif++--------------------+-- Signals+-- | Emitted when the mount has been changed.+mountChanged :: MountClass mount => Signal mount (IO ())+mountChanged = Signal (connect_NONE__NONE "changed")++#if GLIB_CHECK_VERSION(2,22,0)+-- | This signal is emitted when the 'Mount' is about to be unmounted.+mountPreUnmount :: MountClass mount => Signal mount (IO ())+mountPreUnmount = Signal (connect_NONE__NONE "pre-unmount")+#endif++-- | 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 ())+mountUnmounted = Signal (connect_NONE__NONE "unmounted")
+ System/GIO/Volumes/Volume.chs view
@@ -0,0 +1,282 @@+{-# LANGUAGE CPP #-}+--  GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*-+--+--  Author : Andy Stewart+--  Created: 30-Apirl-2010+--+--  Copyright (c) 2010 Andy Stewart+--+--  This library is free software: you can redistribute it and/or+--  modify it under the terms of the GNU Lesser General Public License+--  as published by the Free Software Foundation, either version 3 of+--  the License, or (at your option) any later version.+--  +--  This library is distributed in the hope that it will be useful,+--  but WITHOUT ANY WARRANTY; without even the implied warranty of+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU+--  Lesser General Public License for more details.+--  +--  You should have received a copy of the GNU Lesser General Public+--  License along with this program.  If not, see+--  <http://www.gnu.org/licenses/>.+--  +--  GIO, the C library which this Haskell library depends on, is+--  available under LGPL Version 2. The documentation included with+--  this library is based on the original GIO documentation.+--  +-- | Maintainer  : gtk2hs-devel@lists.sourceforge.net+--   Stability   : alpha+--   Portability : portable (depends on GHC)+module System.GIO.Volumes.Volume (+-- * Details+--+-- | The 'Volume' interface represents user-visible objects that can be mounted. Note, when porting from+-- GnomeVFS, 'Volume' is the moral equivalent of GnomeVFSDrive.+-- +-- Mounting a 'Volume' instance is an asynchronous operation. For more information about asynchronous+-- operations, see 'AsyncReady' and GSimpleAsyncReady. To mount a 'Volume', first call 'volumeMount'+-- with (at least) the 'Volume' instance, optionally a 'MountOperation' object and a 'AsyncReadyCallback'.+-- +-- Typically, one will only want to pass 'Nothing' for the 'MountOperation' if automounting all volumes when+-- a desktop session starts since it's not desirable to put up a lot of dialogs asking for credentials.+-- +-- The callback will be fired when the operation has resolved (either with success or failure), and a+-- 'AsyncReady' structure will be passed to the callback. That callback should then call+-- 'volumeMountFinish' with the 'Volume' instance and the 'AsyncReady' data to see if the operation+-- was completed successfully. If an error is present when 'volumeMountFinish' is called, then it+-- will be filled with any error information.+-- +-- It is sometimes necessary to directly access the underlying operating system object behind a volume+-- (e.g. for passing a volume to an application via the commandline). For this purpose, GIO allows to+-- obtain an 'identifier' for the volume. There can be different kinds of identifiers, such as Hal+-- UDIs, filesystem labels, traditional Unix devices (e.g. /dev/sda2), uuids. GIO uses predefind+-- strings as names for the different kinds of identifiers: 'VolumeIdentifierKindHalUdi',+-- 'VolumeIdentifierKindLabel', etc. Use 'volumeGetIdentifier' to obtain an identifier for a+-- volume.+-- +-- Note that 'VolumeIdentifierKindHalUdi' will only be available when the gvfs hal volume monitor+-- is in use. Other volume monitors will generally be able to provide the+-- 'VolumeIdentifierKindUnixDevice' identifier, which can be used to obtain a hal device by means+-- of 'mangerFindDeviceStringMatch'.++-- * Types  +    Volume(..),+    VolumeClass,++-- * Methods+    volumeGetName,+    volumeGetUUID,+    volumeGetIcon,+    volumeGetDrive,+    volumeGetMount,+    volumeCanMount,+    volumeShouldAutomount,+#if GLIB_CHECK_VERSION(2,18,0)+    volumeGetActivationRoot,+#endif+    volumeMount,    +    volumeMountFinish,+    volumeCanEject,+#if GLIB_CHECK_VERSION(2,22,0)+    volumeEjectWithOperation,+    volumeEjectWithOperationFinish,+#endif+    volumeEnumerateIdentifiers,+    volumeGetIdentifier,++-- * Signals+    volumeChanged,+    volumeRemoved,+    ) where++import Control.Monad+import Data.Maybe (fromMaybe)+import System.GIO.Enums+import System.Glib.Attributes+import System.Glib.FFI+import System.Glib.Flags+import System.Glib.GError+import System.Glib.GObject+import System.Glib.Properties+import System.Glib.Signals+import System.Glib.UTFString+{#import System.GIO.Async.AsyncResult#}+{#import System.GIO.Signals#}+{#import System.GIO.Types#}++{# context lib = "gio" prefix = "g" #}++--------------------+-- Methods+-- | Gets the name of volume.+volumeGetName :: VolumeClass volume => volume+              -> IO String  -- ^ returns the name for the given volume. +volumeGetName volume =+    {#call g_volume_get_name#} (toVolume volume)+    >>= readUTFString++-- | 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)  -- ^ returns the UUID for volume or 'Nothing' if no UUID can be computed.+volumeGetUUID volume = +  {#call g_volume_get_uuid#} (toVolume volume)+  >>= maybePeek readUTFString++-- | Gets the icon for volume.+volumeGetIcon :: VolumeClass volume => volume+              -> IO Icon+volumeGetIcon volume =               +  wrapNewGObject mkIcon $+  {#call g_volume_get_icon#} (toVolume volume)++-- | Gets the drive for the volume.+volumeGetDrive :: VolumeClass volume => volume+               -> IO (Maybe Drive)  -- ^ returns a 'Drive' or 'Nothing' if volume is not associated with a drive.+volumeGetDrive volume = +  maybeNull (wrapNewGObject mkDrive) $+  {#call g_volume_get_drive#} (toVolume volume)++-- | Gets the mount for the volume.+volumeGetMount :: VolumeClass volume => volume+               -> IO (Maybe Mount)  -- ^ returns a 'Mount' or 'Nothing' if volume is not associated with a mount.+volumeGetMount volume = +  maybeNull (wrapNewGObject mkMount) $+  {#call g_volume_get_mount#} (toVolume volume)++-- | Checks if a volume can be mounted.+volumeCanMount :: VolumeClass volume => volume+               -> IO Bool -- ^ returns 'True' if the volume can be mounted. 'False' otherwise. +volumeCanMount volume =+  liftM toBool $+  {#call g_volume_can_mount#} (toVolume volume)++-- | Returns whether the volume should be automatically mounted.+volumeShouldAutomount :: VolumeClass volume => volume+                      -> IO Bool -- ^ returns 'True' if the volume should be automatically mounted. +volumeShouldAutomount volume =+  liftM toBool $+  {#call g_volume_should_automount#} (toVolume volume)++#if GLIB_CHECK_VERSION(2,18,0)+-- | 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) -- ^ returns the activation root of volume or 'Nothing'. +volumeGetActivationRoot volume = +  maybeNull (wrapNewGObject mkFile) $+  {#call g_volume_get_activation_root#} (toVolume volume)+#endif++-- | 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] -- ^ @flags@           flags affecting the operation                        +            -> Maybe MountOperation -- ^ @mountOperation@ a 'MountOperation' or 'Nothing' to avoid user interaction. +            -> Maybe Cancellable -- ^ @cancellable@     optional 'Cancellable' object, 'Nothing' to ignore.        +            -> AsyncReadyCallback -- ^ @callback@        a 'AsyncReadyCallback'+            -> IO ()+volumeMount volume flags mountOperation cancellable callback = do+      cCallback <- marshalAsyncReadyCallback callback+      {#call g_volume_mount #} +        (toVolume volume)+        ((fromIntegral . fromFlags) flags)+        (fromMaybe (MountOperation nullForeignPtr) mountOperation)+        (fromMaybe (Cancellable nullForeignPtr) cancellable) +        cCallback+        (castFunPtrToPtr cCallback)++-- | 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 -- ^ @result@  a 'AsyncResult'                                         +                  -> IO ()+volumeMountFinish volume result =+    propagateGError (\gErrorPtr -> do+                        {#call g_volume_mount_finish#} +                           (toVolume volume) +                           result+                           gErrorPtr+                        return ())++-- | Checks if a volume can be ejected.+volumeCanEject :: VolumeClass volume => volume+               -> IO Bool -- ^ returns 'True' if the volume can be ejected. 'False' otherwise. +volumeCanEject volume = +  liftM toBool $+  {#call g_volume_can_eject#} (toVolume volume)++#if GLIB_CHECK_VERSION(2,22,0)+-- | 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] -- ^ @flags@           flags affecting the unmount if required for eject    + -> Maybe MountOperation -- ^ @mountOperation@ a 'MountOperation' or 'Nothing' to avoid user interaction. + -> Maybe Cancellable -- ^ @cancellable@     optional 'Cancellable' object, 'Nothing' to ignore.        + -> AsyncReadyCallback -- ^ @callback@        a 'AsyncReadyCallback'+ -> IO ()+volumeEjectWithOperation volume flags mountOperation cancellable callback = do+      cCallback <- marshalAsyncReadyCallback callback+      {#call g_volume_eject_with_operation #} +        (toVolume volume)+        ((fromIntegral . fromFlags) flags)+        (fromMaybe (MountOperation nullForeignPtr) mountOperation)+        (fromMaybe (Cancellable nullForeignPtr) cancellable) +        cCallback+        (castFunPtrToPtr cCallback)++-- | 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 -- ^ @result@  a 'AsyncResult'.+                               -> IO ()+volumeEjectWithOperationFinish volume result =+    propagateGError (\gErrorPtr -> do+                       {#call g_volume_eject_with_operation_finish #} +                          (toVolume volume) +                          result+                          gErrorPtr+                       return ())+#endif++-- | Gets the kinds of identifiers that volume has. Use 'volumeGetIdentifer' to obtain the+-- identifiers themselves.+volumeEnumerateIdentifiers :: VolumeClass volume => volume+                           -> IO [String]+volumeEnumerateIdentifiers volume =                           +  {#call g_volume_enumerate_identifiers#} (toVolume volume)+  >>= readUTFStringArray0 ++-- | Gets the identifier of the given kind for volume. See the introduction for more information about+-- volume identifiers.+volumeGetIdentifier :: VolumeClass volume => volume+                    -> String  -- ^ @kind@    the kind of identifier to return+                    -> IO String+volumeGetIdentifier volume kind = +  withUTFString kind $ \ kindPtr -> +  {#call g_volume_get_identifier#} (toVolume volume) kindPtr+  >>= readUTFString++--------------------+-- Signals+-- | Emitted when the volume has been changed.+volumeChanged :: VolumeClass volume => Signal volume (IO ()) +volumeChanged = Signal (connect_NONE__NONE "changed")++-- | 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 ()) +volumeRemoved = Signal (connect_NONE__NONE "removed")+
+ System/GIO/Volumes/VolumeMonitor.chs view
@@ -0,0 +1,185 @@+{-# LANGUAGE CPP #-}+--  GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*-+--+--  Author : Andy Stewart+--  Created: 30-Apirl-2010+--+--  Copyright (c) 2010 Andy Stewart+--+--  This library is free software: you can redistribute it and/or+--  modify it under the terms of the GNU Lesser General Public License+--  as published by the Free Software Foundation, either version 3 of+--  the License, or (at your option) any later version.+--  +--  This library is distributed in the hope that it will be useful,+--  but WITHOUT ANY WARRANTY; without even the implied warranty of+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU+--  Lesser General Public License for more details.+--  +--  You should have received a copy of the GNU Lesser General Public+--  License along with this program.  If not, see+--  <http://www.gnu.org/licenses/>.+--  +--  GIO, the C library which this Haskell library depends on, is+--  available under LGPL Version 2. The documentation included with+--  this library is based on the original GIO documentation.+--  +-- | Maintainer  : gtk2hs-devel@lists.sourceforge.net+--   Stability   : alpha+--   Portability : portable (depends on GHC)+module System.GIO.Volumes.VolumeMonitor (+-- * Details+--+-- | 'VolumeMonitor' is for listing the user interesting devices and volumes on the computer. In other+-- words, what a file selector or file manager would show in a sidebar.+-- +-- 'VolumeMonitor' is not thread-default-context aware, and so should not be used other than from the+-- main thread, with no thread-default-context active.++-- * Types  +    VolumeMonitor(..),+    VolumeMonitorClass,++-- * Methods+    volumeMonitorGet,+    volumeMonitorGetConnectedDrives,+    volumeMonitorGetVolumes,+    volumeMonitorGetMounts,+    volumeMonitorGetMountForUUID,+    volumeMonitorGetVolumeForUUID,++-- * Signals+    vmDriveChanged,+    vmDriveConnected,+    vmDriveDisconnected,+    vmDriveEjectButton,+    vmDriveStopButton,+    vmMountAdded,+    vmMountChanged,+    vmMountPreUnmount,+    vmMountRemoved,+    vmVolumeAdded,+    vmVolumeChanged,+    vmVolumeRemoved,+    ) where++import Control.Monad+import System.GIO.Enums+import System.Glib.Attributes+import System.Glib.FFI+import System.Glib.Flags+import System.Glib.GError+import System.Glib.GList+import System.Glib.GObject+import System.Glib.Properties+import System.Glib.Signals+import System.Glib.UTFString+{#import System.GIO.Signals#}+{#import System.GIO.Types#}++{# context lib = "gio" prefix = "g" #}++--------------------+-- Methods+-- | Gets the volume monitor used by gio.+volumeMonitorGet :: IO VolumeMonitor+volumeMonitorGet =+  wrapNewGObject mkVolumeMonitor $+  {#call g_volume_monitor_get #}++-- | Gets a list of drives connected to the system.+volumeMonitorGetConnectedDrives :: VolumeMonitorClass monitor => monitor+ -> IO [Drive]+volumeMonitorGetConnectedDrives monitor = do+  glistPtr <- {#call g_volume_monitor_get_connected_drives #} (toVolumeMonitor monitor)+  drivePtrs <- fromGList glistPtr+  mapM (wrapNewGObject mkDrive . return) drivePtrs++-- | Gets a list of the volumes on the system.+volumeMonitorGetVolumes :: VolumeMonitorClass monitor => monitor+ -> IO [Drive]+volumeMonitorGetVolumes monitor = do+  glistPtr <- {#call g_volume_monitor_get_volumes #} (toVolumeMonitor monitor)+  volumePtrs <- fromGList glistPtr+  mapM (wrapNewGObject mkDrive . return) volumePtrs++-- | Gets a list of the mounts on the system.+volumeMonitorGetMounts :: VolumeMonitorClass monitor => monitor+ -> IO [Drive]+volumeMonitorGetMounts monitor = do+  glistPtr <- {#call g_volume_monitor_get_mounts #} (toVolumeMonitor monitor)+  mountPtrs <- fromGList glistPtr+  mapM (wrapNewGObject mkDrive . return) mountPtrs++-- | Finds a 'Mount' object by its UUID (see 'mountGetUuid'+volumeMonitorGetMountForUUID :: VolumeMonitorClass monitor => monitor+ -> String -- ^ @uuid@           the UUID to look for+ -> IO (Maybe Mount)               -- ^ returns        a 'Mount' or 'Nothing' if no such mount is available.+volumeMonitorGetMountForUUID monitor uuid =  +  maybeNull (wrapNewGObject mkMount) $+  withUTFString uuid $ \ uuidPtr -> +  {#call g_volume_monitor_get_mount_for_uuid#} (toVolumeMonitor monitor) uuidPtr++-- | Finds a 'Volume' object by its UUID (see 'volumeGetUuid')+volumeMonitorGetVolumeForUUID :: VolumeMonitorClass monitor => monitor+ -> String -- ^ @uuid@           the UUID to look for+ -> IO (Maybe Volume)               -- ^ returns        a 'Volume' or 'Nothing' if no such volume is available.+volumeMonitorGetVolumeForUUID monitor uuid =  +  maybeNull (wrapNewGObject mkVolume) $ +  withUTFString uuid $ \ uuidPtr -> +  {#call g_volume_monitor_get_volume_for_uuid#} (toVolumeMonitor monitor) uuidPtr++--------------------+-- Signals+-- | Emitted when a drive changes.+vmDriveChanged :: VolumeMonitorClass monitor => Signal monitor (Drive -> IO ())+vmDriveChanged = Signal (connect_OBJECT__NONE "drive-changed")++-- | Emitted when a drive changes.+vmDriveConnected :: VolumeMonitorClass monitor => Signal monitor (Drive -> IO ())+vmDriveConnected = Signal (connect_OBJECT__NONE "drive-connected")++-- | Emitted when a drive changes.+vmDriveDisconnected :: VolumeMonitorClass monitor => Signal monitor (Drive -> IO ())+vmDriveDisconnected = Signal (connect_OBJECT__NONE "drive-disconnected")++#if GLIB_CHECK_VERSION(2,18,0)+-- | Emitted when the eject button is pressed on drive.+vmDriveEjectButton :: VolumeMonitorClass monitor => Signal monitor (Drive -> IO ())+vmDriveEjectButton = Signal (connect_OBJECT__NONE "drive-eject-button")+#endif++#if GLIB_CHECK_VERSION(2,22,0)+-- | Emitted when the stop button is pressed on drive.+vmDriveStopButton :: VolumeMonitorClass monitor => Signal monitor (Drive -> IO ())+vmDriveStopButton = Signal (connect_OBJECT__NONE "drive-stop-button")+#endif++-- | Emitted when a mount is added.+vmMountAdded :: VolumeMonitorClass monitor => Signal monitor (Mount -> IO ())+vmMountAdded = Signal (connect_OBJECT__NONE "mount-added")++-- | Emitted when a mount is changed.+vmMountChanged :: VolumeMonitorClass monitor => Signal monitor (Mount -> IO ())+vmMountChanged = Signal (connect_OBJECT__NONE "mount-changed")++-- | Emitted when a mount is about to be removed.+vmMountPreUnmount :: VolumeMonitorClass monitor => Signal monitor (Mount -> IO ())+vmMountPreUnmount = Signal (connect_OBJECT__NONE "mount-pre-unmount")++-- | Emitted when a mount is removed.+vmMountRemoved :: VolumeMonitorClass monitor => Signal monitor (Mount -> IO ())+vmMountRemoved = Signal (connect_OBJECT__NONE "mount-removed")++-- | Emitted when a volume is added.+vmVolumeAdded :: VolumeMonitorClass monitor => Signal monitor (Volume -> IO ())+vmVolumeAdded = Signal (connect_OBJECT__NONE "volume-added")++-- | Emitted when a volume is changed.+vmVolumeChanged :: VolumeMonitorClass monitor => Signal monitor (Volume -> IO ())+vmVolumeChanged = Signal (connect_OBJECT__NONE "volume-changed")++-- | Emitted when a volume is removed.+vmVolumeRemoved :: VolumeMonitorClass monitor => Signal monitor (Volume -> IO ())+vmVolumeRemoved = Signal (connect_OBJECT__NONE "volume-removed")+
+ demo/FileManager.hs view
@@ -0,0 +1,176 @@+-- | File Manager demo.+--  Author      :  Andy Stewart+--  Copyright   :  (c) 2010 Andy Stewart <lazycat.manatee@gmail.com>++-- | This simple file-manager base on gio.+--+module Main where++import Control.Monad+import Data.Maybe+import Graphics.UI.Gtk+import Graphics.UI.Gtk.General.IconTheme+import Graphics.UI.Gtk.ModelView+import System.GIO+import System.Glib.GDateTime+import System.Glib.GError+import System.Locale+import System.Time+import Text.Printf++import qualified Data.ByteString.UTF8 as UTF8++data FMInfo = FMInfo {+  fIcon :: Pixbuf,               -- icon+  fName :: String,               -- file name+  fDesc :: String,               -- mime type description+  fSize :: Integer,              -- file size+  fTime :: ClockTime             -- modified time+}++-- | Main.+main :: IO ()+main = do+  -- Init.+  initGUI++  -- Create window.+  window <- windowNew+  windowSetDefaultSize window 900 600+  windowSetPosition window WinPosCenter+  scrolledWindow <- scrolledWindowNew Nothing Nothing+  window `containerAdd` scrolledWindow++  -- Get file infos under specify directory.+  infos <- directoryGetFileInfos "/"++  -- Get FMInfo.+  fInfos <- mapM (\info -> do+                   -- Get Icon.+                   icon <- fileInfoGetIcon info+                   iconTheme <- iconThemeGetDefault+                   iconInfo <- iconThemeLookupByGIcon iconTheme icon 24 IconLookupUseBuiltin+                   pixbuf <- case iconInfo of+                              Just ii -> iconInfoLoadIcon ii+                              Nothing -> liftM fromJust $ iconThemeLoadIcon iconTheme "unknown" 24 IconLookupUseBuiltin++                   let+                       -- Get file name.+                       name = fromJust $ fileInfoGetName info+                       -- File size.+                       size = toInteger $ fileInfoGetSize info+                       -- File modified time.+                       time = gTimeValToClockTime $ fileInfoGetModificationTime info+                       -- File mime description.+                       Just contentType = fileInfoGetContentType info+                       desc = contentTypeGetDescription contentType++                   return $ FMInfo pixbuf (UTF8.toString name) desc size time+                ) infos++  -- Initialize tree view.+  store <- listStoreNew fInfos+  tv <- treeViewNewWithModel store+  scrolledWindow `containerAdd` tv++  -- List Icons.+  tvc <- treeViewColumnNew+  set tvc [ treeViewColumnTitle := "Icon"+          , treeViewColumnResizable := True ]+  treeViewAppendColumn tv tvc++  icon <- cellRendererPixbufNew+  treeViewColumnPackStart tvc icon True+  cellLayoutSetAttributes tvc icon store $ \FMInfo { fIcon = icon } ->+    [ cellPixbuf := icon ]++  -- List Name.+  tvc <- treeViewColumnNew+  set tvc [ treeViewColumnTitle := "Name"+          , treeViewColumnResizable := True ]+  treeViewAppendColumn tv tvc++  name <- cellRendererTextNew+  treeViewColumnPackStart tvc name True+  cellLayoutSetAttributes tvc name store $ \FMInfo { fName = name } ->+    [ cellText := name ]++  -- List file mime description.+  tvc <- treeViewColumnNew+  set tvc [ treeViewColumnTitle := "Description"+          , treeViewColumnResizable := True ]+  treeViewAppendColumn tv tvc++  desc <- cellRendererTextNew+  treeViewColumnPackStart tvc desc True+  cellLayoutSetAttributes tvc desc store $ \FMInfo { fDesc = desc } ->+    [ cellText := desc ]++  -- List file size.+  tvc <- treeViewColumnNew+  set tvc [ treeViewColumnTitle := "Size"+          , treeViewColumnResizable := True ]+  treeViewAppendColumn tv tvc++  size <- cellRendererTextNew+  treeViewColumnPackStart tvc size True+  cellLayoutSetAttributes tvc size store $ \FMInfo { fSize = size } ->+    [ cellText := formatFileSizeForDisplay size+    , cellXAlign := 1.0]++  -- List modified time.+  tvc <- treeViewColumnNew+  set tvc [ treeViewColumnTitle := "Modified"+          , treeViewColumnResizable := True ]+  treeViewAppendColumn tv tvc++  time <- cellRendererTextNew+  treeViewColumnPackStart tvc time True+  cellLayoutSetAttributes tvc time store $ \FMInfo { fTime = time } ->+    [ cellText :=> do+        calTime <- toCalendarTime time+        return (formatCalendarTime defaultTimeLocale "%Y/%m/%d %T" calTime)]++  -- Show window.+  window `onDestroy` mainQuit+  widgetShowAll window++  mainGUI++directoryGetFileInfos :: FilePath -> IO [FileInfo]+directoryGetFileInfos directory = do+  let dir = fileFromPath (UTF8.fromString directory)+  enumerator <- fileEnumerateChildren dir "*" [] Nothing+  fileEnumeratorGetFileInfos enumerator++fileEnumeratorGetFileInfos :: FileEnumeratorClass enumerator => enumerator -> IO [FileInfo]+fileEnumeratorGetFileInfos enum = do+  fileInfo <- fileEnumeratorNextFile enum Nothing+  case fileInfo of+    Just info -> do+      infos <- fileEnumeratorGetFileInfos enum+      return $ info : infos+    Nothing -> return []++formatFileSizeForDisplay :: Integer -> String+formatFileSizeForDisplay size+    | size < 2 ^ 10  = humanSize 1 ++ " bytes"+    | size < 2 ^ 20  = humanSize (2 ^ 10)  ++ " KB"+    | size < 2 ^ 30  = humanSize (2 ^ 20)  ++ " MB"+    | size < 2 ^ 40  = humanSize (2 ^ 30)  ++ " GB"+    | size < 2 ^ 50  = humanSize (2 ^ 40)  ++ " TB"+    | size < 2 ^ 60  = humanSize (2 ^ 50)  ++ " PB"+    | size < 2 ^ 70  = humanSize (2 ^ 60)  ++ " EB"+    | size < 2 ^ 80  = humanSize (2 ^ 70)  ++ " ZB"+    | size < 2 ^ 90  = humanSize (2 ^ 80)  ++ " YB"+    | size < 2 ^ 100 = humanSize (2 ^ 90)  ++ " NB"+    | size < 2 ^ 110 = humanSize (2 ^ 100) ++ " DB"+    where humanSize base = printf "%.1f" (integralToDouble size / base) :: String++integralToDouble :: Integral a => a -> Double+integralToDouble v = fromIntegral v :: Double++gTimeValToClockTime :: GTimeVal -> ClockTime+gTimeValToClockTime GTimeVal {gTimeValSec  = seconds+                             ,gTimeValUSec = microseconds} =+  TOD (toInteger seconds) (toInteger microseconds * 1000)
+ demo/Makefile view
@@ -0,0 +1,11 @@++PROG  = filemanager+SOURCES = FileManager.hs++$(PROG) : $(SOURCES)+	$(HC) --make $< -o $@ $(HCFLAGS)++clean:+	rm -f $(SOURCES:.hs=.hi) $(SOURCES:.hs=.o) $(PROG)++HC=ghc
gio.cabal view
@@ -1,5 +1,5 @@ Name:           gio-Version:        0.11.1+Version:        0.12.0 License:        LGPL-2.1 License-file:   COPYING Copyright:      (c) 2001-2010 The Gtk2Hs Team@@ -30,6 +30,10 @@ x-Types-Tag:       gio x-Types-Hierarchy: hierarchy.list +Data-Dir:		demo+Data-Files:		Makefile+                FileManager.hs+ Source-Repository head   type:         darcs   location:     http://code.haskell.org/gtk2hs/@@ -37,17 +41,37 @@  Library         build-depends:  base >= 4 && < 5, array, containers, haskell98, mtl, bytestring,-                        glib >= 0.11.1 && < 0.12+                        glib >= 0.12.0 && < 0.13         build-tools:    gtk2hsC2hs, gtk2hsHookGenerator, gtk2hsTypeGen          exposed-modules:           System.GIO-          System.GIO.Base+          System.GIO.Enums+          System.GIO.Types		  +                     System.GIO.Async.AsyncResult           System.GIO.Async.Cancellable+          +          System.GIO.File.AppInfo+          System.GIO.File.ContentType           System.GIO.File.FileAttribute           System.GIO.File.File-          System.GIO.Types		  +          System.GIO.File.FileEnumerator+          System.GIO.File.FileInfo+          System.GIO.File.FileMonitor+          System.GIO.File.IOError+          System.GIO.File.MountOperation+          +          System.GIO.Icons.Emblem+          System.GIO.Icons.EmblemedIcon+          System.GIO.Icons.FileIcon+          System.GIO.Icons.Icon+          System.GIO.Icons.ThemedIcon+          +          System.GIO.Volumes.Drive+          System.GIO.Volumes.Mount+          System.GIO.Volumes.Volume+          System.GIO.Volumes.VolumeMonitor         other-modules:           System.GIO.Signals 
hierarchy.list view
@@ -265,8 +265,8 @@         GVfs				as Vfs, g_vfs_get_type if gio         GMountOperation			as MountOperation, g_mount_operation_get_type if gio         GThemedIcon			as ThemedIcon, g_themed_icon_get_type if gio-        GEmblem			as Emblem, g_emblem_get_type if gio-        GEmblemedIcon			as EmblemedIcon, g_emblemed_icon_get_type if gio+        GEmblem			as Emblem, g_emblem_get_type if gio-2.18+        GEmblemedIcon			as EmblemedIcon, g_emblemed_icon_get_type if gio-2.18         GFileEnumerator			as FileEnumerator, g_file_enumerator_get_type if gio         GFilenameCompleter		as FilenameCompleter, g_filename_completer_get_type if gio         GFileIcon			as FileIcon, g_file_icon_get_type if gio
marshal.list view
@@ -43,3 +43,8 @@ # If it is a Boxed type check that the reference counting is right.  NONE:NONE +NONE:STRING,STRING,STRING,ENUM+NONE:OBJECT,OBJECT,ENUM+NONE:ENUM+NONE:OBJECT+NONE:MOBJECT,MOBJECT,ENUM