-- | 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.GdkPixbuf.Callbacks
    ( 

 -- * Signals


-- ** PixbufDestroyNotify #signal:PixbufDestroyNotify#

    C_PixbufDestroyNotify                   ,
    PixbufDestroyNotify                     ,
    PixbufDestroyNotify_WithClosures        ,
    drop_closures_PixbufDestroyNotify       ,
    dynamic_PixbufDestroyNotify             ,
    genClosure_PixbufDestroyNotify          ,
    mk_PixbufDestroyNotify                  ,
    noPixbufDestroyNotify                   ,
    noPixbufDestroyNotify_WithClosures      ,
    wrap_PixbufDestroyNotify                ,


-- ** PixbufModuleFillInfoFunc #signal:PixbufModuleFillInfoFunc#

    C_PixbufModuleFillInfoFunc              ,
    PixbufModuleFillInfoFunc                ,
    dynamic_PixbufModuleFillInfoFunc        ,
    genClosure_PixbufModuleFillInfoFunc     ,
    mk_PixbufModuleFillInfoFunc             ,
    noPixbufModuleFillInfoFunc              ,
    wrap_PixbufModuleFillInfoFunc           ,


-- ** PixbufModuleFillVtableFunc #signal:PixbufModuleFillVtableFunc#

    C_PixbufModuleFillVtableFunc            ,
    PixbufModuleFillVtableFunc              ,
    dynamic_PixbufModuleFillVtableFunc      ,
    genClosure_PixbufModuleFillVtableFunc   ,
    mk_PixbufModuleFillVtableFunc           ,
    noPixbufModuleFillVtableFunc            ,
    wrap_PixbufModuleFillVtableFunc         ,


-- ** PixbufModuleIncrementLoadFunc #signal:PixbufModuleIncrementLoadFunc#

    C_PixbufModuleIncrementLoadFunc         ,
    PixbufModuleIncrementLoadFunc           ,
    dynamic_PixbufModuleIncrementLoadFunc   ,
    mk_PixbufModuleIncrementLoadFunc        ,
    noPixbufModuleIncrementLoadFunc         ,


-- ** PixbufModuleLoadAnimationFunc #signal:PixbufModuleLoadAnimationFunc#

    C_PixbufModuleLoadAnimationFunc         ,
    PixbufModuleLoadAnimationFunc           ,
    dynamic_PixbufModuleLoadAnimationFunc   ,
    mk_PixbufModuleLoadAnimationFunc        ,
    noPixbufModuleLoadAnimationFunc         ,


-- ** PixbufModuleLoadFunc #signal:PixbufModuleLoadFunc#

    C_PixbufModuleLoadFunc                  ,
    PixbufModuleLoadFunc                    ,
    dynamic_PixbufModuleLoadFunc            ,
    mk_PixbufModuleLoadFunc                 ,
    noPixbufModuleLoadFunc                  ,


-- ** PixbufModuleLoadXpmDataFunc #signal:PixbufModuleLoadXpmDataFunc#

    C_PixbufModuleLoadXpmDataFunc           ,
    PixbufModuleLoadXpmDataFunc             ,
    dynamic_PixbufModuleLoadXpmDataFunc     ,
    genClosure_PixbufModuleLoadXpmDataFunc  ,
    mk_PixbufModuleLoadXpmDataFunc          ,
    noPixbufModuleLoadXpmDataFunc           ,
    wrap_PixbufModuleLoadXpmDataFunc        ,


-- ** PixbufModulePreparedFunc #signal:PixbufModulePreparedFunc#

    C_PixbufModulePreparedFunc              ,
    PixbufModulePreparedFunc                ,
    PixbufModulePreparedFunc_WithClosures   ,
    drop_closures_PixbufModulePreparedFunc  ,
    dynamic_PixbufModulePreparedFunc        ,
    genClosure_PixbufModulePreparedFunc     ,
    mk_PixbufModulePreparedFunc             ,
    noPixbufModulePreparedFunc              ,
    noPixbufModulePreparedFunc_WithClosures ,
    wrap_PixbufModulePreparedFunc           ,


-- ** PixbufModuleSaveFunc #signal:PixbufModuleSaveFunc#

    C_PixbufModuleSaveFunc                  ,
    PixbufModuleSaveFunc                    ,
    dynamic_PixbufModuleSaveFunc            ,
    mk_PixbufModuleSaveFunc                 ,
    noPixbufModuleSaveFunc                  ,


-- ** PixbufModuleSaveOptionSupportedFunc #signal:PixbufModuleSaveOptionSupportedFunc#

    C_PixbufModuleSaveOptionSupportedFunc   ,
    PixbufModuleSaveOptionSupportedFunc     ,
    dynamic_PixbufModuleSaveOptionSupportedFunc,
    genClosure_PixbufModuleSaveOptionSupportedFunc,
    mk_PixbufModuleSaveOptionSupportedFunc  ,
    noPixbufModuleSaveOptionSupportedFunc   ,
    wrap_PixbufModuleSaveOptionSupportedFunc,


-- ** PixbufModuleSizeFunc #signal:PixbufModuleSizeFunc#

    C_PixbufModuleSizeFunc                  ,
    PixbufModuleSizeFunc                    ,
    PixbufModuleSizeFunc_WithClosures       ,
    drop_closures_PixbufModuleSizeFunc      ,
    dynamic_PixbufModuleSizeFunc            ,
    genClosure_PixbufModuleSizeFunc         ,
    mk_PixbufModuleSizeFunc                 ,
    noPixbufModuleSizeFunc                  ,
    noPixbufModuleSizeFunc_WithClosures     ,
    wrap_PixbufModuleSizeFunc               ,


-- ** PixbufModuleStopLoadFunc #signal:PixbufModuleStopLoadFunc#

    C_PixbufModuleStopLoadFunc              ,
    PixbufModuleStopLoadFunc                ,
    dynamic_PixbufModuleStopLoadFunc        ,
    mk_PixbufModuleStopLoadFunc             ,
    noPixbufModuleStopLoadFunc              ,


-- ** PixbufModuleUpdatedFunc #signal:PixbufModuleUpdatedFunc#

    C_PixbufModuleUpdatedFunc               ,
    PixbufModuleUpdatedFunc                 ,
    PixbufModuleUpdatedFunc_WithClosures    ,
    drop_closures_PixbufModuleUpdatedFunc   ,
    dynamic_PixbufModuleUpdatedFunc         ,
    genClosure_PixbufModuleUpdatedFunc      ,
    mk_PixbufModuleUpdatedFunc              ,
    noPixbufModuleUpdatedFunc               ,
    noPixbufModuleUpdatedFunc_WithClosures  ,
    wrap_PixbufModuleUpdatedFunc            ,


-- ** PixbufSaveFunc #signal:PixbufSaveFunc#

    C_PixbufSaveFunc                        ,
    PixbufSaveFunc                          ,
    PixbufSaveFunc_WithClosures             ,
    drop_closures_PixbufSaveFunc            ,
    dynamic_PixbufSaveFunc                  ,
    genClosure_PixbufSaveFunc               ,
    mk_PixbufSaveFunc                       ,
    noPixbufSaveFunc                        ,
    noPixbufSaveFunc_WithClosures           ,
    wrap_PixbufSaveFunc                     ,




    ) 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.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 {-# SOURCE #-} qualified GI.GdkPixbuf.Objects.Pixbuf as GdkPixbuf.Pixbuf
import {-# SOURCE #-} qualified GI.GdkPixbuf.Objects.PixbufAnimation as GdkPixbuf.PixbufAnimation
import {-# SOURCE #-} qualified GI.GdkPixbuf.Structs.PixbufFormat as GdkPixbuf.PixbufFormat
import {-# SOURCE #-} qualified GI.GdkPixbuf.Structs.PixbufModule as GdkPixbuf.PixbufModule

-- callback PixbufSaveFunc
{- Callable
  { returnType = Just (TBasicType TBoolean)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText = Just "`TRUE` if successful, `FALSE` otherwise"
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "buf"
          , argType = TCArray False (-1) 1 (TBasicType TUInt8)
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "bytes to be written."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "count"
          , argType = TBasicType TUInt64
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "number of bytes in @buf."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "error"
          , argType = TError
          , direction = DirectionOut
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "A location to return an error."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferEverything
          }
      , Arg
          { argCName = "data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText =
                    Just "user data passed to gdk_pixbuf_save_to_callback()."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 3
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Save functions used by [method@GdkPixbuf.Pixbuf.save_to_callback].\n\nThis function is called once for each block of bytes that is \"written\"\nby `gdk_pixbuf_save_to_callback()`.\n\nIf successful it should return `TRUE`; if an error occurs it should set\n`error` and return `FALSE`, in which case `gdk_pixbuf_save_to_callback()`\nwill fail with the same error."
        , sinceVersion = Just "2.4"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_PixbufSaveFunc =
    Ptr Word8 ->
    Word64 ->
    Ptr (Ptr GError) ->
    Ptr () ->
    IO CInt

-- Args: [ Arg
--           { argCName = "buf"
--           , argType = TCArray False (-1) 1 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "bytes to be written."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "count"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "number of bytes in @buf."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "error"
--           , argType = TError
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A location to return an error."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "user data passed to gdk_pixbuf_save_to_callback()."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 3
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "count"
--              , argType = TBasicType TUInt64
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "number of bytes in @buf."
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_PixbufSaveFunc :: FunPtr C_PixbufSaveFunc -> C_PixbufSaveFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PixbufSaveFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_PixbufSaveFunc
    -> ByteString
    -- ^ /@buf@/: bytes to be written.
    -> Ptr ()
    -- ^ /@data@/: user data passed to @/gdk_pixbuf_save_to_callback()/@.
    -> m ((Bool, GError))
    -- ^ __Returns:__ @TRUE@ if successful, @FALSE@ otherwise
dynamic_PixbufSaveFunc :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_PixbufSaveFunc -> ByteString -> Ptr () -> m (Bool, GError)
dynamic_PixbufSaveFunc FunPtr C_PixbufSaveFunc
__funPtr ByteString
buf Ptr ()
data_ = IO (Bool, GError) -> m (Bool, GError)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, GError) -> m (Bool, GError))
-> IO (Bool, GError) -> m (Bool, GError)
forall a b. (a -> b) -> a -> b
$ do
    let count :: Word64
count = Int -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word64) -> Int -> Word64
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
buf
    Ptr Word8
buf' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
buf
    Ptr (Ptr GError)
error_ <- IO (Ptr (Ptr GError))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr GError))
    CInt
result <- (FunPtr C_PixbufSaveFunc -> C_PixbufSaveFunc
__dynamic_C_PixbufSaveFunc FunPtr C_PixbufSaveFunc
__funPtr) Ptr Word8
buf' Word64
count Ptr (Ptr GError)
error_ Ptr ()
data_
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Ptr GError
error_' <- Ptr (Ptr GError) -> IO (Ptr GError)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr GError)
error_
    GError
error_'' <- ((ManagedPtr GError -> GError) -> Ptr GError -> IO GError
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr GError -> GError
GError) Ptr GError
error_'
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
buf'
    Ptr (Ptr GError) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr GError)
error_
    (Bool, GError) -> IO (Bool, GError)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', GError
error_'')

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

-- | Save functions used by t'GI.GdkPixbuf.Objects.Pixbuf.Pixbuf'.@/save_to_callback/@().
-- 
-- This function is called once for each block of bytes that is \"written\"
-- by @gdk_pixbuf_save_to_callback()@.
-- 
-- If successful it should return @TRUE@; if an error occurs it should set
-- @error@ and return @FALSE@, in which case @gdk_pixbuf_save_to_callback()@
-- will fail with the same error.
-- 
-- /Since: 2.4/
type PixbufSaveFunc =
    ByteString
    -- ^ /@buf@/: bytes to be written.
    -> IO ((Bool, GError))
    -- ^ __Returns:__ @TRUE@ if successful, @FALSE@ otherwise

-- | A convenience synonym for @`Nothing` :: `Maybe` `PixbufSaveFunc`@.
noPixbufSaveFunc :: Maybe PixbufSaveFunc
noPixbufSaveFunc :: Maybe PixbufSaveFunc
noPixbufSaveFunc = Maybe PixbufSaveFunc
forall a. Maybe a
Nothing

-- | Save functions used by t'GI.GdkPixbuf.Objects.Pixbuf.Pixbuf'.@/save_to_callback/@().
-- 
-- This function is called once for each block of bytes that is \"written\"
-- by @gdk_pixbuf_save_to_callback()@.
-- 
-- If successful it should return @TRUE@; if an error occurs it should set
-- @error@ and return @FALSE@, in which case @gdk_pixbuf_save_to_callback()@
-- will fail with the same error.
-- 
-- /Since: 2.4/
type PixbufSaveFunc_WithClosures =
    ByteString
    -- ^ /@buf@/: bytes to be written.
    -> Ptr ()
    -- ^ /@data@/: user data passed to @/gdk_pixbuf_save_to_callback()/@.
    -> IO ((Bool, GError))
    -- ^ __Returns:__ @TRUE@ if successful, @FALSE@ otherwise

-- | A convenience synonym for @`Nothing` :: `Maybe` `PixbufSaveFunc_WithClosures`@.
noPixbufSaveFunc_WithClosures :: Maybe PixbufSaveFunc_WithClosures
noPixbufSaveFunc_WithClosures :: Maybe PixbufSaveFunc_WithClosures
noPixbufSaveFunc_WithClosures = Maybe PixbufSaveFunc_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_PixbufSaveFunc :: PixbufSaveFunc -> PixbufSaveFunc_WithClosures
drop_closures_PixbufSaveFunc :: PixbufSaveFunc -> PixbufSaveFunc_WithClosures
drop_closures_PixbufSaveFunc PixbufSaveFunc
_f ByteString
buf Ptr ()
_ = PixbufSaveFunc
_f ByteString
buf

-- | Wrap the callback into a `GClosure`.
genClosure_PixbufSaveFunc :: MonadIO m => PixbufSaveFunc -> m (GClosure C_PixbufSaveFunc)
genClosure_PixbufSaveFunc :: forall (m :: * -> *).
MonadIO m =>
PixbufSaveFunc -> m (GClosure C_PixbufSaveFunc)
genClosure_PixbufSaveFunc PixbufSaveFunc
cb = IO (GClosure C_PixbufSaveFunc) -> m (GClosure C_PixbufSaveFunc)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_PixbufSaveFunc) -> m (GClosure C_PixbufSaveFunc))
-> IO (GClosure C_PixbufSaveFunc) -> m (GClosure C_PixbufSaveFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: PixbufSaveFunc_WithClosures
cb' = PixbufSaveFunc -> PixbufSaveFunc_WithClosures
drop_closures_PixbufSaveFunc PixbufSaveFunc
cb
    let cb'' :: C_PixbufSaveFunc
cb'' = Maybe (Ptr (FunPtr C_PixbufSaveFunc))
-> PixbufSaveFunc_WithClosures -> C_PixbufSaveFunc
wrap_PixbufSaveFunc Maybe (Ptr (FunPtr C_PixbufSaveFunc))
forall a. Maybe a
Nothing PixbufSaveFunc_WithClosures
cb'
    C_PixbufSaveFunc -> IO (FunPtr C_PixbufSaveFunc)
mk_PixbufSaveFunc C_PixbufSaveFunc
cb'' IO (FunPtr C_PixbufSaveFunc)
-> (FunPtr C_PixbufSaveFunc -> IO (GClosure C_PixbufSaveFunc))
-> IO (GClosure C_PixbufSaveFunc)
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_PixbufSaveFunc -> IO (GClosure C_PixbufSaveFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `PixbufSaveFunc` into a `C_PixbufSaveFunc`.
wrap_PixbufSaveFunc :: 
    Maybe (Ptr (FunPtr C_PixbufSaveFunc)) ->
    PixbufSaveFunc_WithClosures ->
    C_PixbufSaveFunc
wrap_PixbufSaveFunc :: Maybe (Ptr (FunPtr C_PixbufSaveFunc))
-> PixbufSaveFunc_WithClosures -> C_PixbufSaveFunc
wrap_PixbufSaveFunc Maybe (Ptr (FunPtr C_PixbufSaveFunc))
gi'funptrptr PixbufSaveFunc_WithClosures
gi'cb Ptr Word8
buf Word64
count Ptr (Ptr GError)
error_ Ptr ()
data_ = do
    ByteString
buf' <- (Word64 -> Ptr Word8 -> IO ByteString
forall a. Integral a => a -> Ptr Word8 -> IO ByteString
unpackByteStringWithLength Word64
count) Ptr Word8
buf
    (Bool
result, GError
outerror_) <- PixbufSaveFunc_WithClosures
gi'cb  ByteString
buf' Ptr ()
data_
    Ptr GError
outerror_' <- GError -> IO (Ptr GError)
forall a. (HasCallStack, GBoxed a) => a -> IO (Ptr a)
B.ManagedPtr.disownBoxed GError
outerror_
    Ptr (Ptr GError) -> Ptr GError -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (Ptr GError)
error_ Ptr GError
outerror_'
    Maybe (Ptr (FunPtr C_PixbufSaveFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_PixbufSaveFunc))
gi'funptrptr
    let result' :: CInt
result' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
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
fromEnum) Bool
result
    CInt -> IO CInt
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CInt
result'


