-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria

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

module GI.IBus.Callbacks
    ( 

 -- * Signals


-- ** FreeFunc #signal:FreeFunc#

    C_FreeFunc                              ,
    FreeFunc                                ,
    dynamic_FreeFunc                        ,
    genClosure_FreeFunc                     ,
    mk_FreeFunc                             ,
    noFreeFunc                              ,
    wrap_FreeFunc                           ,


-- ** ObjectDestroyFunc #signal:ObjectDestroyFunc#

    C_ObjectDestroyFunc                     ,
    ObjectDestroyFunc                       ,
    dynamic_ObjectDestroyFunc               ,
    genClosure_ObjectDestroyFunc            ,
    mk_ObjectDestroyFunc                    ,
    noObjectDestroyFunc                     ,
    wrap_ObjectDestroyFunc                  ,


-- ** SerializableCopyFunc #signal:SerializableCopyFunc#

    C_SerializableCopyFunc                  ,
    SerializableCopyFunc                    ,
    dynamic_SerializableCopyFunc            ,
    genClosure_SerializableCopyFunc         ,
    mk_SerializableCopyFunc                 ,
    noSerializableCopyFunc                  ,
    wrap_SerializableCopyFunc               ,


-- ** SerializableDeserializeFunc #signal:SerializableDeserializeFunc#

    C_SerializableDeserializeFunc           ,
    SerializableDeserializeFunc             ,
    dynamic_SerializableDeserializeFunc     ,
    genClosure_SerializableDeserializeFunc  ,
    mk_SerializableDeserializeFunc          ,
    noSerializableDeserializeFunc           ,
    wrap_SerializableDeserializeFunc        ,


-- ** SerializableSerializeFunc #signal:SerializableSerializeFunc#

    C_SerializableSerializeFunc             ,
    SerializableSerializeFunc               ,
    dynamic_SerializableSerializeFunc       ,
    genClosure_SerializableSerializeFunc    ,
    mk_SerializableSerializeFunc            ,
    noSerializableSerializeFunc             ,
    wrap_SerializableSerializeFunc          ,


-- ** UnicodeDataLoadAsyncFinish #signal:UnicodeDataLoadAsyncFinish#

    C_UnicodeDataLoadAsyncFinish            ,
    UnicodeDataLoadAsyncFinish              ,
    UnicodeDataLoadAsyncFinish_WithClosures ,
    drop_closures_UnicodeDataLoadAsyncFinish,
    dynamic_UnicodeDataLoadAsyncFinish      ,
    genClosure_UnicodeDataLoadAsyncFinish   ,
    mk_UnicodeDataLoadAsyncFinish           ,
    noUnicodeDataLoadAsyncFinish            ,
    noUnicodeDataLoadAsyncFinish_WithClosures,
    wrap_UnicodeDataLoadAsyncFinish         ,




    ) 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 GI.GLib.Structs.VariantBuilder as GLib.VariantBuilder
