{-# 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.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
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.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
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 GHC.Records as R
import qualified Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT
#if MIN_VERSION_base(4,18,0)
import qualified GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.GLib.Enums as GLib.Enums
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GLib.Structs.DateTime as GLib.DateTime
import qualified GI.GLib.Structs.PollFD as GLib.PollFD
import qualified GI.GLib.Structs.Source as GLib.Source
import qualified GI.GLib.Structs.TimeVal as GLib.TimeVal
import qualified GI.GObject.Callbacks as GObject.Callbacks
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.Drive as Gio.Drive
import {-# SOURCE #-} qualified GI.Gio.Interfaces.File as Gio.File
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Icon as Gio.Icon
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Mount as Gio.Mount
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Seekable as Gio.Seekable
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Volume as Gio.Volume
import {-# SOURCE #-} qualified GI.Gio.Objects.AppLaunchContext as Gio.AppLaunchContext
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.IOStream as Gio.IOStream
import {-# SOURCE #-} qualified GI.Gio.Objects.InputStream as Gio.InputStream
import {-# SOURCE #-} qualified GI.Gio.Objects.MountOperation as Gio.MountOperation
import {-# SOURCE #-} qualified GI.Gio.Objects.OutputStream as Gio.OutputStream
import {-# SOURCE #-} qualified GI.Gio.Structs.FileAttributeInfo as Gio.FileAttributeInfo
import {-# SOURCE #-} qualified GI.Gio.Structs.FileAttributeInfoList as Gio.FileAttributeInfoList
import {-# SOURCE #-} qualified GI.Gio.Structs.FileAttributeMatcher as Gio.FileAttributeMatcher
import {-# SOURCE #-} qualified GI.Gio.Structs.OutputVector as Gio.OutputVector
#else
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
#endif
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
$c== :: Vfs -> Vfs -> Bool
== :: Vfs -> Vfs -> Bool
$c/= :: Vfs -> Vfs -> Bool
/= :: 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
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 :: (MIO.MonadIO m, IsVfs o) => o -> m Vfs
toVfs :: forall (m :: * -> *) o. (MonadIO m, IsVfs o) => o -> m Vfs
toVfs = IO Vfs -> m Vfs
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.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'
B.ManagedPtr.unsafeCastTo ManagedPtr Vfs -> Vfs
Vfs
instance B.GValue.IsGValue (Maybe Vfs) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_g_vfs_get_type
gvalueSet_ :: Ptr GValue -> Maybe Vfs -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Vfs
P.Nothing = Ptr GValue -> Ptr Vfs -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr Vfs
forall a. Ptr a
FP.nullPtr :: FP.Ptr Vfs)
gvalueSet_ Ptr GValue
gv (P.Just Vfs
obj) = Vfs -> (Ptr Vfs -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Vfs
obj (Ptr GValue -> Ptr Vfs -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe Vfs)
gvalueGet_ Ptr GValue
gv = do
ptr <- Ptr GValue -> IO (Ptr Vfs)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr Vfs)
if ptr /= FP.nullPtr
then P.Just <$> B.ManagedPtr.newObject Vfs ptr
else return P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveVfsMethod (t :: Symbol) (o :: DK.Type) :: DK.Type 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.OverloadedMethod 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
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveVfsMethod t Vfs, O.OverloadedMethod info Vfs p, R.HasField t Vfs p) => R.HasField t Vfs p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveVfsMethod t Vfs, O.OverloadedMethodInfo info Vfs) => OL.IsLabel t (O.MethodProxy info Vfs) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Vfs
type instance O.AttributeList Vfs = VfsAttributeList
type VfsAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Vfs = VfsSignalList
type VfsSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])
#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 :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsVfs a) =>
a -> Text -> m File
vfsGetFileForPath a
vfs Text
path = IO File -> m File
forall a. IO a -> m a
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
vfs' <- a -> IO (Ptr Vfs)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
vfs
path' <- textToCString path
result <- g_vfs_get_file_for_path vfs' path'
checkUnexpectedReturnNULL "vfsGetFileForPath" result
result' <- (wrapObject Gio.File.File) result
touchManagedPtr vfs
freeMem path'
return result'
#if defined(ENABLE_OVERLOADING)
data VfsGetFileForPathMethodInfo
instance (signature ~ (T.Text -> m Gio.File.File), MonadIO m, IsVfs a) => O.OverloadedMethod VfsGetFileForPathMethodInfo a signature where
overloadedMethod = vfsGetFileForPath
instance O.OverloadedMethodInfo VfsGetFileForPathMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Vfs.vfsGetFileForPath",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Vfs.html#v: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 :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsVfs a) =>
a -> Text -> m File
vfsGetFileForUri a
vfs Text
uri = IO File -> m File
forall a. IO a -> m a
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
vfs' <- a -> IO (Ptr Vfs)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
vfs
uri' <- textToCString uri
result <- g_vfs_get_file_for_uri vfs' uri'
checkUnexpectedReturnNULL "vfsGetFileForUri" result
result' <- (wrapObject Gio.File.File) result
touchManagedPtr vfs
freeMem uri'
return result'
#if defined(ENABLE_OVERLOADING)
data VfsGetFileForUriMethodInfo
instance (signature ~ (T.Text -> m Gio.File.File), MonadIO m, IsVfs a) => O.OverloadedMethod VfsGetFileForUriMethodInfo a signature where
overloadedMethod = vfsGetFileForUri
instance O.OverloadedMethodInfo VfsGetFileForUriMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Vfs.vfsGetFileForUri",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Vfs.html#v: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 :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsVfs a) =>
a -> m [Text]
vfsGetSupportedUriSchemes a
vfs = IO [Text] -> m [Text]
forall a. IO a -> m a
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
vfs' <- a -> IO (Ptr Vfs)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
vfs
result <- g_vfs_get_supported_uri_schemes vfs'
checkUnexpectedReturnNULL "vfsGetSupportedUriSchemes" result
result' <- unpackZeroTerminatedUTF8CArray result
touchManagedPtr vfs
return result'
#if defined(ENABLE_OVERLOADING)
data VfsGetSupportedUriSchemesMethodInfo
instance (signature ~ (m [T.Text]), MonadIO m, IsVfs a) => O.OverloadedMethod VfsGetSupportedUriSchemesMethodInfo a signature where
overloadedMethod = vfsGetSupportedUriSchemes
instance O.OverloadedMethodInfo VfsGetSupportedUriSchemesMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Vfs.vfsGetSupportedUriSchemes",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Vfs.html#v: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 :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsVfs a) =>
a -> m Bool
vfsIsActive a
vfs = IO Bool -> m Bool
forall a. IO a -> m a
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
vfs' <- a -> IO (Ptr Vfs)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
vfs
result <- g_vfs_is_active vfs'
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
touchManagedPtr vfs
return result'
#if defined(ENABLE_OVERLOADING)
data VfsIsActiveMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsVfs a) => O.OverloadedMethod VfsIsActiveMethodInfo a signature where
overloadedMethod = vfsIsActive
instance O.OverloadedMethodInfo VfsIsActiveMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Vfs.vfsIsActive",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Vfs.html#v: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 :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsVfs a) =>
a -> Text -> m File
vfsParseName a
vfs Text
parseName = IO File -> m File
forall a. IO a -> m a
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
vfs' <- a -> IO (Ptr Vfs)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
vfs
parseName' <- textToCString parseName
result <- g_vfs_parse_name vfs' parseName'
checkUnexpectedReturnNULL "vfsParseName" result
result' <- (wrapObject Gio.File.File) result
touchManagedPtr vfs
freeMem parseName'
return result'
#if defined(ENABLE_OVERLOADING)
data VfsParseNameMethodInfo
instance (signature ~ (T.Text -> m Gio.File.File), MonadIO m, IsVfs a) => O.OverloadedMethod VfsParseNameMethodInfo a signature where
overloadedMethod = vfsParseName
instance O.OverloadedMethodInfo VfsParseNameMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Vfs.vfsParseName",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Vfs.html#v: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 :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsVfs a) =>
a
-> Text
-> Maybe VfsFileLookupFunc
-> Maybe VfsFileLookupFunc
-> m Bool
vfsRegisterUriScheme a
vfs Text
scheme Maybe VfsFileLookupFunc
uriFunc Maybe VfsFileLookupFunc
parseNameFunc = IO Bool -> m Bool
forall a. IO a -> m a
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
vfs' <- a -> IO (Ptr Vfs)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
vfs
scheme' <- textToCString scheme
maybeUriFunc <- case uriFunc of
Maybe VfsFileLookupFunc
Nothing -> FunPtr C_VfsFileLookupFunc -> IO (FunPtr C_VfsFileLookupFunc)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_VfsFileLookupFunc
forall a. FunPtr a
FP.nullFunPtr
Just VfsFileLookupFunc
jUriFunc -> do
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))
return jUriFunc'
maybeParseNameFunc <- case parseNameFunc of
Maybe VfsFileLookupFunc
Nothing -> FunPtr C_VfsFileLookupFunc -> IO (FunPtr C_VfsFileLookupFunc)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_VfsFileLookupFunc
forall a. FunPtr a
FP.nullFunPtr
Just VfsFileLookupFunc
jParseNameFunc -> do
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))
return jParseNameFunc'
let uriData = FunPtr C_VfsFileLookupFunc -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_VfsFileLookupFunc
maybeUriFunc
let uriDestroy = FunPtr (Ptr a -> IO ())
forall a. FunPtr (Ptr a -> IO ())
SP.safeFreeFunPtrPtr
let parseNameData = FunPtr C_VfsFileLookupFunc -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_VfsFileLookupFunc
maybeParseNameFunc
let parseNameDestroy = FunPtr (Ptr a -> IO ())
forall a. FunPtr (Ptr a -> IO ())
SP.safeFreeFunPtrPtr
result <- g_vfs_register_uri_scheme vfs' scheme' maybeUriFunc uriData uriDestroy maybeParseNameFunc parseNameData parseNameDestroy
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
touchManagedPtr vfs
freeMem scheme'
return 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.OverloadedMethod VfsRegisterUriSchemeMethodInfo a signature where
overloadedMethod = vfsRegisterUriScheme
instance O.OverloadedMethodInfo VfsRegisterUriSchemeMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Vfs.vfsRegisterUriScheme",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Vfs.html#v: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 :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsVfs a) =>
a -> Text -> m Bool
vfsUnregisterUriScheme a
vfs Text
scheme = IO Bool -> m Bool
forall a. IO a -> m a
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
vfs' <- a -> IO (Ptr Vfs)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
vfs
scheme' <- textToCString scheme
result <- g_vfs_unregister_uri_scheme vfs' scheme'
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
touchManagedPtr vfs
freeMem scheme'
return result'
#if defined(ENABLE_OVERLOADING)
data VfsUnregisterUriSchemeMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m, IsVfs a) => O.OverloadedMethod VfsUnregisterUriSchemeMethodInfo a signature where
overloadedMethod = vfsUnregisterUriScheme
instance O.OverloadedMethodInfo VfsUnregisterUriSchemeMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Vfs.vfsUnregisterUriScheme",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Vfs.html#v: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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Vfs
vfsGetDefault = IO Vfs -> m Vfs
forall a. IO a -> m a
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
result <- IO (Ptr Vfs)
g_vfs_get_default
checkUnexpectedReturnNULL "vfsGetDefault" result
result' <- (newObject Vfs) result
return 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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Vfs
vfsGetLocal = IO Vfs -> m Vfs
forall a. IO a -> m a
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
result <- IO (Ptr Vfs)
g_vfs_get_local
checkUnexpectedReturnNULL "vfsGetLocal" result
result' <- (newObject Vfs) result
return result'
#if defined(ENABLE_OVERLOADING)
#endif