-- callback PixbufModuleUpdatedFunc
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "pixbuf"
          , argType =
              TInterface Name { namespace = "GdkPixbuf" , name = "Pixbuf" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just "the #GdkPixbuf that is currently being loaded."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "x"
          , argType = TBasicType TInt
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the X origin of the updated area."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "y"
          , argType = TBasicType TInt
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the Y origin of the updated area."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "width"
          , argType = TBasicType TInt
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the width of the updated area."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "height"
          , argType = TBasicType TInt
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the height of the updated area."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "the loader." , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = 5
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Defines the type of the function that gets called every time a region\nof @pixbuf is updated.\n\n#GdkPixbufLoader uses a function of this type to emit the\n\"<link linkend=\"GdkPixbufLoader-area-updated\">area_updated</link>\"\nsignal."
        , sinceVersion = Just "2.2"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_PixbufModuleUpdatedFunc =
    Ptr GdkPixbuf.Pixbuf.Pixbuf ->
    Int32 ->
    Int32 ->
    Int32 ->
    Int32 ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "pixbuf"
--           , argType =
--               TInterface Name { namespace = "GdkPixbuf" , name = "Pixbuf" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the #GdkPixbuf that is currently being loaded."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "x"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the X origin of the updated area."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "y"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the Y origin of the updated area."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "width"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the width of the updated area."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "height"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the height of the updated area."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the loader." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 5
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_PixbufModuleUpdatedFunc :: FunPtr C_PixbufModuleUpdatedFunc -> C_PixbufModuleUpdatedFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PixbufModuleUpdatedFunc ::
    (B.CallStack.HasCallStack, MonadIO m, GdkPixbuf.Pixbuf.IsPixbuf a) =>
    FunPtr C_PixbufModuleUpdatedFunc
    -> a
    -- ^ /@pixbuf@/: the t'GI.GdkPixbuf.Objects.Pixbuf.Pixbuf' that is currently being loaded.
    -> Int32
    -- ^ /@x@/: the X origin of the updated area.
    -> Int32
    -- ^ /@y@/: the Y origin of the updated area.
    -> Int32
    -- ^ /@width@/: the width of the updated area.
    -> Int32
    -- ^ /@height@/: the height of the updated area.
    -> Ptr ()
    -- ^ /@userData@/: the loader.
    -> m ()
dynamic_PixbufModuleUpdatedFunc :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsPixbuf a) =>
FunPtr C_PixbufModuleUpdatedFunc
-> a -> Int32 -> Int32 -> Int32 -> Int32 -> Ptr () -> m ()
dynamic_PixbufModuleUpdatedFunc FunPtr C_PixbufModuleUpdatedFunc
__funPtr a
pixbuf Int32
x Int32
y Int32
width Int32
height 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 Pixbuf
pixbuf' <- a -> IO (Ptr Pixbuf)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
pixbuf
    (FunPtr C_PixbufModuleUpdatedFunc -> C_PixbufModuleUpdatedFunc
__dynamic_C_PixbufModuleUpdatedFunc FunPtr C_PixbufModuleUpdatedFunc
__funPtr) Ptr Pixbuf
pixbuf' Int32
x Int32
y Int32
width Int32
height Ptr ()
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
pixbuf
    () -> 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_PixbufModuleUpdatedFunc`.
foreign import ccall "wrapper"
    mk_PixbufModuleUpdatedFunc :: C_PixbufModuleUpdatedFunc -> IO (FunPtr C_PixbufModuleUpdatedFunc)

-- | Defines the type of the function that gets called every time a region
-- of /@pixbuf@/ is updated.
-- 
-- t'GI.GdkPixbuf.Objects.PixbufLoader.PixbufLoader' uses a function of this type to emit the
-- \"\<link linkend=\"GdkPixbufLoader-area-updated\">area_updated\<\/link>\"
-- signal.
-- 
-- /Since: 2.2/
type PixbufModuleUpdatedFunc =
    GdkPixbuf.Pixbuf.Pixbuf
    -- ^ /@pixbuf@/: the t'GI.GdkPixbuf.Objects.Pixbuf.Pixbuf' that is currently being loaded.
    -> Int32
    -- ^ /@x@/: the X origin of the updated area.
    -> Int32
    -- ^ /@y@/: the Y origin of the updated area.
    -> Int32
    -- ^ /@width@/: the width of the updated area.
    -> Int32
    -- ^ /@height@/: the height of the updated area.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `PixbufModuleUpdatedFunc`@.
noPixbufModuleUpdatedFunc :: Maybe PixbufModuleUpdatedFunc
noPixbufModuleUpdatedFunc :: Maybe PixbufModuleUpdatedFunc
noPixbufModuleUpdatedFunc = Maybe PixbufModuleUpdatedFunc
forall a. Maybe a
Nothing

-- | Defines the type of the function that gets called every time a region
-- of /@pixbuf@/ is updated.
-- 
-- t'GI.GdkPixbuf.Objects.PixbufLoader.PixbufLoader' uses a function of this type to emit the
-- \"\<link linkend=\"GdkPixbufLoader-area-updated\">area_updated\<\/link>\"
-- signal.
-- 
-- /Since: 2.2/
type PixbufModuleUpdatedFunc_WithClosures =
    GdkPixbuf.Pixbuf.Pixbuf
    -- ^ /@pixbuf@/: the t'GI.GdkPixbuf.Objects.Pixbuf.Pixbuf' that is currently being loaded.
    -> Int32
    -- ^ /@x@/: the X origin of the updated area.
    -> Int32
    -- ^ /@y@/: the Y origin of the updated area.
    -> Int32
    -- ^ /@width@/: the width of the updated area.
    -> Int32
    -- ^ /@height@/: the height of the updated area.
    -> Ptr ()
    -- ^ /@userData@/: the loader.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `PixbufModuleUpdatedFunc_WithClosures`@.
noPixbufModuleUpdatedFunc_WithClosures :: Maybe PixbufModuleUpdatedFunc_WithClosures
noPixbufModuleUpdatedFunc_WithClosures :: Maybe PixbufModuleUpdatedFunc_WithClosures
noPixbufModuleUpdatedFunc_WithClosures = Maybe PixbufModuleUpdatedFunc_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_PixbufModuleUpdatedFunc :: PixbufModuleUpdatedFunc -> PixbufModuleUpdatedFunc_WithClosures
drop_closures_PixbufModuleUpdatedFunc :: PixbufModuleUpdatedFunc -> PixbufModuleUpdatedFunc_WithClosures
drop_closures_PixbufModuleUpdatedFunc PixbufModuleUpdatedFunc
_f Pixbuf
pixbuf Int32
x Int32
y Int32
width Int32
height Ptr ()
_ = PixbufModuleUpdatedFunc
_f Pixbuf
pixbuf Int32
x Int32
y Int32
width Int32
height

-- | Wrap the callback into a `GClosure`.
genClosure_PixbufModuleUpdatedFunc :: MonadIO m => PixbufModuleUpdatedFunc -> m (GClosure C_PixbufModuleUpdatedFunc)
genClosure_PixbufModuleUpdatedFunc :: forall (m :: * -> *).
MonadIO m =>
PixbufModuleUpdatedFunc -> m (GClosure C_PixbufModuleUpdatedFunc)
genClosure_PixbufModuleUpdatedFunc PixbufModuleUpdatedFunc
cb = IO (GClosure C_PixbufModuleUpdatedFunc)
-> m (GClosure C_PixbufModuleUpdatedFunc)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_PixbufModuleUpdatedFunc)
 -> m (GClosure C_PixbufModuleUpdatedFunc))
-> IO (GClosure C_PixbufModuleUpdatedFunc)
-> m (GClosure C_PixbufModuleUpdatedFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: PixbufModuleUpdatedFunc_WithClosures
cb' = PixbufModuleUpdatedFunc -> PixbufModuleUpdatedFunc_WithClosures
drop_closures_PixbufModuleUpdatedFunc PixbufModuleUpdatedFunc
cb
    let cb'' :: C_PixbufModuleUpdatedFunc
cb'' = Maybe (Ptr (FunPtr C_PixbufModuleUpdatedFunc))
-> PixbufModuleUpdatedFunc_WithClosures
-> C_PixbufModuleUpdatedFunc
wrap_PixbufModuleUpdatedFunc Maybe (Ptr (FunPtr C_PixbufModuleUpdatedFunc))
forall a. Maybe a
Nothing PixbufModuleUpdatedFunc_WithClosures
cb'
    C_PixbufModuleUpdatedFunc -> IO (FunPtr C_PixbufModuleUpdatedFunc)
mk_PixbufModuleUpdatedFunc C_PixbufModuleUpdatedFunc
cb'' IO (FunPtr C_PixbufModuleUpdatedFunc)
-> (FunPtr C_PixbufModuleUpdatedFunc
    -> IO (GClosure C_PixbufModuleUpdatedFunc))
-> IO (GClosure C_PixbufModuleUpdatedFunc)
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_PixbufModuleUpdatedFunc
-> IO (GClosure C_PixbufModuleUpdatedFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `PixbufModuleUpdatedFunc` into a `C_PixbufModuleUpdatedFunc`.
wrap_PixbufModuleUpdatedFunc :: 
    Maybe (Ptr (FunPtr C_PixbufModuleUpdatedFunc)) ->
    PixbufModuleUpdatedFunc_WithClosures ->
    C_PixbufModuleUpdatedFunc
wrap_PixbufModuleUpdatedFunc :: Maybe (Ptr (FunPtr C_PixbufModuleUpdatedFunc))
-> PixbufModuleUpdatedFunc_WithClosures
-> C_PixbufModuleUpdatedFunc
wrap_PixbufModuleUpdatedFunc Maybe (Ptr (FunPtr C_PixbufModuleUpdatedFunc))
gi'funptrptr PixbufModuleUpdatedFunc_WithClosures
gi'cb Ptr Pixbuf
pixbuf Int32
x Int32
y Int32
width Int32
height Ptr ()
userData = do
    Pixbuf
pixbuf' <- ((ManagedPtr Pixbuf -> Pixbuf) -> Ptr Pixbuf -> IO Pixbuf
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Pixbuf -> Pixbuf
GdkPixbuf.Pixbuf.Pixbuf) Ptr Pixbuf
pixbuf
    PixbufModuleUpdatedFunc_WithClosures
gi'cb  Pixbuf
pixbuf' Int32
x Int32
y Int32
width Int32
height Ptr ()
userData
    Maybe (Ptr (FunPtr C_PixbufModuleUpdatedFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_PixbufModuleUpdatedFunc))
gi'funptrptr


-- callback PixbufModuleStopLoadFunc
{- Callable
  { returnType = Just (TBasicType TBoolean)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just "`TRUE` if the loading operation was successful"
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "context"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "the state object created by [callback@GdkPixbuf.PixbufModuleBeginLoadFunc]"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferEverything
          }
      ]
  , skipReturn = False
  , callableThrows = True
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Finalizes the image loading state.\n\nThis function is called on success and error states."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_PixbufModuleStopLoadFunc =
    Ptr () ->
    Ptr (Ptr GError) ->
    IO CInt

-- Args: [ Arg
--           { argCName = "context"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the state object created by [callback@GdkPixbuf.PixbufModuleBeginLoadFunc]"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_PixbufModuleStopLoadFunc :: FunPtr C_PixbufModuleStopLoadFunc -> C_PixbufModuleStopLoadFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PixbufModuleStopLoadFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_PixbufModuleStopLoadFunc
    -> Ptr ()
    -- ^ /@context@/: the state object created by [callback/@gdkPixbuf@/.PixbufModuleBeginLoadFunc]
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
dynamic_PixbufModuleStopLoadFunc :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_PixbufModuleStopLoadFunc -> Ptr () -> m ()
dynamic_PixbufModuleStopLoadFunc FunPtr C_PixbufModuleStopLoadFunc
__funPtr Ptr ()
context = 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
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ (FunPtr C_PixbufModuleStopLoadFunc -> C_PixbufModuleStopLoadFunc
__dynamic_C_PixbufModuleStopLoadFunc FunPtr C_PixbufModuleStopLoadFunc
__funPtr) Ptr ()
context
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> 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_PixbufModuleStopLoadFunc`.
foreign import ccall "wrapper"
    mk_PixbufModuleStopLoadFunc :: C_PixbufModuleStopLoadFunc -> IO (FunPtr C_PixbufModuleStopLoadFunc)

-- | Finalizes the image loading state.
-- 
-- This function is called on success and error states.
type PixbufModuleStopLoadFunc =
    Ptr ()
    -- ^ /@context@/: the state object created by [callback/@gdkPixbuf@/.PixbufModuleBeginLoadFunc]
    -> IO ()
    -- ^ __Returns:__ @TRUE@ if the loading operation was successful /(Can throw 'Data.GI.Base.GError.GError')/

-- | A convenience synonym for @`Nothing` :: `Maybe` `PixbufModuleStopLoadFunc`@.
noPixbufModuleStopLoadFunc :: Maybe PixbufModuleStopLoadFunc
noPixbufModuleStopLoadFunc :: Maybe PixbufModuleStopLoadFunc
noPixbufModuleStopLoadFunc = Maybe PixbufModuleStopLoadFunc
forall a. Maybe a
Nothing

-- No Haskell->C wrapper generated since the function throws.

-- callback PixbufModuleSizeFunc
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "width"
          , argType = TBasicType TInt
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just "pointer to a location containing the current image width"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "height"
          , argType = TBasicType TInt
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just "pointer to a location containing the current image height"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "the loader." , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Defines the type of the function that gets called once the size\nof the loaded image is known.\n\nThe function is expected to set @width and @height to the desired\nsize to which the image should be scaled. If a module has no efficient\nway to achieve the desired scaling during the loading of the image, it may\neither ignore the size request, or only approximate it - gdk-pixbuf will\nthen perform the required scaling on the completely loaded image.\n\nIf the function sets @width or @height to zero, the module should interpret\nthis as a hint that it will be closed soon and shouldn't allocate further\nresources. This convention is used to implement gdk_pixbuf_get_file_info()\nefficiently."
        , sinceVersion = Just "2.2"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_PixbufModuleSizeFunc =
    Int32 ->
    Int32 ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "width"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "pointer to a location containing the current image width"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "height"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "pointer to a location containing the current image height"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the loader." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_PixbufModuleSizeFunc :: FunPtr C_PixbufModuleSizeFunc -> C_PixbufModuleSizeFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PixbufModuleSizeFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_PixbufModuleSizeFunc
    -> Int32
    -- ^ /@width@/: pointer to a location containing the current image width
    -> Int32
    -- ^ /@height@/: pointer to a location containing the current image height
    -> Ptr ()
    -- ^ /@userData@/: the loader.
    -> m ()
dynamic_PixbufModuleSizeFunc :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_PixbufModuleSizeFunc -> Int32 -> Int32 -> Ptr () -> m ()
dynamic_PixbufModuleSizeFunc FunPtr C_PixbufModuleSizeFunc
__funPtr Int32
width Int32
height 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
    (FunPtr C_PixbufModuleSizeFunc -> C_PixbufModuleSizeFunc
__dynamic_C_PixbufModuleSizeFunc FunPtr C_PixbufModuleSizeFunc
__funPtr) Int32
width Int32
height Ptr ()
userData
    () -> 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_PixbufModuleSizeFunc`.
foreign import ccall "wrapper"
    mk_PixbufModuleSizeFunc :: C_PixbufModuleSizeFunc -> IO (FunPtr C_PixbufModuleSizeFunc)

-- | Defines the type of the function that gets called once the size
-- of the loaded image is known.
-- 
-- The function is expected to set /@width@/ and /@height@/ to the desired
-- size to which the image should be scaled. If a module has no efficient
-- way to achieve the desired scaling during the loading of the image, it may
-- either ignore the size request, or only approximate it - gdk-pixbuf will
-- then perform the required scaling on the completely loaded image.
-- 
-- If the function sets /@width@/ or /@height@/ to zero, the module should interpret
-- this as a hint that it will be closed soon and shouldn\'t allocate further
-- resources. This convention is used to implement 'GI.GdkPixbuf.Objects.Pixbuf.pixbufGetFileInfo'
-- efficiently.
-- 
-- /Since: 2.2/
type PixbufModuleSizeFunc =
    Int32
    -- ^ /@width@/: pointer to a location containing the current image width
    -> Int32
    -- ^ /@height@/: pointer to a location containing the current image height
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `PixbufModuleSizeFunc`@.
noPixbufModuleSizeFunc :: Maybe PixbufModuleSizeFunc
noPixbufModuleSizeFunc :: Maybe PixbufModuleSizeFunc
noPixbufModuleSizeFunc = Maybe PixbufModuleSizeFunc
forall a. Maybe a
Nothing

-- | Defines the type of the function that gets called once the size
-- of the loaded image is known.
-- 
-- The function is expected to set /@width@/ and /@height@/ to the desired
-- size to which the image should be scaled. If a module has no efficient
-- way to achieve the desired scaling during the loading of the image, it may
-- either ignore the size request, or only approximate it - gdk-pixbuf will
-- then perform the required scaling on the completely loaded image.
-- 
-- If the function sets /@width@/ or /@height@/ to zero, the module should interpret
-- this as a hint that it will be closed soon and shouldn\'t allocate further
-- resources. This convention is used to implement 'GI.GdkPixbuf.Objects.Pixbuf.pixbufGetFileInfo'
-- efficiently.
-- 
-- /Since: 2.2/
type PixbufModuleSizeFunc_WithClosures =
    Int32
    -- ^ /@width@/: pointer to a location containing the current image width
    -> Int32
    -- ^ /@height@/: pointer to a location containing the current image height
    -> Ptr ()
    -- ^ /@userData@/: the loader.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `PixbufModuleSizeFunc_WithClosures`@.
noPixbufModuleSizeFunc_WithClosures :: Maybe PixbufModuleSizeFunc_WithClosures
noPixbufModuleSizeFunc_WithClosures :: Maybe C_PixbufModuleSizeFunc
noPixbufModuleSizeFunc_WithClosures = Maybe C_PixbufModuleSizeFunc
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_PixbufModuleSizeFunc :: PixbufModuleSizeFunc -> PixbufModuleSizeFunc_WithClosures
drop_closures_PixbufModuleSizeFunc :: PixbufModuleSizeFunc -> C_PixbufModuleSizeFunc
drop_closures_PixbufModuleSizeFunc PixbufModuleSizeFunc
_f Int32
width Int32
height Ptr ()
_ = PixbufModuleSizeFunc
_f Int32
width Int32
height

-- | Wrap the callback into a `GClosure`.
genClosure_PixbufModuleSizeFunc :: MonadIO m => PixbufModuleSizeFunc -> m (GClosure C_PixbufModuleSizeFunc)
genClosure_PixbufModuleSizeFunc :: forall (m :: * -> *).
MonadIO m =>
PixbufModuleSizeFunc -> m (GClosure C_PixbufModuleSizeFunc)
genClosure_PixbufModuleSizeFunc PixbufModuleSizeFunc
cb = IO (GClosure C_PixbufModuleSizeFunc)
-> m (GClosure C_PixbufModuleSizeFunc)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_PixbufModuleSizeFunc)
 -> m (GClosure C_PixbufModuleSizeFunc))
-> IO (GClosure C_PixbufModuleSizeFunc)
-> m (GClosure C_PixbufModuleSizeFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_PixbufModuleSizeFunc
cb' = PixbufModuleSizeFunc -> C_PixbufModuleSizeFunc
drop_closures_PixbufModuleSizeFunc PixbufModuleSizeFunc
cb
    let cb'' :: C_PixbufModuleSizeFunc
cb'' = Maybe (Ptr (FunPtr C_PixbufModuleSizeFunc))
-> C_PixbufModuleSizeFunc -> C_PixbufModuleSizeFunc
wrap_PixbufModuleSizeFunc Maybe (Ptr (FunPtr C_PixbufModuleSizeFunc))
forall a. Maybe a
Nothing C_PixbufModuleSizeFunc
cb'
    C_PixbufModuleSizeFunc -> IO (FunPtr C_PixbufModuleSizeFunc)
mk_PixbufModuleSizeFunc C_PixbufModuleSizeFunc
cb'' IO (FunPtr C_PixbufModuleSizeFunc)
-> (FunPtr C_PixbufModuleSizeFunc
    -> IO (GClosure C_PixbufModuleSizeFunc))
-> IO (GClosure C_PixbufModuleSizeFunc)
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_PixbufModuleSizeFunc
-> IO (GClosure C_PixbufModuleSizeFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `PixbufModuleSizeFunc` into a `C_PixbufModuleSizeFunc`.
wrap_PixbufModuleSizeFunc :: 
    Maybe (Ptr (FunPtr C_PixbufModuleSizeFunc)) ->
    PixbufModuleSizeFunc_WithClosures ->
    C_PixbufModuleSizeFunc
wrap_PixbufModuleSizeFunc :: Maybe (Ptr (FunPtr C_PixbufModuleSizeFunc))
-> C_PixbufModuleSizeFunc -> C_PixbufModuleSizeFunc
wrap_PixbufModuleSizeFunc Maybe (Ptr (FunPtr C_PixbufModuleSizeFunc))
gi'funptrptr C_PixbufModuleSizeFunc
gi'cb Int32
width Int32
height Ptr ()
userData = do
    C_PixbufModuleSizeFunc
gi'cb  Int32
width Int32
height Ptr ()
userData
    Maybe (Ptr (FunPtr C_PixbufModuleSizeFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_PixbufModuleSizeFunc))
gi'funptrptr


-- callback PixbufModuleSaveOptionSupportedFunc
{- Callable
  { returnType = Just (TBasicType TBoolean)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText = Just "`TRUE` if the option is supported"
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "option_key"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the option key to check"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Checks whether the given `option_key` is supported when saving."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_PixbufModuleSaveOptionSupportedFunc =
    CString ->
    IO CInt

-- Args: [ Arg
--           { argCName = "option_key"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the option key to check"
--                 , 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_PixbufModuleSaveOptionSupportedFunc :: FunPtr C_PixbufModuleSaveOptionSupportedFunc -> C_PixbufModuleSaveOptionSupportedFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PixbufModuleSaveOptionSupportedFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_PixbufModuleSaveOptionSupportedFunc
    -> T.Text
    -- ^ /@optionKey@/: the option key to check
    -> m Bool
    -- ^ __Returns:__ @TRUE@ if the option is supported
dynamic_PixbufModuleSaveOptionSupportedFunc :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_PixbufModuleSaveOptionSupportedFunc -> Text -> m Bool
dynamic_PixbufModuleSaveOptionSupportedFunc FunPtr C_PixbufModuleSaveOptionSupportedFunc
__funPtr Text
optionKey = 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
    CString
optionKey' <- Text -> IO CString
textToCString Text
optionKey
    CInt
result <- (FunPtr C_PixbufModuleSaveOptionSupportedFunc
-> C_PixbufModuleSaveOptionSupportedFunc
__dynamic_C_PixbufModuleSaveOptionSupportedFunc FunPtr C_PixbufModuleSaveOptionSupportedFunc
__funPtr) CString
optionKey'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
optionKey'
    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_PixbufModuleSaveOptionSupportedFunc`.
foreign import ccall "wrapper"
    mk_PixbufModuleSaveOptionSupportedFunc :: C_PixbufModuleSaveOptionSupportedFunc -> IO (FunPtr C_PixbufModuleSaveOptionSupportedFunc)

-- | Checks whether the given @option_key@ is supported when saving.
type PixbufModuleSaveOptionSupportedFunc =
    T.Text
    -- ^ /@optionKey@/: the option key to check
    -> IO Bool
    -- ^ __Returns:__ @TRUE@ if the option is supported

-- | A convenience synonym for @`Nothing` :: `Maybe` `PixbufModuleSaveOptionSupportedFunc`@.
noPixbufModuleSaveOptionSupportedFunc :: Maybe PixbufModuleSaveOptionSupportedFunc
noPixbufModuleSaveOptionSupportedFunc :: Maybe PixbufModuleSaveOptionSupportedFunc
noPixbufModuleSaveOptionSupportedFunc = Maybe PixbufModuleSaveOptionSupportedFunc
forall a. Maybe a
Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_PixbufModuleSaveOptionSupportedFunc :: MonadIO m => PixbufModuleSaveOptionSupportedFunc -> m (GClosure C_PixbufModuleSaveOptionSupportedFunc)
genClosure_PixbufModuleSaveOptionSupportedFunc :: forall (m :: * -> *).
MonadIO m =>
PixbufModuleSaveOptionSupportedFunc
-> m (GClosure C_PixbufModuleSaveOptionSupportedFunc)
genClosure_PixbufModuleSaveOptionSupportedFunc PixbufModuleSaveOptionSupportedFunc
cb = IO (GClosure C_PixbufModuleSaveOptionSupportedFunc)
-> m (GClosure C_PixbufModuleSaveOptionSupportedFunc)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_PixbufModuleSaveOptionSupportedFunc)
 -> m (GClosure C_PixbufModuleSaveOptionSupportedFunc))