import {-# SOURCE #-} qualified GI.IBus.Objects.Object as IBus.Object
import {-# SOURCE #-} qualified GI.IBus.Objects.Serializable as IBus.Serializable
import {-# SOURCE #-} qualified GI.IBus.Objects.UnicodeData as IBus.UnicodeData

-- callback UnicodeDataLoadAsyncFinish
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "data_list"
          , argType =
              TGSList
                (TInterface Name { namespace = "IBus" , name = "UnicodeData" })
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferEverything
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = 1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just "This callback can receive the list of #IBusUnicodeData."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_UnicodeDataLoadAsyncFinish =
    Ptr (GSList (Ptr IBus.UnicodeData.UnicodeData)) ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "data_list"
--           , argType =
--               TGSList
--                 (TInterface Name { namespace = "IBus" , name = "UnicodeData" })
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , 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 "dynamic" __dynamic_C_UnicodeDataLoadAsyncFinish :: FunPtr C_UnicodeDataLoadAsyncFinish -> C_UnicodeDataLoadAsyncFinish

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_UnicodeDataLoadAsyncFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IBus.UnicodeData.IsUnicodeData a) =>
    FunPtr C_UnicodeDataLoadAsyncFinish
    -> [a]
    -> Ptr ()
    -> m ()
dynamic_UnicodeDataLoadAsyncFinish :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsUnicodeData a) =>
FunPtr C_UnicodeDataLoadAsyncFinish -> [a] -> Ptr () -> m ()
dynamic_UnicodeDataLoadAsyncFinish FunPtr C_UnicodeDataLoadAsyncFinish
__funPtr [a]
dataList Ptr ()
userData = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    [Ptr UnicodeData]
dataList' <- (a -> IO (Ptr UnicodeData)) -> [a] -> IO [Ptr UnicodeData]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM a -> IO (Ptr UnicodeData)
forall a b. (HasCallStack, GObject a) => a -> IO (Ptr b)
B.ManagedPtr.disownObject [a]
dataList
    Ptr (GSList (Ptr UnicodeData))
dataList'' <- [Ptr UnicodeData] -> IO (Ptr (GSList (Ptr UnicodeData)))
forall a. [Ptr a] -> IO (Ptr (GSList (Ptr a)))
packGSList [Ptr UnicodeData]
dataList'
    (FunPtr C_UnicodeDataLoadAsyncFinish -> C_UnicodeDataLoadAsyncFinish
__dynamic_C_UnicodeDataLoadAsyncFinish FunPtr C_UnicodeDataLoadAsyncFinish
__funPtr) Ptr (GSList (Ptr UnicodeData))
dataList'' Ptr ()
userData
    (a -> IO ()) -> [a] -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr [a]
dataList
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

-- | Generate a function pointer callable from C code, from a `C_UnicodeDataLoadAsyncFinish`.
foreign import ccall "wrapper"
    mk_UnicodeDataLoadAsyncFinish :: C_UnicodeDataLoadAsyncFinish -> IO (FunPtr C_UnicodeDataLoadAsyncFinish)

-- | This callback can receive the list of t'GI.IBus.Objects.UnicodeData.UnicodeData'.
type UnicodeDataLoadAsyncFinish =
    [IBus.UnicodeData.UnicodeData]
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `UnicodeDataLoadAsyncFinish`@.
noUnicodeDataLoadAsyncFinish :: Maybe UnicodeDataLoadAsyncFinish
noUnicodeDataLoadAsyncFinish :: Maybe UnicodeDataLoadAsyncFinish
noUnicodeDataLoadAsyncFinish = Maybe UnicodeDataLoadAsyncFinish
forall a. Maybe a
Nothing

-- | This callback can receive the list of t'GI.IBus.Objects.UnicodeData.UnicodeData'.
type UnicodeDataLoadAsyncFinish_WithClosures =
    [IBus.UnicodeData.UnicodeData]
    -> Ptr ()
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `UnicodeDataLoadAsyncFinish_WithClosures`@.
noUnicodeDataLoadAsyncFinish_WithClosures :: Maybe UnicodeDataLoadAsyncFinish_WithClosures
noUnicodeDataLoadAsyncFinish_WithClosures :: Maybe UnicodeDataLoadAsyncFinish_WithClosures
noUnicodeDataLoadAsyncFinish_WithClosures = Maybe UnicodeDataLoadAsyncFinish_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_UnicodeDataLoadAsyncFinish :: UnicodeDataLoadAsyncFinish -> UnicodeDataLoadAsyncFinish_WithClosures
drop_closures_UnicodeDataLoadAsyncFinish :: UnicodeDataLoadAsyncFinish
-> UnicodeDataLoadAsyncFinish_WithClosures
drop_closures_UnicodeDataLoadAsyncFinish UnicodeDataLoadAsyncFinish
_f [UnicodeData]
dataList Ptr ()
_ = UnicodeDataLoadAsyncFinish
_f [UnicodeData]
dataList

-- | Wrap the callback into a `GClosure`.
genClosure_UnicodeDataLoadAsyncFinish :: MonadIO m => UnicodeDataLoadAsyncFinish -> m (GClosure C_UnicodeDataLoadAsyncFinish)
genClosure_UnicodeDataLoadAsyncFinish :: forall (m :: * -> *).
MonadIO m =>
UnicodeDataLoadAsyncFinish
-> m (GClosure C_UnicodeDataLoadAsyncFinish)
genClosure_UnicodeDataLoadAsyncFinish UnicodeDataLoadAsyncFinish
cb = IO (GClosure C_UnicodeDataLoadAsyncFinish)
-> m (GClosure C_UnicodeDataLoadAsyncFinish)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_UnicodeDataLoadAsyncFinish)
 -> m (GClosure C_UnicodeDataLoadAsyncFinish))
-> IO (GClosure C_UnicodeDataLoadAsyncFinish)
-> m (GClosure C_UnicodeDataLoadAsyncFinish)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: UnicodeDataLoadAsyncFinish_WithClosures
cb' = UnicodeDataLoadAsyncFinish
-> UnicodeDataLoadAsyncFinish_WithClosures
drop_closures_UnicodeDataLoadAsyncFinish UnicodeDataLoadAsyncFinish
cb
    let cb'' :: C_UnicodeDataLoadAsyncFinish
cb'' = Maybe (Ptr (FunPtr C_UnicodeDataLoadAsyncFinish))
-> UnicodeDataLoadAsyncFinish_WithClosures
-> C_UnicodeDataLoadAsyncFinish
wrap_UnicodeDataLoadAsyncFinish Maybe (Ptr (FunPtr C_UnicodeDataLoadAsyncFinish))
forall a. Maybe a
Nothing UnicodeDataLoadAsyncFinish_WithClosures
cb'
    C_UnicodeDataLoadAsyncFinish
-> IO (FunPtr C_UnicodeDataLoadAsyncFinish)
mk_UnicodeDataLoadAsyncFinish C_UnicodeDataLoadAsyncFinish
cb'' IO (FunPtr C_UnicodeDataLoadAsyncFinish)
-> (FunPtr C_UnicodeDataLoadAsyncFinish
    -> IO (GClosure C_UnicodeDataLoadAsyncFinish))
