{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}

module GI.Gio.Objects.Vfs
    ( 

-- * Exported types
    Vfs(..)                                 ,
    VfsK                                    ,
    toVfs                                   ,
    noVfs                                   ,


 -- * Methods
-- ** vfsGetDefault
    vfsGetDefault                           ,


-- ** vfsGetFileForPath
    vfsGetFileForPath                       ,


-- ** vfsGetFileForUri
    vfsGetFileForUri                        ,


-- ** vfsGetLocal
    vfsGetLocal                             ,


-- ** vfsGetSupportedUriSchemes
    vfsGetSupportedUriSchemes               ,


-- ** vfsIsActive
    vfsIsActive                             ,


-- ** vfsParseName
    vfsParseName                            ,




    ) where

import Prelude ()
import Data.GI.Base.ShortPrelude

import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map

import GI.Gio.Types
import GI.Gio.Callbacks
import qualified GI.GObject as GObject

newtype Vfs = Vfs (ForeignPtr Vfs)
foreign import ccall "g_vfs_get_type"
    c_g_vfs_get_type :: IO GType

type instance ParentTypes Vfs = VfsParentTypes
type VfsParentTypes = '[GObject.Object]

instance GObject Vfs where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_g_vfs_get_type
    

class GObject o => VfsK o
instance (GObject o, IsDescendantOf Vfs o) => VfsK o

toVfs :: VfsK o => o -> IO Vfs
toVfs = unsafeCastTo Vfs

noVfs :: Maybe Vfs
noVfs = Nothing

type instance AttributeList Vfs = VfsAttributeList
type VfsAttributeList = ('[ ] :: [(Symbol, *)])

type instance SignalList Vfs = VfsSignalList
type VfsSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method Vfs::get_file_for_path
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Vfs", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Vfs", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "File"
-- throws : False
-- Skip return : False

foreign import ccall "g_vfs_get_file_for_path" g_vfs_get_file_for_path :: 
    Ptr Vfs ->                              -- _obj : TInterface "Gio" "Vfs"
    CString ->                              -- path : TBasicType TUTF8
    IO (Ptr File)


vfsGetFileForPath ::
    (MonadIO m, VfsK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- path
    m File
vfsGetFileForPath _obj path = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    path' <- textToCString path
    result <- g_vfs_get_file_for_path _obj' path'
    checkUnexpectedReturnNULL "g_vfs_get_file_for_path" result
    result' <- (wrapObject File) result
    touchManagedPtr _obj
    freeMem path'
    return result'

-- method Vfs::get_file_for_uri
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Vfs", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Vfs", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "File"
-- throws : False
-- Skip return : False

foreign import ccall "g_vfs_get_file_for_uri" g_vfs_get_file_for_uri :: 
    Ptr Vfs ->                              -- _obj : TInterface "Gio" "Vfs"
    CString ->                              -- uri : TBasicType TUTF8
    IO (Ptr File)


vfsGetFileForUri ::
    (MonadIO m, VfsK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- uri
    m File
vfsGetFileForUri _obj uri = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    uri' <- textToCString uri
    result <- g_vfs_get_file_for_uri _obj' uri'
    checkUnexpectedReturnNULL "g_vfs_get_file_for_uri" result
    result' <- (wrapObject File) result
    touchManagedPtr _obj
    freeMem uri'
    return result'

-- method Vfs::get_supported_uri_schemes
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Vfs", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Vfs", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TCArray True (-1) (-1) (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_vfs_get_supported_uri_schemes" g_vfs_get_supported_uri_schemes :: 
    Ptr Vfs ->                              -- _obj : TInterface "Gio" "Vfs"
    IO (Ptr CString)


vfsGetSupportedUriSchemes ::
    (MonadIO m, VfsK a) =>
    a ->                                    -- _obj
    m [T.Text]
vfsGetSupportedUriSchemes _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_vfs_get_supported_uri_schemes _obj'
    checkUnexpectedReturnNULL "g_vfs_get_supported_uri_schemes" result
    result' <- unpackZeroTerminatedUTF8CArray result
    touchManagedPtr _obj
    return result'

-- method Vfs::is_active
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Vfs", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Vfs", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "g_vfs_is_active" g_vfs_is_active :: 
    Ptr Vfs ->                              -- _obj : TInterface "Gio" "Vfs"
    IO CInt


vfsIsActive ::
    (MonadIO m, VfsK a) =>
    a ->                                    -- _obj
    m Bool
vfsIsActive _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_vfs_is_active _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method Vfs::parse_name
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Vfs", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "parse_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Vfs", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "parse_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "File"
-- throws : False
-- Skip return : False

foreign import ccall "g_vfs_parse_name" g_vfs_parse_name :: 
    Ptr Vfs ->                              -- _obj : TInterface "Gio" "Vfs"
    CString ->                              -- parse_name : TBasicType TUTF8
    IO (Ptr File)


vfsParseName ::
    (MonadIO m, VfsK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- parse_name
    m File
vfsParseName _obj parse_name = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    parse_name' <- textToCString parse_name
    result <- g_vfs_parse_name _obj' parse_name'
    checkUnexpectedReturnNULL "g_vfs_parse_name" result
    result' <- (wrapObject File) result
    touchManagedPtr _obj
    freeMem parse_name'
    return result'

-- method Vfs::get_default
-- method type : MemberFunction
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TInterface "Gio" "Vfs"
-- throws : False
-- Skip return : False

foreign import ccall "g_vfs_get_default" g_vfs_get_default :: 
    IO (Ptr Vfs)


vfsGetDefault ::
    (MonadIO m) =>
    m Vfs
vfsGetDefault  = liftIO $ do
    result <- g_vfs_get_default
    checkUnexpectedReturnNULL "g_vfs_get_default" result
    result' <- (newObject Vfs) result
    return result'

-- method Vfs::get_local
-- method type : MemberFunction
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TInterface "Gio" "Vfs"
-- throws : False
-- Skip return : False

foreign import ccall "g_vfs_get_local" g_vfs_get_local :: 
    IO (Ptr Vfs)


vfsGetLocal ::
    (MonadIO m) =>
    m Vfs
vfsGetLocal  = liftIO $ do
    result <- g_vfs_get_local
    checkUnexpectedReturnNULL "g_vfs_get_local" result
    result' <- (newObject Vfs) result
    return result'