{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Objects.Vfs
(
Vfs(..) ,
IsVfs ,
toVfs ,
#if defined(ENABLE_OVERLOADING)
ResolveVfsMethod ,
#endif
vfsGetDefault ,
#if defined(ENABLE_OVERLOADING)
VfsGetFileForPathMethodInfo ,
#endif
vfsGetFileForPath ,
#if defined(ENABLE_OVERLOADING)
VfsGetFileForUriMethodInfo ,
#endif
vfsGetFileForUri ,
vfsGetLocal ,
#if defined(ENABLE_OVERLOADING)
VfsGetSupportedUriSchemesMethodInfo ,
#endif
vfsGetSupportedUriSchemes ,
#if defined(ENABLE_OVERLOADING)
VfsIsActiveMethodInfo ,
#endif
vfsIsActive ,
#if defined(ENABLE_OVERLOADING)
VfsParseNameMethodInfo ,
#endif
vfsParseName ,
#if defined(ENABLE_OVERLOADING)
VfsRegisterUriSchemeMethodInfo ,
#endif
vfsRegisterUriScheme ,
#if defined(ENABLE_OVERLOADING)
VfsUnregisterUriSchemeMethodInfo ,
#endif
vfsUnregisterUriScheme ,
) 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.BasicTypes as B.Types
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 Control.Monad.IO.Class as MIO
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.Callbacks as GLib.Callbacks
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import {-# SOURCE #-} qualified GI.Gio.Interfaces.File as Gio.File
newtype Vfs = Vfs (SP.ManagedPtr Vfs)
deriving (Vfs -> Vfs -> Bool
(Vfs -> Vfs -> Bool) -> (Vfs -> Vfs -> Bool) -> Eq Vfs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Vfs -> Vfs -> Bool
$c/= :: Vfs -> Vfs -> Bool
== :: Vfs -> Vfs -> Bool
$c== :: Vfs -> Vfs -> Bool
Eq)
instance SP.ManagedPtrNewtype Vfs where
toManagedPtr :: Vfs -> ManagedPtr Vfs
toManagedPtr (Vfs ManagedPtr Vfs
p) = ManagedPtr Vfs
p
foreign import ccall "g_vfs_get_type"
c_g_vfs_get_type :: IO B.Types.GType
instance B.Types.TypedObject Vfs where
glibType :: IO GType
glibType = IO GType
c_g_vfs_get_type
instance B.Types.GObject Vfs
instance B.GValue.IsGValue Vfs where
toGValue :: Vfs -> IO GValue
toGValue Vfs
o = do
GType
gtype <- IO GType
c_g_vfs_get_type
Vfs -> (Ptr Vfs -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Vfs
o (GType -> (GValue -> Ptr Vfs -> IO ()) -> Ptr Vfs -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr Vfs -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
fromGValue :: GValue -> IO Vfs
fromGValue GValue
gv = do
Ptr Vfs
ptr <- GValue -> IO (Ptr Vfs)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr Vfs)
(ManagedPtr Vfs -> Vfs) -> Ptr Vfs -> IO Vfs
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr Vfs -> Vfs
Vfs Ptr Vfs
ptr
class (SP.GObject o, O.IsDescendantOf Vfs o) => IsVfs o
instance (SP.GObject o, O.IsDescendantOf Vfs o) => IsVfs o
instance O.HasParentTypes Vfs
type instance O.ParentTypes Vfs = '[GObject.Object.Object]
toVfs :: (MonadIO m, IsVfs o) => o -> m Vfs
toVfs :: o -> m Vfs
toVfs = IO Vfs -> m Vfs
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Vfs -> m Vfs) -> (o -> IO Vfs) -> o -> m Vfs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Vfs -> Vfs) -> o -> IO Vfs
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr Vfs -> Vfs
Vfs
#if defined(ENABLE_OVERLOADING)
type family ResolveVfsMethod (t :: Symbol) (o :: *) :: * where
ResolveVfsMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveVfsMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveVfsMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveVfsMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveVfsMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveVfsMethod "isActive" o = VfsIsActiveMethodInfo
ResolveVfsMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveVfsMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveVfsMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveVfsMethod "parseName" o = VfsParseNameMethodInfo
ResolveVfsMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveVfsMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveVfsMethod "registerUriScheme" o = VfsRegisterUriSchemeMethodInfo
ResolveVfsMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveVfsMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveVfsMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveVfsMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveVfsMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveVfsMethod "unregisterUriScheme" o = VfsUnregisterUriSchemeMethodInfo
ResolveVfsMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveVfsMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveVfsMethod "getFileForPath" o = VfsGetFileForPathMethodInfo
ResolveVfsMethod "getFileForUri" o = VfsGetFileForUriMethodInfo
ResolveVfsMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveVfsMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveVfsMethod "getSupportedUriSchemes" o = VfsGetSupportedUriSchemesMethodInfo
ResolveVfsMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveVfsMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveVfsMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveVfsMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveVfsMethod t Vfs, O.MethodInfo info Vfs p) => OL.IsLabel t (Vfs -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Vfs
type instance O.AttributeList Vfs = VfsAttributeList
type VfsAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Vfs = VfsSignalList
type VfsSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_vfs_get_file_for_path" g_vfs_get_file_for_path ::
Ptr Vfs ->
CString ->
IO (Ptr Gio.File.File)
vfsGetFileForPath ::
(B.CallStack.HasCallStack, MonadIO m, IsVfs a) =>
a
-> T.Text
-> m Gio.File.File
vfsGetFileForPath :: a -> Text -> m File
vfsGetFileForPath a
vfs Text
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
Ptr Vfs
vfs' <- a -> IO (Ptr Vfs)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
vfs
CString
path' <- Text -> IO CString
textToCString Text
path
Ptr File
result <- Ptr Vfs -> CString -> IO (Ptr File)
g_vfs_get_file_for_path Ptr Vfs
vfs' CString
path'
Text -> Ptr File -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"vfsGetFileForPath" 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
Gio.File.File) Ptr File
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
vfs
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)
data VfsGetFileForPathMethodInfo
instance (signature ~ (T.Text -> m Gio.File.File), MonadIO m, IsVfs a) => O.MethodInfo VfsGetFileForPathMethodInfo a signature where
overloadedMethod = vfsGetFileForPath
#endif
foreign import ccall "g_vfs_get_file_for_uri" g_vfs_get_file_for_uri ::
Ptr Vfs ->
CString ->
IO (Ptr Gio.File.File)
vfsGetFileForUri ::
(B.CallStack.HasCallStack, MonadIO m, IsVfs a) =>
a
-> T.Text
-> m Gio.File.File
vfsGetFileForUri :: a -> Text -> m File
vfsGetFileForUri a
vfs 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
Ptr Vfs
vfs' <- a -> IO (Ptr Vfs)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
vfs
CString
uri' <- Text -> IO CString
textToCString Text
uri
Ptr File
result <- Ptr Vfs -> CString -> IO (Ptr File)
g_vfs_get_file_for_uri Ptr Vfs
vfs' CString
uri'
Text -> Ptr File -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"vfsGetFileForUri" 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
Gio.File.File) Ptr File
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
vfs
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)
data VfsGetFileForUriMethodInfo
instance (signature ~ (T.Text -> m Gio.File.File), MonadIO m, IsVfs a) => O.MethodInfo VfsGetFileForUriMethodInfo a signature where
overloadedMethod = vfsGetFileForUri
#endif
foreign import ccall "g_vfs_get_supported_uri_schemes" g_vfs_get_supported_uri_schemes ::
Ptr Vfs ->
IO (Ptr CString)
vfsGetSupportedUriSchemes ::
(B.CallStack.HasCallStack, MonadIO m, IsVfs a) =>
a
-> m [T.Text]
vfsGetSupportedUriSchemes :: a -> m [Text]
vfsGetSupportedUriSchemes a
vfs = 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 Vfs
vfs' <- a -> IO (Ptr Vfs)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
vfs
Ptr CString
result <- Ptr Vfs -> IO (Ptr CString)
g_vfs_get_supported_uri_schemes Ptr Vfs
vfs'
Text -> Ptr CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"vfsGetSupportedUriSchemes" Ptr CString
result
[Text]
result' <- HasCallStack => Ptr CString -> IO [Text]
Ptr CString -> IO [Text]
unpackZeroTerminatedUTF8CArray Ptr CString
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
vfs
[Text] -> IO [Text]
forall (m :: * -> *) a. Monad m => a -> m a
return [Text]
result'
#if defined(ENABLE_OVERLOADING)
data VfsGetSupportedUriSchemesMethodInfo
instance (signature ~ (m [T.Text]), MonadIO m, IsVfs a) => O.MethodInfo VfsGetSupportedUriSchemesMethodInfo a signature where
overloadedMethod = vfsGetSupportedUriSchemes
#endif
foreign import ccall "g_vfs_is_active" g_vfs_is_active ::
Ptr Vfs ->
IO CInt
vfsIsActive ::
(B.CallStack.HasCallStack, MonadIO m, IsVfs a) =>
a
-> m Bool
vfsIsActive :: a -> m Bool
vfsIsActive a
vfs = 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 Vfs
vfs' <- a -> IO (Ptr Vfs)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
vfs
CInt
result <- Ptr Vfs -> IO CInt
g_vfs_is_active Ptr Vfs
vfs'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
vfs
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data VfsIsActiveMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsVfs a) => O.MethodInfo VfsIsActiveMethodInfo a signature where
overloadedMethod = vfsIsActive
#endif
foreign import ccall "g_vfs_parse_name" g_vfs_parse_name ::
Ptr Vfs ->
CString ->
IO (Ptr Gio.File.File)
vfsParseName ::
(B.CallStack.HasCallStack, MonadIO m, IsVfs a) =>
a
-> T.Text
-> m Gio.File.File
vfsParseName :: a -> Text -> m File
vfsParseName a
vfs 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
Ptr Vfs
vfs' <- a -> IO (Ptr Vfs)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
vfs
CString
parseName' <- Text -> IO CString
textToCString Text
parseName
Ptr File
result <- Ptr Vfs -> CString -> IO (Ptr File)
g_vfs_parse_name Ptr Vfs
vfs' CString
parseName'
Text -> Ptr File -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"vfsParseName" 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
Gio.File.File) Ptr File
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
vfs
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)
data VfsParseNameMethodInfo
instance (signature ~ (T.Text -> m Gio.File.File), MonadIO m, IsVfs a) => O.MethodInfo VfsParseNameMethodInfo a signature where
overloadedMethod = vfsParseName
#endif
foreign import ccall "g_vfs_register_uri_scheme" g_vfs_register_uri_scheme ::
Ptr Vfs ->
CString ->
FunPtr Gio.Callbacks.C_VfsFileLookupFunc ->
Ptr () ->
FunPtr GLib.Callbacks.C_DestroyNotify ->
FunPtr Gio.Callbacks.C_VfsFileLookupFunc ->
Ptr () ->
FunPtr GLib.Callbacks.C_DestroyNotify ->
IO CInt
vfsRegisterUriScheme ::
(B.CallStack.HasCallStack, MonadIO m, IsVfs a) =>
a
-> T.Text
-> Maybe (Gio.Callbacks.VfsFileLookupFunc)
-> Maybe (Gio.Callbacks.VfsFileLookupFunc)
-> m Bool
vfsRegisterUriScheme :: a
-> Text
-> Maybe VfsFileLookupFunc
-> Maybe VfsFileLookupFunc
-> m Bool
vfsRegisterUriScheme a
vfs Text
scheme Maybe VfsFileLookupFunc
uriFunc Maybe VfsFileLookupFunc
parseNameFunc = 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 Vfs
vfs' <- a -> IO (Ptr Vfs)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
vfs
CString
scheme' <- Text -> IO CString
textToCString Text
scheme
FunPtr C_VfsFileLookupFunc
maybeUriFunc <- case Maybe VfsFileLookupFunc
uriFunc of
Maybe VfsFileLookupFunc
Nothing -> FunPtr C_VfsFileLookupFunc -> IO (FunPtr C_VfsFileLookupFunc)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_VfsFileLookupFunc
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just VfsFileLookupFunc
jUriFunc -> do
FunPtr C_VfsFileLookupFunc
jUriFunc' <- C_VfsFileLookupFunc -> IO (FunPtr C_VfsFileLookupFunc)
Gio.Callbacks.mk_VfsFileLookupFunc (Maybe (Ptr (FunPtr C_VfsFileLookupFunc))
-> VfsFileLookupFunc_WithClosures -> C_VfsFileLookupFunc
Gio.Callbacks.wrap_VfsFileLookupFunc Maybe (Ptr (FunPtr C_VfsFileLookupFunc))
forall a. Maybe a
Nothing (VfsFileLookupFunc -> VfsFileLookupFunc_WithClosures
Gio.Callbacks.drop_closures_VfsFileLookupFunc VfsFileLookupFunc
jUriFunc))
FunPtr C_VfsFileLookupFunc -> IO (FunPtr C_VfsFileLookupFunc)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_VfsFileLookupFunc
jUriFunc'
FunPtr C_VfsFileLookupFunc
maybeParseNameFunc <- case Maybe VfsFileLookupFunc
parseNameFunc of
Maybe VfsFileLookupFunc
Nothing -> FunPtr C_VfsFileLookupFunc -> IO (FunPtr C_VfsFileLookupFunc)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_VfsFileLookupFunc
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just VfsFileLookupFunc
jParseNameFunc -> do
FunPtr C_VfsFileLookupFunc
jParseNameFunc' <- C_VfsFileLookupFunc -> IO (FunPtr C_VfsFileLookupFunc)
Gio.Callbacks.mk_VfsFileLookupFunc (Maybe (Ptr (FunPtr C_VfsFileLookupFunc))
-> VfsFileLookupFunc_WithClosures -> C_VfsFileLookupFunc
Gio.Callbacks.wrap_VfsFileLookupFunc Maybe (Ptr (FunPtr C_VfsFileLookupFunc))
forall a. Maybe a
Nothing (VfsFileLookupFunc -> VfsFileLookupFunc_WithClosures
Gio.Callbacks.drop_closures_VfsFileLookupFunc VfsFileLookupFunc
jParseNameFunc))
FunPtr C_VfsFileLookupFunc -> IO (FunPtr C_VfsFileLookupFunc)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_VfsFileLookupFunc
jParseNameFunc'
let uriData :: Ptr ()
uriData = FunPtr C_VfsFileLookupFunc -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_VfsFileLookupFunc
maybeUriFunc
let uriDestroy :: FunPtr (Ptr a -> IO ())
uriDestroy = FunPtr (Ptr a -> IO ())
forall a. FunPtr (Ptr a -> IO ())
safeFreeFunPtrPtr
let parseNameData :: Ptr ()
parseNameData = FunPtr C_VfsFileLookupFunc -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_VfsFileLookupFunc
maybeParseNameFunc
let parseNameDestroy :: FunPtr (Ptr a -> IO ())
parseNameDestroy = FunPtr (Ptr a -> IO ())
forall a. FunPtr (Ptr a -> IO ())
safeFreeFunPtrPtr
CInt
result <- Ptr Vfs
-> CString
-> FunPtr C_VfsFileLookupFunc
-> Ptr ()
-> FunPtr C_DestroyNotify
-> FunPtr C_VfsFileLookupFunc
-> Ptr ()
-> FunPtr C_DestroyNotify
-> IO CInt
g_vfs_register_uri_scheme Ptr Vfs
vfs' CString
scheme' FunPtr C_VfsFileLookupFunc
maybeUriFunc Ptr ()
uriData FunPtr C_DestroyNotify
forall a. FunPtr (Ptr a -> IO ())
uriDestroy FunPtr C_VfsFileLookupFunc
maybeParseNameFunc Ptr ()
parseNameData FunPtr C_DestroyNotify
forall a. FunPtr (Ptr a -> IO ())
parseNameDestroy
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
vfs
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
scheme'
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data VfsRegisterUriSchemeMethodInfo
instance (signature ~ (T.Text -> Maybe (Gio.Callbacks.VfsFileLookupFunc) -> Maybe (Gio.Callbacks.VfsFileLookupFunc) -> m Bool), MonadIO m, IsVfs a) => O.MethodInfo VfsRegisterUriSchemeMethodInfo a signature where
overloadedMethod = vfsRegisterUriScheme
#endif
foreign import ccall "g_vfs_unregister_uri_scheme" g_vfs_unregister_uri_scheme ::
Ptr Vfs ->
CString ->
IO CInt
vfsUnregisterUriScheme ::
(B.CallStack.HasCallStack, MonadIO m, IsVfs a) =>
a
-> T.Text
-> m Bool
vfsUnregisterUriScheme :: a -> Text -> m Bool
vfsUnregisterUriScheme a
vfs Text
scheme = 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 Vfs
vfs' <- a -> IO (Ptr Vfs)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
vfs
CString
scheme' <- Text -> IO CString
textToCString Text
scheme
CInt
result <- Ptr Vfs -> CString -> IO CInt
g_vfs_unregister_uri_scheme Ptr Vfs
vfs' CString
scheme'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
vfs
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
scheme'
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data VfsUnregisterUriSchemeMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m, IsVfs a) => O.MethodInfo VfsUnregisterUriSchemeMethodInfo a signature where
overloadedMethod = vfsUnregisterUriScheme
#endif
foreign import ccall "g_vfs_get_default" g_vfs_get_default ::
IO (Ptr Vfs)
vfsGetDefault ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Vfs
vfsGetDefault :: m Vfs
vfsGetDefault = IO Vfs -> m Vfs
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Vfs -> m Vfs) -> IO Vfs -> m Vfs
forall a b. (a -> b) -> a -> b
$ do
Ptr Vfs
result <- IO (Ptr Vfs)
g_vfs_get_default
Text -> Ptr Vfs -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"vfsGetDefault" Ptr Vfs
result
Vfs
result' <- ((ManagedPtr Vfs -> Vfs) -> Ptr Vfs -> IO Vfs
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Vfs -> Vfs
Vfs) Ptr Vfs
result
Vfs -> IO Vfs
forall (m :: * -> *) a. Monad m => a -> m a
return Vfs
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_vfs_get_local" g_vfs_get_local ::
IO (Ptr Vfs)
vfsGetLocal ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Vfs
vfsGetLocal :: m Vfs
vfsGetLocal = IO Vfs -> m Vfs
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Vfs -> m Vfs) -> IO Vfs -> m Vfs
forall a b. (a -> b) -> a -> b
$ do
Ptr Vfs
result <- IO (Ptr Vfs)
g_vfs_get_local
Text -> Ptr Vfs -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"vfsGetLocal" Ptr Vfs
result
Vfs
result' <- ((ManagedPtr Vfs -> Vfs) -> Ptr Vfs -> IO Vfs
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Vfs -> Vfs
Vfs) Ptr Vfs
result
Vfs -> IO Vfs
forall (m :: * -> *) a. Monad m => a -> m a
return Vfs
result'
#if defined(ENABLE_OVERLOADING)
#endif