-> IO (GClosure C_UnicodeDataLoadAsyncFinish)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_UnicodeDataLoadAsyncFinish
-> IO (GClosure C_UnicodeDataLoadAsyncFinish)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `UnicodeDataLoadAsyncFinish` into a `C_UnicodeDataLoadAsyncFinish`.
wrap_UnicodeDataLoadAsyncFinish :: 
    Maybe (Ptr (FunPtr C_UnicodeDataLoadAsyncFinish)) ->
    UnicodeDataLoadAsyncFinish_WithClosures ->
    C_UnicodeDataLoadAsyncFinish
wrap_UnicodeDataLoadAsyncFinish :: Maybe (Ptr (FunPtr C_UnicodeDataLoadAsyncFinish))
-> UnicodeDataLoadAsyncFinish_WithClosures
-> C_UnicodeDataLoadAsyncFinish
wrap_UnicodeDataLoadAsyncFinish Maybe (Ptr (FunPtr C_UnicodeDataLoadAsyncFinish))
gi'funptrptr UnicodeDataLoadAsyncFinish_WithClosures
gi'cb Ptr (GSList (Ptr UnicodeData))
dataList Ptr ()
userData = do
    [Ptr UnicodeData]
dataList' <- Ptr (GSList (Ptr UnicodeData)) -> IO [Ptr UnicodeData]
forall a. Ptr (GSList (Ptr a)) -> IO [Ptr a]
unpackGSList Ptr (GSList (Ptr UnicodeData))
dataList
    [UnicodeData]
dataList'' <- (Ptr UnicodeData -> IO UnicodeData)
-> [Ptr UnicodeData] -> IO [UnicodeData]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM ((ManagedPtr UnicodeData -> UnicodeData)
-> Ptr UnicodeData -> IO UnicodeData
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr UnicodeData -> UnicodeData
IBus.UnicodeData.UnicodeData) [Ptr UnicodeData]
dataList'
    UnicodeDataLoadAsyncFinish_WithClosures
gi'cb  [UnicodeData]
dataList'' Ptr ()
userData
    Maybe (Ptr (FunPtr C_UnicodeDataLoadAsyncFinish)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_UnicodeDataLoadAsyncFinish))
gi'funptrptr