-> IO (GClosure C_PixbufModuleSaveOptionSupportedFunc)
-> m (GClosure C_PixbufModuleSaveOptionSupportedFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_PixbufModuleSaveOptionSupportedFunc
cb' = Maybe (Ptr (FunPtr C_PixbufModuleSaveOptionSupportedFunc))
-> PixbufModuleSaveOptionSupportedFunc
-> C_PixbufModuleSaveOptionSupportedFunc
wrap_PixbufModuleSaveOptionSupportedFunc Maybe (Ptr (FunPtr C_PixbufModuleSaveOptionSupportedFunc))
forall a. Maybe a
Nothing PixbufModuleSaveOptionSupportedFunc
cb
    C_PixbufModuleSaveOptionSupportedFunc
-> IO (FunPtr C_PixbufModuleSaveOptionSupportedFunc)
mk_PixbufModuleSaveOptionSupportedFunc C_PixbufModuleSaveOptionSupportedFunc
cb' IO (FunPtr C_PixbufModuleSaveOptionSupportedFunc)
-> (FunPtr C_PixbufModuleSaveOptionSupportedFunc
    -> IO (GClosure C_PixbufModuleSaveOptionSupportedFunc))
-> IO (GClosure C_PixbufModuleSaveOptionSupportedFunc)
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_PixbufModuleSaveOptionSupportedFunc
-> IO (GClosure C_PixbufModuleSaveOptionSupportedFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `PixbufModuleSaveOptionSupportedFunc` into a `C_PixbufModuleSaveOptionSupportedFunc`.
wrap_PixbufModuleSaveOptionSupportedFunc :: 
    Maybe (Ptr (FunPtr C_PixbufModuleSaveOptionSupportedFunc)) ->
    PixbufModuleSaveOptionSupportedFunc ->
    C_PixbufModuleSaveOptionSupportedFunc
wrap_PixbufModuleSaveOptionSupportedFunc :: Maybe (Ptr (FunPtr C_PixbufModuleSaveOptionSupportedFunc))
-> PixbufModuleSaveOptionSupportedFunc
-> C_PixbufModuleSaveOptionSupportedFunc
wrap_PixbufModuleSaveOptionSupportedFunc Maybe (Ptr (FunPtr C_PixbufModuleSaveOptionSupportedFunc))
gi'funptrptr PixbufModuleSaveOptionSupportedFunc
gi'cb CString
optionKey = do
    Text
optionKey' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
optionKey
    Bool
result <- PixbufModuleSaveOptionSupportedFunc
gi'cb  Text
optionKey'
    Maybe (Ptr (FunPtr C_PixbufModuleSaveOptionSupportedFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_PixbufModuleSaveOptionSupportedFunc))
gi'funptrptr
    let result' :: CInt
result' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
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
fromEnum) Bool
result
    CInt -> IO CInt
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CInt
result'


-- callback PixbufModuleSaveFunc
{- Callable
  { returnType = Just (TBasicType TBoolean)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just
              "`TRUE` on success; in case of failure, `FALSE` is returned and\n  the `error` is set"
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "f"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText =
                    Just "the file stream into which the image should be saved"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "pixbuf"
          , argType =
              TInterface Name { namespace = "GdkPixbuf" , name = "Pixbuf" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the image to save" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "param_keys"
          , argType = TCArray True (-1) (-1) (TBasicType TUTF8)
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "parameter keys to save"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "param_values"
          , argType = TCArray True (-1) (-1) (TBasicType TUTF8)
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "parameter values to save"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = True
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Saves a `GdkPixbuf` into a standard C file stream.\n\nThe optional `param_keys` and `param_values` arrays contain the keys and\nvalues (in the same order) for attributes to be saved alongside the image\ndata."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_PixbufModuleSaveFunc =
    Ptr () ->
    Ptr GdkPixbuf.Pixbuf.Pixbuf ->
    Ptr CString ->
    Ptr CString ->
    Ptr (Ptr GError) ->
    IO CInt

-- Args: [ Arg
--           { argCName = "f"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the file stream into which the image should be saved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "pixbuf"
--           , argType =
--               TInterface Name { namespace = "GdkPixbuf" , name = "Pixbuf" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the image to save" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "param_keys"
--           , argType = TCArray True (-1) (-1) (TBasicType TUTF8)
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "parameter keys to save"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "param_values"
--           , argType = TCArray True (-1) (-1) (TBasicType TUTF8)
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "parameter values to save"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_PixbufModuleSaveFunc :: FunPtr C_PixbufModuleSaveFunc -> C_PixbufModuleSaveFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PixbufModuleSaveFunc ::
    (B.CallStack.HasCallStack, MonadIO m, GdkPixbuf.Pixbuf.IsPixbuf a) =>
    FunPtr C_PixbufModuleSaveFunc
    -> Ptr ()
    -- ^ /@f@/: the file stream into which the image should be saved
    -> a
    -- ^ /@pixbuf@/: the image to save
    -> Maybe ([T.Text])
    -- ^ /@paramKeys@/: parameter keys to save
    -> Maybe ([T.Text])
    -- ^ /@paramValues@/: parameter values to save
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
dynamic_PixbufModuleSaveFunc :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsPixbuf a) =>
FunPtr C_PixbufModuleSaveFunc
-> Ptr () -> a -> Maybe [Text] -> Maybe [Text] -> m ()
dynamic_PixbufModuleSaveFunc FunPtr C_PixbufModuleSaveFunc
__funPtr Ptr ()
f a
pixbuf Maybe [Text]
paramKeys Maybe [Text]
paramValues = 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 Pixbuf
pixbuf' <- a -> IO (Ptr Pixbuf)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
pixbuf
    Ptr CString
maybeParamKeys <- case Maybe [Text]
paramKeys of
        Maybe [Text]
Nothing -> Ptr CString -> IO (Ptr CString)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CString
forall a. Ptr a
nullPtr
        Just [Text]
jParamKeys -> do
            Ptr CString
jParamKeys' <- [Text] -> IO (Ptr CString)
packZeroTerminatedUTF8CArray [Text]
jParamKeys
            Ptr CString -> IO (Ptr CString)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CString
jParamKeys'
    Ptr CString
maybeParamValues <- case Maybe [Text]
paramValues of
        Maybe [Text]
Nothing -> Ptr CString -> IO (Ptr CString)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CString
forall a. Ptr a
nullPtr
        Just [Text]
jParamValues -> do
            Ptr CString
jParamValues' <- [Text] -> IO (Ptr CString)
packZeroTerminatedUTF8CArray [Text]
jParamValues
            Ptr CString -> IO (Ptr CString)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CString
jParamValues'
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ (FunPtr C_PixbufModuleSaveFunc -> C_PixbufModuleSaveFunc
__dynamic_C_PixbufModuleSaveFunc FunPtr C_PixbufModuleSaveFunc
__funPtr) Ptr ()
f Ptr Pixbuf
pixbuf' Ptr CString
maybeParamKeys Ptr CString
maybeParamValues
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
pixbuf
        (CString -> IO ()) -> Ptr CString -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (Ptr a) -> IO ()
mapZeroTerminatedCArray CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
maybeParamKeys
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
maybeParamKeys
        (CString -> IO ()) -> Ptr CString -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (Ptr a) -> IO ()
mapZeroTerminatedCArray CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
maybeParamValues
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
maybeParamValues
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        (CString -> IO ()) -> Ptr CString -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (Ptr a) -> IO ()
mapZeroTerminatedCArray CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
maybeParamKeys
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
maybeParamKeys
        (CString -> IO ()) -> Ptr CString -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (Ptr a) -> IO ()
mapZeroTerminatedCArray CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
maybeParamValues
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
maybeParamValues
     )

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

-- | Saves a @GdkPixbuf@ into a standard C file stream.
-- 
-- The optional @param_keys@ and @param_values@ arrays contain the keys and
-- values (in the same order) for attributes to be saved alongside the image
-- data.
type PixbufModuleSaveFunc =
    Ptr ()
    -- ^ /@f@/: the file stream into which the image should be saved
    -> GdkPixbuf.Pixbuf.Pixbuf
    -- ^ /@pixbuf@/: the image to save
    -> Maybe [T.Text]
    -- ^ /@paramKeys@/: parameter keys to save
    -> Maybe [T.Text]
    -- ^ /@paramValues@/: parameter values to save
    -> IO ()
    -- ^ __Returns:__ @TRUE@ on success; in case of failure, @FALSE@ is returned and
    --   the @error@ is set /(Can throw 'Data.GI.Base.GError.GError')/

-- | A convenience synonym for @`Nothing` :: `Maybe` `PixbufModuleSaveFunc`@.
noPixbufModuleSaveFunc :: Maybe PixbufModuleSaveFunc
noPixbufModuleSaveFunc :: Maybe PixbufModuleSaveFunc
noPixbufModuleSaveFunc = Maybe PixbufModuleSaveFunc
forall a. Maybe a
Nothing

-- No Haskell->C wrapper generated since the function throws.

-- callback PixbufModulePreparedFunc
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "pixbuf"
          , argType =
              TInterface Name { namespace = "GdkPixbuf" , name = "Pixbuf" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just "the #GdkPixbuf that is currently being loaded."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "anim"
          , argType =
              TInterface
                Name { namespace = "GdkPixbuf" , name = "PixbufAnimation" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "if an animation is being loaded, the #GdkPixbufAnimation, else %NULL."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "the loader." , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Defines the type of the function that gets called once the initial\nsetup of @pixbuf is done.\n\n#GdkPixbufLoader uses a function of this type to emit the\n\"<link linkend=\"GdkPixbufLoader-area-prepared\">area_prepared</link>\"\nsignal."
        , sinceVersion = Just "2.2"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_PixbufModulePreparedFunc =
    Ptr GdkPixbuf.Pixbuf.Pixbuf ->
    Ptr GdkPixbuf.PixbufAnimation.PixbufAnimation ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "pixbuf"
--           , argType =
--               TInterface Name { namespace = "GdkPixbuf" , name = "Pixbuf" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the #GdkPixbuf that is currently being loaded."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "anim"
--           , argType =
--               TInterface
--                 Name { namespace = "GdkPixbuf" , name = "PixbufAnimation" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "if an animation is being loaded, the #GdkPixbufAnimation, else %NULL."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the loader." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_PixbufModulePreparedFunc :: FunPtr C_PixbufModulePreparedFunc -> C_PixbufModulePreparedFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PixbufModulePreparedFunc ::
    (B.CallStack.HasCallStack, MonadIO m, GdkPixbuf.Pixbuf.IsPixbuf a, GdkPixbuf.PixbufAnimation.IsPixbufAnimation b) =>
    FunPtr C_PixbufModulePreparedFunc
    -> a
    -- ^ /@pixbuf@/: the t'GI.GdkPixbuf.Objects.Pixbuf.Pixbuf' that is currently being loaded.
    -> b
    -- ^ /@anim@/: if an animation is being loaded, the t'GI.GdkPixbuf.Objects.PixbufAnimation.PixbufAnimation', else 'P.Nothing'.
    -> Ptr ()
    -- ^ /@userData@/: the loader.
    -> m ()
dynamic_PixbufModulePreparedFunc :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsPixbuf a, IsPixbufAnimation b) =>
FunPtr C_PixbufModulePreparedFunc -> a -> b -> Ptr () -> m ()
dynamic_PixbufModulePreparedFunc FunPtr C_PixbufModulePreparedFunc
__funPtr a
pixbuf b
anim 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 Pixbuf
pixbuf' <- a -> IO (Ptr Pixbuf)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
pixbuf
    Ptr PixbufAnimation
anim' <- b -> IO (Ptr PixbufAnimation)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
anim
    (FunPtr C_PixbufModulePreparedFunc -> C_PixbufModulePreparedFunc
__dynamic_C_PixbufModulePreparedFunc FunPtr C_PixbufModulePreparedFunc
__funPtr) Ptr Pixbuf
pixbuf' Ptr PixbufAnimation
anim' Ptr ()
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
pixbuf
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
anim
    () -> 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_PixbufModulePreparedFunc`.
foreign import ccall "wrapper"
    mk_PixbufModulePreparedFunc :: C_PixbufModulePreparedFunc -> IO (FunPtr C_PixbufModulePreparedFunc)

-- | Defines the type of the function that gets called once the initial
-- setup of /@pixbuf@/ is done.
-- 
-- t'GI.GdkPixbuf.Objects.PixbufLoader.PixbufLoader' uses a function of this type to emit the
-- \"\<link linkend=\"GdkPixbufLoader-area-prepared\">area_prepared\<\/link>\"
-- signal.
-- 
-- /Since: 2.2/
type PixbufModulePreparedFunc =
    GdkPixbuf.Pixbuf.Pixbuf
    -- ^ /@pixbuf@/: the t'GI.GdkPixbuf.Objects.Pixbuf.Pixbuf' that is currently being loaded.
    -> GdkPixbuf.PixbufAnimation.PixbufAnimation
    -- ^ /@anim@/: if an animation is being loaded, the t'GI.GdkPixbuf.Objects.PixbufAnimation.PixbufAnimation', else 'P.Nothing'.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `PixbufModulePreparedFunc`@.
noPixbufModulePreparedFunc :: Maybe PixbufModulePreparedFunc
noPixbufModulePreparedFunc :: Maybe PixbufModulePreparedFunc
noPixbufModulePreparedFunc = Maybe PixbufModulePreparedFunc
forall a. Maybe a
Nothing

-- | Defines the type of the function that gets called once the initial
-- setup of /@pixbuf@/ is done.
-- 
-- t'GI.GdkPixbuf.Objects.PixbufLoader.PixbufLoader' uses a function of this type to emit the
-- \"\<link linkend=\"GdkPixbufLoader-area-prepared\">area_prepared\<\/link>\"
-- signal.
-- 
-- /Since: 2.2/
type PixbufModulePreparedFunc_WithClosures =
    GdkPixbuf.Pixbuf.Pixbuf
    -- ^ /@pixbuf@/: the t'GI.GdkPixbuf.Objects.Pixbuf.Pixbuf' that is currently being loaded.
    -> GdkPixbuf.PixbufAnimation.PixbufAnimation
    -- ^ /@anim@/: if an animation is being loaded, the t'GI.GdkPixbuf.Objects.PixbufAnimation.PixbufAnimation', else 'P.Nothing'.
    -> Ptr ()
    -- ^ /@userData@/: the loader.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `PixbufModulePreparedFunc_WithClosures`@.
noPixbufModulePreparedFunc_WithClosures :: Maybe PixbufModulePreparedFunc_WithClosures
noPixbufModulePreparedFunc_WithClosures :: Maybe PixbufModulePreparedFunc_WithClosures
noPixbufModulePreparedFunc_WithClosures = Maybe PixbufModulePreparedFunc_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_PixbufModulePreparedFunc :: PixbufModulePreparedFunc -> PixbufModulePreparedFunc_WithClosures
drop_closures_PixbufModulePreparedFunc :: PixbufModulePreparedFunc -> PixbufModulePreparedFunc_WithClosures
drop_closures_PixbufModulePreparedFunc PixbufModulePreparedFunc
_f Pixbuf
pixbuf PixbufAnimation
anim Ptr ()
_ = PixbufModulePreparedFunc
_f Pixbuf
pixbuf PixbufAnimation
anim

-- | Wrap the callback into a `GClosure`.
genClosure_PixbufModulePreparedFunc :: MonadIO m => PixbufModulePreparedFunc -> m (GClosure C_PixbufModulePreparedFunc)
genClosure_PixbufModulePreparedFunc :: forall (m :: * -> *).
MonadIO m =>
PixbufModulePreparedFunc -> m (GClosure C_PixbufModulePreparedFunc)
genClosure_PixbufModulePreparedFunc PixbufModulePreparedFunc
cb = IO (GClosure C_PixbufModulePreparedFunc)
-> m (GClosure C_PixbufModulePreparedFunc)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_PixbufModulePreparedFunc)
 -> m (GClosure C_PixbufModulePreparedFunc))
-> IO (GClosure C_PixbufModulePreparedFunc)
-> m (GClosure C_PixbufModulePreparedFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: PixbufModulePreparedFunc_WithClosures
cb' = PixbufModulePreparedFunc -> PixbufModulePreparedFunc_WithClosures
drop_closures_PixbufModulePreparedFunc PixbufModulePreparedFunc
cb
    let cb'' :: C_PixbufModulePreparedFunc
cb'' = Maybe (Ptr (FunPtr C_PixbufModulePreparedFunc))
-> PixbufModulePreparedFunc_WithClosures
-> C_PixbufModulePreparedFunc
wrap_PixbufModulePreparedFunc Maybe (Ptr (FunPtr C_PixbufModulePreparedFunc))
forall a. Maybe a
Nothing PixbufModulePreparedFunc_WithClosures
cb'
    C_PixbufModulePreparedFunc
-> IO (FunPtr C_PixbufModulePreparedFunc)
mk_PixbufModulePreparedFunc C_PixbufModulePreparedFunc
cb'' IO (FunPtr C_PixbufModulePreparedFunc)
-> (FunPtr C_PixbufModulePreparedFunc
    -> IO (GClosure C_PixbufModulePreparedFunc))
-> IO (GClosure C_PixbufModulePreparedFunc)
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_PixbufModulePreparedFunc
-> IO (GClosure C_PixbufModulePreparedFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `PixbufModulePreparedFunc` into a `C_PixbufModulePreparedFunc`.
wrap_PixbufModulePreparedFunc :: 
    Maybe (Ptr (FunPtr C_PixbufModulePreparedFunc)) ->
    PixbufModulePreparedFunc_WithClosures ->
    C_PixbufModulePreparedFunc
wrap_PixbufModulePreparedFunc :: Maybe (Ptr (FunPtr C_PixbufModulePreparedFunc))
-> PixbufModulePreparedFunc_WithClosures
-> C_PixbufModulePreparedFunc
wrap_PixbufModulePreparedFunc Maybe (Ptr (FunPtr C_PixbufModulePreparedFunc))
gi'funptrptr PixbufModulePreparedFunc_WithClosures
gi'cb Ptr Pixbuf
pixbuf Ptr PixbufAnimation
anim Ptr ()
userData = do
    Pixbuf
pixbuf' <- ((ManagedPtr Pixbuf -> Pixbuf) -> Ptr Pixbuf -> IO Pixbuf
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Pixbuf -> Pixbuf
GdkPixbuf.Pixbuf.Pixbuf) Ptr Pixbuf
pixbuf
    PixbufAnimation
anim' <- ((ManagedPtr PixbufAnimation -> PixbufAnimation)
-> Ptr PixbufAnimation -> IO PixbufAnimation
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr PixbufAnimation -> PixbufAnimation
GdkPixbuf.PixbufAnimation.PixbufAnimation) Ptr PixbufAnimation
anim
    PixbufModulePreparedFunc_WithClosures
gi'cb  Pixbuf
pixbuf' PixbufAnimation
anim' Ptr ()
userData
    Maybe (Ptr (FunPtr C_PixbufModulePreparedFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_PixbufModulePreparedFunc))
gi'funptrptr


-- callback PixbufModuleLoadXpmDataFunc
{- Callable
  { returnType =
      Just
        (TInterface Name { namespace = "GdkPixbuf" , name = "Pixbuf" })
  , returnMayBeNull = False
  , returnTransfer = TransferEverything
  , returnDocumentation =
      Documentation
        { rawDocText = Just "a newly created `GdkPixbuf` for the XPM data"
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "data"
          , argType = TCArray True (-1) (-1) (TBasicType TUTF8)
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the XPM data" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText = Just "Loads XPM data into a new `GdkPixbuf`."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_PixbufModuleLoadXpmDataFunc =
    Ptr CString ->
    IO (Ptr GdkPixbuf.Pixbuf.Pixbuf)

-- Args: [ Arg
--           { argCName = "data"
--           , argType = TCArray True (-1) (-1) (TBasicType TUTF8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the XPM data" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "GdkPixbuf" , name = "Pixbuf" })
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_PixbufModuleLoadXpmDataFunc :: FunPtr C_PixbufModuleLoadXpmDataFunc -> C_PixbufModuleLoadXpmDataFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PixbufModuleLoadXpmDataFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_PixbufModuleLoadXpmDataFunc
    -> [T.Text]
    -- ^ /@data@/: the XPM data
    -> m GdkPixbuf.Pixbuf.Pixbuf
    -- ^ __Returns:__ a newly created @GdkPixbuf@ for the XPM data
dynamic_PixbufModuleLoadXpmDataFunc :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_PixbufModuleLoadXpmDataFunc -> [Text] -> m Pixbuf
dynamic_PixbufModuleLoadXpmDataFunc FunPtr C_PixbufModuleLoadXpmDataFunc
__funPtr [Text]
data_ = IO Pixbuf -> m Pixbuf
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Pixbuf -> m Pixbuf) -> IO Pixbuf -> m Pixbuf
forall a b. (a -> b) -> a -> b
$ do
    Ptr CString
data_' <- [Text] -> IO (Ptr CString)
packZeroTerminatedUTF8CArray [Text]
data_
    Ptr Pixbuf
result <- (FunPtr C_PixbufModuleLoadXpmDataFunc
-> C_PixbufModuleLoadXpmDataFunc
__dynamic_C_PixbufModuleLoadXpmDataFunc FunPtr C_PixbufModuleLoadXpmDataFunc
__funPtr) Ptr CString
data_'
    Text -> Ptr Pixbuf -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"pixbufModuleLoadXpmDataFunc" Ptr Pixbuf
result
    Pixbuf
result' <- ((ManagedPtr Pixbuf -> Pixbuf) -> Ptr Pixbuf -> IO Pixbuf
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Pixbuf -> Pixbuf
GdkPixbuf.Pixbuf.Pixbuf) Ptr Pixbuf
result
    (CString -> IO ()) -> Ptr CString -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (Ptr a) -> IO ()
mapZeroTerminatedCArray CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
data_'
    Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
data_'
    Pixbuf -> IO Pixbuf
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Pixbuf
result'

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

-- | Loads XPM data into a new @GdkPixbuf@.
type PixbufModuleLoadXpmDataFunc =
    [T.Text]
    -- ^ /@data@/: the XPM data
    -> IO GdkPixbuf.Pixbuf.Pixbuf
    -- ^ __Returns:__ a newly created @GdkPixbuf@ for the XPM data

-- | A convenience synonym for @`Nothing` :: `Maybe` `PixbufModuleLoadXpmDataFunc`@.
noPixbufModuleLoadXpmDataFunc :: Maybe PixbufModuleLoadXpmDataFunc
noPixbufModuleLoadXpmDataFunc :: Maybe PixbufModuleLoadXpmDataFunc
noPixbufModuleLoadXpmDataFunc = Maybe PixbufModuleLoadXpmDataFunc
forall a. Maybe a
Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_PixbufModuleLoadXpmDataFunc :: MonadIO m => PixbufModuleLoadXpmDataFunc -> m (GClosure C_PixbufModuleLoadXpmDataFunc)
genClosure_PixbufModuleLoadXpmDataFunc :: forall (m :: * -> *).
MonadIO m =>
PixbufModuleLoadXpmDataFunc
-> m (GClosure C_PixbufModuleLoadXpmDataFunc)
genClosure_PixbufModuleLoadXpmDataFunc PixbufModuleLoadXpmDataFunc
cb = IO (GClosure C_PixbufModuleLoadXpmDataFunc)
-> m (GClosure C_PixbufModuleLoadXpmDataFunc)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_PixbufModuleLoadXpmDataFunc)
 -> m (GClosure C_PixbufModuleLoadXpmDataFunc))
-> IO (GClosure C_PixbufModuleLoadXpmDataFunc)
-> m (GClosure C_PixbufModuleLoadXpmDataFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_PixbufModuleLoadXpmDataFunc
cb' = Maybe (Ptr (FunPtr C_PixbufModuleLoadXpmDataFunc))
-> PixbufModuleLoadXpmDataFunc -> C_PixbufModuleLoadXpmDataFunc
wrap_PixbufModuleLoadXpmDataFunc Maybe (Ptr (FunPtr C_PixbufModuleLoadXpmDataFunc))
forall a. Maybe a
Nothing PixbufModuleLoadXpmDataFunc
cb
    C_PixbufModuleLoadXpmDataFunc
-> IO (FunPtr C_PixbufModuleLoadXpmDataFunc)
mk_PixbufModuleLoadXpmDataFunc C_PixbufModuleLoadXpmDataFunc
cb' IO (FunPtr C_PixbufModuleLoadXpmDataFunc)
-> (FunPtr C_PixbufModuleLoadXpmDataFunc
    -> IO (GClosure C_PixbufModuleLoadXpmDataFunc))
-> IO (GClosure C_PixbufModuleLoadXpmDataFunc)
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_PixbufModuleLoadXpmDataFunc
-> IO (GClosure C_PixbufModuleLoadXpmDataFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `PixbufModuleLoadXpmDataFunc` into a `C_PixbufModuleLoadXpmDataFunc`.
wrap_PixbufModuleLoadXpmDataFunc :: 
    Maybe (Ptr (FunPtr C_PixbufModuleLoadXpmDataFunc)) ->
    PixbufModuleLoadXpmDataFunc ->
    C_PixbufModuleLoadXpmDataFunc
wrap_PixbufModuleLoadXpmDataFunc :: Maybe (Ptr (FunPtr C_PixbufModuleLoadXpmDataFunc))
-> PixbufModuleLoadXpmDataFunc -> C_PixbufModuleLoadXpmDataFunc
wrap_PixbufModuleLoadXpmDataFunc Maybe (Ptr (FunPtr C_PixbufModuleLoadXpmDataFunc))
gi'funptrptr PixbufModuleLoadXpmDataFunc
gi'cb Ptr CString
data_ = do
    [Text]
data_' <- HasCallStack => Ptr CString -> IO [Text]
Ptr CString -> IO [Text]
unpackZeroTerminatedUTF8CArray Ptr CString
data_
    Pixbuf
result <- PixbufModuleLoadXpmDataFunc
gi'cb  [Text]
data_'
    Maybe (Ptr (FunPtr C_PixbufModuleLoadXpmDataFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_PixbufModuleLoadXpmDataFunc))
gi'funptrptr
    Ptr Pixbuf
result' <- Pixbuf -> IO (Ptr Pixbuf)
forall a b. (HasCallStack, GObject a) => a -> IO (Ptr b)
B.ManagedPtr.disownObject Pixbuf
result
    Ptr Pixbuf -> IO (Ptr Pixbuf)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Pixbuf
result'


-- callback PixbufModuleLoadFunc
{- Callable
  { returnType =
      Just
        (TInterface Name { namespace = "GdkPixbuf" , name = "Pixbuf" })
  , returnMayBeNull = False
  , returnTransfer = TransferEverything
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just "a newly created `GdkPixbuf` for the contents of the file"
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "f"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText =
                    Just "the file stream from which the image should be loaded"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = True
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Loads a file from a standard C file stream into a new `GdkPixbuf`.\n\nIn case of error, this function should return `NULL` and set the `error` argument."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_PixbufModuleLoadFunc =
    Ptr () ->
    Ptr (Ptr GError) ->
    IO (Ptr GdkPixbuf.Pixbuf.Pixbuf)

-- Args: [ Arg
--           { argCName = "f"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the file stream from which the image should be loaded"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "GdkPixbuf" , name = "Pixbuf" })
-- throws : True
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_PixbufModuleLoadFunc :: FunPtr C_PixbufModuleLoadFunc -> C_PixbufModuleLoadFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PixbufModuleLoadFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_PixbufModuleLoadFunc
    -> Ptr ()
    -- ^ /@f@/: the file stream from which the image should be loaded
    -> m GdkPixbuf.Pixbuf.Pixbuf
    -- ^ __Returns:__ a newly created @GdkPixbuf@ for the contents of the file /(Can throw 'Data.GI.Base.GError.GError')/
dynamic_PixbufModuleLoadFunc :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_PixbufModuleLoadFunc -> Ptr () -> m Pixbuf
dynamic_PixbufModuleLoadFunc FunPtr C_PixbufModuleLoadFunc
__funPtr Ptr ()
f = IO Pixbuf -> m Pixbuf
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Pixbuf -> m Pixbuf) -> IO Pixbuf -> m Pixbuf
forall a b. (a -> b) -> a -> b
$ do
    IO Pixbuf -> IO () -> IO Pixbuf
forall a b. IO a -> IO b -> IO a
onException (do
        Ptr Pixbuf
result <- (Ptr (Ptr GError) -> IO (Ptr Pixbuf)) -> IO (Ptr Pixbuf)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr Pixbuf)) -> IO (Ptr Pixbuf))
-> (Ptr (Ptr GError) -> IO (Ptr Pixbuf)) -> IO (Ptr Pixbuf)
forall a b. (a -> b) -> a -> b
$ (FunPtr C_PixbufModuleLoadFunc -> C_PixbufModuleLoadFunc
__dynamic_C_PixbufModuleLoadFunc FunPtr C_PixbufModuleLoadFunc
__funPtr) Ptr ()
f
        Text -> Ptr Pixbuf -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"pixbufModuleLoadFunc" Ptr Pixbuf
result
        Pixbuf
result' <- ((ManagedPtr Pixbuf -> Pixbuf) -> Ptr Pixbuf -> IO Pixbuf
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Pixbuf -> Pixbuf
GdkPixbuf.Pixbuf.Pixbuf) Ptr Pixbuf
result
        Pixbuf -> IO Pixbuf
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Pixbuf
result'
     ) (do
        () -> 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_PixbufModuleLoadFunc`.
foreign import ccall "wrapper"
    mk_PixbufModuleLoadFunc :: C_PixbufModuleLoadFunc -> IO (FunPtr C_PixbufModuleLoadFunc)

-- | Loads a file from a standard C file stream into a new @GdkPixbuf@.
-- 
-- In case of error, this function should return @NULL@ and set the @error@ argument.
type PixbufModuleLoadFunc =
    Ptr ()
    -- ^ /@f@/: the file stream from which the image should be loaded
    -> IO GdkPixbuf.Pixbuf.Pixbuf
    -- ^ __Returns:__ a newly created @GdkPixbuf@ for the contents of the file /(Can throw 'Data.GI.Base.GError.GError')/

-- | A convenience synonym for @`Nothing` :: `Maybe` `PixbufModuleLoadFunc`@.
noPixbufModuleLoadFunc :: Maybe PixbufModuleLoadFunc
noPixbufModuleLoadFunc :: Maybe PixbufModuleLoadFunc
noPixbufModuleLoadFunc = Maybe PixbufModuleLoadFunc
forall a. Maybe a
Nothing

-- No Haskell->C wrapper generated since the function throws.

-- callback PixbufModuleLoadAnimationFunc
{- Callable
  { returnType =
      Just
        (TInterface
           Name { namespace = "GdkPixbuf" , name = "PixbufAnimation" })
  , returnMayBeNull = False
  , returnTransfer = TransferEverything
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just
              "a newly created `GdkPixbufAnimation` for the contents of the file"
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "f"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText =
                    Just "the file stream from which the image should be loaded"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = True
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Loads a file from a standard C file stream into a new `GdkPixbufAnimation`.\n\nIn case of error, this function should return `NULL` and set the `error` argument."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_PixbufModuleLoadAnimationFunc =
    Ptr () ->
    Ptr (Ptr GError) ->
    IO (Ptr GdkPixbuf.PixbufAnimation.PixbufAnimation)

-- Args: [ Arg
--           { argCName = "f"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the file stream from which the image should be loaded"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "GdkPixbuf" , name = "PixbufAnimation" })
-- throws : True
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_PixbufModuleLoadAnimationFunc :: FunPtr C_PixbufModuleLoadAnimationFunc -> C_PixbufModuleLoadAnimationFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PixbufModuleLoadAnimationFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_PixbufModuleLoadAnimationFunc
    -> Ptr ()
    -- ^ /@f@/: the file stream from which the image should be loaded
    -> m GdkPixbuf.PixbufAnimation.PixbufAnimation
    -- ^ __Returns:__ a newly created @GdkPixbufAnimation@ for the contents of the file /(Can throw 'Data.GI.Base.GError.GError')/
dynamic_PixbufModuleLoadAnimationFunc :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_PixbufModuleLoadAnimationFunc
-> Ptr () -> m PixbufAnimation
dynamic_PixbufModuleLoadAnimationFunc FunPtr C_PixbufModuleLoadAnimationFunc
__funPtr Ptr ()
f = IO PixbufAnimation -> m PixbufAnimation
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO PixbufAnimation -> m PixbufAnimation)
-> IO PixbufAnimation -> m PixbufAnimation
forall a b. (a -> b) -> a -> b
$ do
    IO PixbufAnimation -> IO () -> IO PixbufAnimation
forall a b. IO a -> IO b -> IO a
onException (do
        Ptr PixbufAnimation
result <- (Ptr (Ptr GError) -> IO (Ptr PixbufAnimation))
-> IO (Ptr PixbufAnimation)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr PixbufAnimation))
 -> IO (Ptr PixbufAnimation))
-> (Ptr (Ptr GError) -> IO (Ptr PixbufAnimation))
-> IO (Ptr PixbufAnimation)
forall a b. (a -> b) -> a -> b
$ (FunPtr C_PixbufModuleLoadAnimationFunc
-> C_PixbufModuleLoadAnimationFunc
__dynamic_C_PixbufModuleLoadAnimationFunc FunPtr C_PixbufModuleLoadAnimationFunc
__funPtr) Ptr ()
f
        Text -> Ptr PixbufAnimation -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"pixbufModuleLoadAnimationFunc" Ptr PixbufAnimation
result
        PixbufAnimation
result' <- ((ManagedPtr PixbufAnimation -> PixbufAnimation)
-> Ptr PixbufAnimation -> IO PixbufAnimation
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr PixbufAnimation -> PixbufAnimation
GdkPixbuf.PixbufAnimation.PixbufAnimation) Ptr PixbufAnimation
result
        PixbufAnimation -> IO PixbufAnimation
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return PixbufAnimation
result'
     ) (do
        () -> 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_PixbufModuleLoadAnimationFunc`.
foreign import ccall "wrapper"
    mk_PixbufModuleLoadAnimationFunc :: C_PixbufModuleLoadAnimationFunc -> IO (FunPtr C_PixbufModuleLoadAnimationFunc)

-- | Loads a file from a standard C file stream into a new @GdkPixbufAnimation@.
-- 
-- In case of error, this function should return @NULL@ and set the @error@ argument.
type PixbufModuleLoadAnimationFunc =
    Ptr ()
    -- ^ /@f@/: the file stream from which the image should be loaded
    -> IO GdkPixbuf.PixbufAnimation.PixbufAnimation
    -- ^ __Returns:__ a newly created @GdkPixbufAnimation@ for the contents of the file /(Can throw 'Data.GI.Base.GError.GError')/

-- | A convenience synonym for @`Nothing` :: `Maybe` `PixbufModuleLoadAnimationFunc`@.
noPixbufModuleLoadAnimationFunc :: Maybe PixbufModuleLoadAnimationFunc
noPixbufModuleLoadAnimationFunc :: Maybe PixbufModuleLoadAnimationFunc
noPixbufModuleLoadAnimationFunc = Maybe PixbufModuleLoadAnimationFunc
forall a. Maybe a
Nothing

-- No Haskell->C wrapper generated since the function throws.

-- callback PixbufModuleIncrementLoadFunc
{- Callable
  { returnType = Just (TBasicType TBoolean)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText = Just "`TRUE` if the incremental load was successful"
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "context"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "the state object created by [callback@GdkPixbuf.PixbufModuleBeginLoadFunc]"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "buf"
          , argType = TCArray False (-1) 2 (TBasicType TUInt8)
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the data to load" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "size"
          , argType = TBasicType TUInt
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the length of the data to load"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = True
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just "Incrementally loads a buffer into the image data."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_PixbufModuleIncrementLoadFunc =
    Ptr () ->
    Ptr Word8 ->
    Word32 ->
    Ptr (Ptr GError) ->
    IO CInt

-- Args: [ Arg
--           { argCName = "context"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the state object created by [callback@GdkPixbuf.PixbufModuleBeginLoadFunc]"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "buf"
--           , argType = TCArray False (-1) 2 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the data to load" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "size"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the length of the data to load"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "size"
--              , argType = TBasicType TUInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "the length of the data to load"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_PixbufModuleIncrementLoadFunc :: FunPtr C_PixbufModuleIncrementLoadFunc -> C_PixbufModuleIncrementLoadFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PixbufModuleIncrementLoadFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_PixbufModuleIncrementLoadFunc
    -> Ptr ()
    -- ^ /@context@/: the state object created by [callback/@gdkPixbuf@/.PixbufModuleBeginLoadFunc]
    -> ByteString
    -- ^ /@buf@/: the data to load
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
dynamic_PixbufModuleIncrementLoadFunc :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_PixbufModuleIncrementLoadFunc
-> Ptr () -> ByteString -> m ()
dynamic_PixbufModuleIncrementLoadFunc FunPtr C_PixbufModuleIncrementLoadFunc
__funPtr Ptr ()
context ByteString
buf = 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
    let size :: Word32
size = Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word32) -> Int -> Word32
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
buf
    Ptr Word8
buf' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
buf
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ (FunPtr C_PixbufModuleIncrementLoadFunc
-> C_PixbufModuleIncrementLoadFunc
__dynamic_C_PixbufModuleIncrementLoadFunc FunPtr C_PixbufModuleIncrementLoadFunc
__funPtr) Ptr ()
context Ptr Word8
buf' Word32
size
        Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
buf'
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
buf'
     )

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

-- | Incrementally loads a buffer into the image data.
type PixbufModuleIncrementLoadFunc =
    Ptr ()
    -- ^ /@context@/: the state object created by [callback/@gdkPixbuf@/.PixbufModuleBeginLoadFunc]
    -> ByteString
    -- ^ /@buf@/: the data to load
    -> IO ()
    -- ^ __Returns:__ @TRUE@ if the incremental load was successful /(Can throw 'Data.GI.Base.GError.GError')/

-- | A convenience synonym for @`Nothing` :: `Maybe` `PixbufModuleIncrementLoadFunc`@.
noPixbufModuleIncrementLoadFunc :: Maybe PixbufModuleIncrementLoadFunc
noPixbufModuleIncrementLoadFunc :: Maybe PixbufModuleIncrementLoadFunc
noPixbufModuleIncrementLoadFunc = Maybe PixbufModuleIncrementLoadFunc
forall a. Maybe a
Nothing

-- No Haskell->C wrapper generated since the function throws.

-- callback PixbufModuleFillVtableFunc
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "module"
          , argType =
              TInterface Name { namespace = "GdkPixbuf" , name = "PixbufModule" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "a #GdkPixbufModule."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Defines the type of the function used to set the vtable of a\n#GdkPixbufModule when it is loaded."
        , sinceVersion = Just "2.2"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_PixbufModuleFillVtableFunc =
    Ptr GdkPixbuf.PixbufModule.PixbufModule ->
    IO ()

-- Args: [ Arg
--           { argCName = "module"
--           , argType =
--               TInterface Name { namespace = "GdkPixbuf" , name = "PixbufModule" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GdkPixbufModule."
--                 , 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_PixbufModuleFillVtableFunc :: FunPtr C_PixbufModuleFillVtableFunc -> C_PixbufModuleFillVtableFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PixbufModuleFillVtableFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_PixbufModuleFillVtableFunc
    -> GdkPixbuf.PixbufModule.PixbufModule
    -- ^ /@module@/: a t'GI.GdkPixbuf.Structs.PixbufModule.PixbufModule'.
    -> m ()
dynamic_PixbufModuleFillVtableFunc :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_PixbufModuleFillVtableFunc -> PixbufModule -> m ()
dynamic_PixbufModuleFillVtableFunc FunPtr C_PixbufModuleFillVtableFunc
__funPtr PixbufModule
module_ = 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 PixbufModule
module_' <- PixbufModule -> IO (Ptr PixbufModule)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr PixbufModule
module_
    (FunPtr C_PixbufModuleFillVtableFunc -> C_PixbufModuleFillVtableFunc
__dynamic_C_PixbufModuleFillVtableFunc FunPtr C_PixbufModuleFillVtableFunc
__funPtr) Ptr PixbufModule
module_'
    PixbufModule -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr PixbufModule
module_
    () -> 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_PixbufModuleFillVtableFunc`.
foreign import ccall "wrapper"
    mk_PixbufModuleFillVtableFunc :: C_PixbufModuleFillVtableFunc -> IO (FunPtr C_PixbufModuleFillVtableFunc)

-- | Defines the type of the function used to set the vtable of a
-- t'GI.GdkPixbuf.Structs.PixbufModule.PixbufModule' when it is loaded.
-- 
-- /Since: 2.2/
type PixbufModuleFillVtableFunc =
    GdkPixbuf.PixbufModule.PixbufModule
    -- ^ /@module@/: a t'GI.GdkPixbuf.Structs.PixbufModule.PixbufModule'.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `PixbufModuleFillVtableFunc`@.
noPixbufModuleFillVtableFunc :: Maybe PixbufModuleFillVtableFunc
noPixbufModuleFillVtableFunc :: Maybe (PixbufModule -> IO ())
noPixbufModuleFillVtableFunc = Maybe (PixbufModule -> IO ())
forall a. Maybe a
Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_PixbufModuleFillVtableFunc :: MonadIO m => PixbufModuleFillVtableFunc -> m (GClosure C_PixbufModuleFillVtableFunc)
genClosure_PixbufModuleFillVtableFunc :: forall (m :: * -> *).
MonadIO m =>
(PixbufModule -> IO ())
-> m (GClosure C_PixbufModuleFillVtableFunc)
genClosure_PixbufModuleFillVtableFunc PixbufModule -> IO ()
cb = IO (GClosure C_PixbufModuleFillVtableFunc)
-> m (GClosure C_PixbufModuleFillVtableFunc)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_PixbufModuleFillVtableFunc)
 -> m (GClosure C_PixbufModuleFillVtableFunc))
-> IO (GClosure C_PixbufModuleFillVtableFunc)
-> m (GClosure C_PixbufModuleFillVtableFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_PixbufModuleFillVtableFunc
cb' = Maybe (Ptr (FunPtr C_PixbufModuleFillVtableFunc))
-> (PixbufModule -> IO ()) -> C_PixbufModuleFillVtableFunc
wrap_PixbufModuleFillVtableFunc Maybe (Ptr (FunPtr C_PixbufModuleFillVtableFunc))
forall a. Maybe a
Nothing PixbufModule -> IO ()
cb
    C_PixbufModuleFillVtableFunc
-> IO (FunPtr C_PixbufModuleFillVtableFunc)
mk_PixbufModuleFillVtableFunc C_PixbufModuleFillVtableFunc
cb' IO (FunPtr C_PixbufModuleFillVtableFunc)
-> (FunPtr C_PixbufModuleFillVtableFunc
    -> IO (GClosure C_PixbufModuleFillVtableFunc))
-> IO (GClosure C_PixbufModuleFillVtableFunc)
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_PixbufModuleFillVtableFunc
-> IO (GClosure C_PixbufModuleFillVtableFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `PixbufModuleFillVtableFunc` into a `C_PixbufModuleFillVtableFunc`.
wrap_PixbufModuleFillVtableFunc :: 
    Maybe (Ptr (FunPtr C_PixbufModuleFillVtableFunc)) ->
    PixbufModuleFillVtableFunc ->
    C_PixbufModuleFillVtableFunc
wrap_PixbufModuleFillVtableFunc :: Maybe (Ptr (FunPtr C_PixbufModuleFillVtableFunc))
-> (PixbufModule -> IO ()) -> C_PixbufModuleFillVtableFunc
wrap_PixbufModuleFillVtableFunc Maybe (Ptr (FunPtr C_PixbufModuleFillVtableFunc))
gi'funptrptr PixbufModule -> IO ()
gi'cb Ptr PixbufModule
module_ = do
    PixbufModule
module_' <- ((ManagedPtr PixbufModule -> PixbufModule)
-> Ptr PixbufModule -> IO PixbufModule
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr PixbufModule -> PixbufModule
GdkPixbuf.PixbufModule.PixbufModule) Ptr PixbufModule
module_
    PixbufModule -> IO ()
gi'cb  PixbufModule
module_'
    Maybe (Ptr (FunPtr C_PixbufModuleFillVtableFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_PixbufModuleFillVtableFunc))
gi'funptrptr


-- callback PixbufModuleFillInfoFunc
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "info"
          , argType =
              TInterface Name { namespace = "GdkPixbuf" , name = "PixbufFormat" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "a #GdkPixbufFormat."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Defines the type of the function used to fill a\n#GdkPixbufFormat structure with information about a module."
        , sinceVersion = Just "2.2"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_PixbufModuleFillInfoFunc =
    Ptr GdkPixbuf.PixbufFormat.PixbufFormat ->
    IO ()

-- Args: [ Arg
--           { argCName = "info"
--           , argType =
--               TInterface Name { namespace = "GdkPixbuf" , name = "PixbufFormat" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GdkPixbufFormat."
--                 , 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_PixbufModuleFillInfoFunc :: FunPtr C_PixbufModuleFillInfoFunc -> C_PixbufModuleFillInfoFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PixbufModuleFillInfoFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_PixbufModuleFillInfoFunc
    -> GdkPixbuf.PixbufFormat.PixbufFormat
    -- ^ /@info@/: a t'GI.GdkPixbuf.Structs.PixbufFormat.PixbufFormat'.
    -> m ()
dynamic_PixbufModuleFillInfoFunc :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_PixbufModuleFillInfoFunc -> PixbufFormat -> m ()
dynamic_PixbufModuleFillInfoFunc FunPtr C_PixbufModuleFillInfoFunc
__funPtr PixbufFormat
info = 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 PixbufFormat
info' <- PixbufFormat -> IO (Ptr PixbufFormat)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr PixbufFormat
info
    (FunPtr C_PixbufModuleFillInfoFunc -> C_PixbufModuleFillInfoFunc
__dynamic_C_PixbufModuleFillInfoFunc FunPtr C_PixbufModuleFillInfoFunc
__funPtr) Ptr PixbufFormat
info'
    PixbufFormat -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr PixbufFormat
info
    () -> 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_PixbufModuleFillInfoFunc`.
foreign import ccall "wrapper"
    mk_PixbufModuleFillInfoFunc :: C_PixbufModuleFillInfoFunc -> IO (FunPtr C_PixbufModuleFillInfoFunc)

-- | Defines the type of the function used to fill a
-- t'GI.GdkPixbuf.Structs.PixbufFormat.PixbufFormat' structure with information about a module.
-- 
-- /Since: 2.2/
type PixbufModuleFillInfoFunc =
    GdkPixbuf.PixbufFormat.PixbufFormat
    -- ^ /@info@/: a t'GI.GdkPixbuf.Structs.PixbufFormat.PixbufFormat'.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `PixbufModuleFillInfoFunc`@.
noPixbufModuleFillInfoFunc :: Maybe PixbufModuleFillInfoFunc
noPixbufModuleFillInfoFunc :: Maybe (PixbufFormat -> IO ())
noPixbufModuleFillInfoFunc = Maybe (PixbufFormat -> IO ())
forall a. Maybe a
Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_PixbufModuleFillInfoFunc :: MonadIO m => PixbufModuleFillInfoFunc -> m (GClosure C_PixbufModuleFillInfoFunc)
genClosure_PixbufModuleFillInfoFunc :: forall (m :: * -> *).
MonadIO m =>
(PixbufFormat -> IO ()) -> m (GClosure C_PixbufModuleFillInfoFunc)
genClosure_PixbufModuleFillInfoFunc PixbufFormat -> IO ()
cb = IO (GClosure C_PixbufModuleFillInfoFunc)
-> m (GClosure C_PixbufModuleFillInfoFunc)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_PixbufModuleFillInfoFunc)
 -> m (GClosure C_PixbufModuleFillInfoFunc))
-> IO (GClosure C_PixbufModuleFillInfoFunc)
-> m (GClosure C_PixbufModuleFillInfoFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_PixbufModuleFillInfoFunc
cb' = Maybe (Ptr (FunPtr C_PixbufModuleFillInfoFunc))
-> (PixbufFormat -> IO ()) -> C_PixbufModuleFillInfoFunc
wrap_PixbufModuleFillInfoFunc Maybe (Ptr (FunPtr C_PixbufModuleFillInfoFunc))
forall a. Maybe a
Nothing PixbufFormat -> IO ()
cb
    C_PixbufModuleFillInfoFunc
-> IO (FunPtr C_PixbufModuleFillInfoFunc)
mk_PixbufModuleFillInfoFunc C_PixbufModuleFillInfoFunc
cb' IO (FunPtr C_PixbufModuleFillInfoFunc)
-> (FunPtr C_PixbufModuleFillInfoFunc
    -> IO (GClosure C_PixbufModuleFillInfoFunc))
-> IO (GClosure C_PixbufModuleFillInfoFunc)
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_PixbufModuleFillInfoFunc
-> IO (GClosure C_PixbufModuleFillInfoFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `PixbufModuleFillInfoFunc` into a `C_PixbufModuleFillInfoFunc`.
wrap_PixbufModuleFillInfoFunc :: 
    Maybe (Ptr (FunPtr C_PixbufModuleFillInfoFunc)) ->
    PixbufModuleFillInfoFunc ->
    C_PixbufModuleFillInfoFunc
wrap_PixbufModuleFillInfoFunc :: Maybe (Ptr (FunPtr C_PixbufModuleFillInfoFunc))
-> (PixbufFormat -> IO ()) -> C_PixbufModuleFillInfoFunc
wrap_PixbufModuleFillInfoFunc Maybe (Ptr (FunPtr C_PixbufModuleFillInfoFunc))
gi'funptrptr PixbufFormat -> IO ()
gi'cb Ptr PixbufFormat
info = do
    Ptr PixbufFormat -> (PixbufFormat -> IO ()) -> IO ()
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient  Ptr PixbufFormat
info ((PixbufFormat -> IO ()) -> IO ())
-> (PixbufFormat -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \PixbufFormat
info' -> do
        PixbufFormat -> IO ()
gi'cb  PixbufFormat
info'
        Maybe (Ptr (FunPtr C_PixbufModuleFillInfoFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_PixbufModuleFillInfoFunc))
gi'funptrptr


-- callback PixbufDestroyNotify
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "pixels"
          , argType = TCArray False (-1) (-1) (TBasicType TUInt8)
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just "The pixel array of the pixbuf\n  that is being finalized."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "User closure data." , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = 1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "A function of this type is responsible for freeing the pixel array\nof a pixbuf.\n\nThe gdk_pixbuf_new_from_data() function lets you pass in a pre-allocated\npixel array so that a pixbuf can be created from it; in this case you\nwill need to pass in a function of type `GdkPixbufDestroyNotify` so that\nthe pixel data can be freed when the pixbuf is finalized."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_PixbufDestroyNotify =
    Ptr Word8 ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "pixels"
--           , argType = TCArray False (-1) (-1) (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The pixel array of the pixbuf\n  that is being finalized."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "User closure data." , 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_PixbufDestroyNotify :: FunPtr C_PixbufDestroyNotify -> C_PixbufDestroyNotify

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PixbufDestroyNotify ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_PixbufDestroyNotify
    -> Ptr Word8
    -- ^ /@pixels@/: The pixel array of the pixbuf
    --   that is being finalized.
    -> Ptr ()
    -- ^ /@data@/: User closure data.
    -> m ()
dynamic_PixbufDestroyNotify :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_PixbufDestroyNotify -> Ptr Word8 -> Ptr () -> m ()
dynamic_PixbufDestroyNotify FunPtr C_PixbufDestroyNotify
__funPtr Ptr Word8
pixels Ptr ()
data_ = 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_PixbufDestroyNotify -> C_PixbufDestroyNotify
__dynamic_C_PixbufDestroyNotify FunPtr C_PixbufDestroyNotify
__funPtr) Ptr Word8
pixels Ptr ()
data_
    () -> 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_PixbufDestroyNotify`.
foreign import ccall "wrapper"
    mk_PixbufDestroyNotify :: C_PixbufDestroyNotify -> IO (FunPtr C_PixbufDestroyNotify)

-- | A function of this type is responsible for freeing the pixel array
-- of a pixbuf.
-- 
-- The 'GI.GdkPixbuf.Objects.Pixbuf.pixbufNewFromData' function lets you pass in a pre-allocated
-- pixel array so that a pixbuf can be created from it; in this case you
-- will need to pass in a function of type @GdkPixbufDestroyNotify@ so that
-- the pixel data can be freed when the pixbuf is finalized.
type PixbufDestroyNotify =
    Ptr Word8
    -- ^ /@pixels@/: The pixel array of the pixbuf
    --   that is being finalized.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `PixbufDestroyNotify`@.
noPixbufDestroyNotify :: Maybe PixbufDestroyNotify
noPixbufDestroyNotify :: Maybe (Ptr Word8 -> IO ())
noPixbufDestroyNotify = Maybe (Ptr Word8 -> IO ())
forall a. Maybe a
Nothing

-- | A function of this type is responsible for freeing the pixel array
-- of a pixbuf.
-- 
-- The 'GI.GdkPixbuf.Objects.Pixbuf.pixbufNewFromData' function lets you pass in a pre-allocated
-- pixel array so that a pixbuf can be created from it; in this case you
-- will need to pass in a function of type @GdkPixbufDestroyNotify@ so that
-- the pixel data can be freed when the pixbuf is finalized.
type PixbufDestroyNotify_WithClosures =
    Ptr Word8
    -- ^ /@pixels@/: The pixel array of the pixbuf
    --   that is being finalized.
    -> Ptr ()
    -- ^ /@data@/: User closure data.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `PixbufDestroyNotify_WithClosures`@.
noPixbufDestroyNotify_WithClosures :: Maybe PixbufDestroyNotify_WithClosures
noPixbufDestroyNotify_WithClosures :: Maybe C_PixbufDestroyNotify
noPixbufDestroyNotify_WithClosures = Maybe C_PixbufDestroyNotify
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_PixbufDestroyNotify :: PixbufDestroyNotify -> PixbufDestroyNotify_WithClosures
drop_closures_PixbufDestroyNotify :: (Ptr Word8 -> IO ()) -> C_PixbufDestroyNotify
drop_closures_PixbufDestroyNotify Ptr Word8 -> IO ()
_f Ptr Word8
pixels Ptr ()
_ = Ptr Word8 -> IO ()
_f Ptr Word8
pixels

-- | Wrap the callback into a `GClosure`.
genClosure_PixbufDestroyNotify :: MonadIO m => PixbufDestroyNotify -> m (GClosure C_PixbufDestroyNotify)
genClosure_PixbufDestroyNotify :: forall (m :: * -> *).
MonadIO m =>
(Ptr Word8 -> IO ()) -> m (GClosure C_PixbufDestroyNotify)
genClosure_PixbufDestroyNotify Ptr Word8 -> IO ()
cb = IO (GClosure C_PixbufDestroyNotify)
-> m (GClosure C_PixbufDestroyNotify)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_PixbufDestroyNotify)
 -> m (GClosure C_PixbufDestroyNotify))
-> IO (GClosure C_PixbufDestroyNotify)
-> m (GClosure C_PixbufDestroyNotify)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_PixbufDestroyNotify
cb' = (Ptr Word8 -> IO ()) -> C_PixbufDestroyNotify
drop_closures_PixbufDestroyNotify Ptr Word8 -> IO ()
cb
    let cb'' :: C_PixbufDestroyNotify
cb'' = Maybe (Ptr (FunPtr C_PixbufDestroyNotify))
-> C_PixbufDestroyNotify -> C_PixbufDestroyNotify
wrap_PixbufDestroyNotify Maybe (Ptr (FunPtr C_PixbufDestroyNotify))
forall a. Maybe a
Nothing C_PixbufDestroyNotify
cb'
    C_PixbufDestroyNotify -> IO (FunPtr C_PixbufDestroyNotify)
mk_PixbufDestroyNotify C_PixbufDestroyNotify
cb'' IO (FunPtr C_PixbufDestroyNotify)
-> (FunPtr C_PixbufDestroyNotify
    -> IO (GClosure C_PixbufDestroyNotify))
-> IO (GClosure C_PixbufDestroyNotify)
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_PixbufDestroyNotify -> IO (GClosure C_PixbufDestroyNotify)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `PixbufDestroyNotify` into a `C_PixbufDestroyNotify`.
wrap_PixbufDestroyNotify :: 
    Maybe (Ptr (FunPtr C_PixbufDestroyNotify)) ->
    PixbufDestroyNotify_WithClosures ->
    C_PixbufDestroyNotify
wrap_PixbufDestroyNotify :: Maybe (Ptr (FunPtr C_PixbufDestroyNotify))
-> C_PixbufDestroyNotify -> C_PixbufDestroyNotify
wrap_PixbufDestroyNotify Maybe (Ptr (FunPtr C_PixbufDestroyNotify))
gi'funptrptr C_PixbufDestroyNotify
gi'cb Ptr Word8
pixels Ptr ()
data_ = do
    C_PixbufDestroyNotify
gi'cb  Ptr Word8
pixels Ptr ()
data_
    Maybe (Ptr (FunPtr C_PixbufDestroyNotify)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_PixbufDestroyNotify))
gi'funptrptr