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

Represents a scope for loading IO modules. A scope can be used for blocking
duplicate modules, or blocking a module you don't want to load.

The scope can be used with g_io_modules_load_all_in_directory_with_scope()
or g_io_modules_scan_all_in_directory_with_scope().
-}

module GI.Gio.Structs.IOModuleScope
    ( 

-- * Exported types
    IOModuleScope(..)                       ,
    noIOModuleScope                         ,


 -- * Methods
-- ** iOModuleScopeBlock
    iOModuleScopeBlock                      ,


-- ** iOModuleScopeFree
    iOModuleScopeFree                       ,




    ) 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

newtype IOModuleScope = IOModuleScope (ForeignPtr IOModuleScope)
noIOModuleScope :: Maybe IOModuleScope
noIOModuleScope = Nothing

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

foreign import ccall "g_io_module_scope_block" g_io_module_scope_block :: 
    Ptr IOModuleScope ->                    -- _obj : TInterface "Gio" "IOModuleScope"
    CString ->                              -- basename : TBasicType TUTF8
    IO ()


iOModuleScopeBlock ::
    (MonadIO m) =>
    IOModuleScope ->                        -- _obj
    T.Text ->                               -- basename
    m ()
iOModuleScopeBlock _obj basename = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    basename' <- textToCString basename
    g_io_module_scope_block _obj' basename'
    touchManagedPtr _obj
    freeMem basename'
    return ()

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

foreign import ccall "g_io_module_scope_free" g_io_module_scope_free :: 
    Ptr IOModuleScope ->                    -- _obj : TInterface "Gio" "IOModuleScope"
    IO ()


iOModuleScopeFree ::
    (MonadIO m) =>
    IOModuleScope ->                        -- _obj
    m ()
iOModuleScopeFree _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    g_io_module_scope_free _obj'
    touchManagedPtr _obj
    return ()