-- callback SerializableSerializeFunc
{- Callable
  { returnType = Just (TBasicType TBoolean)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText = Just "%TRUE if succeed; %FALSE otherwise."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "serializable"
          , argType =
              TInterface Name { namespace = "IBus" , name = "Serializable" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "An #IBusSerializable."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "builder"
          , argType =
              TInterface Name { namespace = "GLib" , name = "VariantBuilder" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "A #GVariantBuilder."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Prototype of serialize function.\nSerialize function convert an #IBusSerializable to #GVariantBuilder.\nReturns a gboolean value which indicates whether the conversion is success.\nReturn %TRUE if succeed."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_SerializableSerializeFunc =
    Ptr IBus.Serializable.Serializable ->
    Ptr GLib.VariantBuilder.VariantBuilder ->
    IO CInt

-- Args: [ Arg
--           { argCName = "serializable"
--           , argType =
--               TInterface Name { namespace = "IBus" , name = "Serializable" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #IBusSerializable."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "builder"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "VariantBuilder" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GVariantBuilder."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_SerializableSerializeFunc :: FunPtr C_SerializableSerializeFunc -> C_SerializableSerializeFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_SerializableSerializeFunc ::
    (B.CallStack.HasCallStack, MonadIO m, IBus.Serializable.IsSerializable a) =>
    FunPtr C_SerializableSerializeFunc
    -> a
    -- ^ /@serializable@/: An t'GI.IBus.Objects.Serializable.Serializable'.
    -> GLib.VariantBuilder.VariantBuilder
    -- ^ /@builder@/: A t'GI.GLib.Structs.VariantBuilder.VariantBuilder'.
    -> m Bool
    -- ^ __Returns:__ 'P.True' if succeed; 'P.False' otherwise.
dynamic_SerializableSerializeFunc :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSerializable a) =>
FunPtr C_SerializableSerializeFunc -> a -> VariantBuilder -> m Bool
dynamic_SerializableSerializeFunc FunPtr C_SerializableSerializeFunc
__funPtr a
serializable VariantBuilder
builder = 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
    Ptr Serializable
serializable' <- a -> IO (Ptr Serializable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
serializable
    Ptr VariantBuilder
builder' <- VariantBuilder -> IO (Ptr VariantBuilder)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr VariantBuilder
builder
    CInt
result <- (FunPtr C_SerializableSerializeFunc -> C_SerializableSerializeFunc
__dynamic_C_SerializableSerializeFunc FunPtr C_SerializableSerializeFunc
__funPtr) Ptr Serializable
serializable' Ptr VariantBuilder
builder'
    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
serializable
    VariantBuilder -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr VariantBuilder
builder
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

-- | Generate a function pointer callable from C code, from a `C_SerializableSerializeFunc`.
foreign import ccall "wrapper"
    mk_SerializableSerializeFunc :: C_SerializableSerializeFunc -> IO (FunPtr C_SerializableSerializeFunc)

-- | Prototype of serialize function.
-- Serialize function convert an t'GI.IBus.Objects.Serializable.Serializable' to t'GI.GLib.Structs.VariantBuilder.VariantBuilder'.
-- Returns a gboolean value which indicates whether the conversion is success.
-- Return 'P.True' if succeed.
type SerializableSerializeFunc =
    IBus.Serializable.Serializable
    -- ^ /@serializable@/: An t'GI.IBus.Objects.Serializable.Serializable'.
    -> GLib.VariantBuilder.VariantBuilder
    -- ^ /@builder@/: A t'GI.GLib.Structs.VariantBuilder.VariantBuilder'.
    -> IO Bool
    -- ^ __Returns:__ 'P.True' if succeed; 'P.False' otherwise.

-- | A convenience synonym for @`Nothing` :: `Maybe` `SerializableSerializeFunc`@.
noSerializableSerializeFunc :: Maybe SerializableSerializeFunc
noSerializableSerializeFunc :: Maybe SerializableSerializeFunc
noSerializableSerializeFunc = Maybe SerializableSerializeFunc
forall a. Maybe a
Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_SerializableSerializeFunc :: MonadIO m => SerializableSerializeFunc -> m (GClosure C_SerializableSerializeFunc)
genClosure_SerializableSerializeFunc :: forall (m :: * -> *).
MonadIO m =>
SerializableSerializeFunc
-> m (GClosure C_SerializableSerializeFunc)
genClosure_SerializableSerializeFunc SerializableSerializeFunc
cb = IO (GClosure C_SerializableSerializeFunc)
-> m (GClosure C_SerializableSerializeFunc)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_SerializableSerializeFunc)
 -> m (GClosure C_SerializableSerializeFunc))
-> IO (GClosure C_SerializableSerializeFunc)
-> m (GClosure C_SerializableSerializeFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_SerializableSerializeFunc
cb' = Maybe (Ptr (FunPtr C_SerializableSerializeFunc))
-> SerializableSerializeFunc -> C_SerializableSerializeFunc
wrap_SerializableSerializeFunc Maybe (Ptr (FunPtr C_SerializableSerializeFunc))
forall a. Maybe a
Nothing SerializableSerializeFunc
cb
    C_SerializableSerializeFunc
-> IO (FunPtr C_SerializableSerializeFunc)
mk_SerializableSerializeFunc C_SerializableSerializeFunc
cb' IO (FunPtr C_SerializableSerializeFunc)
-> (FunPtr C_SerializableSerializeFunc
    -> IO (GClosure C_SerializableSerializeFunc))
-> IO (GClosure C_SerializableSerializeFunc)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_SerializableSerializeFunc
-> IO (GClosure C_SerializableSerializeFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `SerializableSerializeFunc` into a `C_SerializableSerializeFunc`.
wrap_SerializableSerializeFunc :: 
    Maybe (Ptr (FunPtr C_SerializableSerializeFunc)) ->
    SerializableSerializeFunc ->
    C_SerializableSerializeFunc
wrap_SerializableSerializeFunc :: Maybe (Ptr (FunPtr C_SerializableSerializeFunc))
-> SerializableSerializeFunc -> C_SerializableSerializeFunc
wrap_SerializableSerializeFunc Maybe (Ptr (FunPtr C_SerializableSerializeFunc))
gi'funptrptr SerializableSerializeFunc
gi'cb Ptr Serializable
serializable Ptr VariantBuilder
builder = do
    Serializable
serializable' <- ((ManagedPtr Serializable -> Serializable)
-> Ptr Serializable -> IO Serializable
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Serializable -> Serializable
IBus.Serializable.Serializable) Ptr Serializable
serializable
    Ptr VariantBuilder -> (VariantBuilder -> IO CInt) -> IO CInt
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient  Ptr VariantBuilder
builder ((VariantBuilder -> IO CInt) -> IO CInt)
-> (VariantBuilder -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \VariantBuilder
builder' -> do
        Bool
result <- SerializableSerializeFunc
gi'cb  Serializable
serializable' VariantBuilder
builder'
        Maybe (Ptr (FunPtr C_SerializableSerializeFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_SerializableSerializeFunc))
gi'funptrptr
        let result' :: CInt
result' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
P.fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
P.fromEnum) Bool
result
        CInt -> IO CInt
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CInt
result'


-- callback SerializableDeserializeFunc
{- Callable
  { returnType = Just (TBasicType TInt)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just "The number of values in the variant(tuple) are consumed."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "serializable"
          , argType =
              TInterface Name { namespace = "IBus" , name = "Serializable" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "An #IBusSerializable."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "variant"
          , argType = TVariant
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "A #GVariant contains a tuple."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Prototype of deserialize function.\nDeserialize function convert a #GVariant to #IBusSerializable.\nReturns an integer value which indicates how many values in\nthe variant(tuple) are consumed."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_SerializableDeserializeFunc =
    Ptr IBus.Serializable.Serializable ->
    Ptr GVariant ->
    IO Int32

-- Args: [ Arg
--           { argCName = "serializable"
--           , argType =
--               TInterface Name { namespace = "IBus" , name = "Serializable" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #IBusSerializable."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "variant"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GVariant contains a tuple."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_SerializableDeserializeFunc :: FunPtr C_SerializableDeserializeFunc -> C_SerializableDeserializeFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_SerializableDeserializeFunc ::
    (B.CallStack.HasCallStack, MonadIO m, IBus.Serializable.IsSerializable a) =>
    FunPtr C_SerializableDeserializeFunc
    -> a
    -- ^ /@serializable@/: An t'GI.IBus.Objects.Serializable.Serializable'.
    -> GVariant
    -- ^ /@variant@/: A t'GVariant' contains a tuple.
    -> m Int32
    -- ^ __Returns:__ The number of values in the variant(tuple) are consumed.
dynamic_SerializableDeserializeFunc :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSerializable a) =>
FunPtr C_SerializableDeserializeFunc -> a -> GVariant -> m Int32
dynamic_SerializableDeserializeFunc FunPtr C_SerializableDeserializeFunc
__funPtr a
serializable GVariant
variant = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Ptr Serializable
serializable' <- a -> IO (Ptr Serializable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
serializable
    Ptr GVariant
variant' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
variant
    Int32
result <- (FunPtr C_SerializableDeserializeFunc
-> C_SerializableDeserializeFunc
__dynamic_C_SerializableDeserializeFunc FunPtr C_SerializableDeserializeFunc
__funPtr) Ptr Serializable
serializable' Ptr GVariant
variant'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
serializable
    GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
variant
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

-- | Generate a function pointer callable from C code, from a `C_SerializableDeserializeFunc`.
foreign import ccall "wrapper"
    mk_SerializableDeserializeFunc :: C_SerializableDeserializeFunc -> IO (FunPtr C_SerializableDeserializeFunc)

-- | Prototype of deserialize function.
-- Deserialize function convert a t'GVariant' to t'GI.IBus.Objects.Serializable.Serializable'.
-- Returns an integer value which indicates how many values in
-- the variant(tuple) are consumed.
type SerializableDeserializeFunc =
    IBus.Serializable.Serializable
    -- ^ /@serializable@/: An t'GI.IBus.Objects.Serializable.Serializable'.
    -> GVariant
    -- ^ /@variant@/: A t'GVariant' contains a tuple.
    -> IO Int32
    -- ^ __Returns:__ The number of values in the variant(tuple) are consumed.

-- | A convenience synonym for @`Nothing` :: `Maybe` `SerializableDeserializeFunc`@.
noSerializableDeserializeFunc :: Maybe SerializableDeserializeFunc
noSerializableDeserializeFunc :: Maybe SerializableDeserializeFunc
noSerializableDeserializeFunc = Maybe SerializableDeserializeFunc
forall a. Maybe a
Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_SerializableDeserializeFunc :: MonadIO m => SerializableDeserializeFunc -> m (GClosure C_SerializableDeserializeFunc)
genClosure_SerializableDeserializeFunc :: forall (m :: * -> *).
MonadIO m =>
SerializableDeserializeFunc
-> m (GClosure C_SerializableDeserializeFunc)
genClosure_SerializableDeserializeFunc SerializableDeserializeFunc
cb = IO (GClosure C_SerializableDeserializeFunc)
-> m (GClosure C_SerializableDeserializeFunc)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_SerializableDeserializeFunc)
 -> m (GClosure C_SerializableDeserializeFunc))
-> IO (GClosure C_SerializableDeserializeFunc)
-> m (GClosure C_SerializableDeserializeFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_SerializableDeserializeFunc
cb' = Maybe (Ptr (FunPtr C_SerializableDeserializeFunc))
-> SerializableDeserializeFunc -> C_SerializableDeserializeFunc
wrap_SerializableDeserializeFunc Maybe (Ptr (FunPtr C_SerializableDeserializeFunc))
forall a. Maybe a
Nothing SerializableDeserializeFunc
cb
    C_SerializableDeserializeFunc
-> IO (FunPtr C_SerializableDeserializeFunc)
mk_SerializableDeserializeFunc C_SerializableDeserializeFunc
cb' IO (FunPtr C_SerializableDeserializeFunc)
-> (FunPtr C_SerializableDeserializeFunc
    -> IO (GClosure C_SerializableDeserializeFunc))
-> IO (GClosure C_SerializableDeserializeFunc)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_SerializableDeserializeFunc
-> IO (GClosure C_SerializableDeserializeFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `SerializableDeserializeFunc` into a `C_SerializableDeserializeFunc`.
wrap_SerializableDeserializeFunc :: 
    Maybe (Ptr (FunPtr C_SerializableDeserializeFunc)) ->
    SerializableDeserializeFunc ->
    C_SerializableDeserializeFunc
wrap_SerializableDeserializeFunc :: Maybe (Ptr (FunPtr C_SerializableDeserializeFunc))
-> SerializableDeserializeFunc -> C_SerializableDeserializeFunc
wrap_SerializableDeserializeFunc Maybe (Ptr (FunPtr C_SerializableDeserializeFunc))
gi'funptrptr SerializableDeserializeFunc
gi'cb Ptr Serializable
serializable Ptr GVariant
variant = do
    Serializable
serializable' <- ((ManagedPtr Serializable -> Serializable)
-> Ptr Serializable -> IO Serializable
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Serializable -> Serializable
IBus.Serializable.Serializable) Ptr Serializable
serializable
    GVariant
variant' <- Ptr GVariant -> IO GVariant
B.GVariant.newGVariantFromPtr Ptr GVariant
variant
    Int32
result <- SerializableDeserializeFunc
gi'cb  Serializable
serializable' GVariant
variant'
    Maybe (Ptr (FunPtr C_SerializableDeserializeFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_SerializableDeserializeFunc))
gi'funptrptr
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- callback SerializableCopyFunc
{- Callable
  { returnType = Just (TBasicType TBoolean)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText = Just "%TRUE if succeed; %FALSE otherwise."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "dest"
          , argType =
              TInterface Name { namespace = "IBus" , name = "Serializable" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The destination #IBusSerializable."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "src"
          , argType =
              TInterface Name { namespace = "IBus" , name = "Serializable" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "A source #IBusSerializable."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Prototype of copy function.\nCopy function copy from source #IBusSerializable to the destination one.\nReturns a gboolean value which indicates whether the copying is success."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_SerializableCopyFunc =
    Ptr IBus.Serializable.Serializable ->
    Ptr IBus.Serializable.Serializable ->
    IO CInt

-- Args: [ Arg
--           { argCName = "dest"
--           , argType =
--               TInterface Name { namespace = "IBus" , name = "Serializable" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The destination #IBusSerializable."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "src"
--           , argType =
--               TInterface Name { namespace = "IBus" , name = "Serializable" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A source #IBusSerializable."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_SerializableCopyFunc :: FunPtr C_SerializableCopyFunc -> C_SerializableCopyFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_SerializableCopyFunc ::
    (B.CallStack.HasCallStack, MonadIO m, IBus.Serializable.IsSerializable a, IBus.Serializable.IsSerializable b) =>
    FunPtr C_SerializableCopyFunc
    -> a
    -- ^ /@dest@/: The destination t'GI.IBus.Objects.Serializable.Serializable'.
    -> b
    -- ^ /@src@/: A source t'GI.IBus.Objects.Serializable.Serializable'.
    -> m Bool
    -- ^ __Returns:__ 'P.True' if succeed; 'P.False' otherwise.
dynamic_SerializableCopyFunc :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSerializable a, IsSerializable b) =>
FunPtr C_SerializableCopyFunc -> a -> b -> m Bool
dynamic_SerializableCopyFunc FunPtr C_SerializableCopyFunc
__funPtr a
dest b
src = 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
    Ptr Serializable
dest' <- a -> IO (Ptr Serializable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
dest
    Ptr Serializable
src' <- b -> IO (Ptr Serializable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
src
    CInt
result <- (FunPtr C_SerializableCopyFunc -> C_SerializableCopyFunc
__dynamic_C_SerializableCopyFunc FunPtr C_SerializableCopyFunc
__funPtr) Ptr Serializable
dest' Ptr Serializable
src'
    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
dest
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
src
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

-- | Generate a function pointer callable from C code, from a `C_SerializableCopyFunc`.
foreign import ccall "wrapper"
    mk_SerializableCopyFunc :: C_SerializableCopyFunc -> IO (FunPtr C_SerializableCopyFunc)

-- | Prototype of copy function.
-- Copy function copy from source t'GI.IBus.Objects.Serializable.Serializable' to the destination one.
-- Returns a gboolean value which indicates whether the copying is success.
type SerializableCopyFunc =
    IBus.Serializable.Serializable
    -- ^ /@dest@/: The destination t'GI.IBus.Objects.Serializable.Serializable'.
    -> IBus.Serializable.Serializable
    -- ^ /@src@/: A source t'GI.IBus.Objects.Serializable.Serializable'.
    -> IO Bool
    -- ^ __Returns:__ 'P.True' if succeed; 'P.False' otherwise.

-- | A convenience synonym for @`Nothing` :: `Maybe` `SerializableCopyFunc`@.
noSerializableCopyFunc :: Maybe SerializableCopyFunc
noSerializableCopyFunc :: Maybe SerializableCopyFunc
noSerializableCopyFunc = Maybe SerializableCopyFunc
forall a. Maybe a
Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_SerializableCopyFunc :: MonadIO m => SerializableCopyFunc -> m (GClosure C_SerializableCopyFunc)
genClosure_SerializableCopyFunc :: forall (m :: * -> *).
MonadIO m =>
SerializableCopyFunc -> m (GClosure C_SerializableCopyFunc)
genClosure_SerializableCopyFunc SerializableCopyFunc
cb = IO (GClosure C_SerializableCopyFunc)
-> m (GClosure C_SerializableCopyFunc)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_SerializableCopyFunc)
 -> m (GClosure C_SerializableCopyFunc))
-> IO (GClosure C_SerializableCopyFunc)
-> m (GClosure C_SerializableCopyFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_SerializableCopyFunc
cb' = Maybe (Ptr (FunPtr C_SerializableCopyFunc))
-> SerializableCopyFunc -> C_SerializableCopyFunc
wrap_SerializableCopyFunc Maybe (Ptr (FunPtr C_SerializableCopyFunc))
forall a. Maybe a
Nothing SerializableCopyFunc
cb
    C_SerializableCopyFunc -> IO (FunPtr C_SerializableCopyFunc)
mk_SerializableCopyFunc C_SerializableCopyFunc
cb' IO (FunPtr C_SerializableCopyFunc)
-> (FunPtr C_SerializableCopyFunc
    -> IO (GClosure C_SerializableCopyFunc))
-> IO (GClosure C_SerializableCopyFunc)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_SerializableCopyFunc
-> IO (GClosure C_SerializableCopyFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `SerializableCopyFunc` into a `C_SerializableCopyFunc`.
wrap_SerializableCopyFunc :: 
    Maybe (Ptr (FunPtr C_SerializableCopyFunc)) ->
    SerializableCopyFunc ->
    C_SerializableCopyFunc
wrap_SerializableCopyFunc :: Maybe (Ptr (FunPtr C_SerializableCopyFunc))
-> SerializableCopyFunc -> C_SerializableCopyFunc
wrap_SerializableCopyFunc Maybe (Ptr (FunPtr C_SerializableCopyFunc))
gi'funptrptr SerializableCopyFunc
gi'cb Ptr Serializable
dest Ptr Serializable
src = do
    Serializable
dest' <- ((ManagedPtr Serializable -> Serializable)
-> Ptr Serializable -> IO Serializable
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Serializable -> Serializable
IBus.Serializable.Serializable) Ptr Serializable
dest
    Serializable
src' <- ((ManagedPtr Serializable -> Serializable)
-> Ptr Serializable -> IO Serializable
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Serializable -> Serializable
IBus.Serializable.Serializable) Ptr Serializable
src
    Bool
result <- SerializableCopyFunc
gi'cb  Serializable
dest' Serializable
src'
    Maybe (Ptr (FunPtr C_SerializableCopyFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_SerializableCopyFunc))
gi'funptrptr
    let result' :: CInt
result' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
P.fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
P.fromEnum) Bool
result
    CInt -> IO CInt
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CInt
result'


-- callback ObjectDestroyFunc
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "object"
          , argType =
              TInterface Name { namespace = "IBus" , name = "Object" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_ObjectDestroyFunc =
    Ptr IBus.Object.Object ->
    IO ()

-- Args: [ Arg
--           { argCName = "object"
--           , argType =
--               TInterface Name { namespace = "IBus" , name = "Object" }
--           , 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 "dynamic" __dynamic_C_ObjectDestroyFunc :: FunPtr C_ObjectDestroyFunc -> C_ObjectDestroyFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_ObjectDestroyFunc ::
    (B.CallStack.HasCallStack, MonadIO m, IBus.Object.IsObject a) =>
    FunPtr C_ObjectDestroyFunc
    -> a
    -> m ()
dynamic_ObjectDestroyFunc :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsObject a) =>
FunPtr C_ObjectDestroyFunc -> a -> m ()
dynamic_ObjectDestroyFunc FunPtr C_ObjectDestroyFunc
__funPtr a
object = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Object
object' <- a -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
object
    (FunPtr C_ObjectDestroyFunc -> C_ObjectDestroyFunc
__dynamic_C_ObjectDestroyFunc FunPtr C_ObjectDestroyFunc
__funPtr) Ptr Object
object'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
object
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

-- | Generate a function pointer callable from C code, from a `C_ObjectDestroyFunc`.
foreign import ccall "wrapper"
    mk_ObjectDestroyFunc :: C_ObjectDestroyFunc -> IO (FunPtr C_ObjectDestroyFunc)

-- | /No description available in the introspection data./
type ObjectDestroyFunc =
    IBus.Object.Object
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ObjectDestroyFunc`@.
noObjectDestroyFunc :: Maybe ObjectDestroyFunc
noObjectDestroyFunc :: Maybe ObjectDestroyFunc
noObjectDestroyFunc = Maybe ObjectDestroyFunc
forall a. Maybe a
Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_ObjectDestroyFunc :: MonadIO m => ObjectDestroyFunc -> m (GClosure C_ObjectDestroyFunc)
genClosure_ObjectDestroyFunc :: forall (m :: * -> *).
MonadIO m =>
ObjectDestroyFunc -> m (GClosure C_ObjectDestroyFunc)
genClosure_ObjectDestroyFunc ObjectDestroyFunc
cb = IO (GClosure C_ObjectDestroyFunc)
-> m (GClosure C_ObjectDestroyFunc)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_ObjectDestroyFunc)
 -> m (GClosure C_ObjectDestroyFunc))
-> IO (GClosure C_ObjectDestroyFunc)
-> m (GClosure C_ObjectDestroyFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_ObjectDestroyFunc
cb' = Maybe (Ptr (FunPtr C_ObjectDestroyFunc))
-> ObjectDestroyFunc -> C_ObjectDestroyFunc
wrap_ObjectDestroyFunc Maybe (Ptr (FunPtr C_ObjectDestroyFunc))
forall a. Maybe a
Nothing ObjectDestroyFunc
cb
    C_ObjectDestroyFunc -> IO (FunPtr C_ObjectDestroyFunc)
mk_ObjectDestroyFunc C_ObjectDestroyFunc
cb' IO (FunPtr C_ObjectDestroyFunc)
-> (FunPtr C_ObjectDestroyFunc
    -> IO (GClosure C_ObjectDestroyFunc))
-> IO (GClosure C_ObjectDestroyFunc)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ObjectDestroyFunc -> IO (GClosure C_ObjectDestroyFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `ObjectDestroyFunc` into a `C_ObjectDestroyFunc`.
wrap_ObjectDestroyFunc :: 
    Maybe (Ptr (FunPtr C_ObjectDestroyFunc)) ->
    ObjectDestroyFunc ->
    C_ObjectDestroyFunc
wrap_ObjectDestroyFunc :: Maybe (Ptr (FunPtr C_ObjectDestroyFunc))
-> ObjectDestroyFunc -> C_ObjectDestroyFunc
wrap_ObjectDestroyFunc Maybe (Ptr (FunPtr C_ObjectDestroyFunc))
gi'funptrptr ObjectDestroyFunc
gi'cb Ptr Object
object = do
    Object
object' <- ((ManagedPtr Object -> Object) -> Ptr Object -> IO Object
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Object -> Object
IBus.Object.Object) Ptr Object
object
    ObjectDestroyFunc
gi'cb  Object
object'
    Maybe (Ptr (FunPtr C_ObjectDestroyFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_ObjectDestroyFunc))
gi'funptrptr


-- callback FreeFunc
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "object"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "object to be freed."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText = Just "Free function prototype."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_FreeFunc =
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "object"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "object to be freed."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_FreeFunc :: FunPtr C_FreeFunc -> C_FreeFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_FreeFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_FreeFunc
    -> Ptr ()
    -- ^ /@object@/: object to be freed.
    -> m ()
dynamic_FreeFunc :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_FreeFunc -> Ptr () -> m ()
dynamic_FreeFunc FunPtr C_FreeFunc
__funPtr Ptr ()
object = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    (FunPtr C_FreeFunc -> C_FreeFunc
__dynamic_C_FreeFunc FunPtr C_FreeFunc
__funPtr) Ptr ()
object
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

-- | Generate a function pointer callable from C code, from a `C_FreeFunc`.
foreign import ccall "wrapper"
    mk_FreeFunc :: C_FreeFunc -> IO (FunPtr C_FreeFunc)

-- | Free function prototype.
type FreeFunc =
    Ptr ()
    -- ^ /@object@/: object to be freed.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `FreeFunc`@.
noFreeFunc :: Maybe FreeFunc
noFreeFunc :: Maybe C_FreeFunc
noFreeFunc = Maybe C_FreeFunc
forall a. Maybe a
Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_FreeFunc :: MonadIO m => FreeFunc -> m (GClosure C_FreeFunc)
genClosure_FreeFunc :: forall (m :: * -> *).
MonadIO m =>
C_FreeFunc -> m (GClosure C_FreeFunc)
genClosure_FreeFunc C_FreeFunc
cb = IO (GClosure C_FreeFunc) -> m (GClosure C_FreeFunc)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_FreeFunc) -> m (GClosure C_FreeFunc))
-> IO (GClosure C_FreeFunc) -> m (GClosure C_FreeFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_FreeFunc
cb' = Maybe (Ptr (FunPtr C_FreeFunc)) -> C_FreeFunc -> C_FreeFunc
wrap_FreeFunc Maybe (Ptr (FunPtr C_FreeFunc))
forall a. Maybe a
Nothing C_FreeFunc
cb
    C_FreeFunc -> IO (FunPtr C_FreeFunc)
mk_FreeFunc C_FreeFunc
cb' IO (FunPtr C_FreeFunc)
-> (FunPtr C_FreeFunc -> IO (GClosure C_FreeFunc))
-> IO (GClosure C_FreeFunc)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_FreeFunc -> IO (GClosure C_FreeFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `FreeFunc` into a `C_FreeFunc`.
wrap_FreeFunc :: 
    Maybe (Ptr (FunPtr C_FreeFunc)) ->
    FreeFunc ->
    C_FreeFunc
wrap_FreeFunc :: Maybe (Ptr (FunPtr C_FreeFunc)) -> C_FreeFunc -> C_FreeFunc
wrap_FreeFunc Maybe (Ptr (FunPtr C_FreeFunc))
gi'funptrptr C_FreeFunc
gi'cb Ptr ()
object = do
    C_FreeFunc
gi'cb  Ptr ()
object
    Maybe (Ptr (FunPtr C_FreeFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_FreeFunc))
gi'funptrptr