{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Interfaces.File
(
#if defined(ENABLE_OVERLOADING)
FileCopyAsyncMethodInfo ,
#endif
File(..) ,
noFile ,
IsFile ,
toFile ,
#if defined(ENABLE_OVERLOADING)
ResolveFileMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
FileAppendToMethodInfo ,
#endif
fileAppendTo ,
#if defined(ENABLE_OVERLOADING)
FileAppendToAsyncMethodInfo ,
#endif
fileAppendToAsync ,
#if defined(ENABLE_OVERLOADING)
FileAppendToFinishMethodInfo ,
#endif
fileAppendToFinish ,
#if defined(ENABLE_OVERLOADING)
FileCopyMethodInfo ,
#endif
fileCopy ,
#if defined(ENABLE_OVERLOADING)
FileCopyAttributesMethodInfo ,
#endif
fileCopyAttributes ,
#if defined(ENABLE_OVERLOADING)
FileCopyFinishMethodInfo ,
#endif
fileCopyFinish ,
#if defined(ENABLE_OVERLOADING)
FileCreateMethodInfo ,
#endif
fileCreate ,
#if defined(ENABLE_OVERLOADING)
FileCreateAsyncMethodInfo ,
#endif
fileCreateAsync ,
#if defined(ENABLE_OVERLOADING)
FileCreateFinishMethodInfo ,
#endif
fileCreateFinish ,
#if defined(ENABLE_OVERLOADING)
FileCreateReadwriteMethodInfo ,
#endif
fileCreateReadwrite ,
#if defined(ENABLE_OVERLOADING)
FileCreateReadwriteAsyncMethodInfo ,
#endif
fileCreateReadwriteAsync ,
#if defined(ENABLE_OVERLOADING)
FileCreateReadwriteFinishMethodInfo ,
#endif
fileCreateReadwriteFinish ,
#if defined(ENABLE_OVERLOADING)
FileDeleteMethodInfo ,
#endif
fileDelete ,
#if defined(ENABLE_OVERLOADING)
FileDeleteAsyncMethodInfo ,
#endif
fileDeleteAsync ,
#if defined(ENABLE_OVERLOADING)
FileDeleteFinishMethodInfo ,
#endif
fileDeleteFinish ,
#if defined(ENABLE_OVERLOADING)
FileDupMethodInfo ,
#endif
fileDup ,
#if defined(ENABLE_OVERLOADING)
FileEjectMountableMethodInfo ,
#endif
fileEjectMountable ,
#if defined(ENABLE_OVERLOADING)
FileEjectMountableFinishMethodInfo ,
#endif
fileEjectMountableFinish ,
#if defined(ENABLE_OVERLOADING)
FileEjectMountableWithOperationMethodInfo,
#endif
fileEjectMountableWithOperation ,
#if defined(ENABLE_OVERLOADING)
FileEjectMountableWithOperationFinishMethodInfo,
#endif
fileEjectMountableWithOperationFinish ,
#if defined(ENABLE_OVERLOADING)
FileEnumerateChildrenMethodInfo ,
#endif
fileEnumerateChildren ,
#if defined(ENABLE_OVERLOADING)
FileEnumerateChildrenAsyncMethodInfo ,
#endif
fileEnumerateChildrenAsync ,
#if defined(ENABLE_OVERLOADING)
FileEnumerateChildrenFinishMethodInfo ,
#endif
fileEnumerateChildrenFinish ,
#if defined(ENABLE_OVERLOADING)
FileEqualMethodInfo ,
#endif
fileEqual ,
#if defined(ENABLE_OVERLOADING)
FileFindEnclosingMountMethodInfo ,
#endif
fileFindEnclosingMount ,
#if defined(ENABLE_OVERLOADING)
FileFindEnclosingMountAsyncMethodInfo ,
#endif
fileFindEnclosingMountAsync ,
#if defined(ENABLE_OVERLOADING)
FileFindEnclosingMountFinishMethodInfo ,
#endif
fileFindEnclosingMountFinish ,
#if defined(ENABLE_OVERLOADING)
FileGetBasenameMethodInfo ,
#endif
fileGetBasename ,
#if defined(ENABLE_OVERLOADING)
FileGetChildMethodInfo ,
#endif
fileGetChild ,
#if defined(ENABLE_OVERLOADING)
FileGetChildForDisplayNameMethodInfo ,
#endif
fileGetChildForDisplayName ,
#if defined(ENABLE_OVERLOADING)
FileGetParentMethodInfo ,
#endif
fileGetParent ,
#if defined(ENABLE_OVERLOADING)
FileGetParseNameMethodInfo ,
#endif
fileGetParseName ,
#if defined(ENABLE_OVERLOADING)
FileGetPathMethodInfo ,
#endif
fileGetPath ,
#if defined(ENABLE_OVERLOADING)
FileGetRelativePathMethodInfo ,
#endif
fileGetRelativePath ,
#if defined(ENABLE_OVERLOADING)
FileGetUriMethodInfo ,
#endif
fileGetUri ,
#if defined(ENABLE_OVERLOADING)
FileGetUriSchemeMethodInfo ,
#endif
fileGetUriScheme ,
#if defined(ENABLE_OVERLOADING)
FileHasParentMethodInfo ,
#endif
fileHasParent ,
#if defined(ENABLE_OVERLOADING)
FileHasPrefixMethodInfo ,
#endif
fileHasPrefix ,
#if defined(ENABLE_OVERLOADING)
FileHasUriSchemeMethodInfo ,
#endif
fileHasUriScheme ,
#if defined(ENABLE_OVERLOADING)
FileHashMethodInfo ,
#endif
fileHash ,
#if defined(ENABLE_OVERLOADING)
FileIsNativeMethodInfo ,
#endif
fileIsNative ,
#if defined(ENABLE_OVERLOADING)
FileLoadBytesMethodInfo ,
#endif
fileLoadBytes ,
#if defined(ENABLE_OVERLOADING)
FileLoadBytesAsyncMethodInfo ,
#endif
fileLoadBytesAsync ,
#if defined(ENABLE_OVERLOADING)
FileLoadBytesFinishMethodInfo ,
#endif
fileLoadBytesFinish ,
#if defined(ENABLE_OVERLOADING)
FileLoadContentsMethodInfo ,
#endif
fileLoadContents ,
#if defined(ENABLE_OVERLOADING)
FileLoadContentsAsyncMethodInfo ,
#endif
fileLoadContentsAsync ,
#if defined(ENABLE_OVERLOADING)
FileLoadContentsFinishMethodInfo ,
#endif
fileLoadContentsFinish ,
#if defined(ENABLE_OVERLOADING)
FileLoadPartialContentsFinishMethodInfo ,
#endif
fileLoadPartialContentsFinish ,
#if defined(ENABLE_OVERLOADING)
FileMakeDirectoryMethodInfo ,
#endif
fileMakeDirectory ,
#if defined(ENABLE_OVERLOADING)
FileMakeDirectoryAsyncMethodInfo ,
#endif
fileMakeDirectoryAsync ,
#if defined(ENABLE_OVERLOADING)
FileMakeDirectoryFinishMethodInfo ,
#endif
fileMakeDirectoryFinish ,
#if defined(ENABLE_OVERLOADING)
FileMakeDirectoryWithParentsMethodInfo ,
#endif
fileMakeDirectoryWithParents ,
#if defined(ENABLE_OVERLOADING)
FileMakeSymbolicLinkMethodInfo ,
#endif
fileMakeSymbolicLink ,
#if defined(ENABLE_OVERLOADING)
FileMeasureDiskUsageFinishMethodInfo ,
#endif
fileMeasureDiskUsageFinish ,
#if defined(ENABLE_OVERLOADING)
FileMonitorMethodInfo ,
#endif
fileMonitor ,
#if defined(ENABLE_OVERLOADING)
FileMonitorDirectoryMethodInfo ,
#endif
fileMonitorDirectory ,
#if defined(ENABLE_OVERLOADING)
FileMonitorFileMethodInfo ,
#endif
fileMonitorFile ,
#if defined(ENABLE_OVERLOADING)
FileMountEnclosingVolumeMethodInfo ,
#endif
fileMountEnclosingVolume ,
#if defined(ENABLE_OVERLOADING)
FileMountEnclosingVolumeFinishMethodInfo,
#endif
fileMountEnclosingVolumeFinish ,
#if defined(ENABLE_OVERLOADING)
FileMountMountableMethodInfo ,
#endif
fileMountMountable ,
#if defined(ENABLE_OVERLOADING)
FileMountMountableFinishMethodInfo ,
#endif
fileMountMountableFinish ,
#if defined(ENABLE_OVERLOADING)
FileMoveMethodInfo ,
#endif
fileMove ,
fileNewForCommandlineArg ,
fileNewForCommandlineArgAndCwd ,
fileNewForPath ,
fileNewForUri ,
fileNewTmp ,
#if defined(ENABLE_OVERLOADING)
FileOpenReadwriteMethodInfo ,
#endif
fileOpenReadwrite ,
#if defined(ENABLE_OVERLOADING)
FileOpenReadwriteAsyncMethodInfo ,
#endif
fileOpenReadwriteAsync ,
#if defined(ENABLE_OVERLOADING)
FileOpenReadwriteFinishMethodInfo ,
#endif
fileOpenReadwriteFinish ,
fileParseName ,
#if defined(ENABLE_OVERLOADING)
FilePeekPathMethodInfo ,
#endif
filePeekPath ,
#if defined(ENABLE_OVERLOADING)
FilePollMountableMethodInfo ,
#endif
filePollMountable ,
#if defined(ENABLE_OVERLOADING)
FilePollMountableFinishMethodInfo ,
#endif
filePollMountableFinish ,
#if defined(ENABLE_OVERLOADING)
FileQueryDefaultHandlerMethodInfo ,
#endif
fileQueryDefaultHandler ,
#if defined(ENABLE_OVERLOADING)
FileQueryDefaultHandlerAsyncMethodInfo ,
#endif
fileQueryDefaultHandlerAsync ,
#if defined(ENABLE_OVERLOADING)
FileQueryDefaultHandlerFinishMethodInfo ,
#endif
fileQueryDefaultHandlerFinish ,
#if defined(ENABLE_OVERLOADING)
FileQueryExistsMethodInfo ,
#endif
fileQueryExists ,
#if defined(ENABLE_OVERLOADING)
FileQueryFileTypeMethodInfo ,
#endif
fileQueryFileType ,
#if defined(ENABLE_OVERLOADING)
FileQueryFilesystemInfoMethodInfo ,
#endif
fileQueryFilesystemInfo ,
#if defined(ENABLE_OVERLOADING)
FileQueryFilesystemInfoAsyncMethodInfo ,
#endif
fileQueryFilesystemInfoAsync ,
#if defined(ENABLE_OVERLOADING)
FileQueryFilesystemInfoFinishMethodInfo ,
#endif
fileQueryFilesystemInfoFinish ,
#if defined(ENABLE_OVERLOADING)
FileQueryInfoMethodInfo ,
#endif
fileQueryInfo ,
#if defined(ENABLE_OVERLOADING)
FileQueryInfoAsyncMethodInfo ,
#endif
fileQueryInfoAsync ,
#if defined(ENABLE_OVERLOADING)
FileQueryInfoFinishMethodInfo ,
#endif
fileQueryInfoFinish ,
#if defined(ENABLE_OVERLOADING)
FileQuerySettableAttributesMethodInfo ,
#endif
fileQuerySettableAttributes ,
#if defined(ENABLE_OVERLOADING)
FileQueryWritableNamespacesMethodInfo ,
#endif
fileQueryWritableNamespaces ,
#if defined(ENABLE_OVERLOADING)
FileReadMethodInfo ,
#endif
fileRead ,
#if defined(ENABLE_OVERLOADING)
FileReadAsyncMethodInfo ,
#endif
fileReadAsync ,
#if defined(ENABLE_OVERLOADING)
FileReadFinishMethodInfo ,
#endif
fileReadFinish ,
#if defined(ENABLE_OVERLOADING)
FileReplaceMethodInfo ,
#endif
fileReplace ,
#if defined(ENABLE_OVERLOADING)
FileReplaceAsyncMethodInfo ,
#endif
fileReplaceAsync ,
#if defined(ENABLE_OVERLOADING)
FileReplaceContentsMethodInfo ,
#endif
fileReplaceContents ,
#if defined(ENABLE_OVERLOADING)
FileReplaceContentsAsyncMethodInfo ,
#endif
fileReplaceContentsAsync ,
#if defined(ENABLE_OVERLOADING)
FileReplaceContentsBytesAsyncMethodInfo ,
#endif
fileReplaceContentsBytesAsync ,
#if defined(ENABLE_OVERLOADING)
FileReplaceContentsFinishMethodInfo ,
#endif
fileReplaceContentsFinish ,
#if defined(ENABLE_OVERLOADING)
FileReplaceFinishMethodInfo ,
#endif
fileReplaceFinish ,
#if defined(ENABLE_OVERLOADING)
FileReplaceReadwriteMethodInfo ,
#endif
fileReplaceReadwrite ,
#if defined(ENABLE_OVERLOADING)
FileReplaceReadwriteAsyncMethodInfo ,
#endif
fileReplaceReadwriteAsync ,
#if defined(ENABLE_OVERLOADING)
FileReplaceReadwriteFinishMethodInfo ,
#endif
fileReplaceReadwriteFinish ,
#if defined(ENABLE_OVERLOADING)
FileResolveRelativePathMethodInfo ,
#endif
fileResolveRelativePath ,
#if defined(ENABLE_OVERLOADING)
FileSetAttributeMethodInfo ,
#endif
fileSetAttribute ,
#if defined(ENABLE_OVERLOADING)
FileSetAttributeByteStringMethodInfo ,
#endif
fileSetAttributeByteString ,
#if defined(ENABLE_OVERLOADING)
FileSetAttributeInt32MethodInfo ,
#endif
fileSetAttributeInt32 ,
#if defined(ENABLE_OVERLOADING)
FileSetAttributeInt64MethodInfo ,
#endif
fileSetAttributeInt64 ,
#if defined(ENABLE_OVERLOADING)
FileSetAttributeStringMethodInfo ,
#endif
fileSetAttributeString ,
#if defined(ENABLE_OVERLOADING)
FileSetAttributeUint32MethodInfo ,
#endif
fileSetAttributeUint32 ,
#if defined(ENABLE_OVERLOADING)
FileSetAttributeUint64MethodInfo ,
#endif
fileSetAttributeUint64 ,
#if defined(ENABLE_OVERLOADING)
FileSetAttributesAsyncMethodInfo ,
#endif
fileSetAttributesAsync ,
#if defined(ENABLE_OVERLOADING)
FileSetAttributesFinishMethodInfo ,
#endif
fileSetAttributesFinish ,
#if defined(ENABLE_OVERLOADING)
FileSetAttributesFromInfoMethodInfo ,
#endif
fileSetAttributesFromInfo ,
#if defined(ENABLE_OVERLOADING)
FileSetDisplayNameMethodInfo ,
#endif
fileSetDisplayName ,
#if defined(ENABLE_OVERLOADING)
FileSetDisplayNameAsyncMethodInfo ,
#endif
fileSetDisplayNameAsync ,
#if defined(ENABLE_OVERLOADING)
FileSetDisplayNameFinishMethodInfo ,
#endif
fileSetDisplayNameFinish ,
#if defined(ENABLE_OVERLOADING)
FileStartMountableMethodInfo ,
#endif
fileStartMountable ,
#if defined(ENABLE_OVERLOADING)
FileStartMountableFinishMethodInfo ,
#endif
fileStartMountableFinish ,
#if defined(ENABLE_OVERLOADING)
FileStopMountableMethodInfo ,
#endif
fileStopMountable ,
#if defined(ENABLE_OVERLOADING)
FileStopMountableFinishMethodInfo ,
#endif
fileStopMountableFinish ,
#if defined(ENABLE_OVERLOADING)
FileSupportsThreadContextsMethodInfo ,
#endif
fileSupportsThreadContexts ,
#if defined(ENABLE_OVERLOADING)
FileTrashMethodInfo ,
#endif
fileTrash ,
#if defined(ENABLE_OVERLOADING)
FileTrashAsyncMethodInfo ,
#endif
fileTrashAsync ,
#if defined(ENABLE_OVERLOADING)
FileTrashFinishMethodInfo ,
#endif
fileTrashFinish ,
#if defined(ENABLE_OVERLOADING)
FileUnmountMountableMethodInfo ,
#endif
fileUnmountMountable ,
#if defined(ENABLE_OVERLOADING)
FileUnmountMountableFinishMethodInfo ,
#endif
fileUnmountMountableFinish ,
#if defined(ENABLE_OVERLOADING)
FileUnmountMountableWithOperationMethodInfo,
#endif
fileUnmountMountableWithOperation ,
#if defined(ENABLE_OVERLOADING)
FileUnmountMountableWithOperationFinishMethodInfo,
#endif
fileUnmountMountableWithOperationFinish ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import {-# SOURCE #-} qualified GI.Gio.Enums as Gio.Enums
import {-# SOURCE #-} qualified GI.Gio.Flags as Gio.Flags
import {-# SOURCE #-} qualified GI.Gio.Interfaces.AppInfo as Gio.AppInfo
import {-# SOURCE #-} qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Mount as Gio.Mount
import {-# SOURCE #-} qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.Gio.Objects.FileEnumerator as Gio.FileEnumerator
import {-# SOURCE #-} qualified GI.Gio.Objects.FileIOStream as Gio.FileIOStream
import {-# SOURCE #-} qualified GI.Gio.Objects.FileInfo as Gio.FileInfo
import {-# SOURCE #-} qualified GI.Gio.Objects.FileInputStream as Gio.FileInputStream
import {-# SOURCE #-} qualified GI.Gio.Objects.FileMonitor as Gio.FileMonitor
import {-# SOURCE #-} qualified GI.Gio.Objects.FileOutputStream as Gio.FileOutputStream
import {-# SOURCE #-} qualified GI.Gio.Objects.MountOperation as Gio.MountOperation
import {-# SOURCE #-} qualified GI.Gio.Structs.FileAttributeInfoList as Gio.FileAttributeInfoList
newtype File = File (ManagedPtr File)
deriving (File -> File -> Bool
(File -> File -> Bool) -> (File -> File -> Bool) -> Eq File
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: File -> File -> Bool
$c/= :: File -> File -> Bool
== :: File -> File -> Bool
$c== :: File -> File -> Bool
Eq)
noFile :: Maybe File
noFile :: Maybe File
noFile = Maybe File
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList File = FileSignalList
type FileSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_file_get_type"
c_g_file_get_type :: IO GType
instance GObject File where
gobjectType :: IO GType
gobjectType = IO GType
c_g_file_get_type
instance B.GValue.IsGValue File where
toGValue :: File -> IO GValue
toGValue o :: File
o = do
GType
gtype <- IO GType
c_g_file_get_type
File -> (Ptr File -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr File
o (GType -> (GValue -> Ptr File -> IO ()) -> Ptr File -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr File -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
fromGValue :: GValue -> IO File
fromGValue gv :: GValue
gv = do
Ptr File
ptr <- GValue -> IO (Ptr File)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr File)
(ManagedPtr File -> File) -> Ptr File -> IO File
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr File -> File
File Ptr File
ptr
class (GObject o, O.IsDescendantOf File o) => IsFile o
instance (GObject o, O.IsDescendantOf File o) => IsFile o
instance O.HasParentTypes File
type instance O.ParentTypes File = '[GObject.Object.Object]
toFile :: (MonadIO m, IsFile o) => o -> m File
toFile :: o -> m File
toFile = IO File -> m File
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO File -> m File) -> (o -> IO File) -> o -> m File
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr File -> File) -> o -> IO File
forall o o'.
(HasCallStack, GObject o, GObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr File -> File
File
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList File
type instance O.AttributeList File = FileAttributeList
type FileAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveFileMethod (t :: Symbol) (o :: *) :: * where
ResolveFileMethod "appendTo" o = FileAppendToMethodInfo
ResolveFileMethod "appendToAsync" o = FileAppendToAsyncMethodInfo
ResolveFileMethod "appendToFinish" o = FileAppendToFinishMethodInfo
ResolveFileMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveFileMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveFileMethod "copy" o = FileCopyMethodInfo
ResolveFileMethod "copyAsync" o = FileCopyAsyncMethodInfo
ResolveFileMethod "copyAttributes" o = FileCopyAttributesMethodInfo
ResolveFileMethod "copyFinish" o = FileCopyFinishMethodInfo
ResolveFileMethod "create" o = FileCreateMethodInfo
ResolveFileMethod "createAsync" o = FileCreateAsyncMethodInfo
ResolveFileMethod "createFinish" o = FileCreateFinishMethodInfo
ResolveFileMethod "createReadwrite" o = FileCreateReadwriteMethodInfo
ResolveFileMethod "createReadwriteAsync" o = FileCreateReadwriteAsyncMethodInfo
ResolveFileMethod "createReadwriteFinish" o = FileCreateReadwriteFinishMethodInfo
ResolveFileMethod "delete" o = FileDeleteMethodInfo
ResolveFileMethod "deleteAsync" o = FileDeleteAsyncMethodInfo
ResolveFileMethod "deleteFinish" o = FileDeleteFinishMethodInfo
ResolveFileMethod "dup" o = FileDupMethodInfo
ResolveFileMethod "ejectMountable" o = FileEjectMountableMethodInfo
ResolveFileMethod "ejectMountableFinish" o = FileEjectMountableFinishMethodInfo
ResolveFileMethod "ejectMountableWithOperation" o = FileEjectMountableWithOperationMethodInfo
ResolveFileMethod "ejectMountableWithOperationFinish" o = FileEjectMountableWithOperationFinishMethodInfo
ResolveFileMethod "enumerateChildren" o = FileEnumerateChildrenMethodInfo
ResolveFileMethod "enumerateChildrenAsync" o = FileEnumerateChildrenAsyncMethodInfo
ResolveFileMethod "enumerateChildrenFinish" o = FileEnumerateChildrenFinishMethodInfo
ResolveFileMethod "equal" o = FileEqualMethodInfo
ResolveFileMethod "findEnclosingMount" o = FileFindEnclosingMountMethodInfo
ResolveFileMethod "findEnclosingMountAsync" o = FileFindEnclosingMountAsyncMethodInfo
ResolveFileMethod "findEnclosingMountFinish" o = FileFindEnclosingMountFinishMethodInfo
ResolveFileMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveFileMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveFileMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveFileMethod "hasParent" o = FileHasParentMethodInfo
ResolveFileMethod "hasPrefix" o = FileHasPrefixMethodInfo
ResolveFileMethod "hasUriScheme" o = FileHasUriSchemeMethodInfo
ResolveFileMethod "hash" o = FileHashMethodInfo
ResolveFileMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveFileMethod "isNative" o = FileIsNativeMethodInfo
ResolveFileMethod "loadBytes" o = FileLoadBytesMethodInfo
ResolveFileMethod "loadBytesAsync" o = FileLoadBytesAsyncMethodInfo
ResolveFileMethod "loadBytesFinish" o = FileLoadBytesFinishMethodInfo
ResolveFileMethod "loadContents" o = FileLoadContentsMethodInfo
ResolveFileMethod "loadContentsAsync" o = FileLoadContentsAsyncMethodInfo
ResolveFileMethod "loadContentsFinish" o = FileLoadContentsFinishMethodInfo
ResolveFileMethod "loadPartialContentsFinish" o = FileLoadPartialContentsFinishMethodInfo
ResolveFileMethod "makeDirectory" o = FileMakeDirectoryMethodInfo
ResolveFileMethod "makeDirectoryAsync" o = FileMakeDirectoryAsyncMethodInfo
ResolveFileMethod "makeDirectoryFinish" o = FileMakeDirectoryFinishMethodInfo
ResolveFileMethod "makeDirectoryWithParents" o = FileMakeDirectoryWithParentsMethodInfo
ResolveFileMethod "makeSymbolicLink" o = FileMakeSymbolicLinkMethodInfo
ResolveFileMethod "measureDiskUsageFinish" o = FileMeasureDiskUsageFinishMethodInfo
ResolveFileMethod "monitor" o = FileMonitorMethodInfo
ResolveFileMethod "monitorDirectory" o = FileMonitorDirectoryMethodInfo
ResolveFileMethod "monitorFile" o = FileMonitorFileMethodInfo
ResolveFileMethod "mountEnclosingVolume" o = FileMountEnclosingVolumeMethodInfo
ResolveFileMethod "mountEnclosingVolumeFinish" o = FileMountEnclosingVolumeFinishMethodInfo
ResolveFileMethod "mountMountable" o = FileMountMountableMethodInfo
ResolveFileMethod "mountMountableFinish" o = FileMountMountableFinishMethodInfo
ResolveFileMethod "move" o = FileMoveMethodInfo
ResolveFileMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveFileMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveFileMethod "openReadwrite" o = FileOpenReadwriteMethodInfo
ResolveFileMethod "openReadwriteAsync" o = FileOpenReadwriteAsyncMethodInfo
ResolveFileMethod "openReadwriteFinish" o = FileOpenReadwriteFinishMethodInfo
ResolveFileMethod "peekPath" o = FilePeekPathMethodInfo
ResolveFileMethod "pollMountable" o = FilePollMountableMethodInfo
ResolveFileMethod "pollMountableFinish" o = FilePollMountableFinishMethodInfo
ResolveFileMethod "queryDefaultHandler" o = FileQueryDefaultHandlerMethodInfo
ResolveFileMethod "queryDefaultHandlerAsync" o = FileQueryDefaultHandlerAsyncMethodInfo
ResolveFileMethod "queryDefaultHandlerFinish" o = FileQueryDefaultHandlerFinishMethodInfo
ResolveFileMethod "queryExists" o = FileQueryExistsMethodInfo
ResolveFileMethod "queryFileType" o = FileQueryFileTypeMethodInfo
ResolveFileMethod "queryFilesystemInfo" o = FileQueryFilesystemInfoMethodInfo
ResolveFileMethod "queryFilesystemInfoAsync" o = FileQueryFilesystemInfoAsyncMethodInfo
ResolveFileMethod "queryFilesystemInfoFinish" o = FileQueryFilesystemInfoFinishMethodInfo
ResolveFileMethod "queryInfo" o = FileQueryInfoMethodInfo
ResolveFileMethod "queryInfoAsync" o = FileQueryInfoAsyncMethodInfo
ResolveFileMethod "queryInfoFinish" o = FileQueryInfoFinishMethodInfo
ResolveFileMethod "querySettableAttributes" o = FileQuerySettableAttributesMethodInfo
ResolveFileMethod "queryWritableNamespaces" o = FileQueryWritableNamespacesMethodInfo
ResolveFileMethod "read" o = FileReadMethodInfo
ResolveFileMethod "readAsync" o = FileReadAsyncMethodInfo
ResolveFileMethod "readFinish" o = FileReadFinishMethodInfo
ResolveFileMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveFileMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveFileMethod "replace" o = FileReplaceMethodInfo
ResolveFileMethod "replaceAsync" o = FileReplaceAsyncMethodInfo
ResolveFileMethod "replaceContents" o = FileReplaceContentsMethodInfo
ResolveFileMethod "replaceContentsAsync" o = FileReplaceContentsAsyncMethodInfo
ResolveFileMethod "replaceContentsBytesAsync" o = FileReplaceContentsBytesAsyncMethodInfo
ResolveFileMethod "replaceContentsFinish" o = FileReplaceContentsFinishMethodInfo
ResolveFileMethod "replaceFinish" o = FileReplaceFinishMethodInfo
ResolveFileMethod "replaceReadwrite" o = FileReplaceReadwriteMethodInfo
ResolveFileMethod "replaceReadwriteAsync" o = FileReplaceReadwriteAsyncMethodInfo
ResolveFileMethod "replaceReadwriteFinish" o = FileReplaceReadwriteFinishMethodInfo
ResolveFileMethod "resolveRelativePath" o = FileResolveRelativePathMethodInfo
ResolveFileMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveFileMethod "startMountable" o = FileStartMountableMethodInfo
ResolveFileMethod "startMountableFinish" o = FileStartMountableFinishMethodInfo
ResolveFileMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveFileMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveFileMethod "stopMountable" o = FileStopMountableMethodInfo
ResolveFileMethod "stopMountableFinish" o = FileStopMountableFinishMethodInfo
ResolveFileMethod "supportsThreadContexts" o = FileSupportsThreadContextsMethodInfo
ResolveFileMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveFileMethod "trash" o = FileTrashMethodInfo
ResolveFileMethod "trashAsync" o = FileTrashAsyncMethodInfo
ResolveFileMethod "trashFinish" o = FileTrashFinishMethodInfo
ResolveFileMethod "unmountMountable" o = FileUnmountMountableMethodInfo
ResolveFileMethod "unmountMountableFinish" o = FileUnmountMountableFinishMethodInfo
ResolveFileMethod "unmountMountableWithOperation" o = FileUnmountMountableWithOperationMethodInfo
ResolveFileMethod "unmountMountableWithOperationFinish" o = FileUnmountMountableWithOperationFinishMethodInfo
ResolveFileMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveFileMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveFileMethod "getBasename" o = FileGetBasenameMethodInfo
ResolveFileMethod "getChild" o = FileGetChildMethodInfo
ResolveFileMethod "getChildForDisplayName" o = FileGetChildForDisplayNameMethodInfo
ResolveFileMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveFileMethod "getParent" o = FileGetParentMethodInfo
ResolveFileMethod "getParseName" o = FileGetParseNameMethodInfo
ResolveFileMethod "getPath" o = FileGetPathMethodInfo
ResolveFileMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveFileMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveFileMethod "getRelativePath" o = FileGetRelativePathMethodInfo
ResolveFileMethod "getUri" o = FileGetUriMethodInfo
ResolveFileMethod "getUriScheme" o = FileGetUriSchemeMethodInfo
ResolveFileMethod "setAttribute" o = FileSetAttributeMethodInfo
ResolveFileMethod "setAttributeByteString" o = FileSetAttributeByteStringMethodInfo
ResolveFileMethod "setAttributeInt32" o = FileSetAttributeInt32MethodInfo
ResolveFileMethod "setAttributeInt64" o = FileSetAttributeInt64MethodInfo
ResolveFileMethod "setAttributeString" o = FileSetAttributeStringMethodInfo
ResolveFileMethod "setAttributeUint32" o = FileSetAttributeUint32MethodInfo
ResolveFileMethod "setAttributeUint64" o = FileSetAttributeUint64MethodInfo
ResolveFileMethod "setAttributesAsync" o = FileSetAttributesAsyncMethodInfo
ResolveFileMethod "setAttributesFinish" o = FileSetAttributesFinishMethodInfo
ResolveFileMethod "setAttributesFromInfo" o = FileSetAttributesFromInfoMethodInfo
ResolveFileMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveFileMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveFileMethod "setDisplayName" o = FileSetDisplayNameMethodInfo
ResolveFileMethod "setDisplayNameAsync" o = FileSetDisplayNameAsyncMethodInfo
ResolveFileMethod "setDisplayNameFinish" o = FileSetDisplayNameFinishMethodInfo
ResolveFileMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveFileMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveFileMethod t File, O.MethodInfo info File p) => OL.IsLabel t (File -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif
foreign import ccall "g_file_append_to" g_file_append_to ::
Ptr File ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileOutputStream.FileOutputStream)
fileAppendTo ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> [Gio.Flags.FileCreateFlags]
-> Maybe (b)
-> m Gio.FileOutputStream.FileOutputStream
fileAppendTo :: a -> [FileCreateFlags] -> Maybe b -> m FileOutputStream
fileAppendTo file :: a
file flags :: [FileCreateFlags]
flags cancellable :: Maybe b
cancellable = IO FileOutputStream -> m FileOutputStream
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileOutputStream -> m FileOutputStream)
-> IO FileOutputStream -> m FileOutputStream
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
let flags' :: CUInt
flags' = [FileCreateFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileCreateFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO FileOutputStream -> IO () -> IO FileOutputStream
forall a b. IO a -> IO b -> IO a
onException (do
Ptr FileOutputStream
result <- (Ptr (Ptr GError) -> IO (Ptr FileOutputStream))
-> IO (Ptr FileOutputStream)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr FileOutputStream))
-> IO (Ptr FileOutputStream))
-> (Ptr (Ptr GError) -> IO (Ptr FileOutputStream))
-> IO (Ptr FileOutputStream)
forall a b. (a -> b) -> a -> b
$ Ptr File
-> CUInt
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO (Ptr FileOutputStream)
g_file_append_to Ptr File
file' CUInt
flags' Ptr Cancellable
maybeCancellable
Text -> Ptr FileOutputStream -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileAppendTo" Ptr FileOutputStream
result
FileOutputStream
result' <- ((ManagedPtr FileOutputStream -> FileOutputStream)
-> Ptr FileOutputStream -> IO FileOutputStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileOutputStream -> FileOutputStream
Gio.FileOutputStream.FileOutputStream) Ptr FileOutputStream
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
FileOutputStream -> IO FileOutputStream
forall (m :: * -> *) a. Monad m => a -> m a
return FileOutputStream
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileAppendToMethodInfo
instance (signature ~ ([Gio.Flags.FileCreateFlags] -> Maybe (b) -> m Gio.FileOutputStream.FileOutputStream), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileAppendToMethodInfo a signature where
overloadedMethod = fileAppendTo
#endif
foreign import ccall "g_file_append_to_async" g_file_append_to_async ::
Ptr File ->
CUInt ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileAppendToAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> [Gio.Flags.FileCreateFlags]
-> Int32
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileAppendToAsync :: a
-> [FileCreateFlags]
-> Int32
-> Maybe b
-> Maybe AsyncReadyCallback
-> m ()
fileAppendToAsync file :: a
file flags :: [FileCreateFlags]
flags ioPriority :: Int32
ioPriority cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
let flags' :: CUInt
flags' = [FileCreateFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileCreateFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> CUInt
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_append_to_async Ptr File
file' CUInt
flags' Int32
ioPriority Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileAppendToAsyncMethodInfo
instance (signature ~ ([Gio.Flags.FileCreateFlags] -> Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileAppendToAsyncMethodInfo a signature where
overloadedMethod = fileAppendToAsync
#endif
foreign import ccall "g_file_append_to_finish" g_file_append_to_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileOutputStream.FileOutputStream)
fileAppendToFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m Gio.FileOutputStream.FileOutputStream
fileAppendToFinish :: a -> b -> m FileOutputStream
fileAppendToFinish file :: a
file res :: b
res = IO FileOutputStream -> m FileOutputStream
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileOutputStream -> m FileOutputStream)
-> IO FileOutputStream -> m FileOutputStream
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
res' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
res
IO FileOutputStream -> IO () -> IO FileOutputStream
forall a b. IO a -> IO b -> IO a
onException (do
Ptr FileOutputStream
result <- (Ptr (Ptr GError) -> IO (Ptr FileOutputStream))
-> IO (Ptr FileOutputStream)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr FileOutputStream))
-> IO (Ptr FileOutputStream))
-> (Ptr (Ptr GError) -> IO (Ptr FileOutputStream))
-> IO (Ptr FileOutputStream)
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr AsyncResult -> Ptr (Ptr GError) -> IO (Ptr FileOutputStream)
g_file_append_to_finish Ptr File
file' Ptr AsyncResult
res'
Text -> Ptr FileOutputStream -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileAppendToFinish" Ptr FileOutputStream
result
FileOutputStream
result' <- ((ManagedPtr FileOutputStream -> FileOutputStream)
-> Ptr FileOutputStream -> IO FileOutputStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileOutputStream -> FileOutputStream
Gio.FileOutputStream.FileOutputStream) Ptr FileOutputStream
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
res
FileOutputStream -> IO FileOutputStream
forall (m :: * -> *) a. Monad m => a -> m a
return FileOutputStream
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileAppendToFinishMethodInfo
instance (signature ~ (b -> m Gio.FileOutputStream.FileOutputStream), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileAppendToFinishMethodInfo a signature where
overloadedMethod = fileAppendToFinish
#endif
foreign import ccall "g_file_copy" g_file_copy ::
Ptr File ->
Ptr File ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_FileProgressCallback ->
Ptr () ->
Ptr (Ptr GError) ->
IO CInt
fileCopy ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, IsFile b, Gio.Cancellable.IsCancellable c) =>
a
-> b
-> [Gio.Flags.FileCopyFlags]
-> Maybe (c)
-> Maybe (Gio.Callbacks.FileProgressCallback)
-> m ()
fileCopy :: a
-> b
-> [FileCopyFlags]
-> Maybe c
-> Maybe FileProgressCallback
-> m ()
fileCopy source :: a
source destination :: b
destination flags :: [FileCopyFlags]
flags cancellable :: Maybe c
cancellable progressCallback :: Maybe FileProgressCallback
progressCallback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
source' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
source
Ptr File
destination' <- b -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
destination
let flags' :: CUInt
flags' = [FileCopyFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileCopyFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: c
jCancellable -> do
Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_FileProgressCallback
maybeProgressCallback <- case Maybe FileProgressCallback
progressCallback of
Nothing -> FunPtr C_FileProgressCallback -> IO (FunPtr C_FileProgressCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_FileProgressCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jProgressCallback :: FileProgressCallback
jProgressCallback -> do
FunPtr C_FileProgressCallback
jProgressCallback' <- C_FileProgressCallback -> IO (FunPtr C_FileProgressCallback)
Gio.Callbacks.mk_FileProgressCallback (Maybe (Ptr (FunPtr C_FileProgressCallback))
-> C_FileProgressCallback -> C_FileProgressCallback
Gio.Callbacks.wrap_FileProgressCallback Maybe (Ptr (FunPtr C_FileProgressCallback))
forall a. Maybe a
Nothing (FileProgressCallback -> C_FileProgressCallback
Gio.Callbacks.drop_closures_FileProgressCallback FileProgressCallback
jProgressCallback))
FunPtr C_FileProgressCallback -> IO (FunPtr C_FileProgressCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_FileProgressCallback
jProgressCallback'
let progressCallbackData :: Ptr a
progressCallbackData = Ptr a
forall a. Ptr a
nullPtr
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr File
-> CUInt
-> Ptr Cancellable
-> FunPtr C_FileProgressCallback
-> Ptr ()
-> Ptr (Ptr GError)
-> IO CInt
g_file_copy Ptr File
source' Ptr File
destination' CUInt
flags' Ptr Cancellable
maybeCancellable FunPtr C_FileProgressCallback
maybeProgressCallback Ptr ()
forall a. Ptr a
progressCallbackData
Ptr Any -> IO ()
forall a. Ptr a -> IO ()
safeFreeFunPtr (Ptr Any -> IO ()) -> Ptr Any -> IO ()
forall a b. (a -> b) -> a -> b
$ FunPtr C_FileProgressCallback -> Ptr Any
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_FileProgressCallback
maybeProgressCallback
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
source
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
destination
Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
Ptr Any -> IO ()
forall a. Ptr a -> IO ()
safeFreeFunPtr (Ptr Any -> IO ()) -> Ptr Any -> IO ()
forall a b. (a -> b) -> a -> b
$ FunPtr C_FileProgressCallback -> Ptr Any
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_FileProgressCallback
maybeProgressCallback
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileCopyMethodInfo
instance (signature ~ (b -> [Gio.Flags.FileCopyFlags] -> Maybe (c) -> Maybe (Gio.Callbacks.FileProgressCallback) -> m ()), MonadIO m, IsFile a, IsFile b, Gio.Cancellable.IsCancellable c) => O.MethodInfo FileCopyMethodInfo a signature where
overloadedMethod = fileCopy
#endif
#if defined(ENABLE_OVERLOADING)
data FileCopyAsyncMethodInfo
instance (p ~ (), o ~ O.UnsupportedMethodError "copyAsync" File) => O.MethodInfo FileCopyAsyncMethodInfo o p where
overloadedMethod = undefined
#endif
foreign import ccall "g_file_copy_attributes" g_file_copy_attributes ::
Ptr File ->
Ptr File ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
fileCopyAttributes ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, IsFile b, Gio.Cancellable.IsCancellable c) =>
a
-> b
-> [Gio.Flags.FileCopyFlags]
-> Maybe (c)
-> m ()
fileCopyAttributes :: a -> b -> [FileCopyFlags] -> Maybe c -> m ()
fileCopyAttributes source :: a
source destination :: b
destination flags :: [FileCopyFlags]
flags cancellable :: Maybe c
cancellable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
source' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
source
Ptr File
destination' <- b -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
destination
let flags' :: CUInt
flags' = [FileCopyFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileCopyFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: c
jCancellable -> do
Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr File
-> CUInt
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
g_file_copy_attributes Ptr File
source' Ptr File
destination' CUInt
flags' Ptr Cancellable
maybeCancellable
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
source
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
destination
Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileCopyAttributesMethodInfo
instance (signature ~ (b -> [Gio.Flags.FileCopyFlags] -> Maybe (c) -> m ()), MonadIO m, IsFile a, IsFile b, Gio.Cancellable.IsCancellable c) => O.MethodInfo FileCopyAttributesMethodInfo a signature where
overloadedMethod = fileCopyAttributes
#endif
foreign import ccall "g_file_copy_finish" g_file_copy_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO CInt
fileCopyFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ()
fileCopyFinish :: a -> b -> m ()
fileCopyFinish file :: a
file res :: b
res = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
res' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
res
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File -> Ptr AsyncResult -> Ptr (Ptr GError) -> IO CInt
g_file_copy_finish Ptr File
file' Ptr AsyncResult
res'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
res
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileCopyFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileCopyFinishMethodInfo a signature where
overloadedMethod = fileCopyFinish
#endif
foreign import ccall "g_file_create" g_file_create ::
Ptr File ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileOutputStream.FileOutputStream)
fileCreate ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> [Gio.Flags.FileCreateFlags]
-> Maybe (b)
-> m Gio.FileOutputStream.FileOutputStream
fileCreate :: a -> [FileCreateFlags] -> Maybe b -> m FileOutputStream
fileCreate file :: a
file flags :: [FileCreateFlags]
flags cancellable :: Maybe b
cancellable = IO FileOutputStream -> m FileOutputStream
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileOutputStream -> m FileOutputStream)
-> IO FileOutputStream -> m FileOutputStream
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
let flags' :: CUInt
flags' = [FileCreateFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileCreateFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO FileOutputStream -> IO () -> IO FileOutputStream
forall a b. IO a -> IO b -> IO a
onException (do
Ptr FileOutputStream
result <- (Ptr (Ptr GError) -> IO (Ptr FileOutputStream))
-> IO (Ptr FileOutputStream)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr FileOutputStream))
-> IO (Ptr FileOutputStream))
-> (Ptr (Ptr GError) -> IO (Ptr FileOutputStream))
-> IO (Ptr FileOutputStream)
forall a b. (a -> b) -> a -> b
$ Ptr File
-> CUInt
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO (Ptr FileOutputStream)
g_file_create Ptr File
file' CUInt
flags' Ptr Cancellable
maybeCancellable
Text -> Ptr FileOutputStream -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileCreate" Ptr FileOutputStream
result
FileOutputStream
result' <- ((ManagedPtr FileOutputStream -> FileOutputStream)
-> Ptr FileOutputStream -> IO FileOutputStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileOutputStream -> FileOutputStream
Gio.FileOutputStream.FileOutputStream) Ptr FileOutputStream
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
FileOutputStream -> IO FileOutputStream
forall (m :: * -> *) a. Monad m => a -> m a
return FileOutputStream
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileCreateMethodInfo
instance (signature ~ ([Gio.Flags.FileCreateFlags] -> Maybe (b) -> m Gio.FileOutputStream.FileOutputStream), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileCreateMethodInfo a signature where
overloadedMethod = fileCreate
#endif
foreign import ccall "g_file_create_async" g_file_create_async ::
Ptr File ->
CUInt ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileCreateAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> [Gio.Flags.FileCreateFlags]
-> Int32
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileCreateAsync :: a
-> [FileCreateFlags]
-> Int32
-> Maybe b
-> Maybe AsyncReadyCallback
-> m ()
fileCreateAsync file :: a
file flags :: [FileCreateFlags]
flags ioPriority :: Int32
ioPriority cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
let flags' :: CUInt
flags' = [FileCreateFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileCreateFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> CUInt
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_create_async Ptr File
file' CUInt
flags' Int32
ioPriority Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileCreateAsyncMethodInfo
instance (signature ~ ([Gio.Flags.FileCreateFlags] -> Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileCreateAsyncMethodInfo a signature where
overloadedMethod = fileCreateAsync
#endif
foreign import ccall "g_file_create_finish" g_file_create_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileOutputStream.FileOutputStream)
fileCreateFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m Gio.FileOutputStream.FileOutputStream
fileCreateFinish :: a -> b -> m FileOutputStream
fileCreateFinish file :: a
file res :: b
res = IO FileOutputStream -> m FileOutputStream
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileOutputStream -> m FileOutputStream)
-> IO FileOutputStream -> m FileOutputStream
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
res' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
res
IO FileOutputStream -> IO () -> IO FileOutputStream
forall a b. IO a -> IO b -> IO a
onException (do
Ptr FileOutputStream
result <- (Ptr (Ptr GError) -> IO (Ptr FileOutputStream))
-> IO (Ptr FileOutputStream)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr FileOutputStream))
-> IO (Ptr FileOutputStream))
-> (Ptr (Ptr GError) -> IO (Ptr FileOutputStream))
-> IO (Ptr FileOutputStream)
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr AsyncResult -> Ptr (Ptr GError) -> IO (Ptr FileOutputStream)
g_file_create_finish Ptr File
file' Ptr AsyncResult
res'
Text -> Ptr FileOutputStream -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileCreateFinish" Ptr FileOutputStream
result
FileOutputStream
result' <- ((ManagedPtr FileOutputStream -> FileOutputStream)
-> Ptr FileOutputStream -> IO FileOutputStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileOutputStream -> FileOutputStream
Gio.FileOutputStream.FileOutputStream) Ptr FileOutputStream
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
res
FileOutputStream -> IO FileOutputStream
forall (m :: * -> *) a. Monad m => a -> m a
return FileOutputStream
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileCreateFinishMethodInfo
instance (signature ~ (b -> m Gio.FileOutputStream.FileOutputStream), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileCreateFinishMethodInfo a signature where
overloadedMethod = fileCreateFinish
#endif
foreign import ccall "g_file_create_readwrite" g_file_create_readwrite ::
Ptr File ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileIOStream.FileIOStream)
fileCreateReadwrite ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> [Gio.Flags.FileCreateFlags]
-> Maybe (b)
-> m Gio.FileIOStream.FileIOStream
fileCreateReadwrite :: a -> [FileCreateFlags] -> Maybe b -> m FileIOStream
fileCreateReadwrite file :: a
file flags :: [FileCreateFlags]
flags cancellable :: Maybe b
cancellable = IO FileIOStream -> m FileIOStream
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileIOStream -> m FileIOStream)
-> IO FileIOStream -> m FileIOStream
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
let flags' :: CUInt
flags' = [FileCreateFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileCreateFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO FileIOStream -> IO () -> IO FileIOStream
forall a b. IO a -> IO b -> IO a
onException (do
Ptr FileIOStream
result <- (Ptr (Ptr GError) -> IO (Ptr FileIOStream))
-> IO (Ptr FileIOStream)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr FileIOStream))
-> IO (Ptr FileIOStream))
-> (Ptr (Ptr GError) -> IO (Ptr FileIOStream))
-> IO (Ptr FileIOStream)
forall a b. (a -> b) -> a -> b
$ Ptr File
-> CUInt
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO (Ptr FileIOStream)
g_file_create_readwrite Ptr File
file' CUInt
flags' Ptr Cancellable
maybeCancellable
Text -> Ptr FileIOStream -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileCreateReadwrite" Ptr FileIOStream
result
FileIOStream
result' <- ((ManagedPtr FileIOStream -> FileIOStream)
-> Ptr FileIOStream -> IO FileIOStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileIOStream -> FileIOStream
Gio.FileIOStream.FileIOStream) Ptr FileIOStream
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
FileIOStream -> IO FileIOStream
forall (m :: * -> *) a. Monad m => a -> m a
return FileIOStream
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileCreateReadwriteMethodInfo
instance (signature ~ ([Gio.Flags.FileCreateFlags] -> Maybe (b) -> m Gio.FileIOStream.FileIOStream), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileCreateReadwriteMethodInfo a signature where
overloadedMethod = fileCreateReadwrite
#endif
foreign import ccall "g_file_create_readwrite_async" g_file_create_readwrite_async ::
Ptr File ->
CUInt ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileCreateReadwriteAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> [Gio.Flags.FileCreateFlags]
-> Int32
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileCreateReadwriteAsync :: a
-> [FileCreateFlags]
-> Int32
-> Maybe b
-> Maybe AsyncReadyCallback
-> m ()
fileCreateReadwriteAsync file :: a
file flags :: [FileCreateFlags]
flags ioPriority :: Int32
ioPriority cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
let flags' :: CUInt
flags' = [FileCreateFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileCreateFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> CUInt
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_create_readwrite_async Ptr File
file' CUInt
flags' Int32
ioPriority Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileCreateReadwriteAsyncMethodInfo
instance (signature ~ ([Gio.Flags.FileCreateFlags] -> Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileCreateReadwriteAsyncMethodInfo a signature where
overloadedMethod = fileCreateReadwriteAsync
#endif
foreign import ccall "g_file_create_readwrite_finish" g_file_create_readwrite_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileIOStream.FileIOStream)
fileCreateReadwriteFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m Gio.FileIOStream.FileIOStream
fileCreateReadwriteFinish :: a -> b -> m FileIOStream
fileCreateReadwriteFinish file :: a
file res :: b
res = IO FileIOStream -> m FileIOStream
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileIOStream -> m FileIOStream)
-> IO FileIOStream -> m FileIOStream
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
res' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
res
IO FileIOStream -> IO () -> IO FileIOStream
forall a b. IO a -> IO b -> IO a
onException (do
Ptr FileIOStream
result <- (Ptr (Ptr GError) -> IO (Ptr FileIOStream))
-> IO (Ptr FileIOStream)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr FileIOStream))
-> IO (Ptr FileIOStream))
-> (Ptr (Ptr GError) -> IO (Ptr FileIOStream))
-> IO (Ptr FileIOStream)
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr AsyncResult -> Ptr (Ptr GError) -> IO (Ptr FileIOStream)
g_file_create_readwrite_finish Ptr File
file' Ptr AsyncResult
res'
Text -> Ptr FileIOStream -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileCreateReadwriteFinish" Ptr FileIOStream
result
FileIOStream
result' <- ((ManagedPtr FileIOStream -> FileIOStream)
-> Ptr FileIOStream -> IO FileIOStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileIOStream -> FileIOStream
Gio.FileIOStream.FileIOStream) Ptr FileIOStream
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
res
FileIOStream -> IO FileIOStream
forall (m :: * -> *) a. Monad m => a -> m a
return FileIOStream
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileCreateReadwriteFinishMethodInfo
instance (signature ~ (b -> m Gio.FileIOStream.FileIOStream), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileCreateReadwriteFinishMethodInfo a signature where
overloadedMethod = fileCreateReadwriteFinish
#endif
foreign import ccall "g_file_delete" g_file_delete ::
Ptr File ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
fileDelete ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m ()
fileDelete :: a -> Maybe b -> m ()
fileDelete file :: a
file cancellable :: Maybe b
cancellable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File -> Ptr Cancellable -> Ptr (Ptr GError) -> IO CInt
g_file_delete Ptr File
file' Ptr Cancellable
maybeCancellable
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileDeleteMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileDeleteMethodInfo a signature where
overloadedMethod = fileDelete
#endif
foreign import ccall "g_file_delete_async" g_file_delete_async ::
Ptr File ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileDeleteAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> Int32
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileDeleteAsync :: a -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
fileDeleteAsync file :: a
file ioPriority :: Int32
ioPriority cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_delete_async Ptr File
file' Int32
ioPriority Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileDeleteAsyncMethodInfo
instance (signature ~ (Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileDeleteAsyncMethodInfo a signature where
overloadedMethod = fileDeleteAsync
#endif
foreign import ccall "g_file_delete_finish" g_file_delete_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO CInt
fileDeleteFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ()
fileDeleteFinish :: a -> b -> m ()
fileDeleteFinish file :: a
file result_ :: b
result_ = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File -> Ptr AsyncResult -> Ptr (Ptr GError) -> IO CInt
g_file_delete_finish Ptr File
file' Ptr AsyncResult
result_'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileDeleteFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileDeleteFinishMethodInfo a signature where
overloadedMethod = fileDeleteFinish
#endif
foreign import ccall "g_file_dup" g_file_dup ::
Ptr File ->
IO (Ptr File)
fileDup ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
a
-> m File
fileDup :: a -> m File
fileDup file :: a
file = IO File -> m File
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO File -> m File) -> IO File -> m File
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr File
result <- Ptr File -> IO (Ptr File)
g_file_dup Ptr File
file'
Text -> Ptr File -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileDup" Ptr File
result
File
result' <- ((ManagedPtr File -> File) -> Ptr File -> IO File
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr File -> File
File) Ptr File
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
File -> IO File
forall (m :: * -> *) a. Monad m => a -> m a
return File
result'
#if defined(ENABLE_OVERLOADING)
data FileDupMethodInfo
instance (signature ~ (m File), MonadIO m, IsFile a) => O.MethodInfo FileDupMethodInfo a signature where
overloadedMethod = fileDup
#endif
foreign import ccall "g_file_eject_mountable" g_file_eject_mountable ::
Ptr File ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
{-# DEPRECATED fileEjectMountable ["(Since version 2.22)","Use 'GI.Gio.Interfaces.File.fileEjectMountableWithOperation' instead."] #-}
fileEjectMountable ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> [Gio.Flags.MountUnmountFlags]
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileEjectMountable :: a
-> [MountUnmountFlags]
-> Maybe b
-> Maybe AsyncReadyCallback
-> m ()
fileEjectMountable file :: a
file flags :: [MountUnmountFlags]
flags cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
let flags' :: CUInt
flags' = [MountUnmountFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [MountUnmountFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> CUInt
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_eject_mountable Ptr File
file' CUInt
flags' Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileEjectMountableMethodInfo
instance (signature ~ ([Gio.Flags.MountUnmountFlags] -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileEjectMountableMethodInfo a signature where
overloadedMethod = fileEjectMountable
#endif
foreign import ccall "g_file_eject_mountable_finish" g_file_eject_mountable_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO CInt
{-# DEPRECATED fileEjectMountableFinish ["(Since version 2.22)","Use 'GI.Gio.Interfaces.File.fileEjectMountableWithOperationFinish'"," instead."] #-}
fileEjectMountableFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ()
fileEjectMountableFinish :: a -> b -> m ()
fileEjectMountableFinish file :: a
file result_ :: b
result_ = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File -> Ptr AsyncResult -> Ptr (Ptr GError) -> IO CInt
g_file_eject_mountable_finish Ptr File
file' Ptr AsyncResult
result_'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileEjectMountableFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileEjectMountableFinishMethodInfo a signature where
overloadedMethod = fileEjectMountableFinish
#endif
foreign import ccall "g_file_eject_mountable_with_operation" g_file_eject_mountable_with_operation ::
Ptr File ->
CUInt ->
Ptr Gio.MountOperation.MountOperation ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileEjectMountableWithOperation ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.MountOperation.IsMountOperation b, Gio.Cancellable.IsCancellable c) =>
a
-> [Gio.Flags.MountUnmountFlags]
-> Maybe (b)
-> Maybe (c)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileEjectMountableWithOperation :: a
-> [MountUnmountFlags]
-> Maybe b
-> Maybe c
-> Maybe AsyncReadyCallback
-> m ()
fileEjectMountableWithOperation file :: a
file flags :: [MountUnmountFlags]
flags mountOperation :: Maybe b
mountOperation cancellable :: Maybe c
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
let flags' :: CUInt
flags' = [MountUnmountFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [MountUnmountFlags]
flags
Ptr MountOperation
maybeMountOperation <- case Maybe b
mountOperation of
Nothing -> Ptr MountOperation -> IO (Ptr MountOperation)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MountOperation
forall a. Ptr a
nullPtr
Just jMountOperation :: b
jMountOperation -> do
Ptr MountOperation
jMountOperation' <- b -> IO (Ptr MountOperation)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jMountOperation
Ptr MountOperation -> IO (Ptr MountOperation)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MountOperation
jMountOperation'
Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: c
jCancellable -> do
Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> CUInt
-> Ptr MountOperation
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_eject_mountable_with_operation Ptr File
file' CUInt
flags' Ptr MountOperation
maybeMountOperation Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
mountOperation b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileEjectMountableWithOperationMethodInfo
instance (signature ~ ([Gio.Flags.MountUnmountFlags] -> Maybe (b) -> Maybe (c) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.MountOperation.IsMountOperation b, Gio.Cancellable.IsCancellable c) => O.MethodInfo FileEjectMountableWithOperationMethodInfo a signature where
overloadedMethod = fileEjectMountableWithOperation
#endif
foreign import ccall "g_file_eject_mountable_with_operation_finish" g_file_eject_mountable_with_operation_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO CInt
fileEjectMountableWithOperationFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ()
fileEjectMountableWithOperationFinish :: a -> b -> m ()
fileEjectMountableWithOperationFinish file :: a
file result_ :: b
result_ = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File -> Ptr AsyncResult -> Ptr (Ptr GError) -> IO CInt
g_file_eject_mountable_with_operation_finish Ptr File
file' Ptr AsyncResult
result_'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileEjectMountableWithOperationFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileEjectMountableWithOperationFinishMethodInfo a signature where
overloadedMethod = fileEjectMountableWithOperationFinish
#endif
foreign import ccall "g_file_enumerate_children" g_file_enumerate_children ::
Ptr File ->
CString ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileEnumerator.FileEnumerator)
fileEnumerateChildren ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> T.Text
-> [Gio.Flags.FileQueryInfoFlags]
-> Maybe (b)
-> m Gio.FileEnumerator.FileEnumerator
fileEnumerateChildren :: a -> Text -> [FileQueryInfoFlags] -> Maybe b -> m FileEnumerator
fileEnumerateChildren file :: a
file attributes :: Text
attributes flags :: [FileQueryInfoFlags]
flags cancellable :: Maybe b
cancellable = IO FileEnumerator -> m FileEnumerator
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileEnumerator -> m FileEnumerator)
-> IO FileEnumerator -> m FileEnumerator
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
attributes' <- Text -> IO CString
textToCString Text
attributes
let flags' :: CUInt
flags' = [FileQueryInfoFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileQueryInfoFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO FileEnumerator -> IO () -> IO FileEnumerator
forall a b. IO a -> IO b -> IO a
onException (do
Ptr FileEnumerator
result <- (Ptr (Ptr GError) -> IO (Ptr FileEnumerator))
-> IO (Ptr FileEnumerator)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr FileEnumerator))
-> IO (Ptr FileEnumerator))
-> (Ptr (Ptr GError) -> IO (Ptr FileEnumerator))
-> IO (Ptr FileEnumerator)
forall a b. (a -> b) -> a -> b
$ Ptr File
-> CString
-> CUInt
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO (Ptr FileEnumerator)
g_file_enumerate_children Ptr File
file' CString
attributes' CUInt
flags' Ptr Cancellable
maybeCancellable
Text -> Ptr FileEnumerator -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileEnumerateChildren" Ptr FileEnumerator
result
FileEnumerator
result' <- ((ManagedPtr FileEnumerator -> FileEnumerator)
-> Ptr FileEnumerator -> IO FileEnumerator
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileEnumerator -> FileEnumerator
Gio.FileEnumerator.FileEnumerator) Ptr FileEnumerator
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
attributes'
FileEnumerator -> IO FileEnumerator
forall (m :: * -> *) a. Monad m => a -> m a
return FileEnumerator
result'
) (do
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
attributes'
)
#if defined(ENABLE_OVERLOADING)
data FileEnumerateChildrenMethodInfo
instance (signature ~ (T.Text -> [Gio.Flags.FileQueryInfoFlags] -> Maybe (b) -> m Gio.FileEnumerator.FileEnumerator), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileEnumerateChildrenMethodInfo a signature where
overloadedMethod = fileEnumerateChildren
#endif
foreign import ccall "g_file_enumerate_children_async" g_file_enumerate_children_async ::
Ptr File ->
CString ->
CUInt ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileEnumerateChildrenAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> T.Text
-> [Gio.Flags.FileQueryInfoFlags]
-> Int32
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileEnumerateChildrenAsync :: a
-> Text
-> [FileQueryInfoFlags]
-> Int32
-> Maybe b
-> Maybe AsyncReadyCallback
-> m ()
fileEnumerateChildrenAsync file :: a
file attributes :: Text
attributes flags :: [FileQueryInfoFlags]
flags ioPriority :: Int32
ioPriority cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
attributes' <- Text -> IO CString
textToCString Text
attributes
let flags' :: CUInt
flags' = [FileQueryInfoFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileQueryInfoFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> CString
-> CUInt
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_enumerate_children_async Ptr File
file' CString
attributes' CUInt
flags' Int32
ioPriority Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
attributes'
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileEnumerateChildrenAsyncMethodInfo
instance (signature ~ (T.Text -> [Gio.Flags.FileQueryInfoFlags] -> Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileEnumerateChildrenAsyncMethodInfo a signature where
overloadedMethod = fileEnumerateChildrenAsync
#endif
foreign import ccall "g_file_enumerate_children_finish" g_file_enumerate_children_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileEnumerator.FileEnumerator)
fileEnumerateChildrenFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m Gio.FileEnumerator.FileEnumerator
fileEnumerateChildrenFinish :: a -> b -> m FileEnumerator
fileEnumerateChildrenFinish file :: a
file res :: b
res = IO FileEnumerator -> m FileEnumerator
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileEnumerator -> m FileEnumerator)
-> IO FileEnumerator -> m FileEnumerator
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
res' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
res
IO FileEnumerator -> IO () -> IO FileEnumerator
forall a b. IO a -> IO b -> IO a
onException (do
Ptr FileEnumerator
result <- (Ptr (Ptr GError) -> IO (Ptr FileEnumerator))
-> IO (Ptr FileEnumerator)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr FileEnumerator))
-> IO (Ptr FileEnumerator))
-> (Ptr (Ptr GError) -> IO (Ptr FileEnumerator))
-> IO (Ptr FileEnumerator)
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr AsyncResult -> Ptr (Ptr GError) -> IO (Ptr FileEnumerator)
g_file_enumerate_children_finish Ptr File
file' Ptr AsyncResult
res'
Text -> Ptr FileEnumerator -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileEnumerateChildrenFinish" Ptr FileEnumerator
result
FileEnumerator
result' <- ((ManagedPtr FileEnumerator -> FileEnumerator)
-> Ptr FileEnumerator -> IO FileEnumerator
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileEnumerator -> FileEnumerator
Gio.FileEnumerator.FileEnumerator) Ptr FileEnumerator
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
res
FileEnumerator -> IO FileEnumerator
forall (m :: * -> *) a. Monad m => a -> m a
return FileEnumerator
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileEnumerateChildrenFinishMethodInfo
instance (signature ~ (b -> m Gio.FileEnumerator.FileEnumerator), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileEnumerateChildrenFinishMethodInfo a signature where
overloadedMethod = fileEnumerateChildrenFinish
#endif
foreign import ccall "g_file_equal" g_file_equal ::
Ptr File ->
Ptr File ->
IO CInt
fileEqual ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, IsFile b) =>
a
-> b
-> m Bool
fileEqual :: a -> b -> m Bool
fileEqual file1 :: a
file1 file2 :: b
file2 = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file1' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file1
Ptr File
file2' <- b -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
file2
CInt
result <- Ptr File -> Ptr File -> IO CInt
g_file_equal Ptr File
file1' Ptr File
file2'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file1
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
file2
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data FileEqualMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsFile a, IsFile b) => O.MethodInfo FileEqualMethodInfo a signature where
overloadedMethod = fileEqual
#endif
foreign import ccall "g_file_find_enclosing_mount" g_file_find_enclosing_mount ::
Ptr File ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.Mount.Mount)
fileFindEnclosingMount ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m Gio.Mount.Mount
fileFindEnclosingMount :: a -> Maybe b -> m Mount
fileFindEnclosingMount file :: a
file cancellable :: Maybe b
cancellable = IO Mount -> m Mount
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Mount -> m Mount) -> IO Mount -> m Mount
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO Mount -> IO () -> IO Mount
forall a b. IO a -> IO b -> IO a
onException (do
Ptr Mount
result <- (Ptr (Ptr GError) -> IO (Ptr Mount)) -> IO (Ptr Mount)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr Mount)) -> IO (Ptr Mount))
-> (Ptr (Ptr GError) -> IO (Ptr Mount)) -> IO (Ptr Mount)
forall a b. (a -> b) -> a -> b
$ Ptr File -> Ptr Cancellable -> Ptr (Ptr GError) -> IO (Ptr Mount)
g_file_find_enclosing_mount Ptr File
file' Ptr Cancellable
maybeCancellable
Text -> Ptr Mount -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileFindEnclosingMount" Ptr Mount
result
Mount
result' <- ((ManagedPtr Mount -> Mount) -> Ptr Mount -> IO Mount
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Mount -> Mount
Gio.Mount.Mount) Ptr Mount
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Mount -> IO Mount
forall (m :: * -> *) a. Monad m => a -> m a
return Mount
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileFindEnclosingMountMethodInfo
instance (signature ~ (Maybe (b) -> m Gio.Mount.Mount), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileFindEnclosingMountMethodInfo a signature where
overloadedMethod = fileFindEnclosingMount
#endif
foreign import ccall "g_file_find_enclosing_mount_async" g_file_find_enclosing_mount_async ::
Ptr File ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileFindEnclosingMountAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> Int32
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileFindEnclosingMountAsync :: a -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
fileFindEnclosingMountAsync file :: a
file ioPriority :: Int32
ioPriority cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_find_enclosing_mount_async Ptr File
file' Int32
ioPriority Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileFindEnclosingMountAsyncMethodInfo
instance (signature ~ (Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileFindEnclosingMountAsyncMethodInfo a signature where
overloadedMethod = fileFindEnclosingMountAsync
#endif
foreign import ccall "g_file_find_enclosing_mount_finish" g_file_find_enclosing_mount_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO (Ptr Gio.Mount.Mount)
fileFindEnclosingMountFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m Gio.Mount.Mount
fileFindEnclosingMountFinish :: a -> b -> m Mount
fileFindEnclosingMountFinish file :: a
file res :: b
res = IO Mount -> m Mount
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Mount -> m Mount) -> IO Mount -> m Mount
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
res' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
res
IO Mount -> IO () -> IO Mount
forall a b. IO a -> IO b -> IO a
onException (do
Ptr Mount
result <- (Ptr (Ptr GError) -> IO (Ptr Mount)) -> IO (Ptr Mount)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr Mount)) -> IO (Ptr Mount))
-> (Ptr (Ptr GError) -> IO (Ptr Mount)) -> IO (Ptr Mount)
forall a b. (a -> b) -> a -> b
$ Ptr File -> Ptr AsyncResult -> Ptr (Ptr GError) -> IO (Ptr Mount)
g_file_find_enclosing_mount_finish Ptr File
file' Ptr AsyncResult
res'
Text -> Ptr Mount -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileFindEnclosingMountFinish" Ptr Mount
result
Mount
result' <- ((ManagedPtr Mount -> Mount) -> Ptr Mount -> IO Mount
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Mount -> Mount
Gio.Mount.Mount) Ptr Mount
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
res
Mount -> IO Mount
forall (m :: * -> *) a. Monad m => a -> m a
return Mount
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileFindEnclosingMountFinishMethodInfo
instance (signature ~ (b -> m Gio.Mount.Mount), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileFindEnclosingMountFinishMethodInfo a signature where
overloadedMethod = fileFindEnclosingMountFinish
#endif
foreign import ccall "g_file_get_basename" g_file_get_basename ::
Ptr File ->
IO CString
fileGetBasename ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
a
-> m (Maybe [Char])
fileGetBasename :: a -> m (Maybe [Char])
fileGetBasename file :: a
file = IO (Maybe [Char]) -> m (Maybe [Char])
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe [Char]) -> m (Maybe [Char]))
-> IO (Maybe [Char]) -> m (Maybe [Char])
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
result <- Ptr File -> IO CString
g_file_get_basename Ptr File
file'
Maybe [Char]
maybeResult <- CString -> (CString -> IO [Char]) -> IO (Maybe [Char])
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO [Char]) -> IO (Maybe [Char]))
-> (CString -> IO [Char]) -> IO (Maybe [Char])
forall a b. (a -> b) -> a -> b
$ \result' :: CString
result' -> do
[Char]
result'' <- HasCallStack => CString -> IO [Char]
CString -> IO [Char]
cstringToString CString
result'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result'
[Char] -> IO [Char]
forall (m :: * -> *) a. Monad m => a -> m a
return [Char]
result''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe [Char] -> IO (Maybe [Char])
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe [Char]
maybeResult
#if defined(ENABLE_OVERLOADING)
data FileGetBasenameMethodInfo
instance (signature ~ (m (Maybe [Char])), MonadIO m, IsFile a) => O.MethodInfo FileGetBasenameMethodInfo a signature where
overloadedMethod = fileGetBasename
#endif
foreign import ccall "g_file_get_child" g_file_get_child ::
Ptr File ->
CString ->
IO (Ptr File)
fileGetChild ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
a
-> [Char]
-> m File
fileGetChild :: a -> [Char] -> m File
fileGetChild file :: a
file name :: [Char]
name = IO File -> m File
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO File -> m File) -> IO File -> m File
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
name' <- [Char] -> IO CString
stringToCString [Char]
name
Ptr File
result <- Ptr File -> CString -> IO (Ptr File)
g_file_get_child Ptr File
file' CString
name'
Text -> Ptr File -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileGetChild" Ptr File
result
File
result' <- ((ManagedPtr File -> File) -> Ptr File -> IO File
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr File -> File
File) Ptr File
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
File -> IO File
forall (m :: * -> *) a. Monad m => a -> m a
return File
result'
#if defined(ENABLE_OVERLOADING)
data FileGetChildMethodInfo
instance (signature ~ ([Char] -> m File), MonadIO m, IsFile a) => O.MethodInfo FileGetChildMethodInfo a signature where
overloadedMethod = fileGetChild
#endif
foreign import ccall "g_file_get_child_for_display_name" g_file_get_child_for_display_name ::
Ptr File ->
CString ->
Ptr (Ptr GError) ->
IO (Ptr File)
fileGetChildForDisplayName ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
a
-> T.Text
-> m File
fileGetChildForDisplayName :: a -> Text -> m File
fileGetChildForDisplayName file :: a
file displayName :: Text
displayName = IO File -> m File
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO File -> m File) -> IO File -> m File
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
displayName' <- Text -> IO CString
textToCString Text
displayName
IO File -> IO () -> IO File
forall a b. IO a -> IO b -> IO a
onException (do
Ptr File
result <- (Ptr (Ptr GError) -> IO (Ptr File)) -> IO (Ptr File)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr File)) -> IO (Ptr File))
-> (Ptr (Ptr GError) -> IO (Ptr File)) -> IO (Ptr File)
forall a b. (a -> b) -> a -> b
$ Ptr File -> CString -> Ptr (Ptr GError) -> IO (Ptr File)
g_file_get_child_for_display_name Ptr File
file' CString
displayName'
Text -> Ptr File -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileGetChildForDisplayName" Ptr File
result
File
result' <- ((ManagedPtr File -> File) -> Ptr File -> IO File
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr File -> File
File) Ptr File
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
displayName'
File -> IO File
forall (m :: * -> *) a. Monad m => a -> m a
return File
result'
) (do
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
displayName'
)
#if defined(ENABLE_OVERLOADING)
data FileGetChildForDisplayNameMethodInfo
instance (signature ~ (T.Text -> m File), MonadIO m, IsFile a) => O.MethodInfo FileGetChildForDisplayNameMethodInfo a signature where
overloadedMethod = fileGetChildForDisplayName
#endif
foreign import ccall "g_file_get_parent" g_file_get_parent ::
Ptr File ->
IO (Ptr File)
fileGetParent ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
a
-> m (Maybe File)
fileGetParent :: a -> m (Maybe File)
fileGetParent file :: a
file = IO (Maybe File) -> m (Maybe File)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe File) -> m (Maybe File))
-> IO (Maybe File) -> m (Maybe File)
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr File
result <- Ptr File -> IO (Ptr File)
g_file_get_parent Ptr File
file'
Maybe File
maybeResult <- Ptr File -> (Ptr File -> IO File) -> IO (Maybe File)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr File
result ((Ptr File -> IO File) -> IO (Maybe File))
-> (Ptr File -> IO File) -> IO (Maybe File)
forall a b. (a -> b) -> a -> b
$ \result' :: Ptr File
result' -> do
File
result'' <- ((ManagedPtr File -> File) -> Ptr File -> IO File
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr File -> File
File) Ptr File
result'
File -> IO File
forall (m :: * -> *) a. Monad m => a -> m a
return File
result''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe File -> IO (Maybe File)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe File
maybeResult
#if defined(ENABLE_OVERLOADING)
data FileGetParentMethodInfo
instance (signature ~ (m (Maybe File)), MonadIO m, IsFile a) => O.MethodInfo FileGetParentMethodInfo a signature where
overloadedMethod = fileGetParent
#endif
foreign import ccall "g_file_get_parse_name" g_file_get_parse_name ::
Ptr File ->
IO CString
fileGetParseName ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
a
-> m T.Text
fileGetParseName :: a -> m Text
fileGetParseName file :: a
file = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
result <- Ptr File -> IO CString
g_file_get_parse_name Ptr File
file'
Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileGetParseName" CString
result
Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'
#if defined(ENABLE_OVERLOADING)
data FileGetParseNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsFile a) => O.MethodInfo FileGetParseNameMethodInfo a signature where
overloadedMethod = fileGetParseName
#endif
foreign import ccall "g_file_get_path" g_file_get_path ::
Ptr File ->
IO CString
fileGetPath ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
a
-> m (Maybe [Char])
fileGetPath :: a -> m (Maybe [Char])
fileGetPath file :: a
file = IO (Maybe [Char]) -> m (Maybe [Char])
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe [Char]) -> m (Maybe [Char]))
-> IO (Maybe [Char]) -> m (Maybe [Char])
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
result <- Ptr File -> IO CString
g_file_get_path Ptr File
file'
Maybe [Char]
maybeResult <- CString -> (CString -> IO [Char]) -> IO (Maybe [Char])
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO [Char]) -> IO (Maybe [Char]))
-> (CString -> IO [Char]) -> IO (Maybe [Char])
forall a b. (a -> b) -> a -> b
$ \result' :: CString
result' -> do
[Char]
result'' <- HasCallStack => CString -> IO [Char]
CString -> IO [Char]
cstringToString CString
result'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result'
[Char] -> IO [Char]
forall (m :: * -> *) a. Monad m => a -> m a
return [Char]
result''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe [Char] -> IO (Maybe [Char])
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe [Char]
maybeResult
#if defined(ENABLE_OVERLOADING)
data FileGetPathMethodInfo
instance (signature ~ (m (Maybe [Char])), MonadIO m, IsFile a) => O.MethodInfo FileGetPathMethodInfo a signature where
overloadedMethod = fileGetPath
#endif
foreign import ccall "g_file_get_relative_path" g_file_get_relative_path ::
Ptr File ->
Ptr File ->
IO CString
fileGetRelativePath ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, IsFile b) =>
a
-> b
-> m (Maybe [Char])
fileGetRelativePath :: a -> b -> m (Maybe [Char])
fileGetRelativePath parent :: a
parent descendant :: b
descendant = IO (Maybe [Char]) -> m (Maybe [Char])
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe [Char]) -> m (Maybe [Char]))
-> IO (Maybe [Char]) -> m (Maybe [Char])
forall a b. (a -> b) -> a -> b
$ do
Ptr File
parent' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
parent
Ptr File
descendant' <- b -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
descendant
CString
result <- Ptr File -> Ptr File -> IO CString
g_file_get_relative_path Ptr File
parent' Ptr File
descendant'
Maybe [Char]
maybeResult <- CString -> (CString -> IO [Char]) -> IO (Maybe [Char])
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO [Char]) -> IO (Maybe [Char]))
-> (CString -> IO [Char]) -> IO (Maybe [Char])
forall a b. (a -> b) -> a -> b
$ \result' :: CString
result' -> do
[Char]
result'' <- HasCallStack => CString -> IO [Char]
CString -> IO [Char]
cstringToString CString
result'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result'
[Char] -> IO [Char]
forall (m :: * -> *) a. Monad m => a -> m a
return [Char]
result''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
parent
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
descendant
Maybe [Char] -> IO (Maybe [Char])
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe [Char]
maybeResult
#if defined(ENABLE_OVERLOADING)
data FileGetRelativePathMethodInfo
instance (signature ~ (b -> m (Maybe [Char])), MonadIO m, IsFile a, IsFile b) => O.MethodInfo FileGetRelativePathMethodInfo a signature where
overloadedMethod = fileGetRelativePath
#endif
foreign import ccall "g_file_get_uri" g_file_get_uri ::
Ptr File ->
IO CString
fileGetUri ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
a
-> m T.Text
fileGetUri :: a -> m Text
fileGetUri file :: a
file = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
result <- Ptr File -> IO CString
g_file_get_uri Ptr File
file'
Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileGetUri" CString
result
Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'
#if defined(ENABLE_OVERLOADING)
data FileGetUriMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsFile a) => O.MethodInfo FileGetUriMethodInfo a signature where
overloadedMethod = fileGetUri
#endif
foreign import ccall "g_file_get_uri_scheme" g_file_get_uri_scheme ::
Ptr File ->
IO CString
fileGetUriScheme ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
a
-> m T.Text
fileGetUriScheme :: a -> m Text
fileGetUriScheme file :: a
file = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
result <- Ptr File -> IO CString
g_file_get_uri_scheme Ptr File
file'
Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileGetUriScheme" CString
result
Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'
#if defined(ENABLE_OVERLOADING)
data FileGetUriSchemeMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsFile a) => O.MethodInfo FileGetUriSchemeMethodInfo a signature where
overloadedMethod = fileGetUriScheme
#endif
foreign import ccall "g_file_has_parent" g_file_has_parent ::
Ptr File ->
Ptr File ->
IO CInt
fileHasParent ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, IsFile b) =>
a
-> Maybe (b)
-> m Bool
fileHasParent :: a -> Maybe b -> m Bool
fileHasParent file :: a
file parent :: Maybe b
parent = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr File
maybeParent <- case Maybe b
parent of
Nothing -> Ptr File -> IO (Ptr File)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr File
forall a. Ptr a
nullPtr
Just jParent :: b
jParent -> do
Ptr File
jParent' <- b -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jParent
Ptr File -> IO (Ptr File)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr File
jParent'
CInt
result <- Ptr File -> Ptr File -> IO CInt
g_file_has_parent Ptr File
file' Ptr File
maybeParent
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
parent b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data FileHasParentMethodInfo
instance (signature ~ (Maybe (b) -> m Bool), MonadIO m, IsFile a, IsFile b) => O.MethodInfo FileHasParentMethodInfo a signature where
overloadedMethod = fileHasParent
#endif
foreign import ccall "g_file_has_prefix" g_file_has_prefix ::
Ptr File ->
Ptr File ->
IO CInt
fileHasPrefix ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, IsFile b) =>
a
-> b
-> m Bool
fileHasPrefix :: a -> b -> m Bool
fileHasPrefix file :: a
file prefix :: b
prefix = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr File
prefix' <- b -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
prefix
CInt
result <- Ptr File -> Ptr File -> IO CInt
g_file_has_prefix Ptr File
file' Ptr File
prefix'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
prefix
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data FileHasPrefixMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsFile a, IsFile b) => O.MethodInfo FileHasPrefixMethodInfo a signature where
overloadedMethod = fileHasPrefix
#endif
foreign import ccall "g_file_has_uri_scheme" g_file_has_uri_scheme ::
Ptr File ->
CString ->
IO CInt
fileHasUriScheme ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
a
-> T.Text
-> m Bool
fileHasUriScheme :: a -> Text -> m Bool
fileHasUriScheme file :: a
file uriScheme :: Text
uriScheme = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
uriScheme' <- Text -> IO CString
textToCString Text
uriScheme
CInt
result <- Ptr File -> CString -> IO CInt
g_file_has_uri_scheme Ptr File
file' CString
uriScheme'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
uriScheme'
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data FileHasUriSchemeMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m, IsFile a) => O.MethodInfo FileHasUriSchemeMethodInfo a signature where
overloadedMethod = fileHasUriScheme
#endif
foreign import ccall "g_file_hash" g_file_hash ::
Ptr File ->
IO Word32
fileHash ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
a
-> m Word32
fileHash :: a -> m Word32
fileHash file :: a
file = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Word32
result <- Ptr File -> IO Word32
g_file_hash Ptr File
file'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
#if defined(ENABLE_OVERLOADING)
data FileHashMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsFile a) => O.MethodInfo FileHashMethodInfo a signature where
overloadedMethod = fileHash
#endif
foreign import ccall "g_file_is_native" g_file_is_native ::
Ptr File ->
IO CInt
fileIsNative ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
a
-> m Bool
fileIsNative :: a -> m Bool
fileIsNative file :: a
file = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CInt
result <- Ptr File -> IO CInt
g_file_is_native Ptr File
file'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data FileIsNativeMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsFile a) => O.MethodInfo FileIsNativeMethodInfo a signature where
overloadedMethod = fileIsNative
#endif
foreign import ccall "g_file_load_bytes" g_file_load_bytes ::
Ptr File ->
Ptr Gio.Cancellable.Cancellable ->
Ptr CString ->
Ptr (Ptr GError) ->
IO (Ptr GLib.Bytes.Bytes)
fileLoadBytes ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m ((GLib.Bytes.Bytes, Maybe T.Text))
fileLoadBytes :: a -> Maybe b -> m (Bytes, Maybe Text)
fileLoadBytes file :: a
file cancellable :: Maybe b
cancellable = IO (Bytes, Maybe Text) -> m (Bytes, Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bytes, Maybe Text) -> m (Bytes, Maybe Text))
-> IO (Bytes, Maybe Text) -> m (Bytes, Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
Ptr CString
etagOut <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CString)
IO (Bytes, Maybe Text) -> IO () -> IO (Bytes, Maybe Text)
forall a b. IO a -> IO b -> IO a
onException (do
Ptr Bytes
result <- (Ptr (Ptr GError) -> IO (Ptr Bytes)) -> IO (Ptr Bytes)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr Bytes)) -> IO (Ptr Bytes))
-> (Ptr (Ptr GError) -> IO (Ptr Bytes)) -> IO (Ptr Bytes)
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr Cancellable
-> Ptr CString
-> Ptr (Ptr GError)
-> IO (Ptr Bytes)
g_file_load_bytes Ptr File
file' Ptr Cancellable
maybeCancellable Ptr CString
etagOut
Text -> Ptr Bytes -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileLoadBytes" Ptr Bytes
result
Bytes
result' <- ((ManagedPtr Bytes -> Bytes) -> Ptr Bytes -> IO Bytes
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Bytes -> Bytes
GLib.Bytes.Bytes) Ptr Bytes
result
CString
etagOut' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
etagOut
Maybe Text
maybeEtagOut' <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
etagOut' ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \etagOut'' :: CString
etagOut'' -> do
Text
etagOut''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
etagOut''
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
etagOut'''
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
etagOut'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
etagOut
(Bytes, Maybe Text) -> IO (Bytes, Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return (Bytes
result', Maybe Text
maybeEtagOut')
) (do
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
etagOut
)
#if defined(ENABLE_OVERLOADING)
data FileLoadBytesMethodInfo
instance (signature ~ (Maybe (b) -> m ((GLib.Bytes.Bytes, Maybe T.Text))), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileLoadBytesMethodInfo a signature where
overloadedMethod = fileLoadBytes
#endif
foreign import ccall "g_file_load_bytes_async" g_file_load_bytes_async ::
Ptr File ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileLoadBytesAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileLoadBytesAsync :: a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
fileLoadBytesAsync file :: a
file cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_load_bytes_async Ptr File
file' Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileLoadBytesAsyncMethodInfo
instance (signature ~ (Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileLoadBytesAsyncMethodInfo a signature where
overloadedMethod = fileLoadBytesAsync
#endif
foreign import ccall "g_file_load_bytes_finish" g_file_load_bytes_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr CString ->
Ptr (Ptr GError) ->
IO (Ptr GLib.Bytes.Bytes)
fileLoadBytesFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ((GLib.Bytes.Bytes, Maybe T.Text))
fileLoadBytesFinish :: a -> b -> m (Bytes, Maybe Text)
fileLoadBytesFinish file :: a
file result_ :: b
result_ = IO (Bytes, Maybe Text) -> m (Bytes, Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bytes, Maybe Text) -> m (Bytes, Maybe Text))
-> IO (Bytes, Maybe Text) -> m (Bytes, Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
Ptr CString
etagOut <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CString)
IO (Bytes, Maybe Text) -> IO () -> IO (Bytes, Maybe Text)
forall a b. IO a -> IO b -> IO a
onException (do
Ptr Bytes
result <- (Ptr (Ptr GError) -> IO (Ptr Bytes)) -> IO (Ptr Bytes)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr Bytes)) -> IO (Ptr Bytes))
-> (Ptr (Ptr GError) -> IO (Ptr Bytes)) -> IO (Ptr Bytes)
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr AsyncResult
-> Ptr CString
-> Ptr (Ptr GError)
-> IO (Ptr Bytes)
g_file_load_bytes_finish Ptr File
file' Ptr AsyncResult
result_' Ptr CString
etagOut
Text -> Ptr Bytes -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileLoadBytesFinish" Ptr Bytes
result
Bytes
result' <- ((ManagedPtr Bytes -> Bytes) -> Ptr Bytes -> IO Bytes
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Bytes -> Bytes
GLib.Bytes.Bytes) Ptr Bytes
result
CString
etagOut' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
etagOut
Maybe Text
maybeEtagOut' <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
etagOut' ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \etagOut'' :: CString
etagOut'' -> do
Text
etagOut''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
etagOut''
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
etagOut'''
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
etagOut'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
etagOut
(Bytes, Maybe Text) -> IO (Bytes, Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return (Bytes
result', Maybe Text
maybeEtagOut')
) (do
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
etagOut
)
#if defined(ENABLE_OVERLOADING)
data FileLoadBytesFinishMethodInfo
instance (signature ~ (b -> m ((GLib.Bytes.Bytes, Maybe T.Text))), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileLoadBytesFinishMethodInfo a signature where
overloadedMethod = fileLoadBytesFinish
#endif
foreign import ccall "g_file_load_contents" g_file_load_contents ::
Ptr File ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr Word8) ->
Ptr Word64 ->
Ptr CString ->
Ptr (Ptr GError) ->
IO CInt
fileLoadContents ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m ((ByteString, T.Text))
fileLoadContents :: a -> Maybe b -> m (ByteString, Text)
fileLoadContents file :: a
file cancellable :: Maybe b
cancellable = IO (ByteString, Text) -> m (ByteString, Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (ByteString, Text) -> m (ByteString, Text))
-> IO (ByteString, Text) -> m (ByteString, Text)
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
Ptr (Ptr Word8)
contents <- IO (Ptr (Ptr Word8))
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr (Ptr Word8))
Ptr Word64
length_ <- IO (Ptr Word64)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word64)
Ptr CString
etagOut <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CString)
IO (ByteString, Text) -> IO () -> IO (ByteString, Text)
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr Cancellable
-> Ptr (Ptr Word8)
-> Ptr Word64
-> Ptr CString
-> Ptr (Ptr GError)
-> IO CInt
g_file_load_contents Ptr File
file' Ptr Cancellable
maybeCancellable Ptr (Ptr Word8)
contents Ptr Word64
length_ Ptr CString
etagOut
Word64
length_' <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek Ptr Word64
length_
Ptr Word8
contents' <- Ptr (Ptr Word8) -> IO (Ptr Word8)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Word8)
contents
ByteString
contents'' <- (Word64 -> Ptr Word8 -> IO ByteString
forall a. Integral a => a -> Ptr Word8 -> IO ByteString
unpackByteStringWithLength Word64
length_') Ptr Word8
contents'
Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
contents'
CString
etagOut' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
etagOut
Text
etagOut'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
etagOut'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
etagOut'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Ptr (Ptr Word8) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Word8)
contents
Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
length_
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
etagOut
(ByteString, Text) -> IO (ByteString, Text)
forall (m :: * -> *) a. Monad m => a -> m a
return (ByteString
contents'', Text
etagOut'')
) (do
Ptr (Ptr Word8) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Word8)
contents
Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
length_
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
etagOut
)
#if defined(ENABLE_OVERLOADING)
data FileLoadContentsMethodInfo
instance (signature ~ (Maybe (b) -> m ((ByteString, T.Text))), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileLoadContentsMethodInfo a signature where
overloadedMethod = fileLoadContents
#endif
foreign import ccall "g_file_load_contents_async" g_file_load_contents_async ::
Ptr File ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileLoadContentsAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileLoadContentsAsync :: a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
fileLoadContentsAsync file :: a
file cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_load_contents_async Ptr File
file' Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileLoadContentsAsyncMethodInfo
instance (signature ~ (Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileLoadContentsAsyncMethodInfo a signature where
overloadedMethod = fileLoadContentsAsync
#endif
foreign import ccall "g_file_load_contents_finish" g_file_load_contents_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr Word8) ->
Ptr Word64 ->
Ptr CString ->
Ptr (Ptr GError) ->
IO CInt
fileLoadContentsFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ((ByteString, T.Text))
fileLoadContentsFinish :: a -> b -> m (ByteString, Text)
fileLoadContentsFinish file :: a
file res :: b
res = IO (ByteString, Text) -> m (ByteString, Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (ByteString, Text) -> m (ByteString, Text))
-> IO (ByteString, Text) -> m (ByteString, Text)
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
res' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
res
Ptr (Ptr Word8)
contents <- IO (Ptr (Ptr Word8))
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr (Ptr Word8))
Ptr Word64
length_ <- IO (Ptr Word64)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word64)
Ptr CString
etagOut <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CString)
IO (ByteString, Text) -> IO () -> IO (ByteString, Text)
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr AsyncResult
-> Ptr (Ptr Word8)
-> Ptr Word64
-> Ptr CString
-> Ptr (Ptr GError)
-> IO CInt
g_file_load_contents_finish Ptr File
file' Ptr AsyncResult
res' Ptr (Ptr Word8)
contents Ptr Word64
length_ Ptr CString
etagOut
Word64
length_' <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek Ptr Word64
length_
Ptr Word8
contents' <- Ptr (Ptr Word8) -> IO (Ptr Word8)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Word8)
contents
ByteString
contents'' <- (Word64 -> Ptr Word8 -> IO ByteString
forall a. Integral a => a -> Ptr Word8 -> IO ByteString
unpackByteStringWithLength Word64
length_') Ptr Word8
contents'
Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
contents'
CString
etagOut' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
etagOut
Text
etagOut'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
etagOut'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
etagOut'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
res
Ptr (Ptr Word8) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Word8)
contents
Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
length_
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
etagOut
(ByteString, Text) -> IO (ByteString, Text)
forall (m :: * -> *) a. Monad m => a -> m a
return (ByteString
contents'', Text
etagOut'')
) (do
Ptr (Ptr Word8) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Word8)
contents
Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
length_
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
etagOut
)
#if defined(ENABLE_OVERLOADING)
data FileLoadContentsFinishMethodInfo
instance (signature ~ (b -> m ((ByteString, T.Text))), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileLoadContentsFinishMethodInfo a signature where
overloadedMethod = fileLoadContentsFinish
#endif
foreign import ccall "g_file_load_partial_contents_finish" g_file_load_partial_contents_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr Word8) ->
Ptr Word64 ->
Ptr CString ->
Ptr (Ptr GError) ->
IO CInt
fileLoadPartialContentsFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ((ByteString, T.Text))
fileLoadPartialContentsFinish :: a -> b -> m (ByteString, Text)
fileLoadPartialContentsFinish file :: a
file res :: b
res = IO (ByteString, Text) -> m (ByteString, Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (ByteString, Text) -> m (ByteString, Text))
-> IO (ByteString, Text) -> m (ByteString, Text)
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
res' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
res
Ptr (Ptr Word8)
contents <- IO (Ptr (Ptr Word8))
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr (Ptr Word8))
Ptr Word64
length_ <- IO (Ptr Word64)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word64)
Ptr CString
etagOut <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CString)
IO (ByteString, Text) -> IO () -> IO (ByteString, Text)
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr AsyncResult
-> Ptr (Ptr Word8)
-> Ptr Word64
-> Ptr CString
-> Ptr (Ptr GError)
-> IO CInt
g_file_load_partial_contents_finish Ptr File
file' Ptr AsyncResult
res' Ptr (Ptr Word8)
contents Ptr Word64
length_ Ptr CString
etagOut
Word64
length_' <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek Ptr Word64
length_
Ptr Word8
contents' <- Ptr (Ptr Word8) -> IO (Ptr Word8)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Word8)
contents
ByteString
contents'' <- (Word64 -> Ptr Word8 -> IO ByteString
forall a. Integral a => a -> Ptr Word8 -> IO ByteString
unpackByteStringWithLength Word64
length_') Ptr Word8
contents'
Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
contents'
CString
etagOut' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
etagOut
Text
etagOut'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
etagOut'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
etagOut'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
res
Ptr (Ptr Word8) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Word8)
contents
Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
length_
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
etagOut
(ByteString, Text) -> IO (ByteString, Text)
forall (m :: * -> *) a. Monad m => a -> m a
return (ByteString
contents'', Text
etagOut'')
) (do
Ptr (Ptr Word8) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Word8)
contents
Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
length_
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
etagOut
)
#if defined(ENABLE_OVERLOADING)
data FileLoadPartialContentsFinishMethodInfo
instance (signature ~ (b -> m ((ByteString, T.Text))), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileLoadPartialContentsFinishMethodInfo a signature where
overloadedMethod = fileLoadPartialContentsFinish
#endif
foreign import ccall "g_file_make_directory" g_file_make_directory ::
Ptr File ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
fileMakeDirectory ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m ()
fileMakeDirectory :: a -> Maybe b -> m ()
fileMakeDirectory file :: a
file cancellable :: Maybe b
cancellable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File -> Ptr Cancellable -> Ptr (Ptr GError) -> IO CInt
g_file_make_directory Ptr File
file' Ptr Cancellable
maybeCancellable
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileMakeDirectoryMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileMakeDirectoryMethodInfo a signature where
overloadedMethod = fileMakeDirectory
#endif
foreign import ccall "g_file_make_directory_async" g_file_make_directory_async ::
Ptr File ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileMakeDirectoryAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> Int32
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileMakeDirectoryAsync :: a -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
fileMakeDirectoryAsync file :: a
file ioPriority :: Int32
ioPriority cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_make_directory_async Ptr File
file' Int32
ioPriority Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileMakeDirectoryAsyncMethodInfo
instance (signature ~ (Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileMakeDirectoryAsyncMethodInfo a signature where
overloadedMethod = fileMakeDirectoryAsync
#endif
foreign import ccall "g_file_make_directory_finish" g_file_make_directory_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO CInt
fileMakeDirectoryFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ()
fileMakeDirectoryFinish :: a -> b -> m ()
fileMakeDirectoryFinish file :: a
file result_ :: b
result_ = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File -> Ptr AsyncResult -> Ptr (Ptr GError) -> IO CInt
g_file_make_directory_finish Ptr File
file' Ptr AsyncResult
result_'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileMakeDirectoryFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileMakeDirectoryFinishMethodInfo a signature where
overloadedMethod = fileMakeDirectoryFinish
#endif
foreign import ccall "g_file_make_directory_with_parents" g_file_make_directory_with_parents ::
Ptr File ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
fileMakeDirectoryWithParents ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m ()
fileMakeDirectoryWithParents :: a -> Maybe b -> m ()
fileMakeDirectoryWithParents file :: a
file cancellable :: Maybe b
cancellable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File -> Ptr Cancellable -> Ptr (Ptr GError) -> IO CInt
g_file_make_directory_with_parents Ptr File
file' Ptr Cancellable
maybeCancellable
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileMakeDirectoryWithParentsMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileMakeDirectoryWithParentsMethodInfo a signature where
overloadedMethod = fileMakeDirectoryWithParents
#endif
foreign import ccall "g_file_make_symbolic_link" g_file_make_symbolic_link ::
Ptr File ->
CString ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
fileMakeSymbolicLink ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> [Char]
-> Maybe (b)
-> m ()
fileMakeSymbolicLink :: a -> [Char] -> Maybe b -> m ()
fileMakeSymbolicLink file :: a
file symlinkValue :: [Char]
symlinkValue cancellable :: Maybe b
cancellable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
symlinkValue' <- [Char] -> IO CString
stringToCString [Char]
symlinkValue
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File
-> CString -> Ptr Cancellable -> Ptr (Ptr GError) -> IO CInt
g_file_make_symbolic_link Ptr File
file' CString
symlinkValue' Ptr Cancellable
maybeCancellable
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
symlinkValue'
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
symlinkValue'
)
#if defined(ENABLE_OVERLOADING)
data FileMakeSymbolicLinkMethodInfo
instance (signature ~ ([Char] -> Maybe (b) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileMakeSymbolicLinkMethodInfo a signature where
overloadedMethod = fileMakeSymbolicLink
#endif
foreign import ccall "g_file_measure_disk_usage_finish" g_file_measure_disk_usage_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr Word64 ->
Ptr Word64 ->
Ptr Word64 ->
Ptr (Ptr GError) ->
IO CInt
fileMeasureDiskUsageFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ((Word64, Word64, Word64))
fileMeasureDiskUsageFinish :: a -> b -> m (Word64, Word64, Word64)
fileMeasureDiskUsageFinish file :: a
file result_ :: b
result_ = IO (Word64, Word64, Word64) -> m (Word64, Word64, Word64)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Word64, Word64, Word64) -> m (Word64, Word64, Word64))
-> IO (Word64, Word64, Word64) -> m (Word64, Word64, Word64)
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
Ptr Word64
diskUsage <- IO (Ptr Word64)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word64)
Ptr Word64
numDirs <- IO (Ptr Word64)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word64)
Ptr Word64
numFiles <- IO (Ptr Word64)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word64)
IO (Word64, Word64, Word64) -> IO () -> IO (Word64, Word64, Word64)
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr AsyncResult
-> Ptr Word64
-> Ptr Word64
-> Ptr Word64
-> Ptr (Ptr GError)
-> IO CInt
g_file_measure_disk_usage_finish Ptr File
file' Ptr AsyncResult
result_' Ptr Word64
diskUsage Ptr Word64
numDirs Ptr Word64
numFiles
Word64
diskUsage' <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek Ptr Word64
diskUsage
Word64
numDirs' <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek Ptr Word64
numDirs
Word64
numFiles' <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek Ptr Word64
numFiles
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
diskUsage
Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
numDirs
Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
numFiles
(Word64, Word64, Word64) -> IO (Word64, Word64, Word64)
forall (m :: * -> *) a. Monad m => a -> m a
return (Word64
diskUsage', Word64
numDirs', Word64
numFiles')
) (do
Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
diskUsage
Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
numDirs
Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
numFiles
)
#if defined(ENABLE_OVERLOADING)
data FileMeasureDiskUsageFinishMethodInfo
instance (signature ~ (b -> m ((Word64, Word64, Word64))), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileMeasureDiskUsageFinishMethodInfo a signature where
overloadedMethod = fileMeasureDiskUsageFinish
#endif
foreign import ccall "g_file_monitor" g_file_monitor ::
Ptr File ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileMonitor.FileMonitor)
fileMonitor ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> [Gio.Flags.FileMonitorFlags]
-> Maybe (b)
-> m Gio.FileMonitor.FileMonitor
fileMonitor :: a -> [FileMonitorFlags] -> Maybe b -> m FileMonitor
fileMonitor file :: a
file flags :: [FileMonitorFlags]
flags cancellable :: Maybe b
cancellable = IO FileMonitor -> m FileMonitor
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileMonitor -> m FileMonitor)
-> IO FileMonitor -> m FileMonitor
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
let flags' :: CUInt
flags' = [FileMonitorFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileMonitorFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO FileMonitor -> IO () -> IO FileMonitor
forall a b. IO a -> IO b -> IO a
onException (do
Ptr FileMonitor
result <- (Ptr (Ptr GError) -> IO (Ptr FileMonitor)) -> IO (Ptr FileMonitor)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr FileMonitor))
-> IO (Ptr FileMonitor))
-> (Ptr (Ptr GError) -> IO (Ptr FileMonitor))
-> IO (Ptr FileMonitor)
forall a b. (a -> b) -> a -> b
$ Ptr File
-> CUInt
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO (Ptr FileMonitor)
g_file_monitor Ptr File
file' CUInt
flags' Ptr Cancellable
maybeCancellable
Text -> Ptr FileMonitor -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileMonitor" Ptr FileMonitor
result
FileMonitor
result' <- ((ManagedPtr FileMonitor -> FileMonitor)
-> Ptr FileMonitor -> IO FileMonitor
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileMonitor -> FileMonitor
Gio.FileMonitor.FileMonitor) Ptr FileMonitor
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
FileMonitor -> IO FileMonitor
forall (m :: * -> *) a. Monad m => a -> m a
return FileMonitor
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileMonitorMethodInfo
instance (signature ~ ([Gio.Flags.FileMonitorFlags] -> Maybe (b) -> m Gio.FileMonitor.FileMonitor), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileMonitorMethodInfo a signature where
overloadedMethod = fileMonitor
#endif
foreign import ccall "g_file_monitor_directory" g_file_monitor_directory ::
Ptr File ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileMonitor.FileMonitor)
fileMonitorDirectory ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> [Gio.Flags.FileMonitorFlags]
-> Maybe (b)
-> m Gio.FileMonitor.FileMonitor
fileMonitorDirectory :: a -> [FileMonitorFlags] -> Maybe b -> m FileMonitor
fileMonitorDirectory file :: a
file flags :: [FileMonitorFlags]
flags cancellable :: Maybe b
cancellable = IO FileMonitor -> m FileMonitor
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileMonitor -> m FileMonitor)
-> IO FileMonitor -> m FileMonitor
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
let flags' :: CUInt
flags' = [FileMonitorFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileMonitorFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO FileMonitor -> IO () -> IO FileMonitor
forall a b. IO a -> IO b -> IO a
onException (do
Ptr FileMonitor
result <- (Ptr (Ptr GError) -> IO (Ptr FileMonitor)) -> IO (Ptr FileMonitor)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr FileMonitor))
-> IO (Ptr FileMonitor))
-> (Ptr (Ptr GError) -> IO (Ptr FileMonitor))
-> IO (Ptr FileMonitor)
forall a b. (a -> b) -> a -> b
$ Ptr File
-> CUInt
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO (Ptr FileMonitor)
g_file_monitor_directory Ptr File
file' CUInt
flags' Ptr Cancellable
maybeCancellable
Text -> Ptr FileMonitor -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileMonitorDirectory" Ptr FileMonitor
result
FileMonitor
result' <- ((ManagedPtr FileMonitor -> FileMonitor)
-> Ptr FileMonitor -> IO FileMonitor
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileMonitor -> FileMonitor
Gio.FileMonitor.FileMonitor) Ptr FileMonitor
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
FileMonitor -> IO FileMonitor
forall (m :: * -> *) a. Monad m => a -> m a
return FileMonitor
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileMonitorDirectoryMethodInfo
instance (signature ~ ([Gio.Flags.FileMonitorFlags] -> Maybe (b) -> m Gio.FileMonitor.FileMonitor), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileMonitorDirectoryMethodInfo a signature where
overloadedMethod = fileMonitorDirectory
#endif
foreign import ccall "g_file_monitor_file" g_file_monitor_file ::
Ptr File ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileMonitor.FileMonitor)
fileMonitorFile ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> [Gio.Flags.FileMonitorFlags]
-> Maybe (b)
-> m Gio.FileMonitor.FileMonitor
fileMonitorFile :: a -> [FileMonitorFlags] -> Maybe b -> m FileMonitor
fileMonitorFile file :: a
file flags :: [FileMonitorFlags]
flags cancellable :: Maybe b
cancellable = IO FileMonitor -> m FileMonitor
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileMonitor -> m FileMonitor)
-> IO FileMonitor -> m FileMonitor
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
let flags' :: CUInt
flags' = [FileMonitorFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileMonitorFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO FileMonitor -> IO () -> IO FileMonitor
forall a b. IO a -> IO b -> IO a
onException (do
Ptr FileMonitor
result <- (Ptr (Ptr GError) -> IO (Ptr FileMonitor)) -> IO (Ptr FileMonitor)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr FileMonitor))
-> IO (Ptr FileMonitor))
-> (Ptr (Ptr GError) -> IO (Ptr FileMonitor))
-> IO (Ptr FileMonitor)
forall a b. (a -> b) -> a -> b
$ Ptr File
-> CUInt
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO (Ptr FileMonitor)
g_file_monitor_file Ptr File
file' CUInt
flags' Ptr Cancellable
maybeCancellable
Text -> Ptr FileMonitor -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileMonitorFile" Ptr FileMonitor
result
FileMonitor
result' <- ((ManagedPtr FileMonitor -> FileMonitor)
-> Ptr FileMonitor -> IO FileMonitor
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileMonitor -> FileMonitor
Gio.FileMonitor.FileMonitor) Ptr FileMonitor
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
FileMonitor -> IO FileMonitor
forall (m :: * -> *) a. Monad m => a -> m a
return FileMonitor
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileMonitorFileMethodInfo
instance (signature ~ ([Gio.Flags.FileMonitorFlags] -> Maybe (b) -> m Gio.FileMonitor.FileMonitor), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileMonitorFileMethodInfo a signature where
overloadedMethod = fileMonitorFile
#endif
foreign import ccall "g_file_mount_enclosing_volume" g_file_mount_enclosing_volume ::
Ptr File ->
CUInt ->
Ptr Gio.MountOperation.MountOperation ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileMountEnclosingVolume ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.MountOperation.IsMountOperation b, Gio.Cancellable.IsCancellable c) =>
a
-> [Gio.Flags.MountMountFlags]
-> Maybe (b)
-> Maybe (c)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileMountEnclosingVolume :: a
-> [MountMountFlags]
-> Maybe b
-> Maybe c
-> Maybe AsyncReadyCallback
-> m ()
fileMountEnclosingVolume location :: a
location flags :: [MountMountFlags]
flags mountOperation :: Maybe b
mountOperation cancellable :: Maybe c
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
location' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
location
let flags' :: CUInt
flags' = [MountMountFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [MountMountFlags]
flags
Ptr MountOperation
maybeMountOperation <- case Maybe b
mountOperation of
Nothing -> Ptr MountOperation -> IO (Ptr MountOperation)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MountOperation
forall a. Ptr a
nullPtr
Just jMountOperation :: b
jMountOperation -> do
Ptr MountOperation
jMountOperation' <- b -> IO (Ptr MountOperation)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jMountOperation
Ptr MountOperation -> IO (Ptr MountOperation)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MountOperation
jMountOperation'
Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: c
jCancellable -> do
Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> CUInt
-> Ptr MountOperation
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_mount_enclosing_volume Ptr File
location' CUInt
flags' Ptr MountOperation
maybeMountOperation Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
location
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
mountOperation b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileMountEnclosingVolumeMethodInfo
instance (signature ~ ([Gio.Flags.MountMountFlags] -> Maybe (b) -> Maybe (c) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.MountOperation.IsMountOperation b, Gio.Cancellable.IsCancellable c) => O.MethodInfo FileMountEnclosingVolumeMethodInfo a signature where
overloadedMethod = fileMountEnclosingVolume
#endif
foreign import ccall "g_file_mount_enclosing_volume_finish" g_file_mount_enclosing_volume_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO CInt
fileMountEnclosingVolumeFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ()
fileMountEnclosingVolumeFinish :: a -> b -> m ()
fileMountEnclosingVolumeFinish location :: a
location result_ :: b
result_ = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
location' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
location
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File -> Ptr AsyncResult -> Ptr (Ptr GError) -> IO CInt
g_file_mount_enclosing_volume_finish Ptr File
location' Ptr AsyncResult
result_'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
location
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileMountEnclosingVolumeFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileMountEnclosingVolumeFinishMethodInfo a signature where
overloadedMethod = fileMountEnclosingVolumeFinish
#endif
foreign import ccall "g_file_mount_mountable" g_file_mount_mountable ::
Ptr File ->
CUInt ->
Ptr Gio.MountOperation.MountOperation ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileMountMountable ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.MountOperation.IsMountOperation b, Gio.Cancellable.IsCancellable c) =>
a
-> [Gio.Flags.MountMountFlags]
-> Maybe (b)
-> Maybe (c)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileMountMountable :: a
-> [MountMountFlags]
-> Maybe b
-> Maybe c
-> Maybe AsyncReadyCallback
-> m ()
fileMountMountable file :: a
file flags :: [MountMountFlags]
flags mountOperation :: Maybe b
mountOperation cancellable :: Maybe c
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
let flags' :: CUInt
flags' = [MountMountFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [MountMountFlags]
flags
Ptr MountOperation
maybeMountOperation <- case Maybe b
mountOperation of
Nothing -> Ptr MountOperation -> IO (Ptr MountOperation)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MountOperation
forall a. Ptr a
nullPtr
Just jMountOperation :: b
jMountOperation -> do
Ptr MountOperation
jMountOperation' <- b -> IO (Ptr MountOperation)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jMountOperation
Ptr MountOperation -> IO (Ptr MountOperation)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MountOperation
jMountOperation'
Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: c
jCancellable -> do
Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> CUInt
-> Ptr MountOperation
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_mount_mountable Ptr File
file' CUInt
flags' Ptr MountOperation
maybeMountOperation Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
mountOperation b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileMountMountableMethodInfo
instance (signature ~ ([Gio.Flags.MountMountFlags] -> Maybe (b) -> Maybe (c) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.MountOperation.IsMountOperation b, Gio.Cancellable.IsCancellable c) => O.MethodInfo FileMountMountableMethodInfo a signature where
overloadedMethod = fileMountMountable
#endif
foreign import ccall "g_file_mount_mountable_finish" g_file_mount_mountable_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO (Ptr File)
fileMountMountableFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m File
fileMountMountableFinish :: a -> b -> m File
fileMountMountableFinish file :: a
file result_ :: b
result_ = IO File -> m File
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO File -> m File) -> IO File -> m File
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
IO File -> IO () -> IO File
forall a b. IO a -> IO b -> IO a
onException (do
Ptr File
result <- (Ptr (Ptr GError) -> IO (Ptr File)) -> IO (Ptr File)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr File)) -> IO (Ptr File))
-> (Ptr (Ptr GError) -> IO (Ptr File)) -> IO (Ptr File)
forall a b. (a -> b) -> a -> b
$ Ptr File -> Ptr AsyncResult -> Ptr (Ptr GError) -> IO (Ptr File)
g_file_mount_mountable_finish Ptr File
file' Ptr AsyncResult
result_'
Text -> Ptr File -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileMountMountableFinish" Ptr File
result
File
result' <- ((ManagedPtr File -> File) -> Ptr File -> IO File
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr File -> File
File) Ptr File
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
File -> IO File
forall (m :: * -> *) a. Monad m => a -> m a
return File
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileMountMountableFinishMethodInfo
instance (signature ~ (b -> m File), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileMountMountableFinishMethodInfo a signature where
overloadedMethod = fileMountMountableFinish
#endif
foreign import ccall "g_file_move" g_file_move ::
Ptr File ->
Ptr File ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_FileProgressCallback ->
Ptr () ->
Ptr (Ptr GError) ->
IO CInt
fileMove ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, IsFile b, Gio.Cancellable.IsCancellable c) =>
a
-> b
-> [Gio.Flags.FileCopyFlags]
-> Maybe (c)
-> Maybe (Gio.Callbacks.FileProgressCallback)
-> m ()
fileMove :: a
-> b
-> [FileCopyFlags]
-> Maybe c
-> Maybe FileProgressCallback
-> m ()
fileMove source :: a
source destination :: b
destination flags :: [FileCopyFlags]
flags cancellable :: Maybe c
cancellable progressCallback :: Maybe FileProgressCallback
progressCallback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
source' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
source
Ptr File
destination' <- b -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
destination
let flags' :: CUInt
flags' = [FileCopyFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileCopyFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: c
jCancellable -> do
Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_FileProgressCallback
maybeProgressCallback <- case Maybe FileProgressCallback
progressCallback of
Nothing -> FunPtr C_FileProgressCallback -> IO (FunPtr C_FileProgressCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_FileProgressCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jProgressCallback :: FileProgressCallback
jProgressCallback -> do
FunPtr C_FileProgressCallback
jProgressCallback' <- C_FileProgressCallback -> IO (FunPtr C_FileProgressCallback)
Gio.Callbacks.mk_FileProgressCallback (Maybe (Ptr (FunPtr C_FileProgressCallback))
-> C_FileProgressCallback -> C_FileProgressCallback
Gio.Callbacks.wrap_FileProgressCallback Maybe (Ptr (FunPtr C_FileProgressCallback))
forall a. Maybe a
Nothing (FileProgressCallback -> C_FileProgressCallback
Gio.Callbacks.drop_closures_FileProgressCallback FileProgressCallback
jProgressCallback))
FunPtr C_FileProgressCallback -> IO (FunPtr C_FileProgressCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_FileProgressCallback
jProgressCallback'
let progressCallbackData :: Ptr a
progressCallbackData = Ptr a
forall a. Ptr a
nullPtr
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr File
-> CUInt
-> Ptr Cancellable
-> FunPtr C_FileProgressCallback
-> Ptr ()
-> Ptr (Ptr GError)
-> IO CInt
g_file_move Ptr File
source' Ptr File
destination' CUInt
flags' Ptr Cancellable
maybeCancellable FunPtr C_FileProgressCallback
maybeProgressCallback Ptr ()
forall a. Ptr a
progressCallbackData
Ptr Any -> IO ()
forall a. Ptr a -> IO ()
safeFreeFunPtr (Ptr Any -> IO ()) -> Ptr Any -> IO ()
forall a b. (a -> b) -> a -> b
$ FunPtr C_FileProgressCallback -> Ptr Any
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_FileProgressCallback
maybeProgressCallback
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
source
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
destination
Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
Ptr Any -> IO ()
forall a. Ptr a -> IO ()
safeFreeFunPtr (Ptr Any -> IO ()) -> Ptr Any -> IO ()
forall a b. (a -> b) -> a -> b
$ FunPtr C_FileProgressCallback -> Ptr Any
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_FileProgressCallback
maybeProgressCallback
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileMoveMethodInfo
instance (signature ~ (b -> [Gio.Flags.FileCopyFlags] -> Maybe (c) -> Maybe (Gio.Callbacks.FileProgressCallback) -> m ()), MonadIO m, IsFile a, IsFile b, Gio.Cancellable.IsCancellable c) => O.MethodInfo FileMoveMethodInfo a signature where
overloadedMethod = fileMove
#endif
foreign import ccall "g_file_open_readwrite" g_file_open_readwrite ::
Ptr File ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileIOStream.FileIOStream)
fileOpenReadwrite ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m Gio.FileIOStream.FileIOStream
fileOpenReadwrite :: a -> Maybe b -> m FileIOStream
fileOpenReadwrite file :: a
file cancellable :: Maybe b
cancellable = IO FileIOStream -> m FileIOStream
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileIOStream -> m FileIOStream)
-> IO FileIOStream -> m FileIOStream
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO FileIOStream -> IO () -> IO FileIOStream
forall a b. IO a -> IO b -> IO a
onException (do
Ptr FileIOStream
result <- (Ptr (Ptr GError) -> IO (Ptr FileIOStream))
-> IO (Ptr FileIOStream)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr FileIOStream))
-> IO (Ptr FileIOStream))
-> (Ptr (Ptr GError) -> IO (Ptr FileIOStream))
-> IO (Ptr FileIOStream)
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr Cancellable -> Ptr (Ptr GError) -> IO (Ptr FileIOStream)
g_file_open_readwrite Ptr File
file' Ptr Cancellable
maybeCancellable
Text -> Ptr FileIOStream -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileOpenReadwrite" Ptr FileIOStream
result
FileIOStream
result' <- ((ManagedPtr FileIOStream -> FileIOStream)
-> Ptr FileIOStream -> IO FileIOStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileIOStream -> FileIOStream
Gio.FileIOStream.FileIOStream) Ptr FileIOStream
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
FileIOStream -> IO FileIOStream
forall (m :: * -> *) a. Monad m => a -> m a
return FileIOStream
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileOpenReadwriteMethodInfo
instance (signature ~ (Maybe (b) -> m Gio.FileIOStream.FileIOStream), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileOpenReadwriteMethodInfo a signature where
overloadedMethod = fileOpenReadwrite
#endif
foreign import ccall "g_file_open_readwrite_async" g_file_open_readwrite_async ::
Ptr File ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileOpenReadwriteAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> Int32
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileOpenReadwriteAsync :: a -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
fileOpenReadwriteAsync file :: a
file ioPriority :: Int32
ioPriority cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_open_readwrite_async Ptr File
file' Int32
ioPriority Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileOpenReadwriteAsyncMethodInfo
instance (signature ~ (Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileOpenReadwriteAsyncMethodInfo a signature where
overloadedMethod = fileOpenReadwriteAsync
#endif
foreign import ccall "g_file_open_readwrite_finish" g_file_open_readwrite_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileIOStream.FileIOStream)
fileOpenReadwriteFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m Gio.FileIOStream.FileIOStream
fileOpenReadwriteFinish :: a -> b -> m FileIOStream
fileOpenReadwriteFinish file :: a
file res :: b
res = IO FileIOStream -> m FileIOStream
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileIOStream -> m FileIOStream)
-> IO FileIOStream -> m FileIOStream
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
res' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
res
IO FileIOStream -> IO () -> IO FileIOStream
forall a b. IO a -> IO b -> IO a
onException (do
Ptr FileIOStream
result <- (Ptr (Ptr GError) -> IO (Ptr FileIOStream))
-> IO (Ptr FileIOStream)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr FileIOStream))
-> IO (Ptr FileIOStream))
-> (Ptr (Ptr GError) -> IO (Ptr FileIOStream))
-> IO (Ptr FileIOStream)
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr AsyncResult -> Ptr (Ptr GError) -> IO (Ptr FileIOStream)
g_file_open_readwrite_finish Ptr File
file' Ptr AsyncResult
res'
Text -> Ptr FileIOStream -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileOpenReadwriteFinish" Ptr FileIOStream
result
FileIOStream
result' <- ((ManagedPtr FileIOStream -> FileIOStream)
-> Ptr FileIOStream -> IO FileIOStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileIOStream -> FileIOStream
Gio.FileIOStream.FileIOStream) Ptr FileIOStream
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
res
FileIOStream -> IO FileIOStream
forall (m :: * -> *) a. Monad m => a -> m a
return FileIOStream
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileOpenReadwriteFinishMethodInfo
instance (signature ~ (b -> m Gio.FileIOStream.FileIOStream), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileOpenReadwriteFinishMethodInfo a signature where
overloadedMethod = fileOpenReadwriteFinish
#endif
foreign import ccall "g_file_peek_path" g_file_peek_path ::
Ptr File ->
IO CString
filePeekPath ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
a
-> m (Maybe [Char])
filePeekPath :: a -> m (Maybe [Char])
filePeekPath file :: a
file = IO (Maybe [Char]) -> m (Maybe [Char])
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe [Char]) -> m (Maybe [Char]))
-> IO (Maybe [Char]) -> m (Maybe [Char])
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
result <- Ptr File -> IO CString
g_file_peek_path Ptr File
file'
Maybe [Char]
maybeResult <- CString -> (CString -> IO [Char]) -> IO (Maybe [Char])
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO [Char]) -> IO (Maybe [Char]))
-> (CString -> IO [Char]) -> IO (Maybe [Char])
forall a b. (a -> b) -> a -> b
$ \result' :: CString
result' -> do
[Char]
result'' <- HasCallStack => CString -> IO [Char]
CString -> IO [Char]
cstringToString CString
result'
[Char] -> IO [Char]
forall (m :: * -> *) a. Monad m => a -> m a
return [Char]
result''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe [Char] -> IO (Maybe [Char])
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe [Char]
maybeResult
#if defined(ENABLE_OVERLOADING)
data FilePeekPathMethodInfo
instance (signature ~ (m (Maybe [Char])), MonadIO m, IsFile a) => O.MethodInfo FilePeekPathMethodInfo a signature where
overloadedMethod = filePeekPath
#endif
foreign import ccall "g_file_poll_mountable" g_file_poll_mountable ::
Ptr File ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
filePollMountable ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
filePollMountable :: a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
filePollMountable file :: a
file cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_poll_mountable Ptr File
file' Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FilePollMountableMethodInfo
instance (signature ~ (Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FilePollMountableMethodInfo a signature where
overloadedMethod = filePollMountable
#endif
foreign import ccall "g_file_poll_mountable_finish" g_file_poll_mountable_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO CInt
filePollMountableFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ()
filePollMountableFinish :: a -> b -> m ()
filePollMountableFinish file :: a
file result_ :: b
result_ = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File -> Ptr AsyncResult -> Ptr (Ptr GError) -> IO CInt
g_file_poll_mountable_finish Ptr File
file' Ptr AsyncResult
result_'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FilePollMountableFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FilePollMountableFinishMethodInfo a signature where
overloadedMethod = filePollMountableFinish
#endif
foreign import ccall "g_file_query_default_handler" g_file_query_default_handler ::
Ptr File ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.AppInfo.AppInfo)
fileQueryDefaultHandler ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m Gio.AppInfo.AppInfo
fileQueryDefaultHandler :: a -> Maybe b -> m AppInfo
fileQueryDefaultHandler file :: a
file cancellable :: Maybe b
cancellable = IO AppInfo -> m AppInfo
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO AppInfo -> m AppInfo) -> IO AppInfo -> m AppInfo
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO AppInfo -> IO () -> IO AppInfo
forall a b. IO a -> IO b -> IO a
onException (do
Ptr AppInfo
result <- (Ptr (Ptr GError) -> IO (Ptr AppInfo)) -> IO (Ptr AppInfo)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr AppInfo)) -> IO (Ptr AppInfo))
-> (Ptr (Ptr GError) -> IO (Ptr AppInfo)) -> IO (Ptr AppInfo)
forall a b. (a -> b) -> a -> b
$ Ptr File -> Ptr Cancellable -> Ptr (Ptr GError) -> IO (Ptr AppInfo)
g_file_query_default_handler Ptr File
file' Ptr Cancellable
maybeCancellable
Text -> Ptr AppInfo -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileQueryDefaultHandler" Ptr AppInfo
result
AppInfo
result' <- ((ManagedPtr AppInfo -> AppInfo) -> Ptr AppInfo -> IO AppInfo
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr AppInfo -> AppInfo
Gio.AppInfo.AppInfo) Ptr AppInfo
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
AppInfo -> IO AppInfo
forall (m :: * -> *) a. Monad m => a -> m a
return AppInfo
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileQueryDefaultHandlerMethodInfo
instance (signature ~ (Maybe (b) -> m Gio.AppInfo.AppInfo), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileQueryDefaultHandlerMethodInfo a signature where
overloadedMethod = fileQueryDefaultHandler
#endif
foreign import ccall "g_file_query_default_handler_async" g_file_query_default_handler_async ::
Ptr File ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileQueryDefaultHandlerAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> Int32
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileQueryDefaultHandlerAsync :: a -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
fileQueryDefaultHandlerAsync file :: a
file ioPriority :: Int32
ioPriority cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_query_default_handler_async Ptr File
file' Int32
ioPriority Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileQueryDefaultHandlerAsyncMethodInfo
instance (signature ~ (Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileQueryDefaultHandlerAsyncMethodInfo a signature where
overloadedMethod = fileQueryDefaultHandlerAsync
#endif
foreign import ccall "g_file_query_default_handler_finish" g_file_query_default_handler_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO (Ptr Gio.AppInfo.AppInfo)
fileQueryDefaultHandlerFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m Gio.AppInfo.AppInfo
fileQueryDefaultHandlerFinish :: a -> b -> m AppInfo
fileQueryDefaultHandlerFinish file :: a
file result_ :: b
result_ = IO AppInfo -> m AppInfo
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO AppInfo -> m AppInfo) -> IO AppInfo -> m AppInfo
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
IO AppInfo -> IO () -> IO AppInfo
forall a b. IO a -> IO b -> IO a
onException (do
Ptr AppInfo
result <- (Ptr (Ptr GError) -> IO (Ptr AppInfo)) -> IO (Ptr AppInfo)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr AppInfo)) -> IO (Ptr AppInfo))
-> (Ptr (Ptr GError) -> IO (Ptr AppInfo)) -> IO (Ptr AppInfo)
forall a b. (a -> b) -> a -> b
$ Ptr File -> Ptr AsyncResult -> Ptr (Ptr GError) -> IO (Ptr AppInfo)
g_file_query_default_handler_finish Ptr File
file' Ptr AsyncResult
result_'
Text -> Ptr AppInfo -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileQueryDefaultHandlerFinish" Ptr AppInfo
result
AppInfo
result' <- ((ManagedPtr AppInfo -> AppInfo) -> Ptr AppInfo -> IO AppInfo
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr AppInfo -> AppInfo
Gio.AppInfo.AppInfo) Ptr AppInfo
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
AppInfo -> IO AppInfo
forall (m :: * -> *) a. Monad m => a -> m a
return AppInfo
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileQueryDefaultHandlerFinishMethodInfo
instance (signature ~ (b -> m Gio.AppInfo.AppInfo), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileQueryDefaultHandlerFinishMethodInfo a signature where
overloadedMethod = fileQueryDefaultHandlerFinish
#endif
foreign import ccall "g_file_query_exists" g_file_query_exists ::
Ptr File ->
Ptr Gio.Cancellable.Cancellable ->
IO CInt
fileQueryExists ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m Bool
fileQueryExists :: a -> Maybe b -> m Bool
fileQueryExists file :: a
file cancellable :: Maybe b
cancellable = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
CInt
result <- Ptr File -> Ptr Cancellable -> IO CInt
g_file_query_exists Ptr File
file' Ptr Cancellable
maybeCancellable
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data FileQueryExistsMethodInfo
instance (signature ~ (Maybe (b) -> m Bool), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileQueryExistsMethodInfo a signature where
overloadedMethod = fileQueryExists
#endif
foreign import ccall "g_file_query_file_type" g_file_query_file_type ::
Ptr File ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
IO CUInt
fileQueryFileType ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> [Gio.Flags.FileQueryInfoFlags]
-> Maybe (b)
-> m Gio.Enums.FileType
fileQueryFileType :: a -> [FileQueryInfoFlags] -> Maybe b -> m FileType
fileQueryFileType file :: a
file flags :: [FileQueryInfoFlags]
flags cancellable :: Maybe b
cancellable = IO FileType -> m FileType
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileType -> m FileType) -> IO FileType -> m FileType
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
let flags' :: CUInt
flags' = [FileQueryInfoFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileQueryInfoFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
CUInt
result <- Ptr File -> CUInt -> Ptr Cancellable -> IO CUInt
g_file_query_file_type Ptr File
file' CUInt
flags' Ptr Cancellable
maybeCancellable
let result' :: FileType
result' = (Int -> FileType
forall a. Enum a => Int -> a
toEnum (Int -> FileType) -> (CUInt -> Int) -> CUInt -> FileType
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
FileType -> IO FileType
forall (m :: * -> *) a. Monad m => a -> m a
return FileType
result'
#if defined(ENABLE_OVERLOADING)
data FileQueryFileTypeMethodInfo
instance (signature ~ ([Gio.Flags.FileQueryInfoFlags] -> Maybe (b) -> m Gio.Enums.FileType), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileQueryFileTypeMethodInfo a signature where
overloadedMethod = fileQueryFileType
#endif
foreign import ccall "g_file_query_filesystem_info" g_file_query_filesystem_info ::
Ptr File ->
CString ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileInfo.FileInfo)
fileQueryFilesystemInfo ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> T.Text
-> Maybe (b)
-> m Gio.FileInfo.FileInfo
fileQueryFilesystemInfo :: a -> Text -> Maybe b -> m FileInfo
fileQueryFilesystemInfo file :: a
file attributes :: Text
attributes cancellable :: Maybe b
cancellable = IO FileInfo -> m FileInfo
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileInfo -> m FileInfo) -> IO FileInfo -> m FileInfo
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
attributes' <- Text -> IO CString
textToCString Text
attributes
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO FileInfo -> IO () -> IO FileInfo
forall a b. IO a -> IO b -> IO a
onException (do
Ptr FileInfo
result <- (Ptr (Ptr GError) -> IO (Ptr FileInfo)) -> IO (Ptr FileInfo)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr FileInfo)) -> IO (Ptr FileInfo))
-> (Ptr (Ptr GError) -> IO (Ptr FileInfo)) -> IO (Ptr FileInfo)
forall a b. (a -> b) -> a -> b
$ Ptr File
-> CString
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO (Ptr FileInfo)
g_file_query_filesystem_info Ptr File
file' CString
attributes' Ptr Cancellable
maybeCancellable
Text -> Ptr FileInfo -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileQueryFilesystemInfo" Ptr FileInfo
result
FileInfo
result' <- ((ManagedPtr FileInfo -> FileInfo) -> Ptr FileInfo -> IO FileInfo
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileInfo -> FileInfo
Gio.FileInfo.FileInfo) Ptr FileInfo
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
attributes'
FileInfo -> IO FileInfo
forall (m :: * -> *) a. Monad m => a -> m a
return FileInfo
result'
) (do
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
attributes'
)
#if defined(ENABLE_OVERLOADING)
data FileQueryFilesystemInfoMethodInfo
instance (signature ~ (T.Text -> Maybe (b) -> m Gio.FileInfo.FileInfo), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileQueryFilesystemInfoMethodInfo a signature where
overloadedMethod = fileQueryFilesystemInfo
#endif
foreign import ccall "g_file_query_filesystem_info_async" g_file_query_filesystem_info_async ::
Ptr File ->
CString ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileQueryFilesystemInfoAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> T.Text
-> Int32
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileQueryFilesystemInfoAsync :: a -> Text -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
fileQueryFilesystemInfoAsync file :: a
file attributes :: Text
attributes ioPriority :: Int32
ioPriority cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
attributes' <- Text -> IO CString
textToCString Text
attributes
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> CString
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_query_filesystem_info_async Ptr File
file' CString
attributes' Int32
ioPriority Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
attributes'
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileQueryFilesystemInfoAsyncMethodInfo
instance (signature ~ (T.Text -> Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileQueryFilesystemInfoAsyncMethodInfo a signature where
overloadedMethod = fileQueryFilesystemInfoAsync
#endif
foreign import ccall "g_file_query_filesystem_info_finish" g_file_query_filesystem_info_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileInfo.FileInfo)
fileQueryFilesystemInfoFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m Gio.FileInfo.FileInfo
fileQueryFilesystemInfoFinish :: a -> b -> m FileInfo
fileQueryFilesystemInfoFinish file :: a
file res :: b
res = IO FileInfo -> m FileInfo
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileInfo -> m FileInfo) -> IO FileInfo -> m FileInfo
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
res' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
res
IO FileInfo -> IO () -> IO FileInfo
forall a b. IO a -> IO b -> IO a
onException (do
Ptr FileInfo
result <- (Ptr (Ptr GError) -> IO (Ptr FileInfo)) -> IO (Ptr FileInfo)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr FileInfo)) -> IO (Ptr FileInfo))
-> (Ptr (Ptr GError) -> IO (Ptr FileInfo)) -> IO (Ptr FileInfo)
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr AsyncResult -> Ptr (Ptr GError) -> IO (Ptr FileInfo)
g_file_query_filesystem_info_finish Ptr File
file' Ptr AsyncResult
res'
Text -> Ptr FileInfo -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileQueryFilesystemInfoFinish" Ptr FileInfo
result
FileInfo
result' <- ((ManagedPtr FileInfo -> FileInfo) -> Ptr FileInfo -> IO FileInfo
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileInfo -> FileInfo
Gio.FileInfo.FileInfo) Ptr FileInfo
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
res
FileInfo -> IO FileInfo
forall (m :: * -> *) a. Monad m => a -> m a
return FileInfo
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileQueryFilesystemInfoFinishMethodInfo
instance (signature ~ (b -> m Gio.FileInfo.FileInfo), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileQueryFilesystemInfoFinishMethodInfo a signature where
overloadedMethod = fileQueryFilesystemInfoFinish
#endif
foreign import ccall "g_file_query_info" g_file_query_info ::
Ptr File ->
CString ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileInfo.FileInfo)
fileQueryInfo ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> T.Text
-> [Gio.Flags.FileQueryInfoFlags]
-> Maybe (b)
-> m Gio.FileInfo.FileInfo
fileQueryInfo :: a -> Text -> [FileQueryInfoFlags] -> Maybe b -> m FileInfo
fileQueryInfo file :: a
file attributes :: Text
attributes flags :: [FileQueryInfoFlags]
flags cancellable :: Maybe b
cancellable = IO FileInfo -> m FileInfo
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileInfo -> m FileInfo) -> IO FileInfo -> m FileInfo
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
attributes' <- Text -> IO CString
textToCString Text
attributes
let flags' :: CUInt
flags' = [FileQueryInfoFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileQueryInfoFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO FileInfo -> IO () -> IO FileInfo
forall a b. IO a -> IO b -> IO a
onException (do
Ptr FileInfo
result <- (Ptr (Ptr GError) -> IO (Ptr FileInfo)) -> IO (Ptr FileInfo)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr FileInfo)) -> IO (Ptr FileInfo))
-> (Ptr (Ptr GError) -> IO (Ptr FileInfo)) -> IO (Ptr FileInfo)
forall a b. (a -> b) -> a -> b
$ Ptr File
-> CString
-> CUInt
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO (Ptr FileInfo)
g_file_query_info Ptr File
file' CString
attributes' CUInt
flags' Ptr Cancellable
maybeCancellable
Text -> Ptr FileInfo -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileQueryInfo" Ptr FileInfo
result
FileInfo
result' <- ((ManagedPtr FileInfo -> FileInfo) -> Ptr FileInfo -> IO FileInfo
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileInfo -> FileInfo
Gio.FileInfo.FileInfo) Ptr FileInfo
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
attributes'
FileInfo -> IO FileInfo
forall (m :: * -> *) a. Monad m => a -> m a
return FileInfo
result'
) (do
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
attributes'
)
#if defined(ENABLE_OVERLOADING)
data FileQueryInfoMethodInfo
instance (signature ~ (T.Text -> [Gio.Flags.FileQueryInfoFlags] -> Maybe (b) -> m Gio.FileInfo.FileInfo), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileQueryInfoMethodInfo a signature where
overloadedMethod = fileQueryInfo
#endif
foreign import ccall "g_file_query_info_async" g_file_query_info_async ::
Ptr File ->
CString ->
CUInt ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileQueryInfoAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> T.Text
-> [Gio.Flags.FileQueryInfoFlags]
-> Int32
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileQueryInfoAsync :: a
-> Text
-> [FileQueryInfoFlags]
-> Int32
-> Maybe b
-> Maybe AsyncReadyCallback
-> m ()
fileQueryInfoAsync file :: a
file attributes :: Text
attributes flags :: [FileQueryInfoFlags]
flags ioPriority :: Int32
ioPriority cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
attributes' <- Text -> IO CString
textToCString Text
attributes
let flags' :: CUInt
flags' = [FileQueryInfoFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileQueryInfoFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> CString
-> CUInt
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_query_info_async Ptr File
file' CString
attributes' CUInt
flags' Int32
ioPriority Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
attributes'
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileQueryInfoAsyncMethodInfo
instance (signature ~ (T.Text -> [Gio.Flags.FileQueryInfoFlags] -> Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileQueryInfoAsyncMethodInfo a signature where
overloadedMethod = fileQueryInfoAsync
#endif
foreign import ccall "g_file_query_info_finish" g_file_query_info_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileInfo.FileInfo)
fileQueryInfoFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m Gio.FileInfo.FileInfo
fileQueryInfoFinish :: a -> b -> m FileInfo
fileQueryInfoFinish file :: a
file res :: b
res = IO FileInfo -> m FileInfo
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileInfo -> m FileInfo) -> IO FileInfo -> m FileInfo
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
res' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
res
IO FileInfo -> IO () -> IO FileInfo
forall a b. IO a -> IO b -> IO a
onException (do
Ptr FileInfo
result <- (Ptr (Ptr GError) -> IO (Ptr FileInfo)) -> IO (Ptr FileInfo)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr FileInfo)) -> IO (Ptr FileInfo))
-> (Ptr (Ptr GError) -> IO (Ptr FileInfo)) -> IO (Ptr FileInfo)
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr AsyncResult -> Ptr (Ptr GError) -> IO (Ptr FileInfo)
g_file_query_info_finish Ptr File
file' Ptr AsyncResult
res'
Text -> Ptr FileInfo -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileQueryInfoFinish" Ptr FileInfo
result
FileInfo
result' <- ((ManagedPtr FileInfo -> FileInfo) -> Ptr FileInfo -> IO FileInfo
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileInfo -> FileInfo
Gio.FileInfo.FileInfo) Ptr FileInfo
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
res
FileInfo -> IO FileInfo
forall (m :: * -> *) a. Monad m => a -> m a
return FileInfo
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileQueryInfoFinishMethodInfo
instance (signature ~ (b -> m Gio.FileInfo.FileInfo), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileQueryInfoFinishMethodInfo a signature where
overloadedMethod = fileQueryInfoFinish
#endif
foreign import ccall "g_file_query_settable_attributes" g_file_query_settable_attributes ::
Ptr File ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileAttributeInfoList.FileAttributeInfoList)
fileQuerySettableAttributes ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m Gio.FileAttributeInfoList.FileAttributeInfoList
fileQuerySettableAttributes :: a -> Maybe b -> m FileAttributeInfoList
fileQuerySettableAttributes file :: a
file cancellable :: Maybe b
cancellable = IO FileAttributeInfoList -> m FileAttributeInfoList
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileAttributeInfoList -> m FileAttributeInfoList)
-> IO FileAttributeInfoList -> m FileAttributeInfoList
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO FileAttributeInfoList -> IO () -> IO FileAttributeInfoList
forall a b. IO a -> IO b -> IO a
onException (do
Ptr FileAttributeInfoList
result <- (Ptr (Ptr GError) -> IO (Ptr FileAttributeInfoList))
-> IO (Ptr FileAttributeInfoList)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr FileAttributeInfoList))
-> IO (Ptr FileAttributeInfoList))
-> (Ptr (Ptr GError) -> IO (Ptr FileAttributeInfoList))
-> IO (Ptr FileAttributeInfoList)
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO (Ptr FileAttributeInfoList)
g_file_query_settable_attributes Ptr File
file' Ptr Cancellable
maybeCancellable
Text -> Ptr FileAttributeInfoList -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileQuerySettableAttributes" Ptr FileAttributeInfoList
result
FileAttributeInfoList
result' <- ((ManagedPtr FileAttributeInfoList -> FileAttributeInfoList)
-> Ptr FileAttributeInfoList -> IO FileAttributeInfoList
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr FileAttributeInfoList -> FileAttributeInfoList
Gio.FileAttributeInfoList.FileAttributeInfoList) Ptr FileAttributeInfoList
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
FileAttributeInfoList -> IO FileAttributeInfoList
forall (m :: * -> *) a. Monad m => a -> m a
return FileAttributeInfoList
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileQuerySettableAttributesMethodInfo
instance (signature ~ (Maybe (b) -> m Gio.FileAttributeInfoList.FileAttributeInfoList), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileQuerySettableAttributesMethodInfo a signature where
overloadedMethod = fileQuerySettableAttributes
#endif
foreign import ccall "g_file_query_writable_namespaces" g_file_query_writable_namespaces ::
Ptr File ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileAttributeInfoList.FileAttributeInfoList)
fileQueryWritableNamespaces ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m Gio.FileAttributeInfoList.FileAttributeInfoList
fileQueryWritableNamespaces :: a -> Maybe b -> m FileAttributeInfoList
fileQueryWritableNamespaces file :: a
file cancellable :: Maybe b
cancellable = IO FileAttributeInfoList -> m FileAttributeInfoList
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileAttributeInfoList -> m FileAttributeInfoList)
-> IO FileAttributeInfoList -> m FileAttributeInfoList
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO FileAttributeInfoList -> IO () -> IO FileAttributeInfoList
forall a b. IO a -> IO b -> IO a
onException (do
Ptr FileAttributeInfoList
result <- (Ptr (Ptr GError) -> IO (Ptr FileAttributeInfoList))
-> IO (Ptr FileAttributeInfoList)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr FileAttributeInfoList))
-> IO (Ptr FileAttributeInfoList))
-> (Ptr (Ptr GError) -> IO (Ptr FileAttributeInfoList))
-> IO (Ptr FileAttributeInfoList)
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO (Ptr FileAttributeInfoList)
g_file_query_writable_namespaces Ptr File
file' Ptr Cancellable
maybeCancellable
Text -> Ptr FileAttributeInfoList -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileQueryWritableNamespaces" Ptr FileAttributeInfoList
result
FileAttributeInfoList
result' <- ((ManagedPtr FileAttributeInfoList -> FileAttributeInfoList)
-> Ptr FileAttributeInfoList -> IO FileAttributeInfoList
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr FileAttributeInfoList -> FileAttributeInfoList
Gio.FileAttributeInfoList.FileAttributeInfoList) Ptr FileAttributeInfoList
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
FileAttributeInfoList -> IO FileAttributeInfoList
forall (m :: * -> *) a. Monad m => a -> m a
return FileAttributeInfoList
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileQueryWritableNamespacesMethodInfo
instance (signature ~ (Maybe (b) -> m Gio.FileAttributeInfoList.FileAttributeInfoList), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileQueryWritableNamespacesMethodInfo a signature where
overloadedMethod = fileQueryWritableNamespaces
#endif
foreign import ccall "g_file_read" g_file_read ::
Ptr File ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileInputStream.FileInputStream)
fileRead ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m Gio.FileInputStream.FileInputStream
fileRead :: a -> Maybe b -> m FileInputStream
fileRead file :: a
file cancellable :: Maybe b
cancellable = IO FileInputStream -> m FileInputStream
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileInputStream -> m FileInputStream)
-> IO FileInputStream -> m FileInputStream
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO FileInputStream -> IO () -> IO FileInputStream
forall a b. IO a -> IO b -> IO a
onException (do
Ptr FileInputStream
result <- (Ptr (Ptr GError) -> IO (Ptr FileInputStream))
-> IO (Ptr FileInputStream)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr FileInputStream))
-> IO (Ptr FileInputStream))
-> (Ptr (Ptr GError) -> IO (Ptr FileInputStream))
-> IO (Ptr FileInputStream)
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr Cancellable -> Ptr (Ptr GError) -> IO (Ptr FileInputStream)
g_file_read Ptr File
file' Ptr Cancellable
maybeCancellable
Text -> Ptr FileInputStream -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileRead" Ptr FileInputStream
result
FileInputStream
result' <- ((ManagedPtr FileInputStream -> FileInputStream)
-> Ptr FileInputStream -> IO FileInputStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileInputStream -> FileInputStream
Gio.FileInputStream.FileInputStream) Ptr FileInputStream
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
FileInputStream -> IO FileInputStream
forall (m :: * -> *) a. Monad m => a -> m a
return FileInputStream
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileReadMethodInfo
instance (signature ~ (Maybe (b) -> m Gio.FileInputStream.FileInputStream), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileReadMethodInfo a signature where
overloadedMethod = fileRead
#endif
foreign import ccall "g_file_read_async" g_file_read_async ::
Ptr File ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileReadAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> Int32
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileReadAsync :: a -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
fileReadAsync file :: a
file ioPriority :: Int32
ioPriority cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_read_async Ptr File
file' Int32
ioPriority Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileReadAsyncMethodInfo
instance (signature ~ (Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileReadAsyncMethodInfo a signature where
overloadedMethod = fileReadAsync
#endif
foreign import ccall "g_file_read_finish" g_file_read_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileInputStream.FileInputStream)
fileReadFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m Gio.FileInputStream.FileInputStream
fileReadFinish :: a -> b -> m FileInputStream
fileReadFinish file :: a
file res :: b
res = IO FileInputStream -> m FileInputStream
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileInputStream -> m FileInputStream)
-> IO FileInputStream -> m FileInputStream
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
res' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
res
IO FileInputStream -> IO () -> IO FileInputStream
forall a b. IO a -> IO b -> IO a
onException (do
Ptr FileInputStream
result <- (Ptr (Ptr GError) -> IO (Ptr FileInputStream))
-> IO (Ptr FileInputStream)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr FileInputStream))
-> IO (Ptr FileInputStream))
-> (Ptr (Ptr GError) -> IO (Ptr FileInputStream))
-> IO (Ptr FileInputStream)
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr AsyncResult -> Ptr (Ptr GError) -> IO (Ptr FileInputStream)
g_file_read_finish Ptr File
file' Ptr AsyncResult
res'
Text -> Ptr FileInputStream -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileReadFinish" Ptr FileInputStream
result
FileInputStream
result' <- ((ManagedPtr FileInputStream -> FileInputStream)
-> Ptr FileInputStream -> IO FileInputStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileInputStream -> FileInputStream
Gio.FileInputStream.FileInputStream) Ptr FileInputStream
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
res
FileInputStream -> IO FileInputStream
forall (m :: * -> *) a. Monad m => a -> m a
return FileInputStream
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileReadFinishMethodInfo
instance (signature ~ (b -> m Gio.FileInputStream.FileInputStream), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileReadFinishMethodInfo a signature where
overloadedMethod = fileReadFinish
#endif
foreign import ccall "g_file_replace" g_file_replace ::
Ptr File ->
CString ->
CInt ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileOutputStream.FileOutputStream)
fileReplace ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (T.Text)
-> Bool
-> [Gio.Flags.FileCreateFlags]
-> Maybe (b)
-> m Gio.FileOutputStream.FileOutputStream
fileReplace :: a
-> Maybe Text
-> Bool
-> [FileCreateFlags]
-> Maybe b
-> m FileOutputStream
fileReplace file :: a
file etag :: Maybe Text
etag makeBackup :: Bool
makeBackup flags :: [FileCreateFlags]
flags cancellable :: Maybe b
cancellable = IO FileOutputStream -> m FileOutputStream
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileOutputStream -> m FileOutputStream)
-> IO FileOutputStream -> m FileOutputStream
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
maybeEtag <- case Maybe Text
etag of
Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just jEtag :: Text
jEtag -> do
CString
jEtag' <- Text -> IO CString
textToCString Text
jEtag
CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jEtag'
let makeBackup' :: CInt
makeBackup' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
makeBackup
let flags' :: CUInt
flags' = [FileCreateFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileCreateFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO FileOutputStream -> IO () -> IO FileOutputStream
forall a b. IO a -> IO b -> IO a
onException (do
Ptr FileOutputStream
result <- (Ptr (Ptr GError) -> IO (Ptr FileOutputStream))
-> IO (Ptr FileOutputStream)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr FileOutputStream))
-> IO (Ptr FileOutputStream))
-> (Ptr (Ptr GError) -> IO (Ptr FileOutputStream))
-> IO (Ptr FileOutputStream)
forall a b. (a -> b) -> a -> b
$ Ptr File
-> CString
-> CInt
-> CUInt
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO (Ptr FileOutputStream)
g_file_replace Ptr File
file' CString
maybeEtag CInt
makeBackup' CUInt
flags' Ptr Cancellable
maybeCancellable
Text -> Ptr FileOutputStream -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileReplace" Ptr FileOutputStream
result
FileOutputStream
result' <- ((ManagedPtr FileOutputStream -> FileOutputStream)
-> Ptr FileOutputStream -> IO FileOutputStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileOutputStream -> FileOutputStream
Gio.FileOutputStream.FileOutputStream) Ptr FileOutputStream
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeEtag
FileOutputStream -> IO FileOutputStream
forall (m :: * -> *) a. Monad m => a -> m a
return FileOutputStream
result'
) (do
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeEtag
)
#if defined(ENABLE_OVERLOADING)
data FileReplaceMethodInfo
instance (signature ~ (Maybe (T.Text) -> Bool -> [Gio.Flags.FileCreateFlags] -> Maybe (b) -> m Gio.FileOutputStream.FileOutputStream), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileReplaceMethodInfo a signature where
overloadedMethod = fileReplace
#endif
foreign import ccall "g_file_replace_async" g_file_replace_async ::
Ptr File ->
CString ->
CInt ->
CUInt ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileReplaceAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (T.Text)
-> Bool
-> [Gio.Flags.FileCreateFlags]
-> Int32
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileReplaceAsync :: a
-> Maybe Text
-> Bool
-> [FileCreateFlags]
-> Int32
-> Maybe b
-> Maybe AsyncReadyCallback
-> m ()
fileReplaceAsync file :: a
file etag :: Maybe Text
etag makeBackup :: Bool
makeBackup flags :: [FileCreateFlags]
flags ioPriority :: Int32
ioPriority cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
maybeEtag <- case Maybe Text
etag of
Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just jEtag :: Text
jEtag -> do
CString
jEtag' <- Text -> IO CString
textToCString Text
jEtag
CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jEtag'
let makeBackup' :: CInt
makeBackup' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
makeBackup
let flags' :: CUInt
flags' = [FileCreateFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileCreateFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> CString
-> CInt
-> CUInt
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_replace_async Ptr File
file' CString
maybeEtag CInt
makeBackup' CUInt
flags' Int32
ioPriority Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeEtag
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileReplaceAsyncMethodInfo
instance (signature ~ (Maybe (T.Text) -> Bool -> [Gio.Flags.FileCreateFlags] -> Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileReplaceAsyncMethodInfo a signature where
overloadedMethod = fileReplaceAsync
#endif
foreign import ccall "g_file_replace_contents" g_file_replace_contents ::
Ptr File ->
Ptr Word8 ->
Word64 ->
CString ->
CInt ->
CUInt ->
Ptr CString ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
fileReplaceContents ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> ByteString
-> Maybe (T.Text)
-> Bool
-> [Gio.Flags.FileCreateFlags]
-> Maybe (b)
-> m (T.Text)
fileReplaceContents :: a
-> ByteString
-> Maybe Text
-> Bool
-> [FileCreateFlags]
-> Maybe b
-> m Text
fileReplaceContents file :: a
file contents :: ByteString
contents etag :: Maybe Text
etag makeBackup :: Bool
makeBackup flags :: [FileCreateFlags]
flags cancellable :: Maybe b
cancellable = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
let length_ :: Word64
length_ = Int -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word64) -> Int -> Word64
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
contents
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr Word8
contents' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
contents
CString
maybeEtag <- case Maybe Text
etag of
Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just jEtag :: Text
jEtag -> do
CString
jEtag' <- Text -> IO CString
textToCString Text
jEtag
CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jEtag'
let makeBackup' :: CInt
makeBackup' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
makeBackup
let flags' :: CUInt
flags' = [FileCreateFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileCreateFlags]
flags
Ptr CString
newEtag <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CString)
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO Text -> IO () -> IO Text
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr Word8
-> Word64
-> CString
-> CInt
-> CUInt
-> Ptr CString
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
g_file_replace_contents Ptr File
file' Ptr Word8
contents' Word64
length_ CString
maybeEtag CInt
makeBackup' CUInt
flags' Ptr CString
newEtag Ptr Cancellable
maybeCancellable
CString
newEtag' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
newEtag
Text
newEtag'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
newEtag'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
newEtag'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
contents'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeEtag
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
newEtag
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
newEtag''
) (do
Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
contents'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeEtag
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
newEtag
)
#if defined(ENABLE_OVERLOADING)
data FileReplaceContentsMethodInfo
instance (signature ~ (ByteString -> Maybe (T.Text) -> Bool -> [Gio.Flags.FileCreateFlags] -> Maybe (b) -> m (T.Text)), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileReplaceContentsMethodInfo a signature where
overloadedMethod = fileReplaceContents
#endif
foreign import ccall "g_file_replace_contents_async" g_file_replace_contents_async ::
Ptr File ->
Ptr Word8 ->
Word64 ->
CString ->
CInt ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileReplaceContentsAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> ByteString
-> Maybe (T.Text)
-> Bool
-> [Gio.Flags.FileCreateFlags]
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileReplaceContentsAsync :: a
-> ByteString
-> Maybe Text
-> Bool
-> [FileCreateFlags]
-> Maybe b
-> Maybe AsyncReadyCallback
-> m ()
fileReplaceContentsAsync file :: a
file contents :: ByteString
contents etag :: Maybe Text
etag makeBackup :: Bool
makeBackup flags :: [FileCreateFlags]
flags cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
let length_ :: Word64
length_ = Int -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word64) -> Int -> Word64
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
contents
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr Word8
contents' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
contents
CString
maybeEtag <- case Maybe Text
etag of
Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just jEtag :: Text
jEtag -> do
CString
jEtag' <- Text -> IO CString
textToCString Text
jEtag
CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jEtag'
let makeBackup' :: CInt
makeBackup' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
makeBackup
let flags' :: CUInt
flags' = [FileCreateFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileCreateFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> Ptr Word8
-> Word64
-> CString
-> CInt
-> CUInt
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_replace_contents_async Ptr File
file' Ptr Word8
contents' Word64
length_ CString
maybeEtag CInt
makeBackup' CUInt
flags' Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
contents'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeEtag
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileReplaceContentsAsyncMethodInfo
instance (signature ~ (ByteString -> Maybe (T.Text) -> Bool -> [Gio.Flags.FileCreateFlags] -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileReplaceContentsAsyncMethodInfo a signature where
overloadedMethod = fileReplaceContentsAsync
#endif
foreign import ccall "g_file_replace_contents_bytes_async" g_file_replace_contents_bytes_async ::
Ptr File ->
Ptr GLib.Bytes.Bytes ->
CString ->
CInt ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileReplaceContentsBytesAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> GLib.Bytes.Bytes
-> Maybe (T.Text)
-> Bool
-> [Gio.Flags.FileCreateFlags]
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileReplaceContentsBytesAsync :: a
-> Bytes
-> Maybe Text
-> Bool
-> [FileCreateFlags]
-> Maybe b
-> Maybe AsyncReadyCallback
-> m ()
fileReplaceContentsBytesAsync file :: a
file contents :: Bytes
contents etag :: Maybe Text
etag makeBackup :: Bool
makeBackup flags :: [FileCreateFlags]
flags cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr Bytes
contents' <- Bytes -> IO (Ptr Bytes)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Bytes
contents
CString
maybeEtag <- case Maybe Text
etag of
Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just jEtag :: Text
jEtag -> do
CString
jEtag' <- Text -> IO CString
textToCString Text
jEtag
CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jEtag'
let makeBackup' :: CInt
makeBackup' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
makeBackup
let flags' :: CUInt
flags' = [FileCreateFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileCreateFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> Ptr Bytes
-> CString
-> CInt
-> CUInt
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_replace_contents_bytes_async Ptr File
file' Ptr Bytes
contents' CString
maybeEtag CInt
makeBackup' CUInt
flags' Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Bytes -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Bytes
contents
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeEtag
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileReplaceContentsBytesAsyncMethodInfo
instance (signature ~ (GLib.Bytes.Bytes -> Maybe (T.Text) -> Bool -> [Gio.Flags.FileCreateFlags] -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileReplaceContentsBytesAsyncMethodInfo a signature where
overloadedMethod = fileReplaceContentsBytesAsync
#endif
foreign import ccall "g_file_replace_contents_finish" g_file_replace_contents_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr CString ->
Ptr (Ptr GError) ->
IO CInt
fileReplaceContentsFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m (T.Text)
fileReplaceContentsFinish :: a -> b -> m Text
fileReplaceContentsFinish file :: a
file res :: b
res = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
res' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
res
Ptr CString
newEtag <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CString)
IO Text -> IO () -> IO Text
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr AsyncResult -> Ptr CString -> Ptr (Ptr GError) -> IO CInt
g_file_replace_contents_finish Ptr File
file' Ptr AsyncResult
res' Ptr CString
newEtag
CString
newEtag' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
newEtag
Text
newEtag'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
newEtag'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
newEtag'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
res
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
newEtag
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
newEtag''
) (do
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
newEtag
)
#if defined(ENABLE_OVERLOADING)
data FileReplaceContentsFinishMethodInfo
instance (signature ~ (b -> m (T.Text)), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileReplaceContentsFinishMethodInfo a signature where
overloadedMethod = fileReplaceContentsFinish
#endif
foreign import ccall "g_file_replace_finish" g_file_replace_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileOutputStream.FileOutputStream)
fileReplaceFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m Gio.FileOutputStream.FileOutputStream
fileReplaceFinish :: a -> b -> m FileOutputStream
fileReplaceFinish file :: a
file res :: b
res = IO FileOutputStream -> m FileOutputStream
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileOutputStream -> m FileOutputStream)
-> IO FileOutputStream -> m FileOutputStream
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
res' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
res
IO FileOutputStream -> IO () -> IO FileOutputStream
forall a b. IO a -> IO b -> IO a
onException (do
Ptr FileOutputStream
result <- (Ptr (Ptr GError) -> IO (Ptr FileOutputStream))
-> IO (Ptr FileOutputStream)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr FileOutputStream))
-> IO (Ptr FileOutputStream))
-> (Ptr (Ptr GError) -> IO (Ptr FileOutputStream))
-> IO (Ptr FileOutputStream)
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr AsyncResult -> Ptr (Ptr GError) -> IO (Ptr FileOutputStream)
g_file_replace_finish Ptr File
file' Ptr AsyncResult
res'
Text -> Ptr FileOutputStream -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileReplaceFinish" Ptr FileOutputStream
result
FileOutputStream
result' <- ((ManagedPtr FileOutputStream -> FileOutputStream)
-> Ptr FileOutputStream -> IO FileOutputStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileOutputStream -> FileOutputStream
Gio.FileOutputStream.FileOutputStream) Ptr FileOutputStream
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
res
FileOutputStream -> IO FileOutputStream
forall (m :: * -> *) a. Monad m => a -> m a
return FileOutputStream
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileReplaceFinishMethodInfo
instance (signature ~ (b -> m Gio.FileOutputStream.FileOutputStream), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileReplaceFinishMethodInfo a signature where
overloadedMethod = fileReplaceFinish
#endif
foreign import ccall "g_file_replace_readwrite" g_file_replace_readwrite ::
Ptr File ->
CString ->
CInt ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileIOStream.FileIOStream)
fileReplaceReadwrite ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (T.Text)
-> Bool
-> [Gio.Flags.FileCreateFlags]
-> Maybe (b)
-> m Gio.FileIOStream.FileIOStream
fileReplaceReadwrite :: a
-> Maybe Text
-> Bool
-> [FileCreateFlags]
-> Maybe b
-> m FileIOStream
fileReplaceReadwrite file :: a
file etag :: Maybe Text
etag makeBackup :: Bool
makeBackup flags :: [FileCreateFlags]
flags cancellable :: Maybe b
cancellable = IO FileIOStream -> m FileIOStream
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileIOStream -> m FileIOStream)
-> IO FileIOStream -> m FileIOStream
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
maybeEtag <- case Maybe Text
etag of
Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just jEtag :: Text
jEtag -> do
CString
jEtag' <- Text -> IO CString
textToCString Text
jEtag
CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jEtag'
let makeBackup' :: CInt
makeBackup' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
makeBackup
let flags' :: CUInt
flags' = [FileCreateFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileCreateFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO FileIOStream -> IO () -> IO FileIOStream
forall a b. IO a -> IO b -> IO a
onException (do
Ptr FileIOStream
result <- (Ptr (Ptr GError) -> IO (Ptr FileIOStream))
-> IO (Ptr FileIOStream)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr FileIOStream))
-> IO (Ptr FileIOStream))
-> (Ptr (Ptr GError) -> IO (Ptr FileIOStream))
-> IO (Ptr FileIOStream)
forall a b. (a -> b) -> a -> b
$ Ptr File
-> CString
-> CInt
-> CUInt
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO (Ptr FileIOStream)
g_file_replace_readwrite Ptr File
file' CString
maybeEtag CInt
makeBackup' CUInt
flags' Ptr Cancellable
maybeCancellable
Text -> Ptr FileIOStream -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileReplaceReadwrite" Ptr FileIOStream
result
FileIOStream
result' <- ((ManagedPtr FileIOStream -> FileIOStream)
-> Ptr FileIOStream -> IO FileIOStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileIOStream -> FileIOStream
Gio.FileIOStream.FileIOStream) Ptr FileIOStream
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeEtag
FileIOStream -> IO FileIOStream
forall (m :: * -> *) a. Monad m => a -> m a
return FileIOStream
result'
) (do
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeEtag
)
#if defined(ENABLE_OVERLOADING)
data FileReplaceReadwriteMethodInfo
instance (signature ~ (Maybe (T.Text) -> Bool -> [Gio.Flags.FileCreateFlags] -> Maybe (b) -> m Gio.FileIOStream.FileIOStream), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileReplaceReadwriteMethodInfo a signature where
overloadedMethod = fileReplaceReadwrite
#endif
foreign import ccall "g_file_replace_readwrite_async" g_file_replace_readwrite_async ::
Ptr File ->
CString ->
CInt ->
CUInt ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileReplaceReadwriteAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (T.Text)
-> Bool
-> [Gio.Flags.FileCreateFlags]
-> Int32
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileReplaceReadwriteAsync :: a
-> Maybe Text
-> Bool
-> [FileCreateFlags]
-> Int32
-> Maybe b
-> Maybe AsyncReadyCallback
-> m ()
fileReplaceReadwriteAsync file :: a
file etag :: Maybe Text
etag makeBackup :: Bool
makeBackup flags :: [FileCreateFlags]
flags ioPriority :: Int32
ioPriority cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
maybeEtag <- case Maybe Text
etag of
Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just jEtag :: Text
jEtag -> do
CString
jEtag' <- Text -> IO CString
textToCString Text
jEtag
CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jEtag'
let makeBackup' :: CInt
makeBackup' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
makeBackup
let flags' :: CUInt
flags' = [FileCreateFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileCreateFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> CString
-> CInt
-> CUInt
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_replace_readwrite_async Ptr File
file' CString
maybeEtag CInt
makeBackup' CUInt
flags' Int32
ioPriority Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeEtag
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileReplaceReadwriteAsyncMethodInfo
instance (signature ~ (Maybe (T.Text) -> Bool -> [Gio.Flags.FileCreateFlags] -> Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileReplaceReadwriteAsyncMethodInfo a signature where
overloadedMethod = fileReplaceReadwriteAsync
#endif
foreign import ccall "g_file_replace_readwrite_finish" g_file_replace_readwrite_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileIOStream.FileIOStream)
fileReplaceReadwriteFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m Gio.FileIOStream.FileIOStream
fileReplaceReadwriteFinish :: a -> b -> m FileIOStream
fileReplaceReadwriteFinish file :: a
file res :: b
res = IO FileIOStream -> m FileIOStream
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileIOStream -> m FileIOStream)
-> IO FileIOStream -> m FileIOStream
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
res' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
res
IO FileIOStream -> IO () -> IO FileIOStream
forall a b. IO a -> IO b -> IO a
onException (do
Ptr FileIOStream
result <- (Ptr (Ptr GError) -> IO (Ptr FileIOStream))
-> IO (Ptr FileIOStream)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr FileIOStream))
-> IO (Ptr FileIOStream))
-> (Ptr (Ptr GError) -> IO (Ptr FileIOStream))
-> IO (Ptr FileIOStream)
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr AsyncResult -> Ptr (Ptr GError) -> IO (Ptr FileIOStream)
g_file_replace_readwrite_finish Ptr File
file' Ptr AsyncResult
res'
Text -> Ptr FileIOStream -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileReplaceReadwriteFinish" Ptr FileIOStream
result
FileIOStream
result' <- ((ManagedPtr FileIOStream -> FileIOStream)
-> Ptr FileIOStream -> IO FileIOStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileIOStream -> FileIOStream
Gio.FileIOStream.FileIOStream) Ptr FileIOStream
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
res
FileIOStream -> IO FileIOStream
forall (m :: * -> *) a. Monad m => a -> m a
return FileIOStream
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileReplaceReadwriteFinishMethodInfo
instance (signature ~ (b -> m Gio.FileIOStream.FileIOStream), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileReplaceReadwriteFinishMethodInfo a signature where
overloadedMethod = fileReplaceReadwriteFinish
#endif
foreign import ccall "g_file_resolve_relative_path" g_file_resolve_relative_path ::
Ptr File ->
CString ->
IO (Ptr File)
fileResolveRelativePath ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
a
-> [Char]
-> m File
fileResolveRelativePath :: a -> [Char] -> m File
fileResolveRelativePath file :: a
file relativePath :: [Char]
relativePath = IO File -> m File
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO File -> m File) -> IO File -> m File
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
relativePath' <- [Char] -> IO CString
stringToCString [Char]
relativePath
Ptr File
result <- Ptr File -> CString -> IO (Ptr File)
g_file_resolve_relative_path Ptr File
file' CString
relativePath'
Text -> Ptr File -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileResolveRelativePath" Ptr File
result
File
result' <- ((ManagedPtr File -> File) -> Ptr File -> IO File
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr File -> File
File) Ptr File
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
relativePath'
File -> IO File
forall (m :: * -> *) a. Monad m => a -> m a
return File
result'
#if defined(ENABLE_OVERLOADING)
data FileResolveRelativePathMethodInfo
instance (signature ~ ([Char] -> m File), MonadIO m, IsFile a) => O.MethodInfo FileResolveRelativePathMethodInfo a signature where
overloadedMethod = fileResolveRelativePath
#endif
foreign import ccall "g_file_set_attribute" g_file_set_attribute ::
Ptr File ->
CString ->
CUInt ->
Ptr () ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
fileSetAttribute ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> T.Text
-> Gio.Enums.FileAttributeType
-> Ptr ()
-> [Gio.Flags.FileQueryInfoFlags]
-> Maybe (b)
-> m ()
fileSetAttribute :: a
-> Text
-> FileAttributeType
-> Ptr ()
-> [FileQueryInfoFlags]
-> Maybe b
-> m ()
fileSetAttribute file :: a
file attribute :: Text
attribute type_ :: FileAttributeType
type_ valueP :: Ptr ()
valueP flags :: [FileQueryInfoFlags]
flags cancellable :: Maybe b
cancellable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
attribute' <- Text -> IO CString
textToCString Text
attribute
let type_' :: CUInt
type_' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt)
-> (FileAttributeType -> Int) -> FileAttributeType -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FileAttributeType -> Int
forall a. Enum a => a -> Int
fromEnum) FileAttributeType
type_
let flags' :: CUInt
flags' = [FileQueryInfoFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileQueryInfoFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File
-> CString
-> CUInt
-> Ptr ()
-> CUInt
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
g_file_set_attribute Ptr File
file' CString
attribute' CUInt
type_' Ptr ()
valueP CUInt
flags' Ptr Cancellable
maybeCancellable
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
attribute'
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
attribute'
)
#if defined(ENABLE_OVERLOADING)
data FileSetAttributeMethodInfo
instance (signature ~ (T.Text -> Gio.Enums.FileAttributeType -> Ptr () -> [Gio.Flags.FileQueryInfoFlags] -> Maybe (b) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileSetAttributeMethodInfo a signature where
overloadedMethod = fileSetAttribute
#endif
foreign import ccall "g_file_set_attribute_byte_string" g_file_set_attribute_byte_string ::
Ptr File ->
CString ->
CString ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
fileSetAttributeByteString ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> T.Text
-> T.Text
-> [Gio.Flags.FileQueryInfoFlags]
-> Maybe (b)
-> m ()
fileSetAttributeByteString :: a -> Text -> Text -> [FileQueryInfoFlags] -> Maybe b -> m ()
fileSetAttributeByteString file :: a
file attribute :: Text
attribute value :: Text
value flags :: [FileQueryInfoFlags]
flags cancellable :: Maybe b
cancellable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
attribute' <- Text -> IO CString
textToCString Text
attribute
CString
value' <- Text -> IO CString
textToCString Text
value
let flags' :: CUInt
flags' = [FileQueryInfoFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileQueryInfoFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File
-> CString
-> CString
-> CUInt
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
g_file_set_attribute_byte_string Ptr File
file' CString
attribute' CString
value' CUInt
flags' Ptr Cancellable
maybeCancellable
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
attribute'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
value'
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
attribute'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
value'
)
#if defined(ENABLE_OVERLOADING)
data FileSetAttributeByteStringMethodInfo
instance (signature ~ (T.Text -> T.Text -> [Gio.Flags.FileQueryInfoFlags] -> Maybe (b) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileSetAttributeByteStringMethodInfo a signature where
overloadedMethod = fileSetAttributeByteString
#endif
foreign import ccall "g_file_set_attribute_int32" g_file_set_attribute_int32 ::
Ptr File ->
CString ->
Int32 ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
fileSetAttributeInt32 ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> T.Text
-> Int32
-> [Gio.Flags.FileQueryInfoFlags]
-> Maybe (b)
-> m ()
fileSetAttributeInt32 :: a -> Text -> Int32 -> [FileQueryInfoFlags] -> Maybe b -> m ()
fileSetAttributeInt32 file :: a
file attribute :: Text
attribute value :: Int32
value flags :: [FileQueryInfoFlags]
flags cancellable :: Maybe b
cancellable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
attribute' <- Text -> IO CString
textToCString Text
attribute
let flags' :: CUInt
flags' = [FileQueryInfoFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileQueryInfoFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File
-> CString
-> Int32
-> CUInt
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
g_file_set_attribute_int32 Ptr File
file' CString
attribute' Int32
value CUInt
flags' Ptr Cancellable
maybeCancellable
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
attribute'
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
attribute'
)
#if defined(ENABLE_OVERLOADING)
data FileSetAttributeInt32MethodInfo
instance (signature ~ (T.Text -> Int32 -> [Gio.Flags.FileQueryInfoFlags] -> Maybe (b) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileSetAttributeInt32MethodInfo a signature where
overloadedMethod = fileSetAttributeInt32
#endif
foreign import ccall "g_file_set_attribute_int64" g_file_set_attribute_int64 ::
Ptr File ->
CString ->
Int64 ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
fileSetAttributeInt64 ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> T.Text
-> Int64
-> [Gio.Flags.FileQueryInfoFlags]
-> Maybe (b)
-> m ()
fileSetAttributeInt64 :: a -> Text -> Int64 -> [FileQueryInfoFlags] -> Maybe b -> m ()
fileSetAttributeInt64 file :: a
file attribute :: Text
attribute value :: Int64
value flags :: [FileQueryInfoFlags]
flags cancellable :: Maybe b
cancellable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
attribute' <- Text -> IO CString
textToCString Text
attribute
let flags' :: CUInt
flags' = [FileQueryInfoFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileQueryInfoFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File
-> CString
-> Int64
-> CUInt
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
g_file_set_attribute_int64 Ptr File
file' CString
attribute' Int64
value CUInt
flags' Ptr Cancellable
maybeCancellable
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
attribute'
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
attribute'
)
#if defined(ENABLE_OVERLOADING)
data FileSetAttributeInt64MethodInfo
instance (signature ~ (T.Text -> Int64 -> [Gio.Flags.FileQueryInfoFlags] -> Maybe (b) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileSetAttributeInt64MethodInfo a signature where
overloadedMethod = fileSetAttributeInt64
#endif
foreign import ccall "g_file_set_attribute_string" g_file_set_attribute_string ::
Ptr File ->
CString ->
CString ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
fileSetAttributeString ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> T.Text
-> T.Text
-> [Gio.Flags.FileQueryInfoFlags]
-> Maybe (b)
-> m ()
fileSetAttributeString :: a -> Text -> Text -> [FileQueryInfoFlags] -> Maybe b -> m ()
fileSetAttributeString file :: a
file attribute :: Text
attribute value :: Text
value flags :: [FileQueryInfoFlags]
flags cancellable :: Maybe b
cancellable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
attribute' <- Text -> IO CString
textToCString Text
attribute
CString
value' <- Text -> IO CString
textToCString Text
value
let flags' :: CUInt
flags' = [FileQueryInfoFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileQueryInfoFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File
-> CString
-> CString
-> CUInt
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
g_file_set_attribute_string Ptr File
file' CString
attribute' CString
value' CUInt
flags' Ptr Cancellable
maybeCancellable
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
attribute'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
value'
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
attribute'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
value'
)
#if defined(ENABLE_OVERLOADING)
data FileSetAttributeStringMethodInfo
instance (signature ~ (T.Text -> T.Text -> [Gio.Flags.FileQueryInfoFlags] -> Maybe (b) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileSetAttributeStringMethodInfo a signature where
overloadedMethod = fileSetAttributeString
#endif
foreign import ccall "g_file_set_attribute_uint32" g_file_set_attribute_uint32 ::
Ptr File ->
CString ->
Word32 ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
fileSetAttributeUint32 ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> T.Text
-> Word32
-> [Gio.Flags.FileQueryInfoFlags]
-> Maybe (b)
-> m ()
fileSetAttributeUint32 :: a -> Text -> Word32 -> [FileQueryInfoFlags] -> Maybe b -> m ()
fileSetAttributeUint32 file :: a
file attribute :: Text
attribute value :: Word32
value flags :: [FileQueryInfoFlags]
flags cancellable :: Maybe b
cancellable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
attribute' <- Text -> IO CString
textToCString Text
attribute
let flags' :: CUInt
flags' = [FileQueryInfoFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileQueryInfoFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File
-> CString
-> Word32
-> CUInt
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
g_file_set_attribute_uint32 Ptr File
file' CString
attribute' Word32
value CUInt
flags' Ptr Cancellable
maybeCancellable
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
attribute'
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
attribute'
)
#if defined(ENABLE_OVERLOADING)
data FileSetAttributeUint32MethodInfo
instance (signature ~ (T.Text -> Word32 -> [Gio.Flags.FileQueryInfoFlags] -> Maybe (b) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileSetAttributeUint32MethodInfo a signature where
overloadedMethod = fileSetAttributeUint32
#endif
foreign import ccall "g_file_set_attribute_uint64" g_file_set_attribute_uint64 ::
Ptr File ->
CString ->
Word64 ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
fileSetAttributeUint64 ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> T.Text
-> Word64
-> [Gio.Flags.FileQueryInfoFlags]
-> Maybe (b)
-> m ()
fileSetAttributeUint64 :: a -> Text -> Word64 -> [FileQueryInfoFlags] -> Maybe b -> m ()
fileSetAttributeUint64 file :: a
file attribute :: Text
attribute value :: Word64
value flags :: [FileQueryInfoFlags]
flags cancellable :: Maybe b
cancellable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
attribute' <- Text -> IO CString
textToCString Text
attribute
let flags' :: CUInt
flags' = [FileQueryInfoFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileQueryInfoFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File
-> CString
-> Word64
-> CUInt
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
g_file_set_attribute_uint64 Ptr File
file' CString
attribute' Word64
value CUInt
flags' Ptr Cancellable
maybeCancellable
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
attribute'
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
attribute'
)
#if defined(ENABLE_OVERLOADING)
data FileSetAttributeUint64MethodInfo
instance (signature ~ (T.Text -> Word64 -> [Gio.Flags.FileQueryInfoFlags] -> Maybe (b) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileSetAttributeUint64MethodInfo a signature where
overloadedMethod = fileSetAttributeUint64
#endif
foreign import ccall "g_file_set_attributes_async" g_file_set_attributes_async ::
Ptr File ->
Ptr Gio.FileInfo.FileInfo ->
CUInt ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileSetAttributesAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.FileInfo.IsFileInfo b, Gio.Cancellable.IsCancellable c) =>
a
-> b
-> [Gio.Flags.FileQueryInfoFlags]
-> Int32
-> Maybe (c)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileSetAttributesAsync :: a
-> b
-> [FileQueryInfoFlags]
-> Int32
-> Maybe c
-> Maybe AsyncReadyCallback
-> m ()
fileSetAttributesAsync file :: a
file info :: b
info flags :: [FileQueryInfoFlags]
flags ioPriority :: Int32
ioPriority cancellable :: Maybe c
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr FileInfo
info' <- b -> IO (Ptr FileInfo)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
info
let flags' :: CUInt
flags' = [FileQueryInfoFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileQueryInfoFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: c
jCancellable -> do
Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> Ptr FileInfo
-> CUInt
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_set_attributes_async Ptr File
file' Ptr FileInfo
info' CUInt
flags' Int32
ioPriority Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
info
Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileSetAttributesAsyncMethodInfo
instance (signature ~ (b -> [Gio.Flags.FileQueryInfoFlags] -> Int32 -> Maybe (c) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.FileInfo.IsFileInfo b, Gio.Cancellable.IsCancellable c) => O.MethodInfo FileSetAttributesAsyncMethodInfo a signature where
overloadedMethod = fileSetAttributesAsync
#endif
foreign import ccall "g_file_set_attributes_finish" g_file_set_attributes_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr Gio.FileInfo.FileInfo) ->
Ptr (Ptr GError) ->
IO CInt
fileSetAttributesFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m (Gio.FileInfo.FileInfo)
fileSetAttributesFinish :: a -> b -> m FileInfo
fileSetAttributesFinish file :: a
file result_ :: b
result_ = IO FileInfo -> m FileInfo
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileInfo -> m FileInfo) -> IO FileInfo -> m FileInfo
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
Ptr (Ptr FileInfo)
info <- IO (Ptr (Ptr FileInfo))
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr (Ptr Gio.FileInfo.FileInfo))
IO FileInfo -> IO () -> IO FileInfo
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr AsyncResult
-> Ptr (Ptr FileInfo)
-> Ptr (Ptr GError)
-> IO CInt
g_file_set_attributes_finish Ptr File
file' Ptr AsyncResult
result_' Ptr (Ptr FileInfo)
info
Ptr FileInfo
info' <- Ptr (Ptr FileInfo) -> IO (Ptr FileInfo)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr FileInfo)
info
FileInfo
info'' <- ((ManagedPtr FileInfo -> FileInfo) -> Ptr FileInfo -> IO FileInfo
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileInfo -> FileInfo
Gio.FileInfo.FileInfo) Ptr FileInfo
info'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
Ptr (Ptr FileInfo) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr FileInfo)
info
FileInfo -> IO FileInfo
forall (m :: * -> *) a. Monad m => a -> m a
return FileInfo
info''
) (do
Ptr (Ptr FileInfo) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr FileInfo)
info
)
#if defined(ENABLE_OVERLOADING)
data FileSetAttributesFinishMethodInfo
instance (signature ~ (b -> m (Gio.FileInfo.FileInfo)), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileSetAttributesFinishMethodInfo a signature where
overloadedMethod = fileSetAttributesFinish
#endif
foreign import ccall "g_file_set_attributes_from_info" g_file_set_attributes_from_info ::
Ptr File ->
Ptr Gio.FileInfo.FileInfo ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
fileSetAttributesFromInfo ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.FileInfo.IsFileInfo b, Gio.Cancellable.IsCancellable c) =>
a
-> b
-> [Gio.Flags.FileQueryInfoFlags]
-> Maybe (c)
-> m ()
fileSetAttributesFromInfo :: a -> b -> [FileQueryInfoFlags] -> Maybe c -> m ()
fileSetAttributesFromInfo file :: a
file info :: b
info flags :: [FileQueryInfoFlags]
flags cancellable :: Maybe c
cancellable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr FileInfo
info' <- b -> IO (Ptr FileInfo)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
info
let flags' :: CUInt
flags' = [FileQueryInfoFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [FileQueryInfoFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: c
jCancellable -> do
Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr FileInfo
-> CUInt
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
g_file_set_attributes_from_info Ptr File
file' Ptr FileInfo
info' CUInt
flags' Ptr Cancellable
maybeCancellable
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
info
Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileSetAttributesFromInfoMethodInfo
instance (signature ~ (b -> [Gio.Flags.FileQueryInfoFlags] -> Maybe (c) -> m ()), MonadIO m, IsFile a, Gio.FileInfo.IsFileInfo b, Gio.Cancellable.IsCancellable c) => O.MethodInfo FileSetAttributesFromInfoMethodInfo a signature where
overloadedMethod = fileSetAttributesFromInfo
#endif
foreign import ccall "g_file_set_display_name" g_file_set_display_name ::
Ptr File ->
CString ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr File)
fileSetDisplayName ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> T.Text
-> Maybe (b)
-> m File
fileSetDisplayName :: a -> Text -> Maybe b -> m File
fileSetDisplayName file :: a
file displayName :: Text
displayName cancellable :: Maybe b
cancellable = IO File -> m File
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO File -> m File) -> IO File -> m File
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
displayName' <- Text -> IO CString
textToCString Text
displayName
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO File -> IO () -> IO File
forall a b. IO a -> IO b -> IO a
onException (do
Ptr File
result <- (Ptr (Ptr GError) -> IO (Ptr File)) -> IO (Ptr File)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr File)) -> IO (Ptr File))
-> (Ptr (Ptr GError) -> IO (Ptr File)) -> IO (Ptr File)
forall a b. (a -> b) -> a -> b
$ Ptr File
-> CString -> Ptr Cancellable -> Ptr (Ptr GError) -> IO (Ptr File)
g_file_set_display_name Ptr File
file' CString
displayName' Ptr Cancellable
maybeCancellable
Text -> Ptr File -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileSetDisplayName" Ptr File
result
File
result' <- ((ManagedPtr File -> File) -> Ptr File -> IO File
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr File -> File
File) Ptr File
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
displayName'
File -> IO File
forall (m :: * -> *) a. Monad m => a -> m a
return File
result'
) (do
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
displayName'
)
#if defined(ENABLE_OVERLOADING)
data FileSetDisplayNameMethodInfo
instance (signature ~ (T.Text -> Maybe (b) -> m File), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileSetDisplayNameMethodInfo a signature where
overloadedMethod = fileSetDisplayName
#endif
foreign import ccall "g_file_set_display_name_async" g_file_set_display_name_async ::
Ptr File ->
CString ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileSetDisplayNameAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> T.Text
-> Int32
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileSetDisplayNameAsync :: a -> Text -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
fileSetDisplayNameAsync file :: a
file displayName :: Text
displayName ioPriority :: Int32
ioPriority cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CString
displayName' <- Text -> IO CString
textToCString Text
displayName
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> CString
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_set_display_name_async Ptr File
file' CString
displayName' Int32
ioPriority Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
displayName'
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileSetDisplayNameAsyncMethodInfo
instance (signature ~ (T.Text -> Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileSetDisplayNameAsyncMethodInfo a signature where
overloadedMethod = fileSetDisplayNameAsync
#endif
foreign import ccall "g_file_set_display_name_finish" g_file_set_display_name_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO (Ptr File)
fileSetDisplayNameFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m File
fileSetDisplayNameFinish :: a -> b -> m File
fileSetDisplayNameFinish file :: a
file res :: b
res = IO File -> m File
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO File -> m File) -> IO File -> m File
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
res' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
res
IO File -> IO () -> IO File
forall a b. IO a -> IO b -> IO a
onException (do
Ptr File
result <- (Ptr (Ptr GError) -> IO (Ptr File)) -> IO (Ptr File)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr File)) -> IO (Ptr File))
-> (Ptr (Ptr GError) -> IO (Ptr File)) -> IO (Ptr File)
forall a b. (a -> b) -> a -> b
$ Ptr File -> Ptr AsyncResult -> Ptr (Ptr GError) -> IO (Ptr File)
g_file_set_display_name_finish Ptr File
file' Ptr AsyncResult
res'
Text -> Ptr File -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileSetDisplayNameFinish" Ptr File
result
File
result' <- ((ManagedPtr File -> File) -> Ptr File -> IO File
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr File -> File
File) Ptr File
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
res
File -> IO File
forall (m :: * -> *) a. Monad m => a -> m a
return File
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileSetDisplayNameFinishMethodInfo
instance (signature ~ (b -> m File), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileSetDisplayNameFinishMethodInfo a signature where
overloadedMethod = fileSetDisplayNameFinish
#endif
foreign import ccall "g_file_start_mountable" g_file_start_mountable ::
Ptr File ->
CUInt ->
Ptr Gio.MountOperation.MountOperation ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileStartMountable ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.MountOperation.IsMountOperation b, Gio.Cancellable.IsCancellable c) =>
a
-> [Gio.Flags.DriveStartFlags]
-> Maybe (b)
-> Maybe (c)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileStartMountable :: a
-> [DriveStartFlags]
-> Maybe b
-> Maybe c
-> Maybe AsyncReadyCallback
-> m ()
fileStartMountable file :: a
file flags :: [DriveStartFlags]
flags startOperation :: Maybe b
startOperation cancellable :: Maybe c
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
let flags' :: CUInt
flags' = [DriveStartFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [DriveStartFlags]
flags
Ptr MountOperation
maybeStartOperation <- case Maybe b
startOperation of
Nothing -> Ptr MountOperation -> IO (Ptr MountOperation)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MountOperation
forall a. Ptr a
nullPtr
Just jStartOperation :: b
jStartOperation -> do
Ptr MountOperation
jStartOperation' <- b -> IO (Ptr MountOperation)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jStartOperation
Ptr MountOperation -> IO (Ptr MountOperation)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MountOperation
jStartOperation'
Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: c
jCancellable -> do
Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> CUInt
-> Ptr MountOperation
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_start_mountable Ptr File
file' CUInt
flags' Ptr MountOperation
maybeStartOperation Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
startOperation b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileStartMountableMethodInfo
instance (signature ~ ([Gio.Flags.DriveStartFlags] -> Maybe (b) -> Maybe (c) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.MountOperation.IsMountOperation b, Gio.Cancellable.IsCancellable c) => O.MethodInfo FileStartMountableMethodInfo a signature where
overloadedMethod = fileStartMountable
#endif
foreign import ccall "g_file_start_mountable_finish" g_file_start_mountable_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO CInt
fileStartMountableFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ()
fileStartMountableFinish :: a -> b -> m ()
fileStartMountableFinish file :: a
file result_ :: b
result_ = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File -> Ptr AsyncResult -> Ptr (Ptr GError) -> IO CInt
g_file_start_mountable_finish Ptr File
file' Ptr AsyncResult
result_'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileStartMountableFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileStartMountableFinishMethodInfo a signature where
overloadedMethod = fileStartMountableFinish
#endif
foreign import ccall "g_file_stop_mountable" g_file_stop_mountable ::
Ptr File ->
CUInt ->
Ptr Gio.MountOperation.MountOperation ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileStopMountable ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.MountOperation.IsMountOperation b, Gio.Cancellable.IsCancellable c) =>
a
-> [Gio.Flags.MountUnmountFlags]
-> Maybe (b)
-> Maybe (c)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileStopMountable :: a
-> [MountUnmountFlags]
-> Maybe b
-> Maybe c
-> Maybe AsyncReadyCallback
-> m ()
fileStopMountable file :: a
file flags :: [MountUnmountFlags]
flags mountOperation :: Maybe b
mountOperation cancellable :: Maybe c
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
let flags' :: CUInt
flags' = [MountUnmountFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [MountUnmountFlags]
flags
Ptr MountOperation
maybeMountOperation <- case Maybe b
mountOperation of
Nothing -> Ptr MountOperation -> IO (Ptr MountOperation)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MountOperation
forall a. Ptr a
nullPtr
Just jMountOperation :: b
jMountOperation -> do
Ptr MountOperation
jMountOperation' <- b -> IO (Ptr MountOperation)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jMountOperation
Ptr MountOperation -> IO (Ptr MountOperation)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MountOperation
jMountOperation'
Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: c
jCancellable -> do
Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> CUInt
-> Ptr MountOperation
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_stop_mountable Ptr File
file' CUInt
flags' Ptr MountOperation
maybeMountOperation Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
mountOperation b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileStopMountableMethodInfo
instance (signature ~ ([Gio.Flags.MountUnmountFlags] -> Maybe (b) -> Maybe (c) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.MountOperation.IsMountOperation b, Gio.Cancellable.IsCancellable c) => O.MethodInfo FileStopMountableMethodInfo a signature where
overloadedMethod = fileStopMountable
#endif
foreign import ccall "g_file_stop_mountable_finish" g_file_stop_mountable_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO CInt
fileStopMountableFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ()
fileStopMountableFinish :: a -> b -> m ()
fileStopMountableFinish file :: a
file result_ :: b
result_ = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File -> Ptr AsyncResult -> Ptr (Ptr GError) -> IO CInt
g_file_stop_mountable_finish Ptr File
file' Ptr AsyncResult
result_'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileStopMountableFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileStopMountableFinishMethodInfo a signature where
overloadedMethod = fileStopMountableFinish
#endif
foreign import ccall "g_file_supports_thread_contexts" g_file_supports_thread_contexts ::
Ptr File ->
IO CInt
fileSupportsThreadContexts ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
a
-> m Bool
fileSupportsThreadContexts :: a -> m Bool
fileSupportsThreadContexts file :: a
file = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
CInt
result <- Ptr File -> IO CInt
g_file_supports_thread_contexts Ptr File
file'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data FileSupportsThreadContextsMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsFile a) => O.MethodInfo FileSupportsThreadContextsMethodInfo a signature where
overloadedMethod = fileSupportsThreadContexts
#endif
foreign import ccall "g_file_trash" g_file_trash ::
Ptr File ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
fileTrash ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m ()
fileTrash :: a -> Maybe b -> m ()
fileTrash file :: a
file cancellable :: Maybe b
cancellable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File -> Ptr Cancellable -> Ptr (Ptr GError) -> IO CInt
g_file_trash Ptr File
file' Ptr Cancellable
maybeCancellable
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileTrashMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileTrashMethodInfo a signature where
overloadedMethod = fileTrash
#endif
foreign import ccall "g_file_trash_async" g_file_trash_async ::
Ptr File ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileTrashAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> Int32
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileTrashAsync :: a -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
fileTrashAsync file :: a
file ioPriority :: Int32
ioPriority cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_trash_async Ptr File
file' Int32
ioPriority Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileTrashAsyncMethodInfo
instance (signature ~ (Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileTrashAsyncMethodInfo a signature where
overloadedMethod = fileTrashAsync
#endif
foreign import ccall "g_file_trash_finish" g_file_trash_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO CInt
fileTrashFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ()
fileTrashFinish :: a -> b -> m ()
fileTrashFinish file :: a
file result_ :: b
result_ = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File -> Ptr AsyncResult -> Ptr (Ptr GError) -> IO CInt
g_file_trash_finish Ptr File
file' Ptr AsyncResult
result_'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileTrashFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileTrashFinishMethodInfo a signature where
overloadedMethod = fileTrashFinish
#endif
foreign import ccall "g_file_unmount_mountable" g_file_unmount_mountable ::
Ptr File ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
{-# DEPRECATED fileUnmountMountable ["(Since version 2.22)","Use 'GI.Gio.Interfaces.File.fileUnmountMountableWithOperation' instead."] #-}
fileUnmountMountable ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> [Gio.Flags.MountUnmountFlags]
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileUnmountMountable :: a
-> [MountUnmountFlags]
-> Maybe b
-> Maybe AsyncReadyCallback
-> m ()
fileUnmountMountable file :: a
file flags :: [MountUnmountFlags]
flags cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
let flags' :: CUInt
flags' = [MountUnmountFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [MountUnmountFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> CUInt
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_unmount_mountable Ptr File
file' CUInt
flags' Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileUnmountMountableMethodInfo
instance (signature ~ ([Gio.Flags.MountUnmountFlags] -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileUnmountMountableMethodInfo a signature where
overloadedMethod = fileUnmountMountable
#endif
foreign import ccall "g_file_unmount_mountable_finish" g_file_unmount_mountable_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO CInt
{-# DEPRECATED fileUnmountMountableFinish ["(Since version 2.22)","Use 'GI.Gio.Interfaces.File.fileUnmountMountableWithOperationFinish'"," instead."] #-}
fileUnmountMountableFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ()
fileUnmountMountableFinish :: a -> b -> m ()
fileUnmountMountableFinish file :: a
file result_ :: b
result_ = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File -> Ptr AsyncResult -> Ptr (Ptr GError) -> IO CInt
g_file_unmount_mountable_finish Ptr File
file' Ptr AsyncResult
result_'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileUnmountMountableFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileUnmountMountableFinishMethodInfo a signature where
overloadedMethod = fileUnmountMountableFinish
#endif
foreign import ccall "g_file_unmount_mountable_with_operation" g_file_unmount_mountable_with_operation ::
Ptr File ->
CUInt ->
Ptr Gio.MountOperation.MountOperation ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileUnmountMountableWithOperation ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.MountOperation.IsMountOperation b, Gio.Cancellable.IsCancellable c) =>
a
-> [Gio.Flags.MountUnmountFlags]
-> Maybe (b)
-> Maybe (c)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileUnmountMountableWithOperation :: a
-> [MountUnmountFlags]
-> Maybe b
-> Maybe c
-> Maybe AsyncReadyCallback
-> m ()
fileUnmountMountableWithOperation file :: a
file flags :: [MountUnmountFlags]
flags mountOperation :: Maybe b
mountOperation cancellable :: Maybe c
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
let flags' :: CUInt
flags' = [MountUnmountFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [MountUnmountFlags]
flags
Ptr MountOperation
maybeMountOperation <- case Maybe b
mountOperation of
Nothing -> Ptr MountOperation -> IO (Ptr MountOperation)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MountOperation
forall a. Ptr a
nullPtr
Just jMountOperation :: b
jMountOperation -> do
Ptr MountOperation
jMountOperation' <- b -> IO (Ptr MountOperation)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jMountOperation
Ptr MountOperation -> IO (Ptr MountOperation)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MountOperation
jMountOperation'
Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: c
jCancellable -> do
Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr File
-> CUInt
-> Ptr MountOperation
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_unmount_mountable_with_operation Ptr File
file' CUInt
flags' Ptr MountOperation
maybeMountOperation Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
mountOperation b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileUnmountMountableWithOperationMethodInfo
instance (signature ~ ([Gio.Flags.MountUnmountFlags] -> Maybe (b) -> Maybe (c) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFile a, Gio.MountOperation.IsMountOperation b, Gio.Cancellable.IsCancellable c) => O.MethodInfo FileUnmountMountableWithOperationMethodInfo a signature where
overloadedMethod = fileUnmountMountableWithOperation
#endif
foreign import ccall "g_file_unmount_mountable_with_operation_finish" g_file_unmount_mountable_with_operation_finish ::
Ptr File ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO CInt
fileUnmountMountableWithOperationFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ()
fileUnmountMountableWithOperationFinish :: a -> b -> m ()
fileUnmountMountableWithOperationFinish file :: a
file result_ :: b
result_ = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File -> Ptr AsyncResult -> Ptr (Ptr GError) -> IO CInt
g_file_unmount_mountable_with_operation_finish Ptr File
file' Ptr AsyncResult
result_'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileUnmountMountableWithOperationFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsFile a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileUnmountMountableWithOperationFinishMethodInfo a signature where
overloadedMethod = fileUnmountMountableWithOperationFinish
#endif
foreign import ccall "g_file_new_for_commandline_arg" g_file_new_for_commandline_arg ::
CString ->
IO (Ptr File)
fileNewForCommandlineArg ::
(B.CallStack.HasCallStack, MonadIO m) =>
[Char]
-> m File
fileNewForCommandlineArg :: [Char] -> m File
fileNewForCommandlineArg arg :: [Char]
arg = IO File -> m File
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO File -> m File) -> IO File -> m File
forall a b. (a -> b) -> a -> b
$ do
CString
arg' <- [Char] -> IO CString
stringToCString [Char]
arg
Ptr File
result <- CString -> IO (Ptr File)
g_file_new_for_commandline_arg CString
arg'
Text -> Ptr File -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileNewForCommandlineArg" Ptr File
result
File
result' <- ((ManagedPtr File -> File) -> Ptr File -> IO File
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr File -> File
File) Ptr File
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
arg'
File -> IO File
forall (m :: * -> *) a. Monad m => a -> m a
return File
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_file_new_for_commandline_arg_and_cwd" g_file_new_for_commandline_arg_and_cwd ::
CString ->
CString ->
IO (Ptr File)
fileNewForCommandlineArgAndCwd ::
(B.CallStack.HasCallStack, MonadIO m) =>
[Char]
-> [Char]
-> m File
fileNewForCommandlineArgAndCwd :: [Char] -> [Char] -> m File
fileNewForCommandlineArgAndCwd arg :: [Char]
arg cwd :: [Char]
cwd = IO File -> m File
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO File -> m File) -> IO File -> m File
forall a b. (a -> b) -> a -> b
$ do
CString
arg' <- [Char] -> IO CString
stringToCString [Char]
arg
CString
cwd' <- [Char] -> IO CString
stringToCString [Char]
cwd
Ptr File
result <- CString -> CString -> IO (Ptr File)
g_file_new_for_commandline_arg_and_cwd CString
arg' CString
cwd'
Text -> Ptr File -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileNewForCommandlineArgAndCwd" Ptr File
result
File
result' <- ((ManagedPtr File -> File) -> Ptr File -> IO File
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr File -> File
File) Ptr File
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
arg'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
cwd'
File -> IO File
forall (m :: * -> *) a. Monad m => a -> m a
return File
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_file_new_for_path" g_file_new_for_path ::
CString ->
IO (Ptr File)
fileNewForPath ::
(B.CallStack.HasCallStack, MonadIO m) =>
[Char]
-> m File
fileNewForPath :: [Char] -> m File
fileNewForPath path :: [Char]
path = IO File -> m File
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO File -> m File) -> IO File -> m File
forall a b. (a -> b) -> a -> b
$ do
CString
path' <- [Char] -> IO CString
stringToCString [Char]
path
Ptr File
result <- CString -> IO (Ptr File)
g_file_new_for_path CString
path'
Text -> Ptr File -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileNewForPath" Ptr File
result
File
result' <- ((ManagedPtr File -> File) -> Ptr File -> IO File
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr File -> File
File) Ptr File
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
File -> IO File
forall (m :: * -> *) a. Monad m => a -> m a
return File
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_file_new_for_uri" g_file_new_for_uri ::
CString ->
IO (Ptr File)
fileNewForUri ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m File
fileNewForUri :: Text -> m File
fileNewForUri uri :: Text
uri = IO File -> m File
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO File -> m File) -> IO File -> m File
forall a b. (a -> b) -> a -> b
$ do
CString
uri' <- Text -> IO CString
textToCString Text
uri
Ptr File
result <- CString -> IO (Ptr File)
g_file_new_for_uri CString
uri'
Text -> Ptr File -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileNewForUri" Ptr File
result
File
result' <- ((ManagedPtr File -> File) -> Ptr File -> IO File
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr File -> File
File) Ptr File
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
uri'
File -> IO File
forall (m :: * -> *) a. Monad m => a -> m a
return File
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_file_new_tmp" g_file_new_tmp ::
CString ->
Ptr (Ptr Gio.FileIOStream.FileIOStream) ->
Ptr (Ptr GError) ->
IO (Ptr File)
fileNewTmp ::
(B.CallStack.HasCallStack, MonadIO m) =>
Maybe ([Char])
-> m ((File, Gio.FileIOStream.FileIOStream))
fileNewTmp :: Maybe [Char] -> m (File, FileIOStream)
fileNewTmp tmpl :: Maybe [Char]
tmpl = IO (File, FileIOStream) -> m (File, FileIOStream)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (File, FileIOStream) -> m (File, FileIOStream))
-> IO (File, FileIOStream) -> m (File, FileIOStream)
forall a b. (a -> b) -> a -> b
$ do
CString
maybeTmpl <- case Maybe [Char]
tmpl of
Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just jTmpl :: [Char]
jTmpl -> do
CString
jTmpl' <- [Char] -> IO CString
stringToCString [Char]
jTmpl
CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jTmpl'
Ptr (Ptr FileIOStream)
iostream <- IO (Ptr (Ptr FileIOStream))
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr (Ptr Gio.FileIOStream.FileIOStream))
IO (File, FileIOStream) -> IO () -> IO (File, FileIOStream)
forall a b. IO a -> IO b -> IO a
onException (do
Ptr File
result <- (Ptr (Ptr GError) -> IO (Ptr File)) -> IO (Ptr File)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr File)) -> IO (Ptr File))
-> (Ptr (Ptr GError) -> IO (Ptr File)) -> IO (Ptr File)
forall a b. (a -> b) -> a -> b
$ CString
-> Ptr (Ptr FileIOStream) -> Ptr (Ptr GError) -> IO (Ptr File)
g_file_new_tmp CString
maybeTmpl Ptr (Ptr FileIOStream)
iostream
Text -> Ptr File -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileNewTmp" Ptr File
result
File
result' <- ((ManagedPtr File -> File) -> Ptr File -> IO File
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr File -> File
File) Ptr File
result
Ptr FileIOStream
iostream' <- Ptr (Ptr FileIOStream) -> IO (Ptr FileIOStream)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr FileIOStream)
iostream
FileIOStream
iostream'' <- ((ManagedPtr FileIOStream -> FileIOStream)
-> Ptr FileIOStream -> IO FileIOStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileIOStream -> FileIOStream
Gio.FileIOStream.FileIOStream) Ptr FileIOStream
iostream'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeTmpl
Ptr (Ptr FileIOStream) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr FileIOStream)
iostream
(File, FileIOStream) -> IO (File, FileIOStream)
forall (m :: * -> *) a. Monad m => a -> m a
return (File
result', FileIOStream
iostream'')
) (do
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeTmpl
Ptr (Ptr FileIOStream) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr FileIOStream)
iostream
)
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_file_parse_name" g_file_parse_name ::
CString ->
IO (Ptr File)
fileParseName ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m File
fileParseName :: Text -> m File
fileParseName parseName :: Text
parseName = IO File -> m File
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO File -> m File) -> IO File -> m File
forall a b. (a -> b) -> a -> b
$ do
CString
parseName' <- Text -> IO CString
textToCString Text
parseName
Ptr File
result <- CString -> IO (Ptr File)
g_file_parse_name CString
parseName'
Text -> Ptr File -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileParseName" Ptr File
result
File
result' <- ((ManagedPtr File -> File) -> Ptr File -> IO File
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr File -> File
File) Ptr File
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
parseName'
File -> IO File
forall (m :: * -> *) a. Monad m => a -> m a
return File
result'
#if defined(ENABLE_OVERLOADING)
#endif