{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- A structure allowing control over commits.

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.OSTree.Structs.RepoCommitModifier
    ( 

-- * Exported types
    RepoCommitModifier(..)                  ,
    noRepoCommitModifier                    ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveRepoCommitModifierMethod         ,
#endif


-- ** new #method:new#

    repoCommitModifierNew                   ,


-- ** ref #method:ref#

#if defined(ENABLE_OVERLOADING)
    RepoCommitModifierRefMethodInfo         ,
#endif
    repoCommitModifierRef                   ,


-- ** setDevinoCache #method:setDevinoCache#

#if defined(ENABLE_OVERLOADING)
    RepoCommitModifierSetDevinoCacheMethodInfo,
#endif
    repoCommitModifierSetDevinoCache        ,


-- ** setSepolicy #method:setSepolicy#

#if defined(ENABLE_OVERLOADING)
    RepoCommitModifierSetSepolicyMethodInfo ,
#endif
    repoCommitModifierSetSepolicy           ,


-- ** setXattrCallback #method:setXattrCallback#

#if defined(ENABLE_OVERLOADING)
    RepoCommitModifierSetXattrCallbackMethodInfo,
#endif
    repoCommitModifierSetXattrCallback      ,


-- ** unref #method:unref#

#if defined(ENABLE_OVERLOADING)
    RepoCommitModifierUnrefMethodInfo       ,
#endif
    repoCommitModifierUnref                 ,




    ) 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.Callbacks as GLib.Callbacks
import qualified GI.OSTree.Callbacks as OSTree.Callbacks
import {-# SOURCE #-} qualified GI.OSTree.Flags as OSTree.Flags
import {-# SOURCE #-} qualified GI.OSTree.Objects.SePolicy as OSTree.SePolicy
import {-# SOURCE #-} qualified GI.OSTree.Structs.RepoDevInoCache as OSTree.RepoDevInoCache

-- | Memory-managed wrapper type.
newtype RepoCommitModifier = RepoCommitModifier (ManagedPtr RepoCommitModifier)
    deriving (RepoCommitModifier -> RepoCommitModifier -> Bool
(RepoCommitModifier -> RepoCommitModifier -> Bool)
-> (RepoCommitModifier -> RepoCommitModifier -> Bool)
-> Eq RepoCommitModifier
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RepoCommitModifier -> RepoCommitModifier -> Bool
$c/= :: RepoCommitModifier -> RepoCommitModifier -> Bool
== :: RepoCommitModifier -> RepoCommitModifier -> Bool
$c== :: RepoCommitModifier -> RepoCommitModifier -> Bool
Eq)
foreign import ccall "ostree_repo_commit_modifier_get_type" c_ostree_repo_commit_modifier_get_type :: 
    IO GType

instance BoxedObject RepoCommitModifier where
    boxedType :: RepoCommitModifier -> IO GType
boxedType _ = IO GType
c_ostree_repo_commit_modifier_get_type

-- | Convert 'RepoCommitModifier' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue RepoCommitModifier where
    toGValue :: RepoCommitModifier -> IO GValue
toGValue o :: RepoCommitModifier
o = do
        GType
gtype <- IO GType
c_ostree_repo_commit_modifier_get_type
        RepoCommitModifier
-> (Ptr RepoCommitModifier -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr RepoCommitModifier
o (GType
-> (GValue -> Ptr RepoCommitModifier -> IO ())
-> Ptr RepoCommitModifier
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr RepoCommitModifier -> IO ()
forall a. GValue -> Ptr a -> IO ()
B.GValue.set_boxed)
        
    fromGValue :: GValue -> IO RepoCommitModifier
fromGValue gv :: GValue
gv = do
        Ptr RepoCommitModifier
ptr <- GValue -> IO (Ptr RepoCommitModifier)
forall b. GValue -> IO (Ptr b)
B.GValue.get_boxed GValue
gv :: IO (Ptr RepoCommitModifier)
        (ManagedPtr RepoCommitModifier -> RepoCommitModifier)
-> Ptr RepoCommitModifier -> IO RepoCommitModifier
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr RepoCommitModifier -> RepoCommitModifier
RepoCommitModifier Ptr RepoCommitModifier
ptr
        
    

-- | A convenience alias for `Nothing` :: `Maybe` `RepoCommitModifier`.
noRepoCommitModifier :: Maybe RepoCommitModifier
noRepoCommitModifier :: Maybe RepoCommitModifier
noRepoCommitModifier = Maybe RepoCommitModifier
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList RepoCommitModifier
type instance O.AttributeList RepoCommitModifier = RepoCommitModifierAttributeList
type RepoCommitModifierAttributeList = ('[ ] :: [(Symbol, *)])
#endif

-- method RepoCommitModifier::new
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "flags"
--           , argType =
--               TInterface
--                 Name { namespace = "OSTree" , name = "RepoCommitModifierFlags" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Control options for filter"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "commit_filter"
--           , argType =
--               TInterface
--                 Name { namespace = "OSTree" , name = "RepoCommitFilter" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Function that can inspect individual files"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeNotified
--           , argClosure = 2
--           , argDestroy = 3
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "User data" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "destroy_notify"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "DestroyNotify" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GDestroyNotify" , sinceVersion = Nothing }
--           , argScope = ScopeTypeAsync
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "OSTree" , name = "RepoCommitModifier" })
-- throws : False
-- Skip return : False

foreign import ccall "ostree_repo_commit_modifier_new" ostree_repo_commit_modifier_new :: 
    CUInt ->                                -- flags : TInterface (Name {namespace = "OSTree", name = "RepoCommitModifierFlags"})
    FunPtr OSTree.Callbacks.C_RepoCommitFilter -> -- commit_filter : TInterface (Name {namespace = "OSTree", name = "RepoCommitFilter"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- destroy_notify : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO (Ptr RepoCommitModifier)

-- | /No description available in the introspection data./
repoCommitModifierNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [OSTree.Flags.RepoCommitModifierFlags]
    -- ^ /@flags@/: Control options for filter
    -> Maybe (OSTree.Callbacks.RepoCommitFilter)
    -- ^ /@commitFilter@/: Function that can inspect individual files
    -> m RepoCommitModifier
    -- ^ __Returns:__ A new commit modifier.
repoCommitModifierNew :: [RepoCommitModifierFlags]
-> Maybe RepoCommitFilter -> m RepoCommitModifier
repoCommitModifierNew flags :: [RepoCommitModifierFlags]
flags commitFilter :: Maybe RepoCommitFilter
commitFilter = IO RepoCommitModifier -> m RepoCommitModifier
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO RepoCommitModifier -> m RepoCommitModifier)
-> IO RepoCommitModifier -> m RepoCommitModifier
forall a b. (a -> b) -> a -> b
$ do
    let flags' :: CUInt
flags' = [RepoCommitModifierFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [RepoCommitModifierFlags]
flags
    FunPtr C_RepoCommitFilter
maybeCommitFilter <- case Maybe RepoCommitFilter
commitFilter of
        Nothing -> FunPtr C_RepoCommitFilter -> IO (FunPtr C_RepoCommitFilter)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_RepoCommitFilter
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
        Just jCommitFilter :: RepoCommitFilter
jCommitFilter -> do
            FunPtr C_RepoCommitFilter
jCommitFilter' <- C_RepoCommitFilter -> IO (FunPtr C_RepoCommitFilter)
OSTree.Callbacks.mk_RepoCommitFilter (Maybe (Ptr (FunPtr C_RepoCommitFilter))
-> RepoCommitFilter_WithClosures -> C_RepoCommitFilter
OSTree.Callbacks.wrap_RepoCommitFilter Maybe (Ptr (FunPtr C_RepoCommitFilter))
forall a. Maybe a
Nothing (RepoCommitFilter -> RepoCommitFilter_WithClosures
OSTree.Callbacks.drop_closures_RepoCommitFilter RepoCommitFilter
jCommitFilter))
            FunPtr C_RepoCommitFilter -> IO (FunPtr C_RepoCommitFilter)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_RepoCommitFilter
jCommitFilter'
    let userData :: Ptr ()
userData = FunPtr C_RepoCommitFilter -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_RepoCommitFilter
maybeCommitFilter
    let destroyNotify :: FunPtr (Ptr a -> IO ())
destroyNotify = FunPtr (Ptr a -> IO ())
forall a. FunPtr (Ptr a -> IO ())
safeFreeFunPtrPtr
    Ptr RepoCommitModifier
result <- CUInt
-> FunPtr C_RepoCommitFilter
-> Ptr ()
-> FunPtr C_DestroyNotify
-> IO (Ptr RepoCommitModifier)
ostree_repo_commit_modifier_new CUInt
flags' FunPtr C_RepoCommitFilter
maybeCommitFilter Ptr ()
userData FunPtr C_DestroyNotify
forall a. FunPtr (Ptr a -> IO ())
destroyNotify
    Text -> Ptr RepoCommitModifier -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "repoCommitModifierNew" Ptr RepoCommitModifier
result
    RepoCommitModifier
result' <- ((ManagedPtr RepoCommitModifier -> RepoCommitModifier)
-> Ptr RepoCommitModifier -> IO RepoCommitModifier
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr RepoCommitModifier -> RepoCommitModifier
RepoCommitModifier) Ptr RepoCommitModifier
result
    RepoCommitModifier -> IO RepoCommitModifier
forall (m :: * -> *) a. Monad m => a -> m a
return RepoCommitModifier
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method RepoCommitModifier::ref
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "modifier"
--           , argType =
--               TInterface
--                 Name { namespace = "OSTree" , name = "RepoCommitModifier" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "OSTree" , name = "RepoCommitModifier" })
-- throws : False
-- Skip return : False

foreign import ccall "ostree_repo_commit_modifier_ref" ostree_repo_commit_modifier_ref :: 
    Ptr RepoCommitModifier ->               -- modifier : TInterface (Name {namespace = "OSTree", name = "RepoCommitModifier"})
    IO (Ptr RepoCommitModifier)

-- | /No description available in the introspection data./
repoCommitModifierRef ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    RepoCommitModifier
    -> m RepoCommitModifier
repoCommitModifierRef :: RepoCommitModifier -> m RepoCommitModifier
repoCommitModifierRef modifier :: RepoCommitModifier
modifier = IO RepoCommitModifier -> m RepoCommitModifier
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO RepoCommitModifier -> m RepoCommitModifier)
-> IO RepoCommitModifier -> m RepoCommitModifier
forall a b. (a -> b) -> a -> b
$ do
    Ptr RepoCommitModifier
modifier' <- RepoCommitModifier -> IO (Ptr RepoCommitModifier)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr RepoCommitModifier
modifier
    Ptr RepoCommitModifier
result <- Ptr RepoCommitModifier -> IO (Ptr RepoCommitModifier)
ostree_repo_commit_modifier_ref Ptr RepoCommitModifier
modifier'
    Text -> Ptr RepoCommitModifier -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "repoCommitModifierRef" Ptr RepoCommitModifier
result
    RepoCommitModifier
result' <- ((ManagedPtr RepoCommitModifier -> RepoCommitModifier)
-> Ptr RepoCommitModifier -> IO RepoCommitModifier
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr RepoCommitModifier -> RepoCommitModifier
RepoCommitModifier) Ptr RepoCommitModifier
result
    RepoCommitModifier -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr RepoCommitModifier
modifier
    RepoCommitModifier -> IO RepoCommitModifier
forall (m :: * -> *) a. Monad m => a -> m a
return RepoCommitModifier
result'

#if defined(ENABLE_OVERLOADING)
data RepoCommitModifierRefMethodInfo
instance (signature ~ (m RepoCommitModifier), MonadIO m) => O.MethodInfo RepoCommitModifierRefMethodInfo RepoCommitModifier signature where
    overloadedMethod = repoCommitModifierRef

#endif

-- method RepoCommitModifier::set_devino_cache
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "modifier"
--           , argType =
--               TInterface
--                 Name { namespace = "OSTree" , name = "RepoCommitModifier" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Modifier" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cache"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "RepoDevInoCache" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "A hash table caching device,inode to checksums"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "ostree_repo_commit_modifier_set_devino_cache" ostree_repo_commit_modifier_set_devino_cache :: 
    Ptr RepoCommitModifier ->               -- modifier : TInterface (Name {namespace = "OSTree", name = "RepoCommitModifier"})
    Ptr OSTree.RepoDevInoCache.RepoDevInoCache -> -- cache : TInterface (Name {namespace = "OSTree", name = "RepoDevInoCache"})
    IO ()

-- | See the documentation for
-- @ostree_repo_devino_cache_new()@.  This function can
-- then be used for later calls to
-- @ostree_repo_write_directory_to_mtree()@ to optimize commits.
-- 
-- Note if your process has multiple writers, you should use separate
-- @OSTreeRepo@ instances if you want to also use this API.
-- 
-- This function will add a reference to /@cache@/ without copying - you
-- should avoid further mutation of the cache.
-- 
-- /Since: 2017.13/
repoCommitModifierSetDevinoCache ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    RepoCommitModifier
    -- ^ /@modifier@/: Modifier
    -> OSTree.RepoDevInoCache.RepoDevInoCache
    -- ^ /@cache@/: A hash table caching device,inode to checksums
    -> m ()
repoCommitModifierSetDevinoCache :: RepoCommitModifier -> RepoDevInoCache -> m ()
repoCommitModifierSetDevinoCache modifier :: RepoCommitModifier
modifier cache :: RepoDevInoCache
cache = 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 RepoCommitModifier
modifier' <- RepoCommitModifier -> IO (Ptr RepoCommitModifier)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr RepoCommitModifier
modifier
    Ptr RepoDevInoCache
cache' <- RepoDevInoCache -> IO (Ptr RepoDevInoCache)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr RepoDevInoCache
cache
    Ptr RepoCommitModifier -> Ptr RepoDevInoCache -> IO ()
ostree_repo_commit_modifier_set_devino_cache Ptr RepoCommitModifier
modifier' Ptr RepoDevInoCache
cache'
    RepoCommitModifier -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr RepoCommitModifier
modifier
    RepoDevInoCache -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr RepoDevInoCache
cache
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data RepoCommitModifierSetDevinoCacheMethodInfo
instance (signature ~ (OSTree.RepoDevInoCache.RepoDevInoCache -> m ()), MonadIO m) => O.MethodInfo RepoCommitModifierSetDevinoCacheMethodInfo RepoCommitModifier signature where
    overloadedMethod = repoCommitModifierSetDevinoCache

#endif

-- method RepoCommitModifier::set_sepolicy
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "modifier"
--           , argType =
--               TInterface
--                 Name { namespace = "OSTree" , name = "RepoCommitModifier" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #OstreeRepoCommitModifier"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "sepolicy"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "SePolicy" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Policy to use for labeling"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "ostree_repo_commit_modifier_set_sepolicy" ostree_repo_commit_modifier_set_sepolicy :: 
    Ptr RepoCommitModifier ->               -- modifier : TInterface (Name {namespace = "OSTree", name = "RepoCommitModifier"})
    Ptr OSTree.SePolicy.SePolicy ->         -- sepolicy : TInterface (Name {namespace = "OSTree", name = "SePolicy"})
    IO ()

-- | If /@policy@/ is non-'P.Nothing', use it to look up labels to use for
-- \"security.selinux\" extended attributes.
-- 
-- Note that any policy specified this way operates in addition to any
-- extended attributes provided via
-- 'GI.OSTree.Structs.RepoCommitModifier.repoCommitModifierSetXattrCallback'.  However if both
-- specify a value for \"security.selinux\", then the one from the
-- policy wins.
repoCommitModifierSetSepolicy ::
    (B.CallStack.HasCallStack, MonadIO m, OSTree.SePolicy.IsSePolicy a) =>
    RepoCommitModifier
    -- ^ /@modifier@/: An t'GI.OSTree.Structs.RepoCommitModifier.RepoCommitModifier'
    -> Maybe (a)
    -- ^ /@sepolicy@/: Policy to use for labeling
    -> m ()
repoCommitModifierSetSepolicy :: RepoCommitModifier -> Maybe a -> m ()
repoCommitModifierSetSepolicy modifier :: RepoCommitModifier
modifier sepolicy :: Maybe a
sepolicy = 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 RepoCommitModifier
modifier' <- RepoCommitModifier -> IO (Ptr RepoCommitModifier)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr RepoCommitModifier
modifier
    Ptr SePolicy
maybeSepolicy <- case Maybe a
sepolicy of
        Nothing -> Ptr SePolicy -> IO (Ptr SePolicy)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr SePolicy
forall a. Ptr a
nullPtr
        Just jSepolicy :: a
jSepolicy -> do
            Ptr SePolicy
jSepolicy' <- a -> IO (Ptr SePolicy)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jSepolicy
            Ptr SePolicy -> IO (Ptr SePolicy)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr SePolicy
jSepolicy'
    Ptr RepoCommitModifier -> Ptr SePolicy -> IO ()
ostree_repo_commit_modifier_set_sepolicy Ptr RepoCommitModifier
modifier' Ptr SePolicy
maybeSepolicy
    RepoCommitModifier -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr RepoCommitModifier
modifier
    Maybe a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
sepolicy a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data RepoCommitModifierSetSepolicyMethodInfo
instance (signature ~ (Maybe (a) -> m ()), MonadIO m, OSTree.SePolicy.IsSePolicy a) => O.MethodInfo RepoCommitModifierSetSepolicyMethodInfo RepoCommitModifier signature where
    overloadedMethod = repoCommitModifierSetSepolicy

#endif

-- method RepoCommitModifier::set_xattr_callback
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "modifier"
--           , argType =
--               TInterface
--                 Name { namespace = "OSTree" , name = "RepoCommitModifier" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #OstreeRepoCommitModifier"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface
--                 Name
--                   { namespace = "OSTree" , name = "RepoCommitModifierXattrCallback" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Function to be invoked, should return extended attributes for path"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeNotified
--           , argClosure = 3
--           , argDestroy = 2
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "destroy"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "DestroyNotify" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Destroy notification"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Data for @callback:"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "ostree_repo_commit_modifier_set_xattr_callback" ostree_repo_commit_modifier_set_xattr_callback :: 
    Ptr RepoCommitModifier ->               -- modifier : TInterface (Name {namespace = "OSTree", name = "RepoCommitModifier"})
    FunPtr OSTree.Callbacks.C_RepoCommitModifierXattrCallback -> -- callback : TInterface (Name {namespace = "OSTree", name = "RepoCommitModifierXattrCallback"})
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- destroy : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

-- | If set, this function should return extended attributes to use for
-- the given path.  This is useful for things like ACLs and SELinux,
-- where a build system can label the files as it\'s committing to the
-- repository.
repoCommitModifierSetXattrCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    RepoCommitModifier
    -- ^ /@modifier@/: An t'GI.OSTree.Structs.RepoCommitModifier.RepoCommitModifier'
    -> OSTree.Callbacks.RepoCommitModifierXattrCallback
    -- ^ /@callback@/: Function to be invoked, should return extended attributes for path
    -> m ()
repoCommitModifierSetXattrCallback :: RepoCommitModifier -> RepoCommitModifierXattrCallback -> m ()
repoCommitModifierSetXattrCallback modifier :: RepoCommitModifier
modifier callback :: RepoCommitModifierXattrCallback
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 RepoCommitModifier
modifier' <- RepoCommitModifier -> IO (Ptr RepoCommitModifier)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr RepoCommitModifier
modifier
    FunPtr C_RepoCommitModifierXattrCallback
callback' <- C_RepoCommitModifierXattrCallback
-> IO (FunPtr C_RepoCommitModifierXattrCallback)
OSTree.Callbacks.mk_RepoCommitModifierXattrCallback (Maybe (Ptr (FunPtr C_RepoCommitModifierXattrCallback))
-> RepoCommitModifierXattrCallback_WithClosures
-> C_RepoCommitModifierXattrCallback
OSTree.Callbacks.wrap_RepoCommitModifierXattrCallback Maybe (Ptr (FunPtr C_RepoCommitModifierXattrCallback))
forall a. Maybe a
Nothing (RepoCommitModifierXattrCallback
-> RepoCommitModifierXattrCallback_WithClosures
OSTree.Callbacks.drop_closures_RepoCommitModifierXattrCallback RepoCommitModifierXattrCallback
callback))
    let userData :: Ptr ()
userData = FunPtr C_RepoCommitModifierXattrCallback -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_RepoCommitModifierXattrCallback
callback'
    let destroy :: FunPtr (Ptr a -> IO ())
destroy = FunPtr (Ptr a -> IO ())
forall a. FunPtr (Ptr a -> IO ())
safeFreeFunPtrPtr
    Ptr RepoCommitModifier
-> FunPtr C_RepoCommitModifierXattrCallback
-> FunPtr C_DestroyNotify
-> C_DestroyNotify
ostree_repo_commit_modifier_set_xattr_callback Ptr RepoCommitModifier
modifier' FunPtr C_RepoCommitModifierXattrCallback
callback' FunPtr C_DestroyNotify
forall a. FunPtr (Ptr a -> IO ())
destroy Ptr ()
userData
    RepoCommitModifier -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr RepoCommitModifier
modifier
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data RepoCommitModifierSetXattrCallbackMethodInfo
instance (signature ~ (OSTree.Callbacks.RepoCommitModifierXattrCallback -> m ()), MonadIO m) => O.MethodInfo RepoCommitModifierSetXattrCallbackMethodInfo RepoCommitModifier signature where
    overloadedMethod = repoCommitModifierSetXattrCallback

#endif

-- method RepoCommitModifier::unref
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "modifier"
--           , argType =
--               TInterface
--                 Name { namespace = "OSTree" , name = "RepoCommitModifier" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "ostree_repo_commit_modifier_unref" ostree_repo_commit_modifier_unref :: 
    Ptr RepoCommitModifier ->               -- modifier : TInterface (Name {namespace = "OSTree", name = "RepoCommitModifier"})
    IO ()

-- | /No description available in the introspection data./
repoCommitModifierUnref ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    RepoCommitModifier
    -> m ()
repoCommitModifierUnref :: RepoCommitModifier -> m ()
repoCommitModifierUnref modifier :: RepoCommitModifier
modifier = 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 RepoCommitModifier
modifier' <- RepoCommitModifier -> IO (Ptr RepoCommitModifier)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr RepoCommitModifier
modifier
    Ptr RepoCommitModifier -> IO ()
ostree_repo_commit_modifier_unref Ptr RepoCommitModifier
modifier'
    RepoCommitModifier -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr RepoCommitModifier
modifier
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data RepoCommitModifierUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo RepoCommitModifierUnrefMethodInfo RepoCommitModifier signature where
    overloadedMethod = repoCommitModifierUnref

#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveRepoCommitModifierMethod (t :: Symbol) (o :: *) :: * where
    ResolveRepoCommitModifierMethod "ref" o = RepoCommitModifierRefMethodInfo
    ResolveRepoCommitModifierMethod "unref" o = RepoCommitModifierUnrefMethodInfo
    ResolveRepoCommitModifierMethod "setDevinoCache" o = RepoCommitModifierSetDevinoCacheMethodInfo
    ResolveRepoCommitModifierMethod "setSepolicy" o = RepoCommitModifierSetSepolicyMethodInfo
    ResolveRepoCommitModifierMethod "setXattrCallback" o = RepoCommitModifierSetXattrCallbackMethodInfo
    ResolveRepoCommitModifierMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveRepoCommitModifierMethod t RepoCommitModifier, O.MethodInfo info RepoCommitModifier p) => OL.IsLabel t (RepoCommitModifier -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#endif