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

 -- * Signals


-- ** ActionEntryActivateFieldCallback #signal:ActionEntryActivateFieldCallback#

    ActionEntryActivateFieldCallback        ,
    ActionEntryActivateFieldCallback_WithClosures,
    C_ActionEntryActivateFieldCallback      ,
    drop_closures_ActionEntryActivateFieldCallback,
    dynamic_ActionEntryActivateFieldCallback,
    genClosure_ActionEntryActivateFieldCallback,
    mk_ActionEntryActivateFieldCallback     ,
    noActionEntryActivateFieldCallback      ,
    noActionEntryActivateFieldCallback_WithClosures,
    wrap_ActionEntryActivateFieldCallback   ,


-- ** ActionEntryChangeStateFieldCallback #signal:ActionEntryChangeStateFieldCallback#

    ActionEntryChangeStateFieldCallback     ,
    ActionEntryChangeStateFieldCallback_WithClosures,
    C_ActionEntryChangeStateFieldCallback   ,
    drop_closures_ActionEntryChangeStateFieldCallback,
    dynamic_ActionEntryChangeStateFieldCallback,
    genClosure_ActionEntryChangeStateFieldCallback,
    mk_ActionEntryChangeStateFieldCallback  ,
    noActionEntryChangeStateFieldCallback   ,
    noActionEntryChangeStateFieldCallback_WithClosures,
    wrap_ActionEntryChangeStateFieldCallback,


-- ** AsyncReadyCallback #signal:AsyncReadyCallback#

    AsyncReadyCallback                      ,
    AsyncReadyCallback_WithClosures         ,
    C_AsyncReadyCallback                    ,
    drop_closures_AsyncReadyCallback        ,
    dynamic_AsyncReadyCallback              ,
    genClosure_AsyncReadyCallback           ,
    mk_AsyncReadyCallback                   ,
    noAsyncReadyCallback                    ,
    noAsyncReadyCallback_WithClosures       ,
    wrap_AsyncReadyCallback                 ,


-- ** BusAcquiredCallback #signal:BusAcquiredCallback#

    BusAcquiredCallback                     ,
    BusAcquiredCallback_WithClosures        ,
    C_BusAcquiredCallback                   ,
    drop_closures_BusAcquiredCallback       ,
    dynamic_BusAcquiredCallback             ,
    genClosure_BusAcquiredCallback          ,
    mk_BusAcquiredCallback                  ,
    noBusAcquiredCallback                   ,
    noBusAcquiredCallback_WithClosures      ,
    wrap_BusAcquiredCallback                ,


-- ** BusNameAcquiredCallback #signal:BusNameAcquiredCallback#

    BusNameAcquiredCallback                 ,
    BusNameAcquiredCallback_WithClosures    ,
    C_BusNameAcquiredCallback               ,
    drop_closures_BusNameAcquiredCallback   ,
    dynamic_BusNameAcquiredCallback         ,
    genClosure_BusNameAcquiredCallback      ,
    mk_BusNameAcquiredCallback              ,
    noBusNameAcquiredCallback               ,
    noBusNameAcquiredCallback_WithClosures  ,
    wrap_BusNameAcquiredCallback            ,


-- ** BusNameAppearedCallback #signal:BusNameAppearedCallback#

    BusNameAppearedCallback                 ,
    BusNameAppearedCallback_WithClosures    ,
    C_BusNameAppearedCallback               ,
    drop_closures_BusNameAppearedCallback   ,
    dynamic_BusNameAppearedCallback         ,
    genClosure_BusNameAppearedCallback      ,
    mk_BusNameAppearedCallback              ,
    noBusNameAppearedCallback               ,
    noBusNameAppearedCallback_WithClosures  ,
    wrap_BusNameAppearedCallback            ,


-- ** BusNameLostCallback #signal:BusNameLostCallback#

    BusNameLostCallback                     ,
    BusNameLostCallback_WithClosures        ,
    C_BusNameLostCallback                   ,
    drop_closures_BusNameLostCallback       ,
    dynamic_BusNameLostCallback             ,
    genClosure_BusNameLostCallback          ,
    mk_BusNameLostCallback                  ,
    noBusNameLostCallback                   ,
    noBusNameLostCallback_WithClosures      ,
    wrap_BusNameLostCallback                ,


-- ** BusNameVanishedCallback #signal:BusNameVanishedCallback#

    BusNameVanishedCallback                 ,
    BusNameVanishedCallback_WithClosures    ,
    C_BusNameVanishedCallback               ,
    drop_closures_BusNameVanishedCallback   ,
    dynamic_BusNameVanishedCallback         ,
    genClosure_BusNameVanishedCallback      ,
    mk_BusNameVanishedCallback              ,
    noBusNameVanishedCallback               ,
    noBusNameVanishedCallback_WithClosures  ,
    wrap_BusNameVanishedCallback            ,


-- ** CancellableSourceFunc #signal:CancellableSourceFunc#

    C_CancellableSourceFunc                 ,
    CancellableSourceFunc                   ,
    CancellableSourceFunc_WithClosures      ,
    drop_closures_CancellableSourceFunc     ,
    dynamic_CancellableSourceFunc           ,
    genClosure_CancellableSourceFunc        ,
    mk_CancellableSourceFunc                ,
    noCancellableSourceFunc                 ,
    noCancellableSourceFunc_WithClosures    ,
    wrap_CancellableSourceFunc              ,


-- ** DBusInterfaceGetPropertyFunc #signal:DBusInterfaceGetPropertyFunc#

    C_DBusInterfaceGetPropertyFunc          ,
    DBusInterfaceGetPropertyFunc            ,
    DBusInterfaceGetPropertyFunc_WithClosures,
    drop_closures_DBusInterfaceGetPropertyFunc,
    dynamic_DBusInterfaceGetPropertyFunc    ,
    genClosure_DBusInterfaceGetPropertyFunc ,
    mk_DBusInterfaceGetPropertyFunc         ,
    noDBusInterfaceGetPropertyFunc          ,
    noDBusInterfaceGetPropertyFunc_WithClosures,
    wrap_DBusInterfaceGetPropertyFunc       ,


-- ** DBusInterfaceMethodCallFunc #signal:DBusInterfaceMethodCallFunc#

    C_DBusInterfaceMethodCallFunc           ,
    DBusInterfaceMethodCallFunc             ,
    DBusInterfaceMethodCallFunc_WithClosures,
    drop_closures_DBusInterfaceMethodCallFunc,
    dynamic_DBusInterfaceMethodCallFunc     ,
    genClosure_DBusInterfaceMethodCallFunc  ,
    mk_DBusInterfaceMethodCallFunc          ,
    noDBusInterfaceMethodCallFunc           ,
    noDBusInterfaceMethodCallFunc_WithClosures,
    wrap_DBusInterfaceMethodCallFunc        ,


-- ** DBusInterfaceSetPropertyFunc #signal:DBusInterfaceSetPropertyFunc#

    C_DBusInterfaceSetPropertyFunc          ,
    DBusInterfaceSetPropertyFunc            ,
    DBusInterfaceSetPropertyFunc_WithClosures,
    drop_closures_DBusInterfaceSetPropertyFunc,
    dynamic_DBusInterfaceSetPropertyFunc    ,
    genClosure_DBusInterfaceSetPropertyFunc ,
    mk_DBusInterfaceSetPropertyFunc         ,
    noDBusInterfaceSetPropertyFunc          ,
    noDBusInterfaceSetPropertyFunc_WithClosures,
    wrap_DBusInterfaceSetPropertyFunc       ,


-- ** DBusMessageFilterFunction #signal:DBusMessageFilterFunction#

    C_DBusMessageFilterFunction             ,
    DBusMessageFilterFunction               ,
    DBusMessageFilterFunction_WithClosures  ,
    drop_closures_DBusMessageFilterFunction ,
    dynamic_DBusMessageFilterFunction       ,
    genClosure_DBusMessageFilterFunction    ,
    mk_DBusMessageFilterFunction            ,
    noDBusMessageFilterFunction             ,
    noDBusMessageFilterFunction_WithClosures,
    wrap_DBusMessageFilterFunction          ,


-- ** DBusProxyTypeFunc #signal:DBusProxyTypeFunc#

    C_DBusProxyTypeFunc                     ,
    DBusProxyTypeFunc                       ,
    DBusProxyTypeFunc_WithClosures          ,
    drop_closures_DBusProxyTypeFunc         ,
    dynamic_DBusProxyTypeFunc               ,
    genClosure_DBusProxyTypeFunc            ,
    mk_DBusProxyTypeFunc                    ,
    noDBusProxyTypeFunc                     ,
    noDBusProxyTypeFunc_WithClosures        ,
    wrap_DBusProxyTypeFunc                  ,


-- ** DBusSignalCallback #signal:DBusSignalCallback#

    C_DBusSignalCallback                    ,
    DBusSignalCallback                      ,
    DBusSignalCallback_WithClosures         ,
    drop_closures_DBusSignalCallback        ,
    dynamic_DBusSignalCallback              ,
    genClosure_DBusSignalCallback           ,
    mk_DBusSignalCallback                   ,
    noDBusSignalCallback                    ,
    noDBusSignalCallback_WithClosures       ,
    wrap_DBusSignalCallback                 ,


-- ** DBusSubtreeDispatchFunc #signal:DBusSubtreeDispatchFunc#

    C_DBusSubtreeDispatchFunc               ,
    DBusSubtreeDispatchFunc                 ,
    DBusSubtreeDispatchFunc_WithClosures    ,
    drop_closures_DBusSubtreeDispatchFunc   ,
    dynamic_DBusSubtreeDispatchFunc         ,
    genClosure_DBusSubtreeDispatchFunc      ,
    mk_DBusSubtreeDispatchFunc              ,
    noDBusSubtreeDispatchFunc               ,
    noDBusSubtreeDispatchFunc_WithClosures  ,
    wrap_DBusSubtreeDispatchFunc            ,


-- ** DBusSubtreeEnumerateFunc #signal:DBusSubtreeEnumerateFunc#

    C_DBusSubtreeEnumerateFunc              ,
    DBusSubtreeEnumerateFunc                ,
    DBusSubtreeEnumerateFunc_WithClosures   ,
    drop_closures_DBusSubtreeEnumerateFunc  ,
    dynamic_DBusSubtreeEnumerateFunc        ,
    genClosure_DBusSubtreeEnumerateFunc     ,
    mk_DBusSubtreeEnumerateFunc             ,
    noDBusSubtreeEnumerateFunc              ,
    noDBusSubtreeEnumerateFunc_WithClosures ,
    wrap_DBusSubtreeEnumerateFunc           ,


-- ** DBusSubtreeIntrospectFunc #signal:DBusSubtreeIntrospectFunc#

    C_DBusSubtreeIntrospectFunc             ,
    DBusSubtreeIntrospectFunc               ,
    DBusSubtreeIntrospectFunc_WithClosures  ,
    drop_closures_DBusSubtreeIntrospectFunc ,
    dynamic_DBusSubtreeIntrospectFunc       ,
    genClosure_DBusSubtreeIntrospectFunc    ,
    mk_DBusSubtreeIntrospectFunc            ,
    noDBusSubtreeIntrospectFunc             ,
    noDBusSubtreeIntrospectFunc_WithClosures,
    wrap_DBusSubtreeIntrospectFunc          ,


-- ** DatagramBasedSourceFunc #signal:DatagramBasedSourceFunc#

    C_DatagramBasedSourceFunc               ,
    DatagramBasedSourceFunc                 ,
    DatagramBasedSourceFunc_WithClosures    ,
    drop_closures_DatagramBasedSourceFunc   ,
    dynamic_DatagramBasedSourceFunc         ,
    genClosure_DatagramBasedSourceFunc      ,
    mk_DatagramBasedSourceFunc              ,
    noDatagramBasedSourceFunc               ,
    noDatagramBasedSourceFunc_WithClosures  ,
    wrap_DatagramBasedSourceFunc            ,


-- ** DesktopAppLaunchCallback #signal:DesktopAppLaunchCallback#

    C_DesktopAppLaunchCallback              ,
    DesktopAppLaunchCallback                ,
    DesktopAppLaunchCallback_WithClosures   ,
    drop_closures_DesktopAppLaunchCallback  ,
    dynamic_DesktopAppLaunchCallback        ,
    genClosure_DesktopAppLaunchCallback     ,
    mk_DesktopAppLaunchCallback             ,
    noDesktopAppLaunchCallback              ,
    noDesktopAppLaunchCallback_WithClosures ,
    wrap_DesktopAppLaunchCallback           ,


-- ** FileMeasureProgressCallback #signal:FileMeasureProgressCallback#

    C_FileMeasureProgressCallback           ,
    FileMeasureProgressCallback             ,
    FileMeasureProgressCallback_WithClosures,
    drop_closures_FileMeasureProgressCallback,
    dynamic_FileMeasureProgressCallback     ,
    genClosure_FileMeasureProgressCallback  ,
    mk_FileMeasureProgressCallback          ,
    noFileMeasureProgressCallback           ,
    noFileMeasureProgressCallback_WithClosures,
    wrap_FileMeasureProgressCallback        ,


-- ** FileProgressCallback #signal:FileProgressCallback#

    C_FileProgressCallback                  ,
    FileProgressCallback                    ,
    FileProgressCallback_WithClosures       ,
    drop_closures_FileProgressCallback      ,
    dynamic_FileProgressCallback            ,
    genClosure_FileProgressCallback         ,
    mk_FileProgressCallback                 ,
    noFileProgressCallback                  ,
    noFileProgressCallback_WithClosures     ,
    wrap_FileProgressCallback               ,


-- ** FileReadMoreCallback #signal:FileReadMoreCallback#

    C_FileReadMoreCallback                  ,
    FileReadMoreCallback                    ,
    FileReadMoreCallback_WithClosures       ,
    drop_closures_FileReadMoreCallback      ,
    dynamic_FileReadMoreCallback            ,
    genClosure_FileReadMoreCallback         ,
    mk_FileReadMoreCallback                 ,
    noFileReadMoreCallback                  ,
    noFileReadMoreCallback_WithClosures     ,
    wrap_FileReadMoreCallback               ,


-- ** IOSchedulerJobFunc #signal:IOSchedulerJobFunc#

    C_IOSchedulerJobFunc                    ,
    IOSchedulerJobFunc                      ,
    IOSchedulerJobFunc_WithClosures         ,
    drop_closures_IOSchedulerJobFunc        ,
    dynamic_IOSchedulerJobFunc              ,
    genClosure_IOSchedulerJobFunc           ,
    mk_IOSchedulerJobFunc                   ,
    noIOSchedulerJobFunc                    ,
    noIOSchedulerJobFunc_WithClosures       ,
    wrap_IOSchedulerJobFunc                 ,


-- ** PollableSourceFunc #signal:PollableSourceFunc#

    C_PollableSourceFunc                    ,
    PollableSourceFunc                      ,
    PollableSourceFunc_WithClosures         ,
    drop_closures_PollableSourceFunc        ,
    dynamic_PollableSourceFunc              ,
    genClosure_PollableSourceFunc           ,
    mk_PollableSourceFunc                   ,
    noPollableSourceFunc                    ,
    noPollableSourceFunc_WithClosures       ,
    wrap_PollableSourceFunc                 ,


-- ** ReallocFunc #signal:ReallocFunc#

    C_ReallocFunc                           ,
    ReallocFunc                             ,
    dynamic_ReallocFunc                     ,
    genClosure_ReallocFunc                  ,
    mk_ReallocFunc                          ,
    noReallocFunc                           ,
    wrap_ReallocFunc                        ,


-- ** SettingsBindGetMapping #signal:SettingsBindGetMapping#

    C_SettingsBindGetMapping                ,
    SettingsBindGetMapping                  ,
    SettingsBindGetMapping_WithClosures     ,
    drop_closures_SettingsBindGetMapping    ,
    dynamic_SettingsBindGetMapping          ,
    genClosure_SettingsBindGetMapping       ,
    mk_SettingsBindGetMapping               ,
    noSettingsBindGetMapping                ,
    noSettingsBindGetMapping_WithClosures   ,
    wrap_SettingsBindGetMapping             ,


-- ** SettingsBindSetMapping #signal:SettingsBindSetMapping#

    C_SettingsBindSetMapping                ,
    SettingsBindSetMapping                  ,
    SettingsBindSetMapping_WithClosures     ,
    drop_closures_SettingsBindSetMapping    ,
    dynamic_SettingsBindSetMapping          ,
    genClosure_SettingsBindSetMapping       ,
    mk_SettingsBindSetMapping               ,
    noSettingsBindSetMapping                ,
    noSettingsBindSetMapping_WithClosures   ,
    wrap_SettingsBindSetMapping             ,


-- ** SettingsGetMapping #signal:SettingsGetMapping#

    C_SettingsGetMapping                    ,
    SettingsGetMapping                      ,
    SettingsGetMapping_WithClosures         ,
    drop_closures_SettingsGetMapping        ,
    dynamic_SettingsGetMapping              ,
    genClosure_SettingsGetMapping           ,
    mk_SettingsGetMapping                   ,
    noSettingsGetMapping                    ,
    noSettingsGetMapping_WithClosures       ,
    wrap_SettingsGetMapping                 ,


-- ** SimpleAsyncThreadFunc #signal:SimpleAsyncThreadFunc#

    C_SimpleAsyncThreadFunc                 ,
    SimpleAsyncThreadFunc                   ,
    dynamic_SimpleAsyncThreadFunc           ,
    genClosure_SimpleAsyncThreadFunc        ,
    mk_SimpleAsyncThreadFunc                ,
    noSimpleAsyncThreadFunc                 ,
    wrap_SimpleAsyncThreadFunc              ,


-- ** SocketSourceFunc #signal:SocketSourceFunc#

    C_SocketSourceFunc                      ,
    SocketSourceFunc                        ,
    SocketSourceFunc_WithClosures           ,
    drop_closures_SocketSourceFunc          ,
    dynamic_SocketSourceFunc                ,
    genClosure_SocketSourceFunc             ,
    mk_SocketSourceFunc                     ,
    noSocketSourceFunc                      ,
    noSocketSourceFunc_WithClosures         ,
    wrap_SocketSourceFunc                   ,


-- ** TaskThreadFunc #signal:TaskThreadFunc#

    C_TaskThreadFunc                        ,
    TaskThreadFunc                          ,
    dynamic_TaskThreadFunc                  ,
    genClosure_TaskThreadFunc               ,
    mk_TaskThreadFunc                       ,
    noTaskThreadFunc                        ,
    wrap_TaskThreadFunc                     ,


-- ** VfsFileLookupFunc #signal:VfsFileLookupFunc#

    C_VfsFileLookupFunc                     ,
    VfsFileLookupFunc                       ,
    VfsFileLookupFunc_WithClosures          ,
    drop_closures_VfsFileLookupFunc         ,
    dynamic_VfsFileLookupFunc               ,
    genClosure_VfsFileLookupFunc            ,
    mk_VfsFileLookupFunc                    ,
    noVfsFileLookupFunc                     ,
    noVfsFileLookupFunc_WithClosures        ,
    wrap_VfsFileLookupFunc                  ,




    ) 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.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 qualified GI.GLib.Flags as GLib.Flags
import qualified GI.GLib.Structs.VariantType as GLib.VariantType
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import {-# SOURCE #-} qualified GI.Gio.Interfaces.DatagramBased as Gio.DatagramBased
import {-# SOURCE #-} qualified GI.Gio.Interfaces.File as Gio.File
import {-# SOURCE #-} qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.Gio.Objects.DBusConnection as Gio.DBusConnection
import {-# SOURCE #-} qualified GI.Gio.Objects.DBusMessage as Gio.DBusMessage
import {-# SOURCE #-} qualified GI.Gio.Objects.DBusMethodInvocation as Gio.DBusMethodInvocation
import {-# SOURCE #-} qualified GI.Gio.Objects.DBusObjectManagerClient as Gio.DBusObjectManagerClient
import {-# SOURCE #-} qualified GI.Gio.Objects.DesktopAppInfo as Gio.DesktopAppInfo
import {-# SOURCE #-} qualified GI.Gio.Objects.SimpleAction as Gio.SimpleAction
import {-# SOURCE #-} qualified GI.Gio.Objects.SimpleAsyncResult as Gio.SimpleAsyncResult
import {-# SOURCE #-} qualified GI.Gio.Objects.Socket as Gio.Socket
import {-# SOURCE #-} qualified GI.Gio.Objects.Task as Gio.Task
import {-# SOURCE #-} qualified GI.Gio.Objects.Vfs as Gio.Vfs
import {-# SOURCE #-} qualified GI.Gio.Structs.DBusInterfaceInfo as Gio.DBusInterfaceInfo
import {-# SOURCE #-} qualified GI.Gio.Structs.DBusInterfaceVTable as Gio.DBusInterfaceVTable
import {-# SOURCE #-} qualified GI.Gio.Structs.IOSchedulerJob as Gio.IOSchedulerJob

-- callback VfsFileLookupFunc
{- Callable
  { returnType =
      Just (TInterface Name { namespace = "Gio" , name = "File" })
  , returnMayBeNull = False
  , returnTransfer = TransferEverything
  , returnDocumentation =
      Documentation
        { rawDocText = Just "a #GFile for @identifier."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "vfs"
          , argType = TInterface Name { namespace = "Gio" , name = "Vfs" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "a #GVfs" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "identifier"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "the identifier to look up a #GFile for. This can either\n    be an URI or a parse name as returned by g_file_get_parse_name()"
                , 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 "user data passed to the function"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "This function type is used by g_vfs_register_uri_scheme() to make it\npossible for a client to associate an URI scheme to a different #GFile\nimplementation.\n\nThe client should return a reference to the new file that has been\ncreated for @uri, or %NULL to continue with the default implementation."
        , sinceVersion = Just "2.50"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_VfsFileLookupFunc =
    Ptr Gio.Vfs.Vfs ->
    CString ->
    Ptr () ->
    IO (Ptr Gio.File.File)

-- Args: [ Arg
--           { argCName = "vfs"
--           , argType = TInterface Name { namespace = "Gio" , name = "Vfs" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GVfs" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "identifier"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the identifier to look up a #GFile for. This can either\n    be an URI or a parse name as returned by g_file_get_parse_name()"
--                 , 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 "user data passed to the function"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gio" , name = "File" })
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_VfsFileLookupFunc :: FunPtr C_VfsFileLookupFunc -> C_VfsFileLookupFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_VfsFileLookupFunc ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.Vfs.IsVfs a) =>
    FunPtr C_VfsFileLookupFunc
    -> a
    -- ^ /@vfs@/: a t'GI.Gio.Objects.Vfs.Vfs'
    -> T.Text
    -- ^ /@identifier@/: the identifier to look up a t'GI.Gio.Interfaces.File.File' for. This can either
    --     be an URI or a parse name as returned by 'GI.Gio.Interfaces.File.fileGetParseName'
    -> Ptr ()
    -- ^ /@userData@/: user data passed to the function
    -> m Gio.File.File
    -- ^ __Returns:__ a t'GI.Gio.Interfaces.File.File' for /@identifier@/.
dynamic_VfsFileLookupFunc :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsVfs a) =>
FunPtr C_VfsFileLookupFunc -> a -> Text -> Ptr () -> m File
dynamic_VfsFileLookupFunc FunPtr C_VfsFileLookupFunc
__funPtr a
vfs Text
identifier Ptr ()
userData = IO File -> m File
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO File -> m File) -> IO File -> m File
forall a b. (a -> b) -> a -> b
$ do
    Ptr Vfs
vfs' <- a -> IO (Ptr Vfs)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
vfs
    CString
identifier' <- Text -> IO CString
textToCString Text
identifier
    Ptr File
result <- (FunPtr C_VfsFileLookupFunc -> C_VfsFileLookupFunc
__dynamic_C_VfsFileLookupFunc FunPtr C_VfsFileLookupFunc
__funPtr) Ptr Vfs
vfs' CString
identifier' Ptr ()
userData
    Text -> Ptr File -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"vfsFileLookupFunc" Ptr File
result
    File
result' <- ((ManagedPtr File -> File) -> Ptr File -> IO File
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr File -> File
Gio.File.File) Ptr File
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
vfs
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
identifier'
    File -> IO File
forall (m :: * -> *) a. Monad m => a -> m a
return File
result'

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

-- | This function type is used by 'GI.Gio.Objects.Vfs.vfsRegisterUriScheme' to make it
-- possible for a client to associate an URI scheme to a different t'GI.Gio.Interfaces.File.File'
-- implementation.
-- 
-- The client should return a reference to the new file that has been
-- created for /@uri@/, or 'P.Nothing' to continue with the default implementation.
-- 
-- /Since: 2.50/
type VfsFileLookupFunc =
    Gio.Vfs.Vfs
    -- ^ /@vfs@/: a t'GI.Gio.Objects.Vfs.Vfs'
    -> T.Text
    -- ^ /@identifier@/: the identifier to look up a t'GI.Gio.Interfaces.File.File' for. This can either
    --     be an URI or a parse name as returned by 'GI.Gio.Interfaces.File.fileGetParseName'
    -> IO Gio.File.File
    -- ^ __Returns:__ a t'GI.Gio.Interfaces.File.File' for /@identifier@/.

-- | A convenience synonym for @`Nothing` :: `Maybe` `VfsFileLookupFunc`@.
noVfsFileLookupFunc :: Maybe VfsFileLookupFunc
noVfsFileLookupFunc :: Maybe VfsFileLookupFunc
noVfsFileLookupFunc = Maybe VfsFileLookupFunc
forall a. Maybe a
Nothing

-- | This function type is used by 'GI.Gio.Objects.Vfs.vfsRegisterUriScheme' to make it
-- possible for a client to associate an URI scheme to a different t'GI.Gio.Interfaces.File.File'
-- implementation.
-- 
-- The client should return a reference to the new file that has been
-- created for /@uri@/, or 'P.Nothing' to continue with the default implementation.
-- 
-- /Since: 2.50/
type VfsFileLookupFunc_WithClosures =
    Gio.Vfs.Vfs
    -- ^ /@vfs@/: a t'GI.Gio.Objects.Vfs.Vfs'
    -> T.Text
    -- ^ /@identifier@/: the identifier to look up a t'GI.Gio.Interfaces.File.File' for. This can either
    --     be an URI or a parse name as returned by 'GI.Gio.Interfaces.File.fileGetParseName'
    -> Ptr ()
    -- ^ /@userData@/: user data passed to the function
    -> IO Gio.File.File
    -- ^ __Returns:__ a t'GI.Gio.Interfaces.File.File' for /@identifier@/.

-- | A convenience synonym for @`Nothing` :: `Maybe` `VfsFileLookupFunc_WithClosures`@.
noVfsFileLookupFunc_WithClosures :: Maybe VfsFileLookupFunc_WithClosures
noVfsFileLookupFunc_WithClosures :: Maybe VfsFileLookupFunc_WithClosures
noVfsFileLookupFunc_WithClosures = Maybe VfsFileLookupFunc_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_VfsFileLookupFunc :: VfsFileLookupFunc -> VfsFileLookupFunc_WithClosures
drop_closures_VfsFileLookupFunc :: VfsFileLookupFunc -> VfsFileLookupFunc_WithClosures
drop_closures_VfsFileLookupFunc VfsFileLookupFunc
_f Vfs
vfs Text
identifier Ptr ()
_ = VfsFileLookupFunc
_f Vfs
vfs Text
identifier

-- | Wrap the callback into a `GClosure`.
genClosure_VfsFileLookupFunc :: MonadIO m => VfsFileLookupFunc -> m (GClosure C_VfsFileLookupFunc)
genClosure_VfsFileLookupFunc :: forall (m :: * -> *).
MonadIO m =>
VfsFileLookupFunc -> m (GClosure C_VfsFileLookupFunc)
genClosure_VfsFileLookupFunc VfsFileLookupFunc
cb = IO (GClosure C_VfsFileLookupFunc)
-> m (GClosure C_VfsFileLookupFunc)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_VfsFileLookupFunc)
 -> m (GClosure C_VfsFileLookupFunc))
-> IO (GClosure C_VfsFileLookupFunc)
-> m (GClosure C_VfsFileLookupFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: VfsFileLookupFunc_WithClosures
cb' = VfsFileLookupFunc -> VfsFileLookupFunc_WithClosures
drop_closures_VfsFileLookupFunc VfsFileLookupFunc
cb
    let cb'' :: C_VfsFileLookupFunc
cb'' = Maybe (Ptr (FunPtr C_VfsFileLookupFunc))
-> VfsFileLookupFunc_WithClosures -> C_VfsFileLookupFunc
wrap_VfsFileLookupFunc Maybe (Ptr (FunPtr C_VfsFileLookupFunc))
forall a. Maybe a
Nothing VfsFileLookupFunc_WithClosures
cb'
    C_VfsFileLookupFunc -> IO (FunPtr C_VfsFileLookupFunc)
mk_VfsFileLookupFunc C_VfsFileLookupFunc
cb'' IO (FunPtr C_VfsFileLookupFunc)
-> (FunPtr C_VfsFileLookupFunc
    -> IO (GClosure C_VfsFileLookupFunc))
-> IO (GClosure C_VfsFileLookupFunc)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_VfsFileLookupFunc -> IO (GClosure C_VfsFileLookupFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `VfsFileLookupFunc` into a `C_VfsFileLookupFunc`.
wrap_VfsFileLookupFunc :: 
    Maybe (Ptr (FunPtr C_VfsFileLookupFunc)) ->
    VfsFileLookupFunc_WithClosures ->
    C_VfsFileLookupFunc
wrap_VfsFileLookupFunc :: Maybe (Ptr (FunPtr C_VfsFileLookupFunc))
-> VfsFileLookupFunc_WithClosures -> C_VfsFileLookupFunc
wrap_VfsFileLookupFunc Maybe (Ptr (FunPtr C_VfsFileLookupFunc))
gi'funptrptr VfsFileLookupFunc_WithClosures
gi'cb Ptr Vfs
vfs CString
identifier Ptr ()
userData = do
    Vfs
vfs' <- ((ManagedPtr Vfs -> Vfs) -> Ptr Vfs -> IO Vfs
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Vfs -> Vfs
Gio.Vfs.Vfs) Ptr Vfs
vfs
    Text
identifier' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
identifier
    File
result <- VfsFileLookupFunc_WithClosures
gi'cb  Vfs
vfs' Text
identifier' Ptr ()
userData
    Maybe (Ptr (FunPtr C_VfsFileLookupFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_VfsFileLookupFunc))
gi'funptrptr
    Ptr File
result' <- File -> IO (Ptr File)
forall a b. (HasCallStack, GObject a) => a -> IO (Ptr b)
B.ManagedPtr.disownObject File
result
    Ptr File -> IO (Ptr File)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr File
result'


-- callback TaskThreadFunc
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "task"
          , argType = TInterface Name { namespace = "Gio" , name = "Task" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the #GTask" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "source_object"
          , argType =
              TInterface Name { namespace = "GObject" , name = "Object" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "@task's source object"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "task_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "@task's task data" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "cancellable"
          , argType =
              TInterface Name { namespace = "Gio" , name = "Cancellable" }
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "@task's #GCancellable, or %NULL"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "The prototype for a task function to be run in a thread via\ng_task_run_in_thread() or g_task_run_in_thread_sync().\n\nIf the return-on-cancel flag is set on @task, and @cancellable gets\ncancelled, then the #GTask will be completed immediately (as though\ng_task_return_error_if_cancelled() had been called), without\nwaiting for the task function to complete. However, the task\nfunction will continue running in its thread in the background. The\nfunction therefore needs to be careful about how it uses\nexternally-visible state in this case. See\ng_task_set_return_on_cancel() for more details.\n\nOther than in that case, @task will be completed when the\n#GTaskThreadFunc returns, not when it calls a\n`g_task_return_` function."
        , sinceVersion = Just "2.36"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_TaskThreadFunc =
    Ptr Gio.Task.Task ->
    Ptr GObject.Object.Object ->
    Ptr () ->
    Ptr Gio.Cancellable.Cancellable ->
    IO ()

-- Args: [ Arg
--           { argCName = "task"
--           , argType = TInterface Name { namespace = "Gio" , name = "Task" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #GTask" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "source_object"
--           , argType =
--               TInterface Name { namespace = "GObject" , name = "Object" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "@task's source object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "task_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "@task's task data" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "@task's #GCancellable, or %NULL"
--                 , 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_TaskThreadFunc :: FunPtr C_TaskThreadFunc -> C_TaskThreadFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_TaskThreadFunc ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.Task.IsTask a, GObject.Object.IsObject b, Gio.Cancellable.IsCancellable c) =>
    FunPtr C_TaskThreadFunc
    -> a
    -- ^ /@task@/: the t'GI.Gio.Objects.Task.Task'
    -> b
    -- ^ /@sourceObject@/: /@task@/\'s source object
    -> Ptr ()
    -- ^ /@taskData@/: /@task@/\'s task data
    -> Maybe (c)
    -- ^ /@cancellable@/: /@task@/\'s t'GI.Gio.Objects.Cancellable.Cancellable', or 'P.Nothing'
    -> m ()
dynamic_TaskThreadFunc :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsTask a, IsObject b, IsCancellable c) =>
FunPtr C_TaskThreadFunc -> a -> b -> Ptr () -> Maybe c -> m ()
dynamic_TaskThreadFunc FunPtr C_TaskThreadFunc
__funPtr a
task b
sourceObject Ptr ()
taskData Maybe c
cancellable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Task
task' <- a -> IO (Ptr Task)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
task
    Ptr Object
sourceObject' <- b -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
sourceObject
    Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
        Maybe c
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just c
jCancellable -> do
            Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    (FunPtr C_TaskThreadFunc -> C_TaskThreadFunc
__dynamic_C_TaskThreadFunc FunPtr C_TaskThreadFunc
__funPtr) Ptr Task
task' Ptr Object
sourceObject' Ptr ()
taskData Ptr Cancellable
maybeCancellable
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
task
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
sourceObject
    Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | The prototype for a task function to be run in a thread via
-- 'GI.Gio.Objects.Task.taskRunInThread' or 'GI.Gio.Objects.Task.taskRunInThreadSync'.
-- 
-- If the return-on-cancel flag is set on /@task@/, and /@cancellable@/ gets
-- cancelled, then the t'GI.Gio.Objects.Task.Task' will be completed immediately (as though
-- 'GI.Gio.Objects.Task.taskReturnErrorIfCancelled' had been called), without
-- waiting for the task function to complete. However, the task
-- function will continue running in its thread in the background. The
-- function therefore needs to be careful about how it uses
-- externally-visible state in this case. See
-- 'GI.Gio.Objects.Task.taskSetReturnOnCancel' for more details.
-- 
-- Other than in that case, /@task@/ will be completed when the
-- t'GI.Gio.Callbacks.TaskThreadFunc' returns, not when it calls a
-- @g_task_return_@ function.
-- 
-- /Since: 2.36/
type TaskThreadFunc =
    Gio.Task.Task
    -- ^ /@task@/: the t'GI.Gio.Objects.Task.Task'
    -> GObject.Object.Object
    -- ^ /@sourceObject@/: /@task@/\'s source object
    -> Ptr ()
    -- ^ /@taskData@/: /@task@/\'s task data
    -> Maybe Gio.Cancellable.Cancellable
    -- ^ /@cancellable@/: /@task@/\'s t'GI.Gio.Objects.Cancellable.Cancellable', or 'P.Nothing'
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `TaskThreadFunc`@.
noTaskThreadFunc :: Maybe TaskThreadFunc
noTaskThreadFunc :: Maybe TaskThreadFunc
noTaskThreadFunc = Maybe TaskThreadFunc
forall a. Maybe a
Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_TaskThreadFunc :: MonadIO m => TaskThreadFunc -> m (GClosure C_TaskThreadFunc)
genClosure_TaskThreadFunc :: forall (m :: * -> *).
MonadIO m =>
TaskThreadFunc -> m (GClosure C_TaskThreadFunc)
genClosure_TaskThreadFunc TaskThreadFunc
cb = IO (GClosure C_TaskThreadFunc) -> m (GClosure C_TaskThreadFunc)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_TaskThreadFunc) -> m (GClosure C_TaskThreadFunc))
-> IO (GClosure C_TaskThreadFunc) -> m (GClosure C_TaskThreadFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_TaskThreadFunc
cb' = Maybe (Ptr (FunPtr C_TaskThreadFunc))
-> TaskThreadFunc -> C_TaskThreadFunc
wrap_TaskThreadFunc Maybe (Ptr (FunPtr C_TaskThreadFunc))
forall a. Maybe a
Nothing TaskThreadFunc
cb
    C_TaskThreadFunc -> IO (FunPtr C_TaskThreadFunc)
mk_TaskThreadFunc C_TaskThreadFunc
cb' IO (FunPtr C_TaskThreadFunc)
-> (FunPtr C_TaskThreadFunc -> IO (GClosure C_TaskThreadFunc))
-> IO (GClosure C_TaskThreadFunc)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_TaskThreadFunc -> IO (GClosure C_TaskThreadFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `TaskThreadFunc` into a `C_TaskThreadFunc`.
wrap_TaskThreadFunc :: 
    Maybe (Ptr (FunPtr C_TaskThreadFunc)) ->
    TaskThreadFunc ->
    C_TaskThreadFunc
wrap_TaskThreadFunc :: Maybe (Ptr (FunPtr C_TaskThreadFunc))
-> TaskThreadFunc -> C_TaskThreadFunc
wrap_TaskThreadFunc Maybe (Ptr (FunPtr C_TaskThreadFunc))
gi'funptrptr TaskThreadFunc
gi'cb Ptr Task
task Ptr Object
sourceObject Ptr ()
taskData Ptr Cancellable
cancellable = do
    Task
task' <- ((ManagedPtr Task -> Task) -> Ptr Task -> IO Task
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Task -> Task
Gio.Task.Task) Ptr Task
task
    Object
sourceObject' <- ((ManagedPtr Object -> Object) -> Ptr Object -> IO Object
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Object -> Object
GObject.Object.Object) Ptr Object
sourceObject
    Maybe Cancellable
maybeCancellable <-
        if Ptr Cancellable
cancellable Ptr Cancellable -> Ptr Cancellable -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr Cancellable
forall a. Ptr a
nullPtr
        then Maybe Cancellable -> IO (Maybe Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Cancellable
forall a. Maybe a
Nothing
        else do
            Cancellable
cancellable' <- ((ManagedPtr Cancellable -> Cancellable)
-> Ptr Cancellable -> IO Cancellable
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Cancellable -> Cancellable
Gio.Cancellable.Cancellable) Ptr Cancellable
cancellable
            Maybe Cancellable -> IO (Maybe Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Cancellable -> IO (Maybe Cancellable))
-> Maybe Cancellable -> IO (Maybe Cancellable)
forall a b. (a -> b) -> a -> b
$ Cancellable -> Maybe Cancellable
forall a. a -> Maybe a
Just Cancellable
cancellable'
    TaskThreadFunc
gi'cb  Task
task' Object
sourceObject' Ptr ()
taskData Maybe Cancellable
maybeCancellable
    Maybe (Ptr (FunPtr C_TaskThreadFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_TaskThreadFunc))
gi'funptrptr


-- callback SocketSourceFunc
{- Callable
  { returnType = Just (TBasicType TBoolean)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just "it should return %FALSE if the source should be removed."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "socket"
          , argType = TInterface Name { namespace = "Gio" , name = "Socket" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the #GSocket" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "condition"
          , argType =
              TInterface Name { namespace = "GLib" , name = "IOCondition" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the current condition at the source fired."
                , 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 "data passed in by the user."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "This is the function type of the callback used for the #GSource\nreturned by g_socket_create_source()."
        , sinceVersion = Just "2.22"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_SocketSourceFunc =
    Ptr Gio.Socket.Socket ->
    CUInt ->
    Ptr () ->
    IO CInt

-- Args: [ Arg
--           { argCName = "socket"
--           , argType = TInterface Name { namespace = "Gio" , name = "Socket" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #GSocket" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "condition"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "IOCondition" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the current condition at the source fired."
--                 , 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 "data passed in by the user."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_SocketSourceFunc :: FunPtr C_SocketSourceFunc -> C_SocketSourceFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_SocketSourceFunc ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.Socket.IsSocket a) =>
    FunPtr C_SocketSourceFunc
    -> a
    -- ^ /@socket@/: the t'GI.Gio.Objects.Socket.Socket'
    -> [GLib.Flags.IOCondition]
    -- ^ /@condition@/: the current condition at the source fired.
    -> Ptr ()
    -- ^ /@userData@/: data passed in by the user.
    -> m Bool
    -- ^ __Returns:__ it should return 'P.False' if the source should be removed.
dynamic_SocketSourceFunc :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
FunPtr C_SocketSourceFunc -> a -> [IOCondition] -> Ptr () -> m Bool
dynamic_SocketSourceFunc FunPtr C_SocketSourceFunc
__funPtr a
socket [IOCondition]
condition Ptr ()
userData = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
    let condition' :: CUInt
condition' = [IOCondition] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [IOCondition]
condition
    CInt
result <- (FunPtr C_SocketSourceFunc -> C_SocketSourceFunc
__dynamic_C_SocketSourceFunc FunPtr C_SocketSourceFunc
__funPtr) Ptr Socket
socket' CUInt
condition' Ptr ()
userData
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

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

-- | This is the function type of the callback used for the t'GI.GLib.Structs.Source.Source'
-- returned by @/g_socket_create_source()/@.
-- 
-- /Since: 2.22/
type SocketSourceFunc =
    Gio.Socket.Socket
    -- ^ /@socket@/: the t'GI.Gio.Objects.Socket.Socket'
    -> [GLib.Flags.IOCondition]
    -- ^ /@condition@/: the current condition at the source fired.
    -> IO Bool
    -- ^ __Returns:__ it should return 'P.False' if the source should be removed.

-- | A convenience synonym for @`Nothing` :: `Maybe` `SocketSourceFunc`@.
noSocketSourceFunc :: Maybe SocketSourceFunc
noSocketSourceFunc :: Maybe SocketSourceFunc
noSocketSourceFunc = Maybe SocketSourceFunc
forall a. Maybe a
Nothing

-- | This is the function type of the callback used for the t'GI.GLib.Structs.Source.Source'
-- returned by @/g_socket_create_source()/@.
-- 
-- /Since: 2.22/
type SocketSourceFunc_WithClosures =
    Gio.Socket.Socket
    -- ^ /@socket@/: the t'GI.Gio.Objects.Socket.Socket'
    -> [GLib.Flags.IOCondition]
    -- ^ /@condition@/: the current condition at the source fired.
    -> Ptr ()
    -- ^ /@userData@/: data passed in by the user.
    -> IO Bool
    -- ^ __Returns:__ it should return 'P.False' if the source should be removed.

-- | A convenience synonym for @`Nothing` :: `Maybe` `SocketSourceFunc_WithClosures`@.
noSocketSourceFunc_WithClosures :: Maybe SocketSourceFunc_WithClosures
noSocketSourceFunc_WithClosures :: Maybe SocketSourceFunc_WithClosures
noSocketSourceFunc_WithClosures = Maybe SocketSourceFunc_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_SocketSourceFunc :: SocketSourceFunc -> SocketSourceFunc_WithClosures
drop_closures_SocketSourceFunc :: SocketSourceFunc -> SocketSourceFunc_WithClosures
drop_closures_SocketSourceFunc SocketSourceFunc
_f Socket
socket [IOCondition]
condition Ptr ()
_ = SocketSourceFunc
_f Socket
socket [IOCondition]
condition

-- | Wrap the callback into a `GClosure`.
genClosure_SocketSourceFunc :: MonadIO m => SocketSourceFunc -> m (GClosure C_SocketSourceFunc)
genClosure_SocketSourceFunc :: forall (m :: * -> *).
MonadIO m =>
SocketSourceFunc -> m (GClosure C_SocketSourceFunc)
genClosure_SocketSourceFunc SocketSourceFunc
cb = IO (GClosure C_SocketSourceFunc) -> m (GClosure C_SocketSourceFunc)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_SocketSourceFunc)
 -> m (GClosure C_SocketSourceFunc))
-> IO (GClosure C_SocketSourceFunc)
-> m (GClosure C_SocketSourceFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: SocketSourceFunc_WithClosures
cb' = SocketSourceFunc -> SocketSourceFunc_WithClosures
drop_closures_SocketSourceFunc SocketSourceFunc
cb
    let cb'' :: C_SocketSourceFunc
cb'' = Maybe (Ptr (FunPtr C_SocketSourceFunc))
-> SocketSourceFunc_WithClosures -> C_SocketSourceFunc
wrap_SocketSourceFunc Maybe (Ptr (FunPtr C_SocketSourceFunc))
forall a. Maybe a
Nothing SocketSourceFunc_WithClosures
cb'
    C_SocketSourceFunc -> IO (FunPtr C_SocketSourceFunc)
mk_SocketSourceFunc C_SocketSourceFunc
cb'' IO (FunPtr C_SocketSourceFunc)
-> (FunPtr C_SocketSourceFunc -> IO (GClosure C_SocketSourceFunc))
-> IO (GClosure C_SocketSourceFunc)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_SocketSourceFunc -> IO (GClosure C_SocketSourceFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `SocketSourceFunc` into a `C_SocketSourceFunc`.
wrap_SocketSourceFunc :: 
    Maybe (Ptr (FunPtr C_SocketSourceFunc)) ->
    SocketSourceFunc_WithClosures ->
    C_SocketSourceFunc
wrap_SocketSourceFunc :: Maybe (Ptr (FunPtr C_SocketSourceFunc))
-> SocketSourceFunc_WithClosures -> C_SocketSourceFunc
wrap_SocketSourceFunc Maybe (Ptr (FunPtr C_SocketSourceFunc))
gi'funptrptr SocketSourceFunc_WithClosures
gi'cb Ptr Socket
socket CUInt
condition Ptr ()
userData = do
    Socket
socket' <- ((ManagedPtr Socket -> Socket) -> Ptr Socket -> IO Socket
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Socket -> Socket
Gio.Socket.Socket) Ptr Socket
socket
    let condition' :: [IOCondition]
condition' = CUInt -> [IOCondition]
forall a b. (Storable a, Integral a, Bits a, IsGFlag b) => a -> [b]
wordToGFlags CUInt
condition
    Bool
result <- SocketSourceFunc_WithClosures
gi'cb  Socket
socket' [IOCondition]
condition' Ptr ()
userData
    Maybe (Ptr (FunPtr C_SocketSourceFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_SocketSourceFunc))
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 (m :: * -> *) a. Monad m => a -> m a
return CInt
result'


-- callback SimpleAsyncThreadFunc
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "res"
          , argType =
              TInterface Name { namespace = "Gio" , name = "SimpleAsyncResult" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "a #GSimpleAsyncResult."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "object"
          , argType =
              TInterface Name { namespace = "GObject" , name = "Object" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "a #GObject." , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "cancellable"
          , argType =
              TInterface Name { namespace = "Gio" , name = "Cancellable" }
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText =
                    Just "optional #GCancellable object, %NULL to ignore."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Simple thread function that runs an asynchronous operation and\nchecks for cancellation."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_SimpleAsyncThreadFunc =
    Ptr Gio.SimpleAsyncResult.SimpleAsyncResult ->
    Ptr GObject.Object.Object ->
    Ptr Gio.Cancellable.Cancellable ->
    IO ()

-- Args: [ Arg
--           { argCName = "res"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "SimpleAsyncResult" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSimpleAsyncResult."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "object"
--           , argType =
--               TInterface Name { namespace = "GObject" , name = "Object" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GObject." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "optional #GCancellable object, %NULL to ignore."
--                 , 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_SimpleAsyncThreadFunc :: FunPtr C_SimpleAsyncThreadFunc -> C_SimpleAsyncThreadFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_SimpleAsyncThreadFunc ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.SimpleAsyncResult.IsSimpleAsyncResult a, GObject.Object.IsObject b, Gio.Cancellable.IsCancellable c) =>
    FunPtr C_SimpleAsyncThreadFunc
    -> a
    -- ^ /@res@/: a t'GI.Gio.Objects.SimpleAsyncResult.SimpleAsyncResult'.
    -> b
    -- ^ /@object@/: a t'GI.GObject.Objects.Object.Object'.
    -> Maybe (c)
    -- ^ /@cancellable@/: optional t'GI.Gio.Objects.Cancellable.Cancellable' object, 'P.Nothing' to ignore.
    -> m ()
dynamic_SimpleAsyncThreadFunc :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsSimpleAsyncResult a, IsObject b,
 IsCancellable c) =>
FunPtr C_SimpleAsyncThreadFunc -> a -> b -> Maybe c -> m ()
dynamic_SimpleAsyncThreadFunc FunPtr C_SimpleAsyncThreadFunc
__funPtr a
res b
object Maybe c
cancellable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr SimpleAsyncResult
res' <- a -> IO (Ptr SimpleAsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
res
    Ptr Object
object' <- b -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
object
    Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
        Maybe c
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just c
jCancellable -> do
            Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    (FunPtr C_SimpleAsyncThreadFunc -> C_SimpleAsyncThreadFunc
__dynamic_C_SimpleAsyncThreadFunc FunPtr C_SimpleAsyncThreadFunc
__funPtr) Ptr SimpleAsyncResult
res' Ptr Object
object' Ptr Cancellable
maybeCancellable
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
res
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
object
    Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | Simple thread function that runs an asynchronous operation and
-- checks for cancellation.
type SimpleAsyncThreadFunc =
    Gio.SimpleAsyncResult.SimpleAsyncResult
    -- ^ /@res@/: a t'GI.Gio.Objects.SimpleAsyncResult.SimpleAsyncResult'.
    -> GObject.Object.Object
    -- ^ /@object@/: a t'GI.GObject.Objects.Object.Object'.
    -> Maybe Gio.Cancellable.Cancellable
    -- ^ /@cancellable@/: optional t'GI.Gio.Objects.Cancellable.Cancellable' object, 'P.Nothing' to ignore.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `SimpleAsyncThreadFunc`@.
noSimpleAsyncThreadFunc :: Maybe SimpleAsyncThreadFunc
noSimpleAsyncThreadFunc :: Maybe SimpleAsyncThreadFunc
noSimpleAsyncThreadFunc = Maybe SimpleAsyncThreadFunc
forall a. Maybe a
Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_SimpleAsyncThreadFunc :: MonadIO m => SimpleAsyncThreadFunc -> m (GClosure C_SimpleAsyncThreadFunc)
genClosure_SimpleAsyncThreadFunc :: forall (m :: * -> *).
MonadIO m =>
SimpleAsyncThreadFunc -> m (GClosure C_SimpleAsyncThreadFunc)
genClosure_SimpleAsyncThreadFunc SimpleAsyncThreadFunc
cb = IO (GClosure C_SimpleAsyncThreadFunc)
-> m (GClosure C_SimpleAsyncThreadFunc)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_SimpleAsyncThreadFunc)
 -> m (GClosure C_SimpleAsyncThreadFunc))
-> IO (GClosure C_SimpleAsyncThreadFunc)
-> m (GClosure C_SimpleAsyncThreadFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_SimpleAsyncThreadFunc
cb' = Maybe (Ptr (FunPtr C_SimpleAsyncThreadFunc))
-> SimpleAsyncThreadFunc -> C_SimpleAsyncThreadFunc
wrap_SimpleAsyncThreadFunc Maybe (Ptr (FunPtr C_SimpleAsyncThreadFunc))
forall a. Maybe a
Nothing SimpleAsyncThreadFunc
cb
    C_SimpleAsyncThreadFunc -> IO (FunPtr C_SimpleAsyncThreadFunc)
mk_SimpleAsyncThreadFunc C_SimpleAsyncThreadFunc
cb' IO (FunPtr C_SimpleAsyncThreadFunc)
-> (FunPtr C_SimpleAsyncThreadFunc
    -> IO (GClosure C_SimpleAsyncThreadFunc))
-> IO (GClosure C_SimpleAsyncThreadFunc)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_SimpleAsyncThreadFunc
-> IO (GClosure C_SimpleAsyncThreadFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `SimpleAsyncThreadFunc` into a `C_SimpleAsyncThreadFunc`.
wrap_SimpleAsyncThreadFunc :: 
    Maybe (Ptr (FunPtr C_SimpleAsyncThreadFunc)) ->
    SimpleAsyncThreadFunc ->
    C_SimpleAsyncThreadFunc
wrap_SimpleAsyncThreadFunc :: Maybe (Ptr (FunPtr C_SimpleAsyncThreadFunc))
-> SimpleAsyncThreadFunc -> C_SimpleAsyncThreadFunc
wrap_SimpleAsyncThreadFunc Maybe (Ptr (FunPtr C_SimpleAsyncThreadFunc))
gi'funptrptr SimpleAsyncThreadFunc
gi'cb Ptr SimpleAsyncResult
res Ptr Object
object Ptr Cancellable
cancellable = do
    SimpleAsyncResult
res' <- ((ManagedPtr SimpleAsyncResult -> SimpleAsyncResult)
-> Ptr SimpleAsyncResult -> IO SimpleAsyncResult
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr SimpleAsyncResult -> SimpleAsyncResult
Gio.SimpleAsyncResult.SimpleAsyncResult) Ptr SimpleAsyncResult
res
    Object
object' <- ((ManagedPtr Object -> Object) -> Ptr Object -> IO Object
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Object -> Object
GObject.Object.Object) Ptr Object
object
    Maybe Cancellable
maybeCancellable <-
        if Ptr Cancellable
cancellable Ptr Cancellable -> Ptr Cancellable -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr Cancellable
forall a. Ptr a
nullPtr
        then Maybe Cancellable -> IO (Maybe Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Cancellable
forall a. Maybe a
Nothing
        else do
            Cancellable
cancellable' <- ((ManagedPtr Cancellable -> Cancellable)
-> Ptr Cancellable -> IO Cancellable
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Cancellable -> Cancellable
Gio.Cancellable.Cancellable) Ptr Cancellable
cancellable
            Maybe Cancellable -> IO (Maybe Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Cancellable -> IO (Maybe Cancellable))
-> Maybe Cancellable -> IO (Maybe Cancellable)
forall a b. (a -> b) -> a -> b
$ Cancellable -> Maybe Cancellable
forall a. a -> Maybe a
Just Cancellable
cancellable'
    SimpleAsyncThreadFunc
gi'cb  SimpleAsyncResult
res' Object
object' Maybe Cancellable
maybeCancellable
    Maybe (Ptr (FunPtr C_SimpleAsyncThreadFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_SimpleAsyncThreadFunc))
gi'funptrptr


-- callback SettingsGetMapping
{- Callable
  { returnType = Just (TBasicType TBoolean)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just
              "%TRUE if the conversion succeeded, %FALSE in case of an error"
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "value"
          , argType = TVariant
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the #GVariant to map, or %NULL"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "result"
          , argType = TBasicType TPtr
          , direction = DirectionOut
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "the result of the mapping"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferEverything
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText =
                    Just "the user data that was passed to\ng_settings_get_mapped()"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "The type of the function that is used to convert from a value stored\nin a #GSettings to a value that is useful to the application.\n\nIf the value is successfully mapped, the result should be stored at\n@result and %TRUE returned.  If mapping fails (for example, if @value\nis not in the right format) then %FALSE should be returned.\n\nIf @value is %NULL then it means that the mapping function is being\ngiven a \"last chance\" to successfully return a valid value.  %TRUE\nmust be returned in this case."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_SettingsGetMapping =
    Ptr GVariant ->
    Ptr (Ptr ()) ->
    Ptr () ->
    IO CInt

-- Args: [ Arg
--           { argCName = "value"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #GVariant to map, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "result"
--           , argType = TBasicType TPtr
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the result of the mapping"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the user data that was passed to\ng_settings_get_mapped()"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_SettingsGetMapping :: FunPtr C_SettingsGetMapping -> C_SettingsGetMapping

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_SettingsGetMapping ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_SettingsGetMapping
    -> GVariant
    -- ^ /@value@/: the t'GVariant' to map, or 'P.Nothing'
    -> Ptr ()
    -- ^ /@userData@/: the user data that was passed to
    -- 'GI.Gio.Objects.Settings.settingsGetMapped'
    -> m ((Bool, Ptr ()))
    -- ^ __Returns:__ 'P.True' if the conversion succeeded, 'P.False' in case of an error
dynamic_SettingsGetMapping :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_SettingsGetMapping
-> GVariant -> Ptr () -> m (Bool, Ptr ())
dynamic_SettingsGetMapping FunPtr C_SettingsGetMapping
__funPtr GVariant
value Ptr ()
userData = IO (Bool, Ptr ()) -> m (Bool, Ptr ())
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, Ptr ()) -> m (Bool, Ptr ()))
-> IO (Bool, Ptr ()) -> m (Bool, Ptr ())
forall a b. (a -> b) -> a -> b
$ do
    Ptr GVariant
value' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
value
    Ptr (Ptr ())
result_ <- IO (Ptr (Ptr ()))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr ()))
    CInt
result <- (FunPtr C_SettingsGetMapping -> C_SettingsGetMapping
__dynamic_C_SettingsGetMapping FunPtr C_SettingsGetMapping
__funPtr) Ptr GVariant
value' Ptr (Ptr ())
result_ Ptr ()
userData
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Ptr ()
result_' <- Ptr (Ptr ()) -> IO (Ptr ())
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr ())
result_
    GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
value
    Ptr (Ptr ()) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr ())
result_
    (Bool, Ptr ()) -> IO (Bool, Ptr ())
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', Ptr ()
result_')

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

-- | The type of the function that is used to convert from a value stored
-- in a t'GI.Gio.Objects.Settings.Settings' to a value that is useful to the application.
-- 
-- If the value is successfully mapped, the result should be stored at
-- /@result@/ and 'P.True' returned.  If mapping fails (for example, if /@value@/
-- is not in the right format) then 'P.False' should be returned.
-- 
-- If /@value@/ is 'P.Nothing' then it means that the mapping function is being
-- given a \"last chance\" to successfully return a valid value.  'P.True'
-- must be returned in this case.
type SettingsGetMapping =
    GVariant
    -- ^ /@value@/: the t'GVariant' to map, or 'P.Nothing'
    -> IO ((Bool, Ptr ()))
    -- ^ __Returns:__ 'P.True' if the conversion succeeded, 'P.False' in case of an error

-- | A convenience synonym for @`Nothing` :: `Maybe` `SettingsGetMapping`@.
noSettingsGetMapping :: Maybe SettingsGetMapping
noSettingsGetMapping :: Maybe SettingsGetMapping
noSettingsGetMapping = Maybe SettingsGetMapping
forall a. Maybe a
Nothing

-- | The type of the function that is used to convert from a value stored
-- in a t'GI.Gio.Objects.Settings.Settings' to a value that is useful to the application.
-- 
-- If the value is successfully mapped, the result should be stored at
-- /@result@/ and 'P.True' returned.  If mapping fails (for example, if /@value@/
-- is not in the right format) then 'P.False' should be returned.
-- 
-- If /@value@/ is 'P.Nothing' then it means that the mapping function is being
-- given a \"last chance\" to successfully return a valid value.  'P.True'
-- must be returned in this case.
type SettingsGetMapping_WithClosures =
    GVariant
    -- ^ /@value@/: the t'GVariant' to map, or 'P.Nothing'
    -> Ptr ()
    -- ^ /@userData@/: the user data that was passed to
    -- 'GI.Gio.Objects.Settings.settingsGetMapped'
    -> IO ((Bool, Ptr ()))
    -- ^ __Returns:__ 'P.True' if the conversion succeeded, 'P.False' in case of an error

-- | A convenience synonym for @`Nothing` :: `Maybe` `SettingsGetMapping_WithClosures`@.
noSettingsGetMapping_WithClosures :: Maybe SettingsGetMapping_WithClosures
noSettingsGetMapping_WithClosures :: Maybe SettingsGetMapping_WithClosures
noSettingsGetMapping_WithClosures = Maybe SettingsGetMapping_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_SettingsGetMapping :: SettingsGetMapping -> SettingsGetMapping_WithClosures
drop_closures_SettingsGetMapping :: SettingsGetMapping -> SettingsGetMapping_WithClosures
drop_closures_SettingsGetMapping SettingsGetMapping
_f GVariant
value Ptr ()
_ = SettingsGetMapping
_f GVariant
value

-- | Wrap the callback into a `GClosure`.
genClosure_SettingsGetMapping :: MonadIO m => SettingsGetMapping -> m (GClosure C_SettingsGetMapping)
genClosure_SettingsGetMapping :: forall (m :: * -> *).
MonadIO m =>
SettingsGetMapping -> m (GClosure C_SettingsGetMapping)
genClosure_SettingsGetMapping SettingsGetMapping
cb = IO (GClosure C_SettingsGetMapping)
-> m (GClosure C_SettingsGetMapping)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_SettingsGetMapping)
 -> m (GClosure C_SettingsGetMapping))
-> IO (GClosure C_SettingsGetMapping)
-> m (GClosure C_SettingsGetMapping)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: SettingsGetMapping_WithClosures
cb' = SettingsGetMapping -> SettingsGetMapping_WithClosures
drop_closures_SettingsGetMapping SettingsGetMapping
cb
    let cb'' :: C_SettingsGetMapping
cb'' = Maybe (Ptr (FunPtr C_SettingsGetMapping))
-> SettingsGetMapping_WithClosures -> C_SettingsGetMapping
wrap_SettingsGetMapping Maybe (Ptr (FunPtr C_SettingsGetMapping))
forall a. Maybe a
Nothing SettingsGetMapping_WithClosures
cb'
    C_SettingsGetMapping -> IO (FunPtr C_SettingsGetMapping)
mk_SettingsGetMapping C_SettingsGetMapping
cb'' IO (FunPtr C_SettingsGetMapping)
-> (FunPtr C_SettingsGetMapping
    -> IO (GClosure C_SettingsGetMapping))
-> IO (GClosure C_SettingsGetMapping)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_SettingsGetMapping -> IO (GClosure C_SettingsGetMapping)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `SettingsGetMapping` into a `C_SettingsGetMapping`.
wrap_SettingsGetMapping :: 
    Maybe (Ptr (FunPtr C_SettingsGetMapping)) ->
    SettingsGetMapping_WithClosures ->
    C_SettingsGetMapping
wrap_SettingsGetMapping :: Maybe (Ptr (FunPtr C_SettingsGetMapping))
-> SettingsGetMapping_WithClosures -> C_SettingsGetMapping
wrap_SettingsGetMapping Maybe (Ptr (FunPtr C_SettingsGetMapping))
gi'funptrptr SettingsGetMapping_WithClosures
gi'cb Ptr GVariant
value Ptr (Ptr ())
result_ Ptr ()
userData = do
    GVariant
value' <- Ptr GVariant -> IO GVariant
B.GVariant.newGVariantFromPtr Ptr GVariant
value
    (Bool
result, Ptr ()
outresult_) <- SettingsGetMapping_WithClosures
gi'cb  GVariant
value' Ptr ()
userData
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (Ptr ())
result_ Ptr ()
outresult_
    Maybe (Ptr (FunPtr C_SettingsGetMapping)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_SettingsGetMapping))
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 (m :: * -> *) a. Monad m => a -> m a
return CInt
result'


-- callback SettingsBindSetMapping
{- Callable
  { returnType = Just TVariant
  , returnMayBeNull = False
  , returnTransfer = TransferEverything
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just
              "a new #GVariant holding the data from @value,\n    or %NULL in case of an error"
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "value"
          , argType = TGValue
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just "a #GValue containing the property value to map"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "expected_type"
          , argType =
              TInterface Name { namespace = "GLib" , name = "VariantType" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the #GVariantType to create"
                , 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 "user data that was specified when the binding was created"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "The type for the function that is used to convert an object property\nvalue to a #GVariant for storing it in #GSettings."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_SettingsBindSetMapping =
    Ptr GValue ->
    Ptr GLib.VariantType.VariantType ->
    Ptr () ->
    IO (Ptr GVariant)

-- Args: [ Arg
--           { argCName = "value"
--           , argType = TGValue
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a #GValue containing the property value to map"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "expected_type"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "VariantType" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #GVariantType to create"
--                 , 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 "user data that was specified when the binding was created"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just TVariant
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_SettingsBindSetMapping :: FunPtr C_SettingsBindSetMapping -> C_SettingsBindSetMapping

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_SettingsBindSetMapping ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_SettingsBindSetMapping
    -> GValue
    -- ^ /@value@/: a t'GI.GObject.Structs.Value.Value' containing the property value to map
    -> GLib.VariantType.VariantType
    -- ^ /@expectedType@/: the t'GI.GLib.Structs.VariantType.VariantType' to create
    -> Ptr ()
    -- ^ /@userData@/: user data that was specified when the binding was created
    -> m GVariant
    -- ^ __Returns:__ a new t'GVariant' holding the data from /@value@/,
    --     or 'P.Nothing' in case of an error
dynamic_SettingsBindSetMapping :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_SettingsBindSetMapping
-> GValue -> VariantType -> Ptr () -> m GVariant
dynamic_SettingsBindSetMapping FunPtr C_SettingsBindSetMapping
__funPtr GValue
value VariantType
expectedType Ptr ()
userData = IO GVariant -> m GVariant
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GVariant -> m GVariant) -> IO GVariant -> m GVariant
forall a b. (a -> b) -> a -> b
$ do
    Ptr GValue
value' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
value
    Ptr VariantType
expectedType' <- VariantType -> IO (Ptr VariantType)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr VariantType
expectedType
    Ptr GVariant
result <- (FunPtr C_SettingsBindSetMapping -> C_SettingsBindSetMapping
__dynamic_C_SettingsBindSetMapping FunPtr C_SettingsBindSetMapping
__funPtr) Ptr GValue
value' Ptr VariantType
expectedType' Ptr ()
userData
    Text -> Ptr GVariant -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"settingsBindSetMapping" Ptr GVariant
result
    GVariant
result' <- Ptr GVariant -> IO GVariant
B.GVariant.wrapGVariantPtr Ptr GVariant
result
    GValue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GValue
value
    VariantType -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr VariantType
expectedType
    GVariant -> IO GVariant
forall (m :: * -> *) a. Monad m => a -> m a
return GVariant
result'

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

-- | The type for the function that is used to convert an object property
-- value to a t'GVariant' for storing it in t'GI.Gio.Objects.Settings.Settings'.
type SettingsBindSetMapping =
    GValue
    -- ^ /@value@/: a t'GI.GObject.Structs.Value.Value' containing the property value to map
    -> GLib.VariantType.VariantType
    -- ^ /@expectedType@/: the t'GI.GLib.Structs.VariantType.VariantType' to create
    -> IO GVariant
    -- ^ __Returns:__ a new t'GVariant' holding the data from /@value@/,
    --     or 'P.Nothing' in case of an error

-- | A convenience synonym for @`Nothing` :: `Maybe` `SettingsBindSetMapping`@.
noSettingsBindSetMapping :: Maybe SettingsBindSetMapping
noSettingsBindSetMapping :: Maybe SettingsBindSetMapping
noSettingsBindSetMapping = Maybe SettingsBindSetMapping
forall a. Maybe a
Nothing

-- | The type for the function that is used to convert an object property
-- value to a t'GVariant' for storing it in t'GI.Gio.Objects.Settings.Settings'.
type SettingsBindSetMapping_WithClosures =
    GValue
    -- ^ /@value@/: a t'GI.GObject.Structs.Value.Value' containing the property value to map
    -> GLib.VariantType.VariantType
    -- ^ /@expectedType@/: the t'GI.GLib.Structs.VariantType.VariantType' to create
    -> Ptr ()
    -- ^ /@userData@/: user data that was specified when the binding was created
    -> IO GVariant
    -- ^ __Returns:__ a new t'GVariant' holding the data from /@value@/,
    --     or 'P.Nothing' in case of an error

-- | A convenience synonym for @`Nothing` :: `Maybe` `SettingsBindSetMapping_WithClosures`@.
noSettingsBindSetMapping_WithClosures :: Maybe SettingsBindSetMapping_WithClosures
noSettingsBindSetMapping_WithClosures :: Maybe SettingsBindSetMapping_WithClosures
noSettingsBindSetMapping_WithClosures = Maybe SettingsBindSetMapping_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_SettingsBindSetMapping :: SettingsBindSetMapping -> SettingsBindSetMapping_WithClosures
drop_closures_SettingsBindSetMapping :: SettingsBindSetMapping -> SettingsBindSetMapping_WithClosures
drop_closures_SettingsBindSetMapping SettingsBindSetMapping
_f GValue
value VariantType
expectedType Ptr ()
_ = SettingsBindSetMapping
_f GValue
value VariantType
expectedType

-- | Wrap the callback into a `GClosure`.
genClosure_SettingsBindSetMapping :: MonadIO m => SettingsBindSetMapping -> m (GClosure C_SettingsBindSetMapping)
genClosure_SettingsBindSetMapping :: forall (m :: * -> *).
MonadIO m =>
SettingsBindSetMapping -> m (GClosure C_SettingsBindSetMapping)
genClosure_SettingsBindSetMapping SettingsBindSetMapping
cb = IO (GClosure C_SettingsBindSetMapping)
-> m (GClosure C_SettingsBindSetMapping)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_SettingsBindSetMapping)
 -> m (GClosure C_SettingsBindSetMapping))
-> IO (GClosure C_SettingsBindSetMapping)
-> m (GClosure C_SettingsBindSetMapping)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: SettingsBindSetMapping_WithClosures
cb' = SettingsBindSetMapping -> SettingsBindSetMapping_WithClosures
drop_closures_SettingsBindSetMapping SettingsBindSetMapping
cb
    let cb'' :: C_SettingsBindSetMapping
cb'' = Maybe (Ptr (FunPtr C_SettingsBindSetMapping))
-> SettingsBindSetMapping_WithClosures -> C_SettingsBindSetMapping
wrap_SettingsBindSetMapping Maybe (Ptr (FunPtr C_SettingsBindSetMapping))
forall a. Maybe a
Nothing SettingsBindSetMapping_WithClosures
cb'
    C_SettingsBindSetMapping -> IO (FunPtr C_SettingsBindSetMapping)
mk_SettingsBindSetMapping C_SettingsBindSetMapping
cb'' IO (FunPtr C_SettingsBindSetMapping)
-> (FunPtr C_SettingsBindSetMapping
    -> IO (GClosure C_SettingsBindSetMapping))
-> IO (GClosure C_SettingsBindSetMapping)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_SettingsBindSetMapping
-> IO (GClosure C_SettingsBindSetMapping)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `SettingsBindSetMapping` into a `C_SettingsBindSetMapping`.
wrap_SettingsBindSetMapping :: 
    Maybe (Ptr (FunPtr C_SettingsBindSetMapping)) ->
    SettingsBindSetMapping_WithClosures ->
    C_SettingsBindSetMapping
wrap_SettingsBindSetMapping :: Maybe (Ptr (FunPtr C_SettingsBindSetMapping))
-> SettingsBindSetMapping_WithClosures -> C_SettingsBindSetMapping
wrap_SettingsBindSetMapping Maybe (Ptr (FunPtr C_SettingsBindSetMapping))
gi'funptrptr SettingsBindSetMapping_WithClosures
gi'cb Ptr GValue
value Ptr VariantType
expectedType Ptr ()
userData = do
    GValue
value' <- Ptr GValue -> IO GValue
B.GValue.newGValueFromPtr Ptr GValue
value
    Ptr VariantType
-> (VariantType -> IO (Ptr GVariant)) -> IO (Ptr GVariant)
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient  Ptr VariantType
expectedType ((VariantType -> IO (Ptr GVariant)) -> IO (Ptr GVariant))
-> (VariantType -> IO (Ptr GVariant)) -> IO (Ptr GVariant)
forall a b. (a -> b) -> a -> b
$ \VariantType
expectedType' -> do
        GVariant
result <- SettingsBindSetMapping_WithClosures
gi'cb  GValue
value' VariantType
expectedType' Ptr ()
userData
        Maybe (Ptr (FunPtr C_SettingsBindSetMapping)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_SettingsBindSetMapping))
gi'funptrptr
        Ptr GVariant
result' <- GVariant -> IO (Ptr GVariant)
B.GVariant.disownGVariant GVariant
result
        Ptr GVariant -> IO (Ptr GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GVariant
result'


-- callback SettingsBindGetMapping
{- Callable
  { returnType = Just (TBasicType TBoolean)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just
              "%TRUE if the conversion succeeded, %FALSE in case of an error"
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "value"
          , argType = TGValue
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "return location for the property value"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "variant"
          , argType = TVariant
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the #GVariant" , 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 "user data that was specified when the binding was created"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "The type for the function that is used to convert from #GSettings to\nan object property. The @value is already initialized to hold values\nof the appropriate type."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_SettingsBindGetMapping =
    Ptr GValue ->
    Ptr GVariant ->
    Ptr () ->
    IO CInt

-- Args: [ Arg
--           { argCName = "value"
--           , argType = TGValue
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "return location for the property value"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "variant"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #GVariant" , 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 "user data that was specified when the binding was created"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_SettingsBindGetMapping :: FunPtr C_SettingsBindGetMapping -> C_SettingsBindGetMapping

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_SettingsBindGetMapping ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_SettingsBindGetMapping
    -> GValue
    -- ^ /@value@/: return location for the property value
    -> GVariant
    -- ^ /@variant@/: the t'GVariant'
    -> Ptr ()
    -- ^ /@userData@/: user data that was specified when the binding was created
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the conversion succeeded, 'P.False' in case of an error
dynamic_SettingsBindGetMapping :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_SettingsBindGetMapping
-> GValue -> GVariant -> Ptr () -> m Bool
dynamic_SettingsBindGetMapping FunPtr C_SettingsBindGetMapping
__funPtr GValue
value GVariant
variant Ptr ()
userData = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr GValue
value' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
value
    Ptr GVariant
variant' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
variant
    CInt
result <- (FunPtr C_SettingsBindGetMapping -> C_SettingsBindGetMapping
__dynamic_C_SettingsBindGetMapping FunPtr C_SettingsBindGetMapping
__funPtr) Ptr GValue
value' Ptr GVariant
variant' Ptr ()
userData
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    GValue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GValue
value
    GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
variant
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

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

-- | The type for the function that is used to convert from t'GI.Gio.Objects.Settings.Settings' to
-- an object property. The /@value@/ is already initialized to hold values
-- of the appropriate type.
type SettingsBindGetMapping =
    GValue
    -- ^ /@value@/: return location for the property value
    -> GVariant
    -- ^ /@variant@/: the t'GVariant'
    -> IO Bool
    -- ^ __Returns:__ 'P.True' if the conversion succeeded, 'P.False' in case of an error

-- | A convenience synonym for @`Nothing` :: `Maybe` `SettingsBindGetMapping`@.
noSettingsBindGetMapping :: Maybe SettingsBindGetMapping
noSettingsBindGetMapping :: Maybe SettingsBindGetMapping
noSettingsBindGetMapping = Maybe SettingsBindGetMapping
forall a. Maybe a
Nothing

-- | The type for the function that is used to convert from t'GI.Gio.Objects.Settings.Settings' to
-- an object property. The /@value@/ is already initialized to hold values
-- of the appropriate type.
type SettingsBindGetMapping_WithClosures =
    GValue
    -- ^ /@value@/: return location for the property value
    -> GVariant
    -- ^ /@variant@/: the t'GVariant'
    -> Ptr ()
    -- ^ /@userData@/: user data that was specified when the binding was created
    -> IO Bool
    -- ^ __Returns:__ 'P.True' if the conversion succeeded, 'P.False' in case of an error

-- | A convenience synonym for @`Nothing` :: `Maybe` `SettingsBindGetMapping_WithClosures`@.
noSettingsBindGetMapping_WithClosures :: Maybe SettingsBindGetMapping_WithClosures
noSettingsBindGetMapping_WithClosures :: Maybe SettingsBindGetMapping_WithClosures
noSettingsBindGetMapping_WithClosures = Maybe SettingsBindGetMapping_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_SettingsBindGetMapping :: SettingsBindGetMapping -> SettingsBindGetMapping_WithClosures
drop_closures_SettingsBindGetMapping :: SettingsBindGetMapping -> SettingsBindGetMapping_WithClosures
drop_closures_SettingsBindGetMapping SettingsBindGetMapping
_f GValue
value GVariant
variant Ptr ()
_ = SettingsBindGetMapping
_f GValue
value GVariant
variant

-- | Wrap the callback into a `GClosure`.
genClosure_SettingsBindGetMapping :: MonadIO m => SettingsBindGetMapping -> m (GClosure C_SettingsBindGetMapping)
genClosure_SettingsBindGetMapping :: forall (m :: * -> *).
MonadIO m =>
SettingsBindGetMapping -> m (GClosure C_SettingsBindGetMapping)
genClosure_SettingsBindGetMapping SettingsBindGetMapping
cb = IO (GClosure C_SettingsBindGetMapping)
-> m (GClosure C_SettingsBindGetMapping)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_SettingsBindGetMapping)
 -> m (GClosure C_SettingsBindGetMapping))
-> IO (GClosure C_SettingsBindGetMapping)
-> m (GClosure C_SettingsBindGetMapping)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: SettingsBindGetMapping_WithClosures
cb' = SettingsBindGetMapping -> SettingsBindGetMapping_WithClosures
drop_closures_SettingsBindGetMapping SettingsBindGetMapping
cb
    let cb'' :: C_SettingsBindGetMapping
cb'' = Maybe (Ptr (FunPtr C_SettingsBindGetMapping))
-> SettingsBindGetMapping_WithClosures -> C_SettingsBindGetMapping
wrap_SettingsBindGetMapping Maybe (Ptr (FunPtr C_SettingsBindGetMapping))
forall a. Maybe a
Nothing SettingsBindGetMapping_WithClosures
cb'
    C_SettingsBindGetMapping -> IO (FunPtr C_SettingsBindGetMapping)
mk_SettingsBindGetMapping C_SettingsBindGetMapping
cb'' IO (FunPtr C_SettingsBindGetMapping)
-> (FunPtr C_SettingsBindGetMapping
    -> IO (GClosure C_SettingsBindGetMapping))
-> IO (GClosure C_SettingsBindGetMapping)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_SettingsBindGetMapping
-> IO (GClosure C_SettingsBindGetMapping)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `SettingsBindGetMapping` into a `C_SettingsBindGetMapping`.
wrap_SettingsBindGetMapping :: 
    Maybe (Ptr (FunPtr C_SettingsBindGetMapping)) ->
    SettingsBindGetMapping_WithClosures ->
    C_SettingsBindGetMapping
wrap_SettingsBindGetMapping :: Maybe (Ptr (FunPtr C_SettingsBindGetMapping))
-> SettingsBindGetMapping_WithClosures -> C_SettingsBindGetMapping
wrap_SettingsBindGetMapping Maybe (Ptr (FunPtr C_SettingsBindGetMapping))
gi'funptrptr SettingsBindGetMapping_WithClosures
gi'cb Ptr GValue
value Ptr GVariant
variant Ptr ()
userData = do
    GValue
value' <- Ptr GValue -> IO GValue
B.GValue.newGValueFromPtr Ptr GValue
value
    GVariant
variant' <- Ptr GVariant -> IO GVariant
B.GVariant.newGVariantFromPtr Ptr GVariant
variant
    Bool
result <- SettingsBindGetMapping_WithClosures
gi'cb  GValue
value' GVariant
variant' Ptr ()
userData
    Maybe (Ptr (FunPtr C_SettingsBindGetMapping)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_SettingsBindGetMapping))
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 (m :: * -> *) a. Monad m => a -> m a
return CInt
result'


-- callback ReallocFunc
{- Callable
  { returnType = Just (TBasicType TPtr)
  , returnMayBeNull = True
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText = Just "a pointer to the reallocated memory"
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "memory block to reallocate"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "size"
          , argType = TBasicType TUInt64
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "size to reallocate @data to"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Changes the size of the memory block pointed to by @data to\n@size bytes.\n\nThe function should have the same semantics as realloc()."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_ReallocFunc =
    Ptr () ->
    Word64 ->
    IO (Ptr ())

-- Args: [ Arg
--           { argCName = "data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "memory block to reallocate"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "size"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "size to reallocate @data to"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TPtr)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_ReallocFunc :: FunPtr C_ReallocFunc -> C_ReallocFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_ReallocFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_ReallocFunc
    -> Ptr ()
    -- ^ /@data@/: memory block to reallocate
    -> Word64
    -- ^ /@size@/: size to reallocate /@data@/ to
    -> m (Ptr ())
    -- ^ __Returns:__ a pointer to the reallocated memory
dynamic_ReallocFunc :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_ReallocFunc -> Ptr () -> Word64 -> m (Ptr ())
dynamic_ReallocFunc FunPtr C_ReallocFunc
__funPtr Ptr ()
data_ Word64
size = IO (Ptr ()) -> m (Ptr ())
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Ptr ()) -> m (Ptr ())) -> IO (Ptr ()) -> m (Ptr ())
forall a b. (a -> b) -> a -> b
$ do
    Ptr ()
result <- (FunPtr C_ReallocFunc -> C_ReallocFunc
__dynamic_C_ReallocFunc FunPtr C_ReallocFunc
__funPtr) Ptr ()
data_ Word64
size
    Ptr () -> IO (Ptr ())
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ()
result

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

-- | Changes the size of the memory block pointed to by /@data@/ to
-- /@size@/ bytes.
-- 
-- The function should have the same semantics as @/realloc()/@.
type ReallocFunc =
    Ptr ()
    -- ^ /@data@/: memory block to reallocate
    -> Word64
    -- ^ /@size@/: size to reallocate /@data@/ to
    -> IO (Ptr ())
    -- ^ __Returns:__ a pointer to the reallocated memory

-- | A convenience synonym for @`Nothing` :: `Maybe` `ReallocFunc`@.
noReallocFunc :: Maybe ReallocFunc
noReallocFunc :: Maybe C_ReallocFunc
noReallocFunc = Maybe C_ReallocFunc
forall a. Maybe a
Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_ReallocFunc :: MonadIO m => ReallocFunc -> m (GClosure C_ReallocFunc)
genClosure_ReallocFunc :: forall (m :: * -> *).
MonadIO m =>
C_ReallocFunc -> m (GClosure C_ReallocFunc)
genClosure_ReallocFunc C_ReallocFunc
cb = IO (GClosure C_ReallocFunc) -> m (GClosure C_ReallocFunc)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_ReallocFunc) -> m (GClosure C_ReallocFunc))
-> IO (GClosure C_ReallocFunc) -> m (GClosure C_ReallocFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_ReallocFunc
cb' = Maybe (Ptr (FunPtr C_ReallocFunc))
-> C_ReallocFunc -> C_ReallocFunc
wrap_ReallocFunc Maybe (Ptr (FunPtr C_ReallocFunc))
forall a. Maybe a
Nothing C_ReallocFunc
cb
    C_ReallocFunc -> IO (FunPtr C_ReallocFunc)
mk_ReallocFunc C_ReallocFunc
cb' IO (FunPtr C_ReallocFunc)
-> (FunPtr C_ReallocFunc -> IO (GClosure C_ReallocFunc))
-> IO (GClosure C_ReallocFunc)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ReallocFunc -> IO (GClosure C_ReallocFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `ReallocFunc` into a `C_ReallocFunc`.
wrap_ReallocFunc :: 
    Maybe (Ptr (FunPtr C_ReallocFunc)) ->
    ReallocFunc ->
    C_ReallocFunc
wrap_ReallocFunc :: Maybe (Ptr (FunPtr C_ReallocFunc))
-> C_ReallocFunc -> C_ReallocFunc
wrap_ReallocFunc Maybe (Ptr (FunPtr C_ReallocFunc))
gi'funptrptr C_ReallocFunc
gi'cb Ptr ()
data_ Word64
size = do
    Ptr ()
result <- C_ReallocFunc
gi'cb  Ptr ()
data_ Word64
size
    Maybe (Ptr (FunPtr C_ReallocFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_ReallocFunc))
gi'funptrptr
    Ptr () -> IO (Ptr ())
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ()
result


-- callback PollableSourceFunc
{- Callable
  { returnType = Just (TBasicType TBoolean)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just "it should return %FALSE if the source should be removed."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "pollable_stream"
          , argType =
              TInterface Name { namespace = "GObject" , name = "Object" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just "the #GPollableInputStream or #GPollableOutputStream"
                , 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 "data passed in by the user."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "This is the function type of the callback used for the #GSource\nreturned by g_pollable_input_stream_create_source() and\ng_pollable_output_stream_create_source()."
        , sinceVersion = Just "2.28"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_PollableSourceFunc =
    Ptr GObject.Object.Object ->
    Ptr () ->
    IO CInt

-- Args: [ Arg
--           { argCName = "pollable_stream"
--           , argType =
--               TInterface Name { namespace = "GObject" , name = "Object" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the #GPollableInputStream or #GPollableOutputStream"
--                 , 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 "data passed in by the user."
--                 , 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_PollableSourceFunc :: FunPtr C_PollableSourceFunc -> C_PollableSourceFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PollableSourceFunc ::
    (B.CallStack.HasCallStack, MonadIO m, GObject.Object.IsObject a) =>
    FunPtr C_PollableSourceFunc
    -> a
    -- ^ /@pollableStream@/: the t'GI.Gio.Interfaces.PollableInputStream.PollableInputStream' or t'GI.Gio.Interfaces.PollableOutputStream.PollableOutputStream'
    -> Ptr ()
    -- ^ /@userData@/: data passed in by the user.
    -> m Bool
    -- ^ __Returns:__ it should return 'P.False' if the source should be removed.
dynamic_PollableSourceFunc :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsObject a) =>
FunPtr C_PollableSourceFunc -> a -> Ptr () -> m Bool
dynamic_PollableSourceFunc FunPtr C_PollableSourceFunc
__funPtr a
pollableStream Ptr ()
userData = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr Object
pollableStream' <- a -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
pollableStream
    CInt
result <- (FunPtr C_PollableSourceFunc -> C_PollableSourceFunc
__dynamic_C_PollableSourceFunc FunPtr C_PollableSourceFunc
__funPtr) Ptr Object
pollableStream' Ptr ()
userData
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
pollableStream
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

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

-- | This is the function type of the callback used for the t'GI.GLib.Structs.Source.Source'
-- returned by 'GI.Gio.Interfaces.PollableInputStream.pollableInputStreamCreateSource' and
-- 'GI.Gio.Interfaces.PollableOutputStream.pollableOutputStreamCreateSource'.
-- 
-- /Since: 2.28/
type PollableSourceFunc =
    GObject.Object.Object
    -- ^ /@pollableStream@/: the t'GI.Gio.Interfaces.PollableInputStream.PollableInputStream' or t'GI.Gio.Interfaces.PollableOutputStream.PollableOutputStream'
    -> IO Bool
    -- ^ __Returns:__ it should return 'P.False' if the source should be removed.

-- | A convenience synonym for @`Nothing` :: `Maybe` `PollableSourceFunc`@.
noPollableSourceFunc :: Maybe PollableSourceFunc
noPollableSourceFunc :: Maybe PollableSourceFunc
noPollableSourceFunc = Maybe PollableSourceFunc
forall a. Maybe a
Nothing

-- | This is the function type of the callback used for the t'GI.GLib.Structs.Source.Source'
-- returned by 'GI.Gio.Interfaces.PollableInputStream.pollableInputStreamCreateSource' and
-- 'GI.Gio.Interfaces.PollableOutputStream.pollableOutputStreamCreateSource'.
-- 
-- /Since: 2.28/
type PollableSourceFunc_WithClosures =
    GObject.Object.Object
    -- ^ /@pollableStream@/: the t'GI.Gio.Interfaces.PollableInputStream.PollableInputStream' or t'GI.Gio.Interfaces.PollableOutputStream.PollableOutputStream'
    -> Ptr ()
    -- ^ /@userData@/: data passed in by the user.
    -> IO Bool
    -- ^ __Returns:__ it should return 'P.False' if the source should be removed.

-- | A convenience synonym for @`Nothing` :: `Maybe` `PollableSourceFunc_WithClosures`@.
noPollableSourceFunc_WithClosures :: Maybe PollableSourceFunc_WithClosures
noPollableSourceFunc_WithClosures :: Maybe PollableSourceFunc_WithClosures
noPollableSourceFunc_WithClosures = Maybe PollableSourceFunc_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_PollableSourceFunc :: PollableSourceFunc -> PollableSourceFunc_WithClosures
drop_closures_PollableSourceFunc :: PollableSourceFunc -> PollableSourceFunc_WithClosures
drop_closures_PollableSourceFunc PollableSourceFunc
_f Object
pollableStream Ptr ()
_ = PollableSourceFunc
_f Object
pollableStream

-- | Wrap the callback into a `GClosure`.
genClosure_PollableSourceFunc :: MonadIO m => PollableSourceFunc -> m (GClosure C_PollableSourceFunc)
genClosure_PollableSourceFunc :: forall (m :: * -> *).
MonadIO m =>
PollableSourceFunc -> m (GClosure C_PollableSourceFunc)
genClosure_PollableSourceFunc PollableSourceFunc
cb = IO (GClosure C_PollableSourceFunc)
-> m (GClosure C_PollableSourceFunc)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_PollableSourceFunc)
 -> m (GClosure C_PollableSourceFunc))
-> IO (GClosure C_PollableSourceFunc)
-> m (GClosure C_PollableSourceFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: PollableSourceFunc_WithClosures
cb' = PollableSourceFunc -> PollableSourceFunc_WithClosures
drop_closures_PollableSourceFunc PollableSourceFunc
cb
    let cb'' :: C_PollableSourceFunc
cb'' = Maybe (Ptr (FunPtr C_PollableSourceFunc))
-> PollableSourceFunc_WithClosures -> C_PollableSourceFunc
wrap_PollableSourceFunc Maybe (Ptr (FunPtr C_PollableSourceFunc))
forall a. Maybe a
Nothing PollableSourceFunc_WithClosures
cb'
    C_PollableSourceFunc -> IO (FunPtr C_PollableSourceFunc)
mk_PollableSourceFunc C_PollableSourceFunc
cb'' IO (FunPtr C_PollableSourceFunc)
-> (FunPtr C_PollableSourceFunc
    -> IO (GClosure C_PollableSourceFunc))
-> IO (GClosure C_PollableSourceFunc)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_PollableSourceFunc -> IO (GClosure C_PollableSourceFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `PollableSourceFunc` into a `C_PollableSourceFunc`.
wrap_PollableSourceFunc :: 
    Maybe (Ptr (FunPtr C_PollableSourceFunc)) ->
    PollableSourceFunc_WithClosures ->
    C_PollableSourceFunc
wrap_PollableSourceFunc :: Maybe (Ptr (FunPtr C_PollableSourceFunc))
-> PollableSourceFunc_WithClosures -> C_PollableSourceFunc
wrap_PollableSourceFunc Maybe (Ptr (FunPtr C_PollableSourceFunc))
gi'funptrptr PollableSourceFunc_WithClosures
gi'cb Ptr Object
pollableStream Ptr ()
userData = do
    Object
pollableStream' <- ((ManagedPtr Object -> Object) -> Ptr Object -> IO Object
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Object -> Object
GObject.Object.Object) Ptr Object
pollableStream
    Bool
result <- PollableSourceFunc_WithClosures
gi'cb  Object
pollableStream' Ptr ()
userData
    Maybe (Ptr (FunPtr C_PollableSourceFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_PollableSourceFunc))
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 (m :: * -> *) a. Monad m => a -> m a
return CInt
result'


-- callback IOSchedulerJobFunc
{- Callable
  { returnType = Just (TBasicType TBoolean)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just
              "%TRUE if this function should be called again to\n   complete the job, %FALSE if the job is complete (or cancelled)"
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "job"
          , argType =
              TInterface Name { namespace = "Gio" , name = "IOSchedulerJob" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "a #GIOSchedulerJob."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "cancellable"
          , argType =
              TInterface Name { namespace = "Gio" , name = "Cancellable" }
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText =
                    Just "optional #GCancellable object, %NULL to ignore."
                , 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 data to pass to callback function"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "I/O Job function.\n\nLong-running jobs should periodically check the @cancellable\nto see if they have been cancelled."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_IOSchedulerJobFunc =
    Ptr Gio.IOSchedulerJob.IOSchedulerJob ->
    Ptr Gio.Cancellable.Cancellable ->
    Ptr () ->
    IO CInt

-- Args: [ Arg
--           { argCName = "job"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "IOSchedulerJob" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GIOSchedulerJob."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "optional #GCancellable object, %NULL to ignore."
--                 , 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 data to pass to callback function"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_IOSchedulerJobFunc :: FunPtr C_IOSchedulerJobFunc -> C_IOSchedulerJobFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_IOSchedulerJobFunc ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
    FunPtr C_IOSchedulerJobFunc
    -> Gio.IOSchedulerJob.IOSchedulerJob
    -- ^ /@job@/: a t'GI.Gio.Structs.IOSchedulerJob.IOSchedulerJob'.
    -> Maybe (a)
    -- ^ /@cancellable@/: optional t'GI.Gio.Objects.Cancellable.Cancellable' object, 'P.Nothing' to ignore.
    -> Ptr ()
    -- ^ /@userData@/: the data to pass to callback function
    -> m Bool
    -- ^ __Returns:__ 'P.True' if this function should be called again to
    --    complete the job, 'P.False' if the job is complete (or cancelled)
dynamic_IOSchedulerJobFunc :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCancellable a) =>
FunPtr C_IOSchedulerJobFunc
-> IOSchedulerJob -> Maybe a -> Ptr () -> m Bool
dynamic_IOSchedulerJobFunc FunPtr C_IOSchedulerJobFunc
__funPtr IOSchedulerJob
job Maybe a
cancellable Ptr ()
userData = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr IOSchedulerJob
job' <- IOSchedulerJob -> IO (Ptr IOSchedulerJob)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOSchedulerJob
job
    Ptr Cancellable
maybeCancellable <- case Maybe a
cancellable of
        Maybe a
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just a
jCancellable -> do
            Ptr Cancellable
jCancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    CInt
result <- (FunPtr C_IOSchedulerJobFunc -> C_IOSchedulerJobFunc
__dynamic_C_IOSchedulerJobFunc FunPtr C_IOSchedulerJobFunc
__funPtr) Ptr IOSchedulerJob
job' Ptr Cancellable
maybeCancellable Ptr ()
userData
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    IOSchedulerJob -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOSchedulerJob
job
    Maybe a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
cancellable a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

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

-- | I\/O Job function.
-- 
-- Long-running jobs should periodically check the /@cancellable@/
-- to see if they have been cancelled.
type IOSchedulerJobFunc =
    Gio.IOSchedulerJob.IOSchedulerJob
    -- ^ /@job@/: a t'GI.Gio.Structs.IOSchedulerJob.IOSchedulerJob'.
    -> Maybe Gio.Cancellable.Cancellable
    -- ^ /@cancellable@/: optional t'GI.Gio.Objects.Cancellable.Cancellable' object, 'P.Nothing' to ignore.
    -> IO Bool
    -- ^ __Returns:__ 'P.True' if this function should be called again to
    --    complete the job, 'P.False' if the job is complete (or cancelled)

-- | A convenience synonym for @`Nothing` :: `Maybe` `IOSchedulerJobFunc`@.
noIOSchedulerJobFunc :: Maybe IOSchedulerJobFunc
noIOSchedulerJobFunc :: Maybe IOSchedulerJobFunc
noIOSchedulerJobFunc = Maybe IOSchedulerJobFunc
forall a. Maybe a
Nothing

-- | I\/O Job function.
-- 
-- Long-running jobs should periodically check the /@cancellable@/
-- to see if they have been cancelled.
type IOSchedulerJobFunc_WithClosures =
    Gio.IOSchedulerJob.IOSchedulerJob
    -- ^ /@job@/: a t'GI.Gio.Structs.IOSchedulerJob.IOSchedulerJob'.
    -> Maybe Gio.Cancellable.Cancellable
    -- ^ /@cancellable@/: optional t'GI.Gio.Objects.Cancellable.Cancellable' object, 'P.Nothing' to ignore.
    -> Ptr ()
    -- ^ /@userData@/: the data to pass to callback function
    -> IO Bool
    -- ^ __Returns:__ 'P.True' if this function should be called again to
    --    complete the job, 'P.False' if the job is complete (or cancelled)

-- | A convenience synonym for @`Nothing` :: `Maybe` `IOSchedulerJobFunc_WithClosures`@.
noIOSchedulerJobFunc_WithClosures :: Maybe IOSchedulerJobFunc_WithClosures
noIOSchedulerJobFunc_WithClosures :: Maybe IOSchedulerJobFunc_WithClosures
noIOSchedulerJobFunc_WithClosures = Maybe IOSchedulerJobFunc_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_IOSchedulerJobFunc :: IOSchedulerJobFunc -> IOSchedulerJobFunc_WithClosures
drop_closures_IOSchedulerJobFunc :: IOSchedulerJobFunc -> IOSchedulerJobFunc_WithClosures
drop_closures_IOSchedulerJobFunc IOSchedulerJobFunc
_f IOSchedulerJob
job Maybe Cancellable
cancellable Ptr ()
_ = IOSchedulerJobFunc
_f IOSchedulerJob
job Maybe Cancellable
cancellable

-- | Wrap the callback into a `GClosure`.
genClosure_IOSchedulerJobFunc :: MonadIO m => IOSchedulerJobFunc -> m (GClosure C_IOSchedulerJobFunc)
genClosure_IOSchedulerJobFunc :: forall (m :: * -> *).
MonadIO m =>
IOSchedulerJobFunc -> m (GClosure C_IOSchedulerJobFunc)
genClosure_IOSchedulerJobFunc IOSchedulerJobFunc
cb = IO (GClosure C_IOSchedulerJobFunc)
-> m (GClosure C_IOSchedulerJobFunc)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_IOSchedulerJobFunc)
 -> m (GClosure C_IOSchedulerJobFunc))
-> IO (GClosure C_IOSchedulerJobFunc)
-> m (GClosure C_IOSchedulerJobFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: IOSchedulerJobFunc_WithClosures
cb' = IOSchedulerJobFunc -> IOSchedulerJobFunc_WithClosures
drop_closures_IOSchedulerJobFunc IOSchedulerJobFunc
cb
    let cb'' :: C_IOSchedulerJobFunc
cb'' = Maybe (Ptr (FunPtr C_IOSchedulerJobFunc))
-> IOSchedulerJobFunc_WithClosures -> C_IOSchedulerJobFunc
wrap_IOSchedulerJobFunc Maybe (Ptr (FunPtr C_IOSchedulerJobFunc))
forall a. Maybe a
Nothing IOSchedulerJobFunc_WithClosures
cb'
    C_IOSchedulerJobFunc -> IO (FunPtr C_IOSchedulerJobFunc)
mk_IOSchedulerJobFunc C_IOSchedulerJobFunc
cb'' IO (FunPtr C_IOSchedulerJobFunc)
-> (FunPtr C_IOSchedulerJobFunc
    -> IO (GClosure C_IOSchedulerJobFunc))
-> IO (GClosure C_IOSchedulerJobFunc)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_IOSchedulerJobFunc -> IO (GClosure C_IOSchedulerJobFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `IOSchedulerJobFunc` into a `C_IOSchedulerJobFunc`.
wrap_IOSchedulerJobFunc :: 
    Maybe (Ptr (FunPtr C_IOSchedulerJobFunc)) ->
    IOSchedulerJobFunc_WithClosures ->
    C_IOSchedulerJobFunc
wrap_IOSchedulerJobFunc :: Maybe (Ptr (FunPtr C_IOSchedulerJobFunc))
-> IOSchedulerJobFunc_WithClosures -> C_IOSchedulerJobFunc
wrap_IOSchedulerJobFunc Maybe (Ptr (FunPtr C_IOSchedulerJobFunc))
gi'funptrptr IOSchedulerJobFunc_WithClosures
gi'cb Ptr IOSchedulerJob
job Ptr Cancellable
cancellable Ptr ()
userData = do
    IOSchedulerJob
job' <- ((ManagedPtr IOSchedulerJob -> IOSchedulerJob)
-> Ptr IOSchedulerJob -> IO IOSchedulerJob
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr IOSchedulerJob -> IOSchedulerJob
Gio.IOSchedulerJob.IOSchedulerJob) Ptr IOSchedulerJob
job
    Maybe Cancellable
maybeCancellable <-
        if Ptr Cancellable
cancellable Ptr Cancellable -> Ptr Cancellable -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr Cancellable
forall a. Ptr a
nullPtr
        then Maybe Cancellable -> IO (Maybe Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Cancellable
forall a. Maybe a
Nothing
        else do
            Cancellable
cancellable' <- ((ManagedPtr Cancellable -> Cancellable)
-> Ptr Cancellable -> IO Cancellable
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Cancellable -> Cancellable
Gio.Cancellable.Cancellable) Ptr Cancellable
cancellable
            Maybe Cancellable -> IO (Maybe Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Cancellable -> IO (Maybe Cancellable))
-> Maybe Cancellable -> IO (Maybe Cancellable)
forall a b. (a -> b) -> a -> b
$ Cancellable -> Maybe Cancellable
forall a. a -> Maybe a
Just Cancellable
cancellable'
    Bool
result <- IOSchedulerJobFunc_WithClosures
gi'cb  IOSchedulerJob
job' Maybe Cancellable
maybeCancellable Ptr ()
userData
    Maybe (Ptr (FunPtr C_IOSchedulerJobFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_IOSchedulerJobFunc))
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 (m :: * -> *) a. Monad m => a -> m a
return CInt
result'


-- callback FileReadMoreCallback
{- Callable
  { returnType = Just (TBasicType TBoolean)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just "%TRUE if more data should be read back. %FALSE otherwise."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "file_contents"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the data as currently read."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "file_size"
          , argType = TBasicType TInt64
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the size of the data currently read."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "callback_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "data passed to the callback."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "When loading the partial contents of a file with g_file_load_partial_contents_async(),\nit may become necessary to determine if any more data from the file should be loaded.\nA #GFileReadMoreCallback function facilitates this by returning %TRUE if more data\nshould be read, or %FALSE otherwise."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_FileReadMoreCallback =
    CString ->
    Int64 ->
    Ptr () ->
    IO CInt

-- Args: [ Arg
--           { argCName = "file_contents"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the data as currently read."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "file_size"
--           , argType = TBasicType TInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the size of the data currently read."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "data passed to the callback."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_FileReadMoreCallback :: FunPtr C_FileReadMoreCallback -> C_FileReadMoreCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_FileReadMoreCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_FileReadMoreCallback
    -> T.Text
    -- ^ /@fileContents@/: the data as currently read.
    -> Int64
    -- ^ /@fileSize@/: the size of the data currently read.
    -> Ptr ()
    -- ^ /@callbackData@/: data passed to the callback.
    -> m Bool
    -- ^ __Returns:__ 'P.True' if more data should be read back. 'P.False' otherwise.
dynamic_FileReadMoreCallback :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_FileReadMoreCallback -> Text -> Int64 -> Ptr () -> m Bool
dynamic_FileReadMoreCallback FunPtr C_FileReadMoreCallback
__funPtr Text
fileContents Int64
fileSize Ptr ()
callbackData = IO Bool -> m Bool
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
fileContents' <- Text -> IO CString
textToCString Text
fileContents
    CInt
result <- (FunPtr C_FileReadMoreCallback -> C_FileReadMoreCallback
__dynamic_C_FileReadMoreCallback FunPtr C_FileReadMoreCallback
__funPtr) CString
fileContents' Int64
fileSize Ptr ()
callbackData
    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
fileContents'
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

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

-- | When loading the partial contents of a file with @/g_file_load_partial_contents_async()/@,
-- it may become necessary to determine if any more data from the file should be loaded.
-- A t'GI.Gio.Callbacks.FileReadMoreCallback' function facilitates this by returning 'P.True' if more data
-- should be read, or 'P.False' otherwise.
type FileReadMoreCallback =
    T.Text
    -- ^ /@fileContents@/: the data as currently read.
    -> Int64
    -- ^ /@fileSize@/: the size of the data currently read.
    -> IO Bool
    -- ^ __Returns:__ 'P.True' if more data should be read back. 'P.False' otherwise.

-- | A convenience synonym for @`Nothing` :: `Maybe` `FileReadMoreCallback`@.
noFileReadMoreCallback :: Maybe FileReadMoreCallback
noFileReadMoreCallback :: Maybe FileReadMoreCallback
noFileReadMoreCallback = Maybe FileReadMoreCallback
forall a. Maybe a
Nothing

-- | When loading the partial contents of a file with @/g_file_load_partial_contents_async()/@,
-- it may become necessary to determine if any more data from the file should be loaded.
-- A t'GI.Gio.Callbacks.FileReadMoreCallback' function facilitates this by returning 'P.True' if more data
-- should be read, or 'P.False' otherwise.
type FileReadMoreCallback_WithClosures =
    T.Text
    -- ^ /@fileContents@/: the data as currently read.
    -> Int64
    -- ^ /@fileSize@/: the size of the data currently read.
    -> Ptr ()
    -- ^ /@callbackData@/: data passed to the callback.
    -> IO Bool
    -- ^ __Returns:__ 'P.True' if more data should be read back. 'P.False' otherwise.

-- | A convenience synonym for @`Nothing` :: `Maybe` `FileReadMoreCallback_WithClosures`@.
noFileReadMoreCallback_WithClosures :: Maybe FileReadMoreCallback_WithClosures
noFileReadMoreCallback_WithClosures :: Maybe FileReadMoreCallback_WithClosures
noFileReadMoreCallback_WithClosures = Maybe FileReadMoreCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_FileReadMoreCallback :: FileReadMoreCallback -> FileReadMoreCallback_WithClosures
drop_closures_FileReadMoreCallback :: FileReadMoreCallback -> FileReadMoreCallback_WithClosures
drop_closures_FileReadMoreCallback FileReadMoreCallback
_f Text
fileContents Int64
fileSize Ptr ()
_ = FileReadMoreCallback
_f Text
fileContents Int64
fileSize

-- | Wrap the callback into a `GClosure`.
genClosure_FileReadMoreCallback :: MonadIO m => FileReadMoreCallback -> m (GClosure C_FileReadMoreCallback)
genClosure_FileReadMoreCallback :: forall (m :: * -> *).
MonadIO m =>
FileReadMoreCallback -> m (GClosure C_FileReadMoreCallback)
genClosure_FileReadMoreCallback FileReadMoreCallback
cb = IO (GClosure C_FileReadMoreCallback)
-> m (GClosure C_FileReadMoreCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_FileReadMoreCallback)
 -> m (GClosure C_FileReadMoreCallback))
-> IO (GClosure C_FileReadMoreCallback)
-> m (GClosure C_FileReadMoreCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: FileReadMoreCallback_WithClosures
cb' = FileReadMoreCallback -> FileReadMoreCallback_WithClosures
drop_closures_FileReadMoreCallback FileReadMoreCallback
cb
    let cb'' :: C_FileReadMoreCallback
cb'' = Maybe (Ptr (FunPtr C_FileReadMoreCallback))
-> FileReadMoreCallback_WithClosures -> C_FileReadMoreCallback
wrap_FileReadMoreCallback Maybe (Ptr (FunPtr C_FileReadMoreCallback))
forall a. Maybe a
Nothing FileReadMoreCallback_WithClosures
cb'
    C_FileReadMoreCallback -> IO (FunPtr C_FileReadMoreCallback)
mk_FileReadMoreCallback C_FileReadMoreCallback
cb'' IO (FunPtr C_FileReadMoreCallback)
-> (FunPtr C_FileReadMoreCallback
    -> IO (GClosure C_FileReadMoreCallback))
-> IO (GClosure C_FileReadMoreCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_FileReadMoreCallback
-> IO (GClosure C_FileReadMoreCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `FileReadMoreCallback` into a `C_FileReadMoreCallback`.
wrap_FileReadMoreCallback :: 
    Maybe (Ptr (FunPtr C_FileReadMoreCallback)) ->
    FileReadMoreCallback_WithClosures ->
    C_FileReadMoreCallback
wrap_FileReadMoreCallback :: Maybe (Ptr (FunPtr C_FileReadMoreCallback))
-> FileReadMoreCallback_WithClosures -> C_FileReadMoreCallback
wrap_FileReadMoreCallback Maybe (Ptr (FunPtr C_FileReadMoreCallback))
gi'funptrptr FileReadMoreCallback_WithClosures
gi'cb CString
fileContents Int64
fileSize Ptr ()
callbackData = do
    Text
fileContents' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
fileContents
    Bool
result <- FileReadMoreCallback_WithClosures
gi'cb  Text
fileContents' Int64
fileSize Ptr ()
callbackData
    Maybe (Ptr (FunPtr C_FileReadMoreCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_FileReadMoreCallback))
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 (m :: * -> *) a. Monad m => a -> m a
return CInt
result'


-- callback FileProgressCallback
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "current_num_bytes"
          , argType = TBasicType TInt64
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the current number of bytes in the operation."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "total_num_bytes"
          , argType = TBasicType TInt64
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the total number of bytes in the operation."
                , 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 "user data passed to the callback."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "When doing file operations that may take a while, such as moving\na file or copying a file, a progress callback is used to pass how\nfar along that operation is to the application."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_FileProgressCallback =
    Int64 ->
    Int64 ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "current_num_bytes"
--           , argType = TBasicType TInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the current number of bytes in the operation."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "total_num_bytes"
--           , argType = TBasicType TInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the total number of bytes in the operation."
--                 , 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 "user data passed to the callback."
--                 , 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_FileProgressCallback :: FunPtr C_FileProgressCallback -> C_FileProgressCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_FileProgressCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_FileProgressCallback
    -> Int64
    -- ^ /@currentNumBytes@/: the current number of bytes in the operation.
    -> Int64
    -- ^ /@totalNumBytes@/: the total number of bytes in the operation.
    -> Ptr ()
    -- ^ /@userData@/: user data passed to the callback.
    -> m ()
dynamic_FileProgressCallback :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_FileProgressCallback -> Int64 -> Int64 -> Ptr () -> m ()
dynamic_FileProgressCallback FunPtr C_FileProgressCallback
__funPtr Int64
currentNumBytes Int64
totalNumBytes Ptr ()
userData = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    (FunPtr C_FileProgressCallback -> C_FileProgressCallback
__dynamic_C_FileProgressCallback FunPtr C_FileProgressCallback
__funPtr) Int64
currentNumBytes Int64
totalNumBytes Ptr ()
userData
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | When doing file operations that may take a while, such as moving
-- a file or copying a file, a progress callback is used to pass how
-- far along that operation is to the application.
type FileProgressCallback =
    Int64
    -- ^ /@currentNumBytes@/: the current number of bytes in the operation.
    -> Int64
    -- ^ /@totalNumBytes@/: the total number of bytes in the operation.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `FileProgressCallback`@.
noFileProgressCallback :: Maybe FileProgressCallback
noFileProgressCallback :: Maybe FileProgressCallback
noFileProgressCallback = Maybe FileProgressCallback
forall a. Maybe a
Nothing

-- | When doing file operations that may take a while, such as moving
-- a file or copying a file, a progress callback is used to pass how
-- far along that operation is to the application.
type FileProgressCallback_WithClosures =
    Int64
    -- ^ /@currentNumBytes@/: the current number of bytes in the operation.
    -> Int64
    -- ^ /@totalNumBytes@/: the total number of bytes in the operation.
    -> Ptr ()
    -- ^ /@userData@/: user data passed to the callback.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `FileProgressCallback_WithClosures`@.
noFileProgressCallback_WithClosures :: Maybe FileProgressCallback_WithClosures
noFileProgressCallback_WithClosures :: Maybe C_FileProgressCallback
noFileProgressCallback_WithClosures = Maybe C_FileProgressCallback
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_FileProgressCallback :: FileProgressCallback -> FileProgressCallback_WithClosures
drop_closures_FileProgressCallback :: FileProgressCallback -> C_FileProgressCallback
drop_closures_FileProgressCallback FileProgressCallback
_f Int64
currentNumBytes Int64
totalNumBytes Ptr ()
_ = FileProgressCallback
_f Int64
currentNumBytes Int64
totalNumBytes

-- | Wrap the callback into a `GClosure`.
genClosure_FileProgressCallback :: MonadIO m => FileProgressCallback -> m (GClosure C_FileProgressCallback)
genClosure_FileProgressCallback :: forall (m :: * -> *).
MonadIO m =>
FileProgressCallback -> m (GClosure C_FileProgressCallback)
genClosure_FileProgressCallback FileProgressCallback
cb = IO (GClosure C_FileProgressCallback)
-> m (GClosure C_FileProgressCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_FileProgressCallback)
 -> m (GClosure C_FileProgressCallback))
-> IO (GClosure C_FileProgressCallback)
-> m (GClosure C_FileProgressCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_FileProgressCallback
cb' = FileProgressCallback -> C_FileProgressCallback
drop_closures_FileProgressCallback FileProgressCallback
cb
    let cb'' :: C_FileProgressCallback
cb'' = Maybe (Ptr (FunPtr C_FileProgressCallback))
-> C_FileProgressCallback -> C_FileProgressCallback
wrap_FileProgressCallback Maybe (Ptr (FunPtr C_FileProgressCallback))
forall a. Maybe a
Nothing C_FileProgressCallback
cb'
    C_FileProgressCallback -> IO (FunPtr C_FileProgressCallback)
mk_FileProgressCallback C_FileProgressCallback
cb'' IO (FunPtr C_FileProgressCallback)
-> (FunPtr C_FileProgressCallback
    -> IO (GClosure C_FileProgressCallback))
-> IO (GClosure C_FileProgressCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_FileProgressCallback
-> IO (GClosure C_FileProgressCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `FileProgressCallback` into a `C_FileProgressCallback`.
wrap_FileProgressCallback :: 
    Maybe (Ptr (FunPtr C_FileProgressCallback)) ->
    FileProgressCallback_WithClosures ->
    C_FileProgressCallback
wrap_FileProgressCallback :: Maybe (Ptr (FunPtr C_FileProgressCallback))
-> C_FileProgressCallback -> C_FileProgressCallback
wrap_FileProgressCallback Maybe (Ptr (FunPtr C_FileProgressCallback))
gi'funptrptr C_FileProgressCallback
gi'cb Int64
currentNumBytes Int64
totalNumBytes Ptr ()
userData = do
    C_FileProgressCallback
gi'cb  Int64
currentNumBytes Int64
totalNumBytes Ptr ()
userData
    Maybe (Ptr (FunPtr C_FileProgressCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_FileProgressCallback))
gi'funptrptr


-- callback FileMeasureProgressCallback
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "reporting"
          , argType = TBasicType TBoolean
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "%TRUE if more reports will come"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "current_size"
          , argType = TBasicType TUInt64
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the current cumulative size measurement"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "num_dirs"
          , argType = TBasicType TUInt64
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the number of directories visited so far"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "num_files"
          , argType = TBasicType TUInt64
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the number of non-directory files encountered"
                , 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 data passed to the original request for this callback"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 4
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "This callback type is used by g_file_measure_disk_usage() to make\nperiodic progress reports when measuring the amount of disk spaced\nused by a directory.\n\nThese calls are made on a best-effort basis and not all types of\n#GFile will support them.  At the minimum, however, one call will\nalways be made immediately.\n\nIn the case that there is no support, @reporting will be set to\n%FALSE (and the other values undefined) and no further calls will be\nmade.  Otherwise, the @reporting will be %TRUE and the other values\nall-zeros during the first (immediate) call.  In this way, you can\nknow which type of progress UI to show without a delay.\n\nFor g_file_measure_disk_usage() the callback is made directly.  For\ng_file_measure_disk_usage_async() the callback is made via the\ndefault main context of the calling thread (ie: the same way that the\nfinal async result would be reported).\n\n@current_size is in the same units as requested by the operation (see\n%G_FILE_MEASURE_APPARENT_SIZE).\n\nThe frequency of the updates is implementation defined, but is\nideally about once every 200ms.\n\nThe last progress callback may or may not be equal to the final\nresult.  Always check the async result to get the final value."
        , sinceVersion = Just "2.38"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_FileMeasureProgressCallback =
    CInt ->
    Word64 ->
    Word64 ->
    Word64 ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "reporting"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "%TRUE if more reports will come"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "current_size"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the current cumulative size measurement"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "num_dirs"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the number of directories visited so far"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "num_files"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the number of non-directory files encountered"
--                 , 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 data passed to the original request for this callback"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 4
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_FileMeasureProgressCallback :: FunPtr C_FileMeasureProgressCallback -> C_FileMeasureProgressCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_FileMeasureProgressCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_FileMeasureProgressCallback
    -> Bool
    -- ^ /@reporting@/: 'P.True' if more reports will come
    -> Word64
    -- ^ /@currentSize@/: the current cumulative size measurement
    -> Word64
    -- ^ /@numDirs@/: the number of directories visited so far
    -> Word64
    -- ^ /@numFiles@/: the number of non-directory files encountered
    -> Ptr ()
    -- ^ /@userData@/: the data passed to the original request for this callback
    -> m ()
dynamic_FileMeasureProgressCallback :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_FileMeasureProgressCallback
-> Bool -> Word64 -> Word64 -> Word64 -> Ptr () -> m ()
dynamic_FileMeasureProgressCallback FunPtr C_FileMeasureProgressCallback
__funPtr Bool
reporting Word64
currentSize Word64
numDirs Word64
numFiles Ptr ()
userData = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    let reporting' :: CInt
reporting' = (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
reporting
    (FunPtr C_FileMeasureProgressCallback
-> C_FileMeasureProgressCallback
__dynamic_C_FileMeasureProgressCallback FunPtr C_FileMeasureProgressCallback
__funPtr) CInt
reporting' Word64
currentSize Word64
numDirs Word64
numFiles Ptr ()
userData
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | This callback type is used by @/g_file_measure_disk_usage()/@ to make
-- periodic progress reports when measuring the amount of disk spaced
-- used by a directory.
-- 
-- These calls are made on a best-effort basis and not all types of
-- t'GI.Gio.Interfaces.File.File' will support them.  At the minimum, however, one call will
-- always be made immediately.
-- 
-- In the case that there is no support, /@reporting@/ will be set to
-- 'P.False' (and the other values undefined) and no further calls will be
-- made.  Otherwise, the /@reporting@/ will be 'P.True' and the other values
-- all-zeros during the first (immediate) call.  In this way, you can
-- know which type of progress UI to show without a delay.
-- 
-- For @/g_file_measure_disk_usage()/@ the callback is made directly.  For
-- @/g_file_measure_disk_usage_async()/@ the callback is made via the
-- default main context of the calling thread (ie: the same way that the
-- final async result would be reported).
-- 
-- /@currentSize@/ is in the same units as requested by the operation (see
-- 'GI.Gio.Flags.FileMeasureFlagsApparentSize').
-- 
-- The frequency of the updates is implementation defined, but is
-- ideally about once every 200ms.
-- 
-- The last progress callback may or may not be equal to the final
-- result.  Always check the async result to get the final value.
-- 
-- /Since: 2.38/
type FileMeasureProgressCallback =
    Bool
    -- ^ /@reporting@/: 'P.True' if more reports will come
    -> Word64
    -- ^ /@currentSize@/: the current cumulative size measurement
    -> Word64
    -- ^ /@numDirs@/: the number of directories visited so far
    -> Word64
    -- ^ /@numFiles@/: the number of non-directory files encountered
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `FileMeasureProgressCallback`@.
noFileMeasureProgressCallback :: Maybe FileMeasureProgressCallback
noFileMeasureProgressCallback :: Maybe FileMeasureProgressCallback
noFileMeasureProgressCallback = Maybe FileMeasureProgressCallback
forall a. Maybe a
Nothing

-- | This callback type is used by @/g_file_measure_disk_usage()/@ to make
-- periodic progress reports when measuring the amount of disk spaced
-- used by a directory.
-- 
-- These calls are made on a best-effort basis and not all types of
-- t'GI.Gio.Interfaces.File.File' will support them.  At the minimum, however, one call will
-- always be made immediately.
-- 
-- In the case that there is no support, /@reporting@/ will be set to
-- 'P.False' (and the other values undefined) and no further calls will be
-- made.  Otherwise, the /@reporting@/ will be 'P.True' and the other values
-- all-zeros during the first (immediate) call.  In this way, you can
-- know which type of progress UI to show without a delay.
-- 
-- For @/g_file_measure_disk_usage()/@ the callback is made directly.  For
-- @/g_file_measure_disk_usage_async()/@ the callback is made via the
-- default main context of the calling thread (ie: the same way that the
-- final async result would be reported).
-- 
-- /@currentSize@/ is in the same units as requested by the operation (see
-- 'GI.Gio.Flags.FileMeasureFlagsApparentSize').
-- 
-- The frequency of the updates is implementation defined, but is
-- ideally about once every 200ms.
-- 
-- The last progress callback may or may not be equal to the final
-- result.  Always check the async result to get the final value.
-- 
-- /Since: 2.38/
type FileMeasureProgressCallback_WithClosures =
    Bool
    -- ^ /@reporting@/: 'P.True' if more reports will come
    -> Word64
    -- ^ /@currentSize@/: the current cumulative size measurement
    -> Word64
    -- ^ /@numDirs@/: the number of directories visited so far
    -> Word64
    -- ^ /@numFiles@/: the number of non-directory files encountered
    -> Ptr ()
    -- ^ /@userData@/: the data passed to the original request for this callback
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `FileMeasureProgressCallback_WithClosures`@.
noFileMeasureProgressCallback_WithClosures :: Maybe FileMeasureProgressCallback_WithClosures
noFileMeasureProgressCallback_WithClosures :: Maybe FileMeasureProgressCallback_WithClosures
noFileMeasureProgressCallback_WithClosures = Maybe FileMeasureProgressCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_FileMeasureProgressCallback :: FileMeasureProgressCallback -> FileMeasureProgressCallback_WithClosures
drop_closures_FileMeasureProgressCallback :: FileMeasureProgressCallback
-> FileMeasureProgressCallback_WithClosures
drop_closures_FileMeasureProgressCallback FileMeasureProgressCallback
_f Bool
reporting Word64
currentSize Word64
numDirs Word64
numFiles Ptr ()
_ = FileMeasureProgressCallback
_f Bool
reporting Word64
currentSize Word64
numDirs Word64
numFiles

-- | Wrap the callback into a `GClosure`.
genClosure_FileMeasureProgressCallback :: MonadIO m => FileMeasureProgressCallback -> m (GClosure C_FileMeasureProgressCallback)
genClosure_FileMeasureProgressCallback :: forall (m :: * -> *).
MonadIO m =>
FileMeasureProgressCallback
-> m (GClosure C_FileMeasureProgressCallback)
genClosure_FileMeasureProgressCallback FileMeasureProgressCallback
cb = IO (GClosure C_FileMeasureProgressCallback)
-> m (GClosure C_FileMeasureProgressCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_FileMeasureProgressCallback)
 -> m (GClosure C_FileMeasureProgressCallback))
-> IO (GClosure C_FileMeasureProgressCallback)
-> m (GClosure C_FileMeasureProgressCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: FileMeasureProgressCallback_WithClosures
cb' = FileMeasureProgressCallback
-> FileMeasureProgressCallback_WithClosures
drop_closures_FileMeasureProgressCallback FileMeasureProgressCallback
cb
    let cb'' :: C_FileMeasureProgressCallback
cb'' = Maybe (Ptr (FunPtr C_FileMeasureProgressCallback))
-> FileMeasureProgressCallback_WithClosures
-> C_FileMeasureProgressCallback
wrap_FileMeasureProgressCallback Maybe (Ptr (FunPtr C_FileMeasureProgressCallback))
forall a. Maybe a
Nothing FileMeasureProgressCallback_WithClosures
cb'
    C_FileMeasureProgressCallback
-> IO (FunPtr C_FileMeasureProgressCallback)
mk_FileMeasureProgressCallback C_FileMeasureProgressCallback
cb'' IO (FunPtr C_FileMeasureProgressCallback)
-> (FunPtr C_FileMeasureProgressCallback
    -> IO (GClosure C_FileMeasureProgressCallback))
-> IO (GClosure C_FileMeasureProgressCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_FileMeasureProgressCallback
-> IO (GClosure C_FileMeasureProgressCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `FileMeasureProgressCallback` into a `C_FileMeasureProgressCallback`.
wrap_FileMeasureProgressCallback :: 
    Maybe (Ptr (FunPtr C_FileMeasureProgressCallback)) ->
    FileMeasureProgressCallback_WithClosures ->
    C_FileMeasureProgressCallback
wrap_FileMeasureProgressCallback :: Maybe (Ptr (FunPtr C_FileMeasureProgressCallback))
-> FileMeasureProgressCallback_WithClosures
-> C_FileMeasureProgressCallback
wrap_FileMeasureProgressCallback Maybe (Ptr (FunPtr C_FileMeasureProgressCallback))
gi'funptrptr FileMeasureProgressCallback_WithClosures
gi'cb CInt
reporting Word64
currentSize Word64
numDirs Word64
numFiles Ptr ()
userData = do
    let reporting' :: Bool
reporting' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
reporting
    FileMeasureProgressCallback_WithClosures
gi'cb  Bool
reporting' Word64
currentSize Word64
numDirs Word64
numFiles Ptr ()
userData
    Maybe (Ptr (FunPtr C_FileMeasureProgressCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_FileMeasureProgressCallback))
gi'funptrptr


-- callback DesktopAppLaunchCallback
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "appinfo"
          , argType =
              TInterface Name { namespace = "Gio" , name = "DesktopAppInfo" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "a #GDesktopAppInfo" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "pid"
          , argType = TBasicType TInt
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "Process identifier" , 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 "User data" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "During invocation, g_desktop_app_info_launch_uris_as_manager() may\ncreate one or more child processes.  This callback is invoked once\nfor each, providing the process ID."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_DesktopAppLaunchCallback =
    Ptr Gio.DesktopAppInfo.DesktopAppInfo ->
    Int32 ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "appinfo"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "DesktopAppInfo" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GDesktopAppInfo" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "pid"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Process identifier" , 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 "User data" , 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_DesktopAppLaunchCallback :: FunPtr C_DesktopAppLaunchCallback -> C_DesktopAppLaunchCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_DesktopAppLaunchCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.DesktopAppInfo.IsDesktopAppInfo a) =>
    FunPtr C_DesktopAppLaunchCallback
    -> a
    -- ^ /@appinfo@/: a t'GI.Gio.Objects.DesktopAppInfo.DesktopAppInfo'
    -> Int32
    -- ^ /@pid@/: Process identifier
    -> Ptr ()
    -- ^ /@userData@/: User data
    -> m ()
dynamic_DesktopAppLaunchCallback :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDesktopAppInfo a) =>
FunPtr C_DesktopAppLaunchCallback -> a -> Int32 -> Ptr () -> m ()
dynamic_DesktopAppLaunchCallback FunPtr C_DesktopAppLaunchCallback
__funPtr a
appinfo Int32
pid Ptr ()
userData = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr DesktopAppInfo
appinfo' <- a -> IO (Ptr DesktopAppInfo)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
appinfo
    (FunPtr C_DesktopAppLaunchCallback -> C_DesktopAppLaunchCallback
__dynamic_C_DesktopAppLaunchCallback FunPtr C_DesktopAppLaunchCallback
__funPtr) Ptr DesktopAppInfo
appinfo' Int32
pid Ptr ()
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
appinfo
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | During invocation, 'GI.Gio.Objects.DesktopAppInfo.desktopAppInfoLaunchUrisAsManager' may
-- create one or more child processes.  This callback is invoked once
-- for each, providing the process ID.
type DesktopAppLaunchCallback =
    Gio.DesktopAppInfo.DesktopAppInfo
    -- ^ /@appinfo@/: a t'GI.Gio.Objects.DesktopAppInfo.DesktopAppInfo'
    -> Int32
    -- ^ /@pid@/: Process identifier
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `DesktopAppLaunchCallback`@.
noDesktopAppLaunchCallback :: Maybe DesktopAppLaunchCallback
noDesktopAppLaunchCallback :: Maybe DesktopAppLaunchCallback
noDesktopAppLaunchCallback = Maybe DesktopAppLaunchCallback
forall a. Maybe a
Nothing

-- | During invocation, 'GI.Gio.Objects.DesktopAppInfo.desktopAppInfoLaunchUrisAsManager' may
-- create one or more child processes.  This callback is invoked once
-- for each, providing the process ID.
type DesktopAppLaunchCallback_WithClosures =
    Gio.DesktopAppInfo.DesktopAppInfo
    -- ^ /@appinfo@/: a t'GI.Gio.Objects.DesktopAppInfo.DesktopAppInfo'
    -> Int32
    -- ^ /@pid@/: Process identifier
    -> Ptr ()
    -- ^ /@userData@/: User data
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `DesktopAppLaunchCallback_WithClosures`@.
noDesktopAppLaunchCallback_WithClosures :: Maybe DesktopAppLaunchCallback_WithClosures
noDesktopAppLaunchCallback_WithClosures :: Maybe DesktopAppLaunchCallback_WithClosures
noDesktopAppLaunchCallback_WithClosures = Maybe DesktopAppLaunchCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_DesktopAppLaunchCallback :: DesktopAppLaunchCallback -> DesktopAppLaunchCallback_WithClosures
drop_closures_DesktopAppLaunchCallback :: DesktopAppLaunchCallback -> DesktopAppLaunchCallback_WithClosures
drop_closures_DesktopAppLaunchCallback DesktopAppLaunchCallback
_f DesktopAppInfo
appinfo Int32
pid Ptr ()
_ = DesktopAppLaunchCallback
_f DesktopAppInfo
appinfo Int32
pid

-- | Wrap the callback into a `GClosure`.
genClosure_DesktopAppLaunchCallback :: MonadIO m => DesktopAppLaunchCallback -> m (GClosure C_DesktopAppLaunchCallback)
genClosure_DesktopAppLaunchCallback :: forall (m :: * -> *).
MonadIO m =>
DesktopAppLaunchCallback -> m (GClosure C_DesktopAppLaunchCallback)
genClosure_DesktopAppLaunchCallback DesktopAppLaunchCallback
cb = IO (GClosure C_DesktopAppLaunchCallback)
-> m (GClosure C_DesktopAppLaunchCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DesktopAppLaunchCallback)
 -> m (GClosure C_DesktopAppLaunchCallback))
-> IO (GClosure C_DesktopAppLaunchCallback)
-> m (GClosure C_DesktopAppLaunchCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: DesktopAppLaunchCallback_WithClosures
cb' = DesktopAppLaunchCallback -> DesktopAppLaunchCallback_WithClosures
drop_closures_DesktopAppLaunchCallback DesktopAppLaunchCallback
cb
    let cb'' :: C_DesktopAppLaunchCallback
cb'' = Maybe (Ptr (FunPtr C_DesktopAppLaunchCallback))
-> DesktopAppLaunchCallback_WithClosures
-> C_DesktopAppLaunchCallback
wrap_DesktopAppLaunchCallback Maybe (Ptr (FunPtr C_DesktopAppLaunchCallback))
forall a. Maybe a
Nothing DesktopAppLaunchCallback_WithClosures
cb'
    C_DesktopAppLaunchCallback
-> IO (FunPtr C_DesktopAppLaunchCallback)
mk_DesktopAppLaunchCallback C_DesktopAppLaunchCallback
cb'' IO (FunPtr C_DesktopAppLaunchCallback)
-> (FunPtr C_DesktopAppLaunchCallback
    -> IO (GClosure C_DesktopAppLaunchCallback))
-> IO (GClosure C_DesktopAppLaunchCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DesktopAppLaunchCallback
-> IO (GClosure C_DesktopAppLaunchCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `DesktopAppLaunchCallback` into a `C_DesktopAppLaunchCallback`.
wrap_DesktopAppLaunchCallback :: 
    Maybe (Ptr (FunPtr C_DesktopAppLaunchCallback)) ->
    DesktopAppLaunchCallback_WithClosures ->
    C_DesktopAppLaunchCallback
wrap_DesktopAppLaunchCallback :: Maybe (Ptr (FunPtr C_DesktopAppLaunchCallback))
-> DesktopAppLaunchCallback_WithClosures
-> C_DesktopAppLaunchCallback
wrap_DesktopAppLaunchCallback Maybe (Ptr (FunPtr C_DesktopAppLaunchCallback))
gi'funptrptr DesktopAppLaunchCallback_WithClosures
gi'cb Ptr DesktopAppInfo
appinfo Int32
pid Ptr ()
userData = do
    DesktopAppInfo
appinfo' <- ((ManagedPtr DesktopAppInfo -> DesktopAppInfo)
-> Ptr DesktopAppInfo -> IO DesktopAppInfo
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr DesktopAppInfo -> DesktopAppInfo
Gio.DesktopAppInfo.DesktopAppInfo) Ptr DesktopAppInfo
appinfo
    DesktopAppLaunchCallback_WithClosures
gi'cb  DesktopAppInfo
appinfo' Int32
pid Ptr ()
userData
    Maybe (Ptr (FunPtr C_DesktopAppLaunchCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_DesktopAppLaunchCallback))
gi'funptrptr


-- callback DatagramBasedSourceFunc
{- Callable
  { returnType = Just (TBasicType TBoolean)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just
              "%G_SOURCE_REMOVE if the source should be removed,\n  %G_SOURCE_CONTINUE otherwise"
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "datagram_based"
          , argType =
              TInterface Name { namespace = "Gio" , name = "DatagramBased" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the #GDatagramBased"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "condition"
          , argType =
              TInterface Name { namespace = "GLib" , name = "IOCondition" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the current condition at the source fired"
                , 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 "data passed in by the user"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "This is the function type of the callback used for the #GSource\nreturned by g_datagram_based_create_source()."
        , sinceVersion = Just "2.48"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_DatagramBasedSourceFunc =
    Ptr Gio.DatagramBased.DatagramBased ->
    CUInt ->
    Ptr () ->
    IO CInt

-- Args: [ Arg
--           { argCName = "datagram_based"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "DatagramBased" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #GDatagramBased"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "condition"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "IOCondition" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the current condition at the source fired"
--                 , 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 "data passed in by the user"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DatagramBasedSourceFunc :: FunPtr C_DatagramBasedSourceFunc -> C_DatagramBasedSourceFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_DatagramBasedSourceFunc ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.DatagramBased.IsDatagramBased a) =>
    FunPtr C_DatagramBasedSourceFunc
    -> a
    -- ^ /@datagramBased@/: the t'GI.Gio.Interfaces.DatagramBased.DatagramBased'
    -> [GLib.Flags.IOCondition]
    -- ^ /@condition@/: the current condition at the source fired
    -> Ptr ()
    -- ^ /@userData@/: data passed in by the user
    -> m Bool
    -- ^ __Returns:__ 'GI.GLib.Constants.SOURCE_REMOVE' if the source should be removed,
    --   'GI.GLib.Constants.SOURCE_CONTINUE' otherwise
dynamic_DatagramBasedSourceFunc :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDatagramBased a) =>
FunPtr C_DatagramBasedSourceFunc
-> a -> [IOCondition] -> Ptr () -> m Bool
dynamic_DatagramBasedSourceFunc FunPtr C_DatagramBasedSourceFunc
__funPtr a
datagramBased [IOCondition]
condition Ptr ()
userData = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr DatagramBased
datagramBased' <- a -> IO (Ptr DatagramBased)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
datagramBased
    let condition' :: CUInt
condition' = [IOCondition] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [IOCondition]
condition
    CInt
result <- (FunPtr C_DatagramBasedSourceFunc -> C_DatagramBasedSourceFunc
__dynamic_C_DatagramBasedSourceFunc FunPtr C_DatagramBasedSourceFunc
__funPtr) Ptr DatagramBased
datagramBased' CUInt
condition' Ptr ()
userData
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
datagramBased
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

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

-- | This is the function type of the callback used for the t'GI.GLib.Structs.Source.Source'
-- returned by 'GI.Gio.Interfaces.DatagramBased.datagramBasedCreateSource'.
-- 
-- /Since: 2.48/
type DatagramBasedSourceFunc =
    Gio.DatagramBased.DatagramBased
    -- ^ /@datagramBased@/: the t'GI.Gio.Interfaces.DatagramBased.DatagramBased'
    -> [GLib.Flags.IOCondition]
    -- ^ /@condition@/: the current condition at the source fired
    -> IO Bool
    -- ^ __Returns:__ 'GI.GLib.Constants.SOURCE_REMOVE' if the source should be removed,
    --   'GI.GLib.Constants.SOURCE_CONTINUE' otherwise

-- | A convenience synonym for @`Nothing` :: `Maybe` `DatagramBasedSourceFunc`@.
noDatagramBasedSourceFunc :: Maybe DatagramBasedSourceFunc
noDatagramBasedSourceFunc :: Maybe DatagramBasedSourceFunc
noDatagramBasedSourceFunc = Maybe DatagramBasedSourceFunc
forall a. Maybe a
Nothing

-- | This is the function type of the callback used for the t'GI.GLib.Structs.Source.Source'
-- returned by 'GI.Gio.Interfaces.DatagramBased.datagramBasedCreateSource'.
-- 
-- /Since: 2.48/
type DatagramBasedSourceFunc_WithClosures =
    Gio.DatagramBased.DatagramBased
    -- ^ /@datagramBased@/: the t'GI.Gio.Interfaces.DatagramBased.DatagramBased'
    -> [GLib.Flags.IOCondition]
    -- ^ /@condition@/: the current condition at the source fired
    -> Ptr ()
    -- ^ /@userData@/: data passed in by the user
    -> IO Bool
    -- ^ __Returns:__ 'GI.GLib.Constants.SOURCE_REMOVE' if the source should be removed,
    --   'GI.GLib.Constants.SOURCE_CONTINUE' otherwise

-- | A convenience synonym for @`Nothing` :: `Maybe` `DatagramBasedSourceFunc_WithClosures`@.
noDatagramBasedSourceFunc_WithClosures :: Maybe DatagramBasedSourceFunc_WithClosures
noDatagramBasedSourceFunc_WithClosures :: Maybe DatagramBasedSourceFunc_WithClosures
noDatagramBasedSourceFunc_WithClosures = Maybe DatagramBasedSourceFunc_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_DatagramBasedSourceFunc :: DatagramBasedSourceFunc -> DatagramBasedSourceFunc_WithClosures
drop_closures_DatagramBasedSourceFunc :: DatagramBasedSourceFunc -> DatagramBasedSourceFunc_WithClosures
drop_closures_DatagramBasedSourceFunc DatagramBasedSourceFunc
_f DatagramBased
datagramBased [IOCondition]
condition Ptr ()
_ = DatagramBasedSourceFunc
_f DatagramBased
datagramBased [IOCondition]
condition

-- | Wrap the callback into a `GClosure`.
genClosure_DatagramBasedSourceFunc :: MonadIO m => DatagramBasedSourceFunc -> m (GClosure C_DatagramBasedSourceFunc)
genClosure_DatagramBasedSourceFunc :: forall (m :: * -> *).
MonadIO m =>
DatagramBasedSourceFunc -> m (GClosure C_DatagramBasedSourceFunc)
genClosure_DatagramBasedSourceFunc DatagramBasedSourceFunc
cb = IO (GClosure C_DatagramBasedSourceFunc)
-> m (GClosure C_DatagramBasedSourceFunc)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DatagramBasedSourceFunc)
 -> m (GClosure C_DatagramBasedSourceFunc))
-> IO (GClosure C_DatagramBasedSourceFunc)
-> m (GClosure C_DatagramBasedSourceFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: DatagramBasedSourceFunc_WithClosures
cb' = DatagramBasedSourceFunc -> DatagramBasedSourceFunc_WithClosures
drop_closures_DatagramBasedSourceFunc DatagramBasedSourceFunc
cb
    let cb'' :: C_DatagramBasedSourceFunc
cb'' = Maybe (Ptr (FunPtr C_DatagramBasedSourceFunc))
-> DatagramBasedSourceFunc_WithClosures
-> C_DatagramBasedSourceFunc
wrap_DatagramBasedSourceFunc Maybe (Ptr (FunPtr C_DatagramBasedSourceFunc))
forall a. Maybe a
Nothing DatagramBasedSourceFunc_WithClosures
cb'
    C_DatagramBasedSourceFunc -> IO (FunPtr C_DatagramBasedSourceFunc)
mk_DatagramBasedSourceFunc C_DatagramBasedSourceFunc
cb'' IO (FunPtr C_DatagramBasedSourceFunc)
-> (FunPtr C_DatagramBasedSourceFunc
    -> IO (GClosure C_DatagramBasedSourceFunc))
-> IO (GClosure C_DatagramBasedSourceFunc)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DatagramBasedSourceFunc
-> IO (GClosure C_DatagramBasedSourceFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `DatagramBasedSourceFunc` into a `C_DatagramBasedSourceFunc`.
wrap_DatagramBasedSourceFunc :: 
    Maybe (Ptr (FunPtr C_DatagramBasedSourceFunc)) ->
    DatagramBasedSourceFunc_WithClosures ->
    C_DatagramBasedSourceFunc
wrap_DatagramBasedSourceFunc :: Maybe (Ptr (FunPtr C_DatagramBasedSourceFunc))
-> DatagramBasedSourceFunc_WithClosures
-> C_DatagramBasedSourceFunc
wrap_DatagramBasedSourceFunc Maybe (Ptr (FunPtr C_DatagramBasedSourceFunc))
gi'funptrptr DatagramBasedSourceFunc_WithClosures
gi'cb Ptr DatagramBased
datagramBased CUInt
condition Ptr ()
userData = do
    DatagramBased
datagramBased' <- ((ManagedPtr DatagramBased -> DatagramBased)
-> Ptr DatagramBased -> IO DatagramBased
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr DatagramBased -> DatagramBased
Gio.DatagramBased.DatagramBased) Ptr DatagramBased
datagramBased
    let condition' :: [IOCondition]
condition' = CUInt -> [IOCondition]
forall a b. (Storable a, Integral a, Bits a, IsGFlag b) => a -> [b]
wordToGFlags CUInt
condition
    Bool
result <- DatagramBasedSourceFunc_WithClosures
gi'cb  DatagramBased
datagramBased' [IOCondition]
condition' Ptr ()
userData
    Maybe (Ptr (FunPtr C_DatagramBasedSourceFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_DatagramBasedSourceFunc))
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 (m :: * -> *) a. Monad m => a -> m a
return CInt
result'


-- callback DBusSubtreeIntrospectFunc
{- Callable
  { returnType =
      Just
        (TCArray
           True
           (-1)
           (-1)
           (TInterface
              Name { namespace = "Gio" , name = "DBusInterfaceInfo" }))
  , returnMayBeNull = True
  , returnTransfer = TransferEverything
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just
              "A %NULL-terminated array of pointers to #GDBusInterfaceInfo, or %NULL."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "connection"
          , argType =
              TInterface Name { namespace = "Gio" , name = "DBusConnection" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "A #GDBusConnection."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "sender"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The unique bus name of the remote caller."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "object_path"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "The object path that was registered with g_dbus_connection_register_subtree()."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "node"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "A node that is a child of @object_path (relative to @object_path) or %NULL for the root of the subtree."
                , 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 @user_data #gpointer passed to g_dbus_connection_register_subtree()."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 4
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "The type of the @introspect function in #GDBusSubtreeVTable.\n\nSubtrees are flat.  @node, if non-%NULL, is always exactly one\nsegment of the object path (ie: it never contains a slash).\n\nThis function should return %NULL to indicate that there is no object\nat this node.\n\nIf this function returns non-%NULL, the return value is expected to\nbe a %NULL-terminated array of pointers to #GDBusInterfaceInfo\nstructures describing the interfaces implemented by @node.  This\narray will have g_dbus_interface_info_unref() called on each item\nbefore being freed with g_free().\n\nThe difference between returning %NULL and an array containing zero\nitems is that the standard DBus interfaces will returned to the\nremote introspector in the empty array case, but not in the %NULL\ncase."
        , sinceVersion = Just "2.26"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_DBusSubtreeIntrospectFunc =
    Ptr Gio.DBusConnection.DBusConnection ->
    CString ->
    CString ->
    CString ->
    Ptr () ->
    IO (Ptr (Ptr Gio.DBusInterfaceInfo.DBusInterfaceInfo))

-- Args: [ Arg
--           { argCName = "connection"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "DBusConnection" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GDBusConnection."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "sender"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The unique bus name of the remote caller."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "object_path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "The object path that was registered with g_dbus_connection_register_subtree()."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "node"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "A node that is a child of @object_path (relative to @object_path) or %NULL for the root of the subtree."
--                 , 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 @user_data #gpointer passed to g_dbus_connection_register_subtree()."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 4
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TCArray
--                  True
--                  (-1)
--                  (-1)
--                  (TInterface
--                     Name { namespace = "Gio" , name = "DBusInterfaceInfo" }))
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DBusSubtreeIntrospectFunc :: FunPtr C_DBusSubtreeIntrospectFunc -> C_DBusSubtreeIntrospectFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_DBusSubtreeIntrospectFunc ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.DBusConnection.IsDBusConnection a) =>
    FunPtr C_DBusSubtreeIntrospectFunc
    -> a
    -- ^ /@connection@/: A t'GI.Gio.Objects.DBusConnection.DBusConnection'.
    -> T.Text
    -- ^ /@sender@/: The unique bus name of the remote caller.
    -> T.Text
    -- ^ /@objectPath@/: The object path that was registered with 'GI.Gio.Objects.DBusConnection.dBusConnectionRegisterSubtree'.
    -> T.Text
    -- ^ /@node@/: A node that is a child of /@objectPath@/ (relative to /@objectPath@/) or 'P.Nothing' for the root of the subtree.
    -> Ptr ()
    -- ^ /@userData@/: The /@userData@/ @/gpointer/@ passed to 'GI.Gio.Objects.DBusConnection.dBusConnectionRegisterSubtree'.
    -> m (Maybe [Gio.DBusInterfaceInfo.DBusInterfaceInfo])
    -- ^ __Returns:__ A 'P.Nothing'-terminated array of pointers to t'GI.Gio.Structs.DBusInterfaceInfo.DBusInterfaceInfo', or 'P.Nothing'.
dynamic_DBusSubtreeIntrospectFunc :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDBusConnection a) =>
FunPtr C_DBusSubtreeIntrospectFunc
-> a
-> Text
-> Text
-> Text
-> Ptr ()
-> m (Maybe [DBusInterfaceInfo])
dynamic_DBusSubtreeIntrospectFunc FunPtr C_DBusSubtreeIntrospectFunc
__funPtr a
connection Text
sender Text
objectPath Text
node Ptr ()
userData = IO (Maybe [DBusInterfaceInfo]) -> m (Maybe [DBusInterfaceInfo])
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe [DBusInterfaceInfo]) -> m (Maybe [DBusInterfaceInfo]))
-> IO (Maybe [DBusInterfaceInfo]) -> m (Maybe [DBusInterfaceInfo])
forall a b. (a -> b) -> a -> b
$ do
    Ptr DBusConnection
connection' <- a -> IO (Ptr DBusConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
    CString
sender' <- Text -> IO CString
textToCString Text
sender
    CString
objectPath' <- Text -> IO CString
textToCString Text
objectPath
    CString
node' <- Text -> IO CString
textToCString Text
node
    Ptr (Ptr DBusInterfaceInfo)
result <- (FunPtr C_DBusSubtreeIntrospectFunc -> C_DBusSubtreeIntrospectFunc
__dynamic_C_DBusSubtreeIntrospectFunc FunPtr C_DBusSubtreeIntrospectFunc
__funPtr) Ptr DBusConnection
connection' CString
sender' CString
objectPath' CString
node' Ptr ()
userData
    Maybe [DBusInterfaceInfo]
maybeResult <- Ptr (Ptr DBusInterfaceInfo)
-> (Ptr (Ptr DBusInterfaceInfo) -> IO [DBusInterfaceInfo])
-> IO (Maybe [DBusInterfaceInfo])
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr (Ptr DBusInterfaceInfo)
result ((Ptr (Ptr DBusInterfaceInfo) -> IO [DBusInterfaceInfo])
 -> IO (Maybe [DBusInterfaceInfo]))
-> (Ptr (Ptr DBusInterfaceInfo) -> IO [DBusInterfaceInfo])
-> IO (Maybe [DBusInterfaceInfo])
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr DBusInterfaceInfo)
result' -> do
        [Ptr DBusInterfaceInfo]
result'' <- Ptr (Ptr DBusInterfaceInfo) -> IO [Ptr DBusInterfaceInfo]
forall a. Ptr (Ptr a) -> IO [Ptr a]
unpackZeroTerminatedPtrArray Ptr (Ptr DBusInterfaceInfo)
result'
        [DBusInterfaceInfo]
result''' <- (Ptr DBusInterfaceInfo -> IO DBusInterfaceInfo)
-> [Ptr DBusInterfaceInfo] -> IO [DBusInterfaceInfo]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((ManagedPtr DBusInterfaceInfo -> DBusInterfaceInfo)
-> Ptr DBusInterfaceInfo -> IO DBusInterfaceInfo
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr DBusInterfaceInfo -> DBusInterfaceInfo
Gio.DBusInterfaceInfo.DBusInterfaceInfo) [Ptr DBusInterfaceInfo]
result''
        Ptr (Ptr DBusInterfaceInfo) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr DBusInterfaceInfo)
result'
        [DBusInterfaceInfo] -> IO [DBusInterfaceInfo]
forall (m :: * -> *) a. Monad m => a -> m a
return [DBusInterfaceInfo]
result'''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
connection
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
sender'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
objectPath'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
node'
    Maybe [DBusInterfaceInfo] -> IO (Maybe [DBusInterfaceInfo])
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe [DBusInterfaceInfo]
maybeResult

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

-- | The type of the /@introspect@/ function in t'GI.Gio.Structs.DBusSubtreeVTable.DBusSubtreeVTable'.
-- 
-- Subtrees are flat.  /@node@/, if non-'P.Nothing', is always exactly one
-- segment of the object path (ie: it never contains a slash).
-- 
-- This function should return 'P.Nothing' to indicate that there is no object
-- at this node.
-- 
-- If this function returns non-'P.Nothing', the return value is expected to
-- be a 'P.Nothing'-terminated array of pointers to t'GI.Gio.Structs.DBusInterfaceInfo.DBusInterfaceInfo'
-- structures describing the interfaces implemented by /@node@/.  This
-- array will have 'GI.Gio.Structs.DBusInterfaceInfo.dBusInterfaceInfoUnref' called on each item
-- before being freed with 'GI.GLib.Functions.free'.
-- 
-- The difference between returning 'P.Nothing' and an array containing zero
-- items is that the standard DBus interfaces will returned to the
-- remote introspector in the empty array case, but not in the 'P.Nothing'
-- case.
-- 
-- /Since: 2.26/
type DBusSubtreeIntrospectFunc =
    Gio.DBusConnection.DBusConnection
    -- ^ /@connection@/: A t'GI.Gio.Objects.DBusConnection.DBusConnection'.
    -> T.Text
    -- ^ /@sender@/: The unique bus name of the remote caller.
    -> T.Text
    -- ^ /@objectPath@/: The object path that was registered with 'GI.Gio.Objects.DBusConnection.dBusConnectionRegisterSubtree'.
    -> T.Text
    -- ^ /@node@/: A node that is a child of /@objectPath@/ (relative to /@objectPath@/) or 'P.Nothing' for the root of the subtree.
    -> IO (Maybe [Gio.DBusInterfaceInfo.DBusInterfaceInfo])
    -- ^ __Returns:__ A 'P.Nothing'-terminated array of pointers to t'GI.Gio.Structs.DBusInterfaceInfo.DBusInterfaceInfo', or 'P.Nothing'.

-- | A convenience synonym for @`Nothing` :: `Maybe` `DBusSubtreeIntrospectFunc`@.
noDBusSubtreeIntrospectFunc :: Maybe DBusSubtreeIntrospectFunc
noDBusSubtreeIntrospectFunc :: Maybe DBusSubtreeIntrospectFunc
noDBusSubtreeIntrospectFunc = Maybe DBusSubtreeIntrospectFunc
forall a. Maybe a
Nothing

-- | The type of the /@introspect@/ function in t'GI.Gio.Structs.DBusSubtreeVTable.DBusSubtreeVTable'.
-- 
-- Subtrees are flat.  /@node@/, if non-'P.Nothing', is always exactly one
-- segment of the object path (ie: it never contains a slash).
-- 
-- This function should return 'P.Nothing' to indicate that there is no object
-- at this node.
-- 
-- If this function returns non-'P.Nothing', the return value is expected to
-- be a 'P.Nothing'-terminated array of pointers to t'GI.Gio.Structs.DBusInterfaceInfo.DBusInterfaceInfo'
-- structures describing the interfaces implemented by /@node@/.  This
-- array will have 'GI.Gio.Structs.DBusInterfaceInfo.dBusInterfaceInfoUnref' called on each item
-- before being freed with 'GI.GLib.Functions.free'.
-- 
-- The difference between returning 'P.Nothing' and an array containing zero
-- items is that the standard DBus interfaces will returned to the
-- remote introspector in the empty array case, but not in the 'P.Nothing'
-- case.
-- 
-- /Since: 2.26/
type DBusSubtreeIntrospectFunc_WithClosures =
    Gio.DBusConnection.DBusConnection
    -- ^ /@connection@/: A t'GI.Gio.Objects.DBusConnection.DBusConnection'.
    -> T.Text
    -- ^ /@sender@/: The unique bus name of the remote caller.
    -> T.Text
    -- ^ /@objectPath@/: The object path that was registered with 'GI.Gio.Objects.DBusConnection.dBusConnectionRegisterSubtree'.
    -> T.Text
    -- ^ /@node@/: A node that is a child of /@objectPath@/ (relative to /@objectPath@/) or 'P.Nothing' for the root of the subtree.
    -> Ptr ()
    -- ^ /@userData@/: The /@userData@/ @/gpointer/@ passed to 'GI.Gio.Objects.DBusConnection.dBusConnectionRegisterSubtree'.
    -> IO (Maybe [Gio.DBusInterfaceInfo.DBusInterfaceInfo])
    -- ^ __Returns:__ A 'P.Nothing'-terminated array of pointers to t'GI.Gio.Structs.DBusInterfaceInfo.DBusInterfaceInfo', or 'P.Nothing'.

-- | A convenience synonym for @`Nothing` :: `Maybe` `DBusSubtreeIntrospectFunc_WithClosures`@.
noDBusSubtreeIntrospectFunc_WithClosures :: Maybe DBusSubtreeIntrospectFunc_WithClosures
noDBusSubtreeIntrospectFunc_WithClosures :: Maybe DBusSubtreeIntrospectFunc_WithClosures
noDBusSubtreeIntrospectFunc_WithClosures = Maybe DBusSubtreeIntrospectFunc_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_DBusSubtreeIntrospectFunc :: DBusSubtreeIntrospectFunc -> DBusSubtreeIntrospectFunc_WithClosures
drop_closures_DBusSubtreeIntrospectFunc :: DBusSubtreeIntrospectFunc -> DBusSubtreeIntrospectFunc_WithClosures
drop_closures_DBusSubtreeIntrospectFunc DBusSubtreeIntrospectFunc
_f DBusConnection
connection Text
sender Text
objectPath Text
node Ptr ()
_ = DBusSubtreeIntrospectFunc
_f DBusConnection
connection Text
sender Text
objectPath Text
node

-- | Wrap the callback into a `GClosure`.
genClosure_DBusSubtreeIntrospectFunc :: MonadIO m => DBusSubtreeIntrospectFunc -> m (GClosure C_DBusSubtreeIntrospectFunc)
genClosure_DBusSubtreeIntrospectFunc :: forall (m :: * -> *).
MonadIO m =>
DBusSubtreeIntrospectFunc
-> m (GClosure C_DBusSubtreeIntrospectFunc)
genClosure_DBusSubtreeIntrospectFunc DBusSubtreeIntrospectFunc
cb = IO (GClosure C_DBusSubtreeIntrospectFunc)
-> m (GClosure C_DBusSubtreeIntrospectFunc)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DBusSubtreeIntrospectFunc)
 -> m (GClosure C_DBusSubtreeIntrospectFunc))
-> IO (GClosure C_DBusSubtreeIntrospectFunc)
-> m (GClosure C_DBusSubtreeIntrospectFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: DBusSubtreeIntrospectFunc_WithClosures
cb' = DBusSubtreeIntrospectFunc -> DBusSubtreeIntrospectFunc_WithClosures
drop_closures_DBusSubtreeIntrospectFunc DBusSubtreeIntrospectFunc
cb
    let cb'' :: C_DBusSubtreeIntrospectFunc
cb'' = Maybe (Ptr (FunPtr C_DBusSubtreeIntrospectFunc))
-> DBusSubtreeIntrospectFunc_WithClosures
-> C_DBusSubtreeIntrospectFunc
wrap_DBusSubtreeIntrospectFunc Maybe (Ptr (FunPtr C_DBusSubtreeIntrospectFunc))
forall a. Maybe a
Nothing DBusSubtreeIntrospectFunc_WithClosures
cb'
    C_DBusSubtreeIntrospectFunc
-> IO (FunPtr C_DBusSubtreeIntrospectFunc)
mk_DBusSubtreeIntrospectFunc C_DBusSubtreeIntrospectFunc
cb'' IO (FunPtr C_DBusSubtreeIntrospectFunc)
-> (FunPtr C_DBusSubtreeIntrospectFunc
    -> IO (GClosure C_DBusSubtreeIntrospectFunc))
-> IO (GClosure C_DBusSubtreeIntrospectFunc)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DBusSubtreeIntrospectFunc
-> IO (GClosure C_DBusSubtreeIntrospectFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `DBusSubtreeIntrospectFunc` into a `C_DBusSubtreeIntrospectFunc`.
wrap_DBusSubtreeIntrospectFunc :: 
    Maybe (Ptr (FunPtr C_DBusSubtreeIntrospectFunc)) ->
    DBusSubtreeIntrospectFunc_WithClosures ->
    C_DBusSubtreeIntrospectFunc
wrap_DBusSubtreeIntrospectFunc :: Maybe (Ptr (FunPtr C_DBusSubtreeIntrospectFunc))
-> DBusSubtreeIntrospectFunc_WithClosures
-> C_DBusSubtreeIntrospectFunc
wrap_DBusSubtreeIntrospectFunc Maybe (Ptr (FunPtr C_DBusSubtreeIntrospectFunc))
gi'funptrptr DBusSubtreeIntrospectFunc_WithClosures
gi'cb Ptr DBusConnection
connection CString
sender CString
objectPath CString
node Ptr ()
userData = do
    DBusConnection
connection' <- ((ManagedPtr DBusConnection -> DBusConnection)
-> Ptr DBusConnection -> IO DBusConnection
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr DBusConnection -> DBusConnection
Gio.DBusConnection.DBusConnection) Ptr DBusConnection
connection
    Text
sender' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
sender
    Text
objectPath' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
objectPath
    Text
node' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
node
    Maybe [DBusInterfaceInfo]
result <- DBusSubtreeIntrospectFunc_WithClosures
gi'cb  DBusConnection
connection' Text
sender' Text
objectPath' Text
node' Ptr ()
userData
    Maybe (Ptr (FunPtr C_DBusSubtreeIntrospectFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_DBusSubtreeIntrospectFunc))
gi'funptrptr
    Ptr (Ptr DBusInterfaceInfo)
-> Maybe [DBusInterfaceInfo]
-> ([DBusInterfaceInfo] -> IO (Ptr (Ptr DBusInterfaceInfo)))
-> IO (Ptr (Ptr DBusInterfaceInfo))
forall (m :: * -> *) b a.
Monad m =>
b -> Maybe a -> (a -> m b) -> m b
maybeM Ptr (Ptr DBusInterfaceInfo)
forall a. Ptr a
FP.nullPtr Maybe [DBusInterfaceInfo]
result (([DBusInterfaceInfo] -> IO (Ptr (Ptr DBusInterfaceInfo)))
 -> IO (Ptr (Ptr DBusInterfaceInfo)))
-> ([DBusInterfaceInfo] -> IO (Ptr (Ptr DBusInterfaceInfo)))
-> IO (Ptr (Ptr DBusInterfaceInfo))
forall a b. (a -> b) -> a -> b
$ \[DBusInterfaceInfo]
result' -> do
        [Ptr DBusInterfaceInfo]
result'' <- (DBusInterfaceInfo -> IO (Ptr DBusInterfaceInfo))
-> [DBusInterfaceInfo] -> IO [Ptr DBusInterfaceInfo]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM DBusInterfaceInfo -> IO (Ptr DBusInterfaceInfo)
forall a. (HasCallStack, GBoxed a) => a -> IO (Ptr a)
B.ManagedPtr.disownBoxed [DBusInterfaceInfo]
result'
        Ptr (Ptr DBusInterfaceInfo)
result''' <- [Ptr DBusInterfaceInfo] -> IO (Ptr (Ptr DBusInterfaceInfo))
forall a. [Ptr a] -> IO (Ptr (Ptr a))
packZeroTerminatedPtrArray [Ptr DBusInterfaceInfo]
result''
        Ptr (Ptr DBusInterfaceInfo) -> IO (Ptr (Ptr DBusInterfaceInfo))
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (Ptr DBusInterfaceInfo)
result'''


-- callback DBusSubtreeEnumerateFunc
{- Callable
  { returnType = Just (TCArray True (-1) (-1) (TBasicType TUTF8))
  , returnMayBeNull = False
  , returnTransfer = TransferEverything
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just
              "A newly allocated array of strings for node names that are children of @object_path."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "connection"
          , argType =
              TInterface Name { namespace = "Gio" , name = "DBusConnection" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "A #GDBusConnection."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "sender"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The unique bus name of the remote caller."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "object_path"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "The object path that was registered with g_dbus_connection_register_subtree()."
                , 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 @user_data #gpointer passed to g_dbus_connection_register_subtree()."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 3
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "The type of the @enumerate function in #GDBusSubtreeVTable.\n\nThis function is called when generating introspection data and also\nwhen preparing to dispatch incoming messages in the event that the\n%G_DBUS_SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES flag is not\nspecified (ie: to verify that the object path is valid).\n\nHierarchies are not supported; the items that you return should not\ncontain the `/` character.\n\nThe return value will be freed with g_strfreev()."
        , sinceVersion = Just "2.26"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_DBusSubtreeEnumerateFunc =
    Ptr Gio.DBusConnection.DBusConnection ->
    CString ->
    CString ->
    Ptr () ->
    IO (Ptr CString)

-- Args: [ Arg
--           { argCName = "connection"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "DBusConnection" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GDBusConnection."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "sender"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The unique bus name of the remote caller."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "object_path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "The object path that was registered with g_dbus_connection_register_subtree()."
--                 , 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 @user_data #gpointer passed to g_dbus_connection_register_subtree()."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 3
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DBusSubtreeEnumerateFunc :: FunPtr C_DBusSubtreeEnumerateFunc -> C_DBusSubtreeEnumerateFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_DBusSubtreeEnumerateFunc ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.DBusConnection.IsDBusConnection a) =>
    FunPtr C_DBusSubtreeEnumerateFunc
    -> a
    -- ^ /@connection@/: A t'GI.Gio.Objects.DBusConnection.DBusConnection'.
    -> T.Text
    -- ^ /@sender@/: The unique bus name of the remote caller.
    -> T.Text
    -- ^ /@objectPath@/: The object path that was registered with 'GI.Gio.Objects.DBusConnection.dBusConnectionRegisterSubtree'.
    -> Ptr ()
    -- ^ /@userData@/: The /@userData@/ @/gpointer/@ passed to 'GI.Gio.Objects.DBusConnection.dBusConnectionRegisterSubtree'.
    -> m [T.Text]
    -- ^ __Returns:__ A newly allocated array of strings for node names that are children of /@objectPath@/.
dynamic_DBusSubtreeEnumerateFunc :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDBusConnection a) =>
FunPtr C_DBusSubtreeEnumerateFunc
-> a -> Text -> Text -> Ptr () -> m [Text]
dynamic_DBusSubtreeEnumerateFunc FunPtr C_DBusSubtreeEnumerateFunc
__funPtr a
connection Text
sender Text
objectPath Ptr ()
userData = IO [Text] -> m [Text]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Text] -> m [Text]) -> IO [Text] -> m [Text]
forall a b. (a -> b) -> a -> b
$ do
    Ptr DBusConnection
connection' <- a -> IO (Ptr DBusConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
    CString
sender' <- Text -> IO CString
textToCString Text
sender
    CString
objectPath' <- Text -> IO CString
textToCString Text
objectPath
    Ptr CString
result <- (FunPtr C_DBusSubtreeEnumerateFunc -> C_DBusSubtreeEnumerateFunc
__dynamic_C_DBusSubtreeEnumerateFunc FunPtr C_DBusSubtreeEnumerateFunc
__funPtr) Ptr DBusConnection
connection' CString
sender' CString
objectPath' Ptr ()
userData
    Text -> Ptr CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"dBusSubtreeEnumerateFunc" Ptr CString
result
    [Text]
result' <- HasCallStack => Ptr CString -> IO [Text]
Ptr CString -> IO [Text]
unpackZeroTerminatedUTF8CArray Ptr CString
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
result
    Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
connection
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
sender'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
objectPath'
    [Text] -> IO [Text]
forall (m :: * -> *) a. Monad m => a -> m a
return [Text]
result'

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

-- | The type of the /@enumerate@/ function in t'GI.Gio.Structs.DBusSubtreeVTable.DBusSubtreeVTable'.
-- 
-- This function is called when generating introspection data and also
-- when preparing to dispatch incoming messages in the event that the
-- 'GI.Gio.Flags.DBusSubtreeFlagsDispatchToUnenumeratedNodes' flag is not
-- specified (ie: to verify that the object path is valid).
-- 
-- Hierarchies are not supported; the items that you return should not
-- contain the @\/@ character.
-- 
-- The return value will be freed with 'GI.GLib.Functions.strfreev'.
-- 
-- /Since: 2.26/
type DBusSubtreeEnumerateFunc =
    Gio.DBusConnection.DBusConnection
    -- ^ /@connection@/: A t'GI.Gio.Objects.DBusConnection.DBusConnection'.
    -> T.Text
    -- ^ /@sender@/: The unique bus name of the remote caller.
    -> T.Text
    -- ^ /@objectPath@/: The object path that was registered with 'GI.Gio.Objects.DBusConnection.dBusConnectionRegisterSubtree'.
    -> IO [T.Text]
    -- ^ __Returns:__ A newly allocated array of strings for node names that are children of /@objectPath@/.

-- | A convenience synonym for @`Nothing` :: `Maybe` `DBusSubtreeEnumerateFunc`@.
noDBusSubtreeEnumerateFunc :: Maybe DBusSubtreeEnumerateFunc
noDBusSubtreeEnumerateFunc :: Maybe DBusSubtreeEnumerateFunc
noDBusSubtreeEnumerateFunc = Maybe DBusSubtreeEnumerateFunc
forall a. Maybe a
Nothing

-- | The type of the /@enumerate@/ function in t'GI.Gio.Structs.DBusSubtreeVTable.DBusSubtreeVTable'.
-- 
-- This function is called when generating introspection data and also
-- when preparing to dispatch incoming messages in the event that the
-- 'GI.Gio.Flags.DBusSubtreeFlagsDispatchToUnenumeratedNodes' flag is not
-- specified (ie: to verify that the object path is valid).
-- 
-- Hierarchies are not supported; the items that you return should not
-- contain the @\/@ character.
-- 
-- The return value will be freed with 'GI.GLib.Functions.strfreev'.
-- 
-- /Since: 2.26/
type DBusSubtreeEnumerateFunc_WithClosures =
    Gio.DBusConnection.DBusConnection
    -- ^ /@connection@/: A t'GI.Gio.Objects.DBusConnection.DBusConnection'.
    -> T.Text
    -- ^ /@sender@/: The unique bus name of the remote caller.
    -> T.Text
    -- ^ /@objectPath@/: The object path that was registered with 'GI.Gio.Objects.DBusConnection.dBusConnectionRegisterSubtree'.
    -> Ptr ()
    -- ^ /@userData@/: The /@userData@/ @/gpointer/@ passed to 'GI.Gio.Objects.DBusConnection.dBusConnectionRegisterSubtree'.
    -> IO [T.Text]
    -- ^ __Returns:__ A newly allocated array of strings for node names that are children of /@objectPath@/.

-- | A convenience synonym for @`Nothing` :: `Maybe` `DBusSubtreeEnumerateFunc_WithClosures`@.
noDBusSubtreeEnumerateFunc_WithClosures :: Maybe DBusSubtreeEnumerateFunc_WithClosures
noDBusSubtreeEnumerateFunc_WithClosures :: Maybe DBusSubtreeEnumerateFunc_WithClosures
noDBusSubtreeEnumerateFunc_WithClosures = Maybe DBusSubtreeEnumerateFunc_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_DBusSubtreeEnumerateFunc :: DBusSubtreeEnumerateFunc -> DBusSubtreeEnumerateFunc_WithClosures
drop_closures_DBusSubtreeEnumerateFunc :: DBusSubtreeEnumerateFunc -> DBusSubtreeEnumerateFunc_WithClosures
drop_closures_DBusSubtreeEnumerateFunc DBusSubtreeEnumerateFunc
_f DBusConnection
connection Text
sender Text
objectPath Ptr ()
_ = DBusSubtreeEnumerateFunc
_f DBusConnection
connection Text
sender Text
objectPath

-- | Wrap the callback into a `GClosure`.
genClosure_DBusSubtreeEnumerateFunc :: MonadIO m => DBusSubtreeEnumerateFunc -> m (GClosure C_DBusSubtreeEnumerateFunc)
genClosure_DBusSubtreeEnumerateFunc :: forall (m :: * -> *).
MonadIO m =>
DBusSubtreeEnumerateFunc -> m (GClosure C_DBusSubtreeEnumerateFunc)
genClosure_DBusSubtreeEnumerateFunc DBusSubtreeEnumerateFunc
cb = IO (GClosure C_DBusSubtreeEnumerateFunc)
-> m (GClosure C_DBusSubtreeEnumerateFunc)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DBusSubtreeEnumerateFunc)
 -> m (GClosure C_DBusSubtreeEnumerateFunc))
-> IO (GClosure C_DBusSubtreeEnumerateFunc)
-> m (GClosure C_DBusSubtreeEnumerateFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: DBusSubtreeEnumerateFunc_WithClosures
cb' = DBusSubtreeEnumerateFunc -> DBusSubtreeEnumerateFunc_WithClosures
drop_closures_DBusSubtreeEnumerateFunc DBusSubtreeEnumerateFunc
cb
    let cb'' :: C_DBusSubtreeEnumerateFunc
cb'' = Maybe (Ptr (FunPtr C_DBusSubtreeEnumerateFunc))
-> DBusSubtreeEnumerateFunc_WithClosures
-> C_DBusSubtreeEnumerateFunc
wrap_DBusSubtreeEnumerateFunc Maybe (Ptr (FunPtr C_DBusSubtreeEnumerateFunc))
forall a. Maybe a
Nothing DBusSubtreeEnumerateFunc_WithClosures
cb'
    C_DBusSubtreeEnumerateFunc
-> IO (FunPtr C_DBusSubtreeEnumerateFunc)
mk_DBusSubtreeEnumerateFunc C_DBusSubtreeEnumerateFunc
cb'' IO (FunPtr C_DBusSubtreeEnumerateFunc)
-> (FunPtr C_DBusSubtreeEnumerateFunc
    -> IO (GClosure C_DBusSubtreeEnumerateFunc))
-> IO (GClosure C_DBusSubtreeEnumerateFunc)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DBusSubtreeEnumerateFunc
-> IO (GClosure C_DBusSubtreeEnumerateFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `DBusSubtreeEnumerateFunc` into a `C_DBusSubtreeEnumerateFunc`.
wrap_DBusSubtreeEnumerateFunc :: 
    Maybe (Ptr (FunPtr C_DBusSubtreeEnumerateFunc)) ->
    DBusSubtreeEnumerateFunc_WithClosures ->
    C_DBusSubtreeEnumerateFunc
wrap_DBusSubtreeEnumerateFunc :: Maybe (Ptr (FunPtr C_DBusSubtreeEnumerateFunc))
-> DBusSubtreeEnumerateFunc_WithClosures
-> C_DBusSubtreeEnumerateFunc
wrap_DBusSubtreeEnumerateFunc Maybe (Ptr (FunPtr C_DBusSubtreeEnumerateFunc))
gi'funptrptr DBusSubtreeEnumerateFunc_WithClosures
gi'cb Ptr DBusConnection
connection CString
sender CString
objectPath Ptr ()
userData = do
    DBusConnection
connection' <- ((ManagedPtr DBusConnection -> DBusConnection)
-> Ptr DBusConnection -> IO DBusConnection
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr DBusConnection -> DBusConnection
Gio.DBusConnection.DBusConnection) Ptr DBusConnection
connection
    Text
sender' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
sender
    Text
objectPath' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
objectPath
    [Text]
result <- DBusSubtreeEnumerateFunc_WithClosures
gi'cb  DBusConnection
connection' Text
sender' Text
objectPath' Ptr ()
userData
    Maybe (Ptr (FunPtr C_DBusSubtreeEnumerateFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_DBusSubtreeEnumerateFunc))
gi'funptrptr
    Ptr CString
result' <- [Text] -> IO (Ptr CString)
packZeroTerminatedUTF8CArray [Text]
result
    Ptr CString -> IO (Ptr CString)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CString
result'


-- callback DBusSubtreeDispatchFunc
{- Callable
  { returnType =
      Just
        (TInterface
           Name { namespace = "Gio" , name = "DBusInterfaceVTable" })
  , returnMayBeNull = True
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just
              "A #GDBusInterfaceVTable or %NULL if you don't want to handle the methods."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "connection"
          , argType =
              TInterface Name { namespace = "Gio" , name = "DBusConnection" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "A #GDBusConnection."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "sender"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The unique bus name of the remote caller."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "object_path"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "The object path that was registered with g_dbus_connection_register_subtree()."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "interface_name"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "The D-Bus interface name that the method call or property access is for."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "node"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "A node that is a child of @object_path (relative to @object_path) or %NULL for the root of the subtree."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "out_user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "Return location for user data to pass to functions in the returned #GDBusInterfaceVTable."
                , 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 @user_data #gpointer passed to g_dbus_connection_register_subtree()."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 6
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "The type of the @dispatch function in #GDBusSubtreeVTable.\n\nSubtrees are flat.  @node, if non-%NULL, is always exactly one\nsegment of the object path (ie: it never contains a slash)."
        , sinceVersion = Just "2.26"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_DBusSubtreeDispatchFunc =
    Ptr Gio.DBusConnection.DBusConnection ->
    CString ->
    CString ->
    CString ->
    CString ->
    Ptr () ->
    Ptr () ->
    IO (Ptr Gio.DBusInterfaceVTable.DBusInterfaceVTable)

-- Args: [ Arg
--           { argCName = "connection"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "DBusConnection" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GDBusConnection."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "sender"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The unique bus name of the remote caller."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "object_path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "The object path that was registered with g_dbus_connection_register_subtree()."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "interface_name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "The D-Bus interface name that the method call or property access is for."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "node"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "A node that is a child of @object_path (relative to @object_path) or %NULL for the root of the subtree."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "out_user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Return location for user data to pass to functions in the returned #GDBusInterfaceVTable."
--                 , 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 @user_data #gpointer passed to g_dbus_connection_register_subtree()."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 6
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "Gio" , name = "DBusInterfaceVTable" })
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DBusSubtreeDispatchFunc :: FunPtr C_DBusSubtreeDispatchFunc -> C_DBusSubtreeDispatchFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_DBusSubtreeDispatchFunc ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.DBusConnection.IsDBusConnection a) =>
    FunPtr C_DBusSubtreeDispatchFunc
    -> a
    -- ^ /@connection@/: A t'GI.Gio.Objects.DBusConnection.DBusConnection'.
    -> T.Text
    -- ^ /@sender@/: The unique bus name of the remote caller.
    -> T.Text
    -- ^ /@objectPath@/: The object path that was registered with 'GI.Gio.Objects.DBusConnection.dBusConnectionRegisterSubtree'.
    -> T.Text
    -- ^ /@interfaceName@/: The D-Bus interface name that the method call or property access is for.
    -> T.Text
    -- ^ /@node@/: A node that is a child of /@objectPath@/ (relative to /@objectPath@/) or 'P.Nothing' for the root of the subtree.
    -> Ptr ()
    -- ^ /@outUserData@/: Return location for user data to pass to functions in the returned t'GI.Gio.Structs.DBusInterfaceVTable.DBusInterfaceVTable'.
    -> Ptr ()
    -- ^ /@userData@/: The /@userData@/ @/gpointer/@ passed to 'GI.Gio.Objects.DBusConnection.dBusConnectionRegisterSubtree'.
    -> m (Maybe Gio.DBusInterfaceVTable.DBusInterfaceVTable)
    -- ^ __Returns:__ A t'GI.Gio.Structs.DBusInterfaceVTable.DBusInterfaceVTable' or 'P.Nothing' if you don\'t want to handle the methods.
dynamic_DBusSubtreeDispatchFunc :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDBusConnection a) =>
FunPtr C_DBusSubtreeDispatchFunc
-> a
-> Text
-> Text
-> Text
-> Text
-> Ptr ()
-> Ptr ()
-> m (Maybe DBusInterfaceVTable)
dynamic_DBusSubtreeDispatchFunc FunPtr C_DBusSubtreeDispatchFunc
__funPtr a
connection Text
sender Text
objectPath Text
interfaceName Text
node Ptr ()
outUserData Ptr ()
userData = IO (Maybe DBusInterfaceVTable) -> m (Maybe DBusInterfaceVTable)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe DBusInterfaceVTable) -> m (Maybe DBusInterfaceVTable))
-> IO (Maybe DBusInterfaceVTable) -> m (Maybe DBusInterfaceVTable)
forall a b. (a -> b) -> a -> b
$ do
    Ptr DBusConnection
connection' <- a -> IO (Ptr DBusConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
    CString
sender' <- Text -> IO CString
textToCString Text
sender
    CString
objectPath' <- Text -> IO CString
textToCString Text
objectPath
    CString
interfaceName' <- Text -> IO CString
textToCString Text
interfaceName
    CString
node' <- Text -> IO CString
textToCString Text
node
    Ptr DBusInterfaceVTable
result <- (FunPtr C_DBusSubtreeDispatchFunc -> C_DBusSubtreeDispatchFunc
__dynamic_C_DBusSubtreeDispatchFunc FunPtr C_DBusSubtreeDispatchFunc
__funPtr) Ptr DBusConnection
connection' CString
sender' CString
objectPath' CString
interfaceName' CString
node' Ptr ()
outUserData Ptr ()
userData
    Maybe DBusInterfaceVTable
maybeResult <- Ptr DBusInterfaceVTable
-> (Ptr DBusInterfaceVTable -> IO DBusInterfaceVTable)
-> IO (Maybe DBusInterfaceVTable)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr DBusInterfaceVTable
result ((Ptr DBusInterfaceVTable -> IO DBusInterfaceVTable)
 -> IO (Maybe DBusInterfaceVTable))
-> (Ptr DBusInterfaceVTable -> IO DBusInterfaceVTable)
-> IO (Maybe DBusInterfaceVTable)
forall a b. (a -> b) -> a -> b
$ \Ptr DBusInterfaceVTable
result' -> do
        DBusInterfaceVTable
result'' <- ((ManagedPtr DBusInterfaceVTable -> DBusInterfaceVTable)
-> Ptr DBusInterfaceVTable -> IO DBusInterfaceVTable
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr DBusInterfaceVTable -> DBusInterfaceVTable
Gio.DBusInterfaceVTable.DBusInterfaceVTable) Ptr DBusInterfaceVTable
result'
        DBusInterfaceVTable -> IO DBusInterfaceVTable
forall (m :: * -> *) a. Monad m => a -> m a
return DBusInterfaceVTable
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
connection
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
sender'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
objectPath'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
interfaceName'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
node'
    Maybe DBusInterfaceVTable -> IO (Maybe DBusInterfaceVTable)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe DBusInterfaceVTable
maybeResult

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

-- | The type of the /@dispatch@/ function in t'GI.Gio.Structs.DBusSubtreeVTable.DBusSubtreeVTable'.
-- 
-- Subtrees are flat.  /@node@/, if non-'P.Nothing', is always exactly one
-- segment of the object path (ie: it never contains a slash).
-- 
-- /Since: 2.26/
type DBusSubtreeDispatchFunc =
    Gio.DBusConnection.DBusConnection
    -- ^ /@connection@/: A t'GI.Gio.Objects.DBusConnection.DBusConnection'.
    -> T.Text
    -- ^ /@sender@/: The unique bus name of the remote caller.
    -> T.Text
    -- ^ /@objectPath@/: The object path that was registered with 'GI.Gio.Objects.DBusConnection.dBusConnectionRegisterSubtree'.
    -> T.Text
    -- ^ /@interfaceName@/: The D-Bus interface name that the method call or property access is for.
    -> T.Text
    -- ^ /@node@/: A node that is a child of /@objectPath@/ (relative to /@objectPath@/) or 'P.Nothing' for the root of the subtree.
    -> Ptr ()
    -- ^ /@outUserData@/: Return location for user data to pass to functions in the returned t'GI.Gio.Structs.DBusInterfaceVTable.DBusInterfaceVTable'.
    -> IO (Maybe Gio.DBusInterfaceVTable.DBusInterfaceVTable)
    -- ^ __Returns:__ A t'GI.Gio.Structs.DBusInterfaceVTable.DBusInterfaceVTable' or 'P.Nothing' if you don\'t want to handle the methods.

-- | A convenience synonym for @`Nothing` :: `Maybe` `DBusSubtreeDispatchFunc`@.
noDBusSubtreeDispatchFunc :: Maybe DBusSubtreeDispatchFunc
noDBusSubtreeDispatchFunc :: Maybe DBusSubtreeDispatchFunc
noDBusSubtreeDispatchFunc = Maybe DBusSubtreeDispatchFunc
forall a. Maybe a
Nothing

-- | The type of the /@dispatch@/ function in t'GI.Gio.Structs.DBusSubtreeVTable.DBusSubtreeVTable'.
-- 
-- Subtrees are flat.  /@node@/, if non-'P.Nothing', is always exactly one
-- segment of the object path (ie: it never contains a slash).
-- 
-- /Since: 2.26/
type DBusSubtreeDispatchFunc_WithClosures =
    Gio.DBusConnection.DBusConnection
    -- ^ /@connection@/: A t'GI.Gio.Objects.DBusConnection.DBusConnection'.
    -> T.Text
    -- ^ /@sender@/: The unique bus name of the remote caller.
    -> T.Text
    -- ^ /@objectPath@/: The object path that was registered with 'GI.Gio.Objects.DBusConnection.dBusConnectionRegisterSubtree'.
    -> T.Text
    -- ^ /@interfaceName@/: The D-Bus interface name that the method call or property access is for.
    -> T.Text
    -- ^ /@node@/: A node that is a child of /@objectPath@/ (relative to /@objectPath@/) or 'P.Nothing' for the root of the subtree.
    -> Ptr ()
    -- ^ /@outUserData@/: Return location for user data to pass to functions in the returned t'GI.Gio.Structs.DBusInterfaceVTable.DBusInterfaceVTable'.
    -> Ptr ()
    -- ^ /@userData@/: The /@userData@/ @/gpointer/@ passed to 'GI.Gio.Objects.DBusConnection.dBusConnectionRegisterSubtree'.
    -> IO (Maybe Gio.DBusInterfaceVTable.DBusInterfaceVTable)
    -- ^ __Returns:__ A t'GI.Gio.Structs.DBusInterfaceVTable.DBusInterfaceVTable' or 'P.Nothing' if you don\'t want to handle the methods.

-- | A convenience synonym for @`Nothing` :: `Maybe` `DBusSubtreeDispatchFunc_WithClosures`@.
noDBusSubtreeDispatchFunc_WithClosures :: Maybe DBusSubtreeDispatchFunc_WithClosures
noDBusSubtreeDispatchFunc_WithClosures :: Maybe DBusSubtreeDispatchFunc_WithClosures
noDBusSubtreeDispatchFunc_WithClosures = Maybe DBusSubtreeDispatchFunc_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_DBusSubtreeDispatchFunc :: DBusSubtreeDispatchFunc -> DBusSubtreeDispatchFunc_WithClosures
drop_closures_DBusSubtreeDispatchFunc :: DBusSubtreeDispatchFunc -> DBusSubtreeDispatchFunc_WithClosures
drop_closures_DBusSubtreeDispatchFunc DBusSubtreeDispatchFunc
_f DBusConnection
connection Text
sender Text
objectPath Text
interfaceName Text
node Ptr ()
outUserData Ptr ()
_ = DBusSubtreeDispatchFunc
_f DBusConnection
connection Text
sender Text
objectPath Text
interfaceName Text
node Ptr ()
outUserData

-- | Wrap the callback into a `GClosure`.
genClosure_DBusSubtreeDispatchFunc :: MonadIO m => DBusSubtreeDispatchFunc -> m (GClosure C_DBusSubtreeDispatchFunc)
genClosure_DBusSubtreeDispatchFunc :: forall (m :: * -> *).
MonadIO m =>
DBusSubtreeDispatchFunc -> m (GClosure C_DBusSubtreeDispatchFunc)
genClosure_DBusSubtreeDispatchFunc DBusSubtreeDispatchFunc
cb = IO (GClosure C_DBusSubtreeDispatchFunc)
-> m (GClosure C_DBusSubtreeDispatchFunc)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DBusSubtreeDispatchFunc)
 -> m (GClosure C_DBusSubtreeDispatchFunc))
-> IO (GClosure C_DBusSubtreeDispatchFunc)
-> m (GClosure C_DBusSubtreeDispatchFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: DBusSubtreeDispatchFunc_WithClosures
cb' = DBusSubtreeDispatchFunc -> DBusSubtreeDispatchFunc_WithClosures
drop_closures_DBusSubtreeDispatchFunc DBusSubtreeDispatchFunc
cb
    let cb'' :: C_DBusSubtreeDispatchFunc
cb'' = Maybe (Ptr (FunPtr C_DBusSubtreeDispatchFunc))
-> DBusSubtreeDispatchFunc_WithClosures
-> C_DBusSubtreeDispatchFunc
wrap_DBusSubtreeDispatchFunc Maybe (Ptr (FunPtr C_DBusSubtreeDispatchFunc))
forall a. Maybe a
Nothing DBusSubtreeDispatchFunc_WithClosures
cb'
    C_DBusSubtreeDispatchFunc -> IO (FunPtr C_DBusSubtreeDispatchFunc)
mk_DBusSubtreeDispatchFunc C_DBusSubtreeDispatchFunc
cb'' IO (FunPtr C_DBusSubtreeDispatchFunc)
-> (FunPtr C_DBusSubtreeDispatchFunc
    -> IO (GClosure C_DBusSubtreeDispatchFunc))
-> IO (GClosure C_DBusSubtreeDispatchFunc)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DBusSubtreeDispatchFunc
-> IO (GClosure C_DBusSubtreeDispatchFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `DBusSubtreeDispatchFunc` into a `C_DBusSubtreeDispatchFunc`.
wrap_DBusSubtreeDispatchFunc :: 
    Maybe (Ptr (FunPtr C_DBusSubtreeDispatchFunc)) ->
    DBusSubtreeDispatchFunc_WithClosures ->
    C_DBusSubtreeDispatchFunc
wrap_DBusSubtreeDispatchFunc :: Maybe (Ptr (FunPtr C_DBusSubtreeDispatchFunc))
-> DBusSubtreeDispatchFunc_WithClosures
-> C_DBusSubtreeDispatchFunc
wrap_DBusSubtreeDispatchFunc Maybe (Ptr (FunPtr C_DBusSubtreeDispatchFunc))
gi'funptrptr DBusSubtreeDispatchFunc_WithClosures
gi'cb Ptr DBusConnection
connection CString
sender CString
objectPath CString
interfaceName CString
node Ptr ()
outUserData Ptr ()
userData = do
    DBusConnection
connection' <- ((ManagedPtr DBusConnection -> DBusConnection)
-> Ptr DBusConnection -> IO DBusConnection
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr DBusConnection -> DBusConnection
Gio.DBusConnection.DBusConnection) Ptr DBusConnection
connection
    Text
sender' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
sender
    Text
objectPath' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
objectPath
    Text
interfaceName' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
interfaceName
    Text
node' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
node
    Maybe DBusInterfaceVTable
result <- DBusSubtreeDispatchFunc_WithClosures
gi'cb  DBusConnection
connection' Text
sender' Text
objectPath' Text
interfaceName' Text
node' Ptr ()
outUserData Ptr ()
userData
    Maybe (Ptr (FunPtr C_DBusSubtreeDispatchFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_DBusSubtreeDispatchFunc))
gi'funptrptr
    Ptr DBusInterfaceVTable
-> Maybe DBusInterfaceVTable
-> (DBusInterfaceVTable -> IO (Ptr DBusInterfaceVTable))
-> IO (Ptr DBusInterfaceVTable)
forall (m :: * -> *) b a.
Monad m =>
b -> Maybe a -> (a -> m b) -> m b
maybeM Ptr DBusInterfaceVTable
forall a. Ptr a
FP.nullPtr Maybe DBusInterfaceVTable
result ((DBusInterfaceVTable -> IO (Ptr DBusInterfaceVTable))
 -> IO (Ptr DBusInterfaceVTable))
-> (DBusInterfaceVTable -> IO (Ptr DBusInterfaceVTable))
-> IO (Ptr DBusInterfaceVTable)
forall a b. (a -> b) -> a -> b
$ \DBusInterfaceVTable
result' -> do
        Ptr DBusInterfaceVTable
result'' <- DBusInterfaceVTable -> IO (Ptr DBusInterfaceVTable)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DBusInterfaceVTable
result'
        Ptr DBusInterfaceVTable -> IO (Ptr DBusInterfaceVTable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr DBusInterfaceVTable
result''


-- callback DBusSignalCallback
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "connection"
          , argType =
              TInterface Name { namespace = "Gio" , name = "DBusConnection" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "A #GDBusConnection."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "sender_name"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "The unique bus name of the sender of the signal,\n   or %NULL on a peer-to-peer D-Bus connection."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "object_path"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just "The object path that the signal was emitted on."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "interface_name"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The name of the interface."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "signal_name"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The name of the signal."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "parameters"
          , argType = TVariant
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just "A #GVariant tuple with parameters for the signal."
                , 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 "User data passed when subscribing to the signal."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 6
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Signature for callback function used in g_dbus_connection_signal_subscribe()."
        , sinceVersion = Just "2.26"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_DBusSignalCallback =
    Ptr Gio.DBusConnection.DBusConnection ->
    CString ->
    CString ->
    CString ->
    CString ->
    Ptr GVariant ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "connection"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "DBusConnection" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GDBusConnection."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "sender_name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "The unique bus name of the sender of the signal,\n   or %NULL on a peer-to-peer D-Bus connection."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "object_path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The object path that the signal was emitted on."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "interface_name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The name of the interface."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "signal_name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The name of the signal."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "parameters"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "A #GVariant tuple with parameters for the signal."
--                 , 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 "User data passed when subscribing to the signal."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 6
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DBusSignalCallback :: FunPtr C_DBusSignalCallback -> C_DBusSignalCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_DBusSignalCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.DBusConnection.IsDBusConnection a) =>
    FunPtr C_DBusSignalCallback
    -> a
    -- ^ /@connection@/: A t'GI.Gio.Objects.DBusConnection.DBusConnection'.
    -> Maybe (T.Text)
    -- ^ /@senderName@/: The unique bus name of the sender of the signal,
    --    or 'P.Nothing' on a peer-to-peer D-Bus connection.
    -> T.Text
    -- ^ /@objectPath@/: The object path that the signal was emitted on.
    -> T.Text
    -- ^ /@interfaceName@/: The name of the interface.
    -> T.Text
    -- ^ /@signalName@/: The name of the signal.
    -> GVariant
    -- ^ /@parameters@/: A t'GVariant' tuple with parameters for the signal.
    -> Ptr ()
    -- ^ /@userData@/: User data passed when subscribing to the signal.
    -> m ()
dynamic_DBusSignalCallback :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDBusConnection a) =>
FunPtr C_DBusSignalCallback
-> a
-> Maybe Text
-> Text
-> Text
-> Text
-> GVariant
-> Ptr ()
-> m ()
dynamic_DBusSignalCallback FunPtr C_DBusSignalCallback
__funPtr a
connection Maybe Text
senderName Text
objectPath Text
interfaceName Text
signalName GVariant
parameters Ptr ()
userData = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr DBusConnection
connection' <- a -> IO (Ptr DBusConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
    CString
maybeSenderName <- case Maybe Text
senderName of
        Maybe Text
Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just Text
jSenderName -> do
            CString
jSenderName' <- Text -> IO CString
textToCString Text
jSenderName
            CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jSenderName'
    CString
objectPath' <- Text -> IO CString
textToCString Text
objectPath
    CString
interfaceName' <- Text -> IO CString
textToCString Text
interfaceName
    CString
signalName' <- Text -> IO CString
textToCString Text
signalName
    Ptr GVariant
parameters' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
parameters
    (FunPtr C_DBusSignalCallback -> C_DBusSignalCallback
__dynamic_C_DBusSignalCallback FunPtr C_DBusSignalCallback
__funPtr) Ptr DBusConnection
connection' CString
maybeSenderName CString
objectPath' CString
interfaceName' CString
signalName' Ptr GVariant
parameters' Ptr ()
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
connection
    GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
parameters
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeSenderName
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
objectPath'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
interfaceName'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
signalName'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | Signature for callback function used in 'GI.Gio.Objects.DBusConnection.dBusConnectionSignalSubscribe'.
-- 
-- /Since: 2.26/
type DBusSignalCallback =
    Gio.DBusConnection.DBusConnection
    -- ^ /@connection@/: A t'GI.Gio.Objects.DBusConnection.DBusConnection'.
    -> Maybe T.Text
    -- ^ /@senderName@/: The unique bus name of the sender of the signal,
    --    or 'P.Nothing' on a peer-to-peer D-Bus connection.
    -> T.Text
    -- ^ /@objectPath@/: The object path that the signal was emitted on.
    -> T.Text
    -- ^ /@interfaceName@/: The name of the interface.
    -> T.Text
    -- ^ /@signalName@/: The name of the signal.
    -> GVariant
    -- ^ /@parameters@/: A t'GVariant' tuple with parameters for the signal.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `DBusSignalCallback`@.
noDBusSignalCallback :: Maybe DBusSignalCallback
noDBusSignalCallback :: Maybe DBusSignalCallback
noDBusSignalCallback = Maybe DBusSignalCallback
forall a. Maybe a
Nothing

-- | Signature for callback function used in 'GI.Gio.Objects.DBusConnection.dBusConnectionSignalSubscribe'.
-- 
-- /Since: 2.26/
type DBusSignalCallback_WithClosures =
    Gio.DBusConnection.DBusConnection
    -- ^ /@connection@/: A t'GI.Gio.Objects.DBusConnection.DBusConnection'.
    -> Maybe T.Text
    -- ^ /@senderName@/: The unique bus name of the sender of the signal,
    --    or 'P.Nothing' on a peer-to-peer D-Bus connection.
    -> T.Text
    -- ^ /@objectPath@/: The object path that the signal was emitted on.
    -> T.Text
    -- ^ /@interfaceName@/: The name of the interface.
    -> T.Text
    -- ^ /@signalName@/: The name of the signal.
    -> GVariant
    -- ^ /@parameters@/: A t'GVariant' tuple with parameters for the signal.
    -> Ptr ()
    -- ^ /@userData@/: User data passed when subscribing to the signal.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `DBusSignalCallback_WithClosures`@.
noDBusSignalCallback_WithClosures :: Maybe DBusSignalCallback_WithClosures
noDBusSignalCallback_WithClosures :: Maybe DBusSignalCallback_WithClosures
noDBusSignalCallback_WithClosures = Maybe DBusSignalCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_DBusSignalCallback :: DBusSignalCallback -> DBusSignalCallback_WithClosures
drop_closures_DBusSignalCallback :: DBusSignalCallback -> DBusSignalCallback_WithClosures
drop_closures_DBusSignalCallback DBusSignalCallback
_f DBusConnection
connection Maybe Text
senderName Text
objectPath Text
interfaceName Text
signalName GVariant
parameters Ptr ()
_ = DBusSignalCallback
_f DBusConnection
connection Maybe Text
senderName Text
objectPath Text
interfaceName Text
signalName GVariant
parameters

-- | Wrap the callback into a `GClosure`.
genClosure_DBusSignalCallback :: MonadIO m => DBusSignalCallback -> m (GClosure C_DBusSignalCallback)
genClosure_DBusSignalCallback :: forall (m :: * -> *).
MonadIO m =>
DBusSignalCallback -> m (GClosure C_DBusSignalCallback)
genClosure_DBusSignalCallback DBusSignalCallback
cb = IO (GClosure C_DBusSignalCallback)
-> m (GClosure C_DBusSignalCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DBusSignalCallback)
 -> m (GClosure C_DBusSignalCallback))
-> IO (GClosure C_DBusSignalCallback)
-> m (GClosure C_DBusSignalCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: DBusSignalCallback_WithClosures
cb' = DBusSignalCallback -> DBusSignalCallback_WithClosures
drop_closures_DBusSignalCallback DBusSignalCallback
cb
    let cb'' :: C_DBusSignalCallback
cb'' = Maybe (Ptr (FunPtr C_DBusSignalCallback))
-> DBusSignalCallback_WithClosures -> C_DBusSignalCallback
wrap_DBusSignalCallback Maybe (Ptr (FunPtr C_DBusSignalCallback))
forall a. Maybe a
Nothing DBusSignalCallback_WithClosures
cb'
    C_DBusSignalCallback -> IO (FunPtr C_DBusSignalCallback)
mk_DBusSignalCallback C_DBusSignalCallback
cb'' IO (FunPtr C_DBusSignalCallback)
-> (FunPtr C_DBusSignalCallback
    -> IO (GClosure C_DBusSignalCallback))
-> IO (GClosure C_DBusSignalCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DBusSignalCallback -> IO (GClosure C_DBusSignalCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `DBusSignalCallback` into a `C_DBusSignalCallback`.
wrap_DBusSignalCallback :: 
    Maybe (Ptr (FunPtr C_DBusSignalCallback)) ->
    DBusSignalCallback_WithClosures ->
    C_DBusSignalCallback
wrap_DBusSignalCallback :: Maybe (Ptr (FunPtr C_DBusSignalCallback))
-> DBusSignalCallback_WithClosures -> C_DBusSignalCallback
wrap_DBusSignalCallback Maybe (Ptr (FunPtr C_DBusSignalCallback))
gi'funptrptr DBusSignalCallback_WithClosures
gi'cb Ptr DBusConnection
connection CString
senderName CString
objectPath CString
interfaceName CString
signalName Ptr GVariant
parameters Ptr ()
userData = do
    DBusConnection
connection' <- ((ManagedPtr DBusConnection -> DBusConnection)
-> Ptr DBusConnection -> IO DBusConnection
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr DBusConnection -> DBusConnection
Gio.DBusConnection.DBusConnection) Ptr DBusConnection
connection
    Maybe Text
maybeSenderName <-
        if CString
senderName CString -> CString -> Bool
forall a. Eq a => a -> a -> Bool
== CString
forall a. Ptr a
nullPtr
        then Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
forall a. Maybe a
Nothing
        else do
            Text
senderName' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
senderName
            Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Text -> IO (Maybe Text)) -> Maybe Text -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ Text -> Maybe Text
forall a. a -> Maybe a
Just Text
senderName'
    Text
objectPath' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
objectPath
    Text
interfaceName' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
interfaceName
    Text
signalName' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
signalName
    GVariant
parameters' <- Ptr GVariant -> IO GVariant
B.GVariant.newGVariantFromPtr Ptr GVariant
parameters
    DBusSignalCallback_WithClosures
gi'cb  DBusConnection
connection' Maybe Text
maybeSenderName Text
objectPath' Text
interfaceName' Text
signalName' GVariant
parameters' Ptr ()
userData
    Maybe (Ptr (FunPtr C_DBusSignalCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_DBusSignalCallback))
gi'funptrptr


-- callback DBusProxyTypeFunc
{- Callable
  { returnType = Just (TBasicType TGType)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just
              "A #GType to use for the remote object. The returned type\n  must be a #GDBusProxy or #GDBusObjectProxy -derived\n  type."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "manager"
          , argType =
              TInterface
                Name { namespace = "Gio" , name = "DBusObjectManagerClient" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "A #GDBusObjectManagerClient."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "object_path"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The object path of the remote object."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "interface_name"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "The interface name of the remote object or %NULL if a #GDBusObjectProxy #GType is requested."
                , 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 "User data." , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = 3
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Function signature for a function used to determine the #GType to\nuse for an interface proxy (if @interface_name is not %NULL) or\nobject proxy (if @interface_name is %NULL).\n\nThis function is called in the\n[thread-default main loop][g-main-context-push-thread-default]\nthat @manager was constructed in."
        , sinceVersion = Just "2.30"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_DBusProxyTypeFunc =
    Ptr Gio.DBusObjectManagerClient.DBusObjectManagerClient ->
    CString ->
    CString ->
    Ptr () ->
    IO CGType

-- Args: [ Arg
--           { argCName = "manager"
--           , argType =
--               TInterface
--                 Name { namespace = "Gio" , name = "DBusObjectManagerClient" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GDBusObjectManagerClient."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "object_path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The object path of the remote object."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "interface_name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "The interface name of the remote object or %NULL if a #GDBusObjectProxy #GType is requested."
--                 , 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 "User data." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 3
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TGType)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DBusProxyTypeFunc :: FunPtr C_DBusProxyTypeFunc -> C_DBusProxyTypeFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_DBusProxyTypeFunc ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.DBusObjectManagerClient.IsDBusObjectManagerClient a) =>
    FunPtr C_DBusProxyTypeFunc
    -> a
    -- ^ /@manager@/: A t'GI.Gio.Objects.DBusObjectManagerClient.DBusObjectManagerClient'.
    -> T.Text
    -- ^ /@objectPath@/: The object path of the remote object.
    -> Maybe (T.Text)
    -- ^ /@interfaceName@/: The interface name of the remote object or 'P.Nothing' if a t'GI.Gio.Objects.DBusObjectProxy.DBusObjectProxy' t'GType' is requested.
    -> Ptr ()
    -- ^ /@userData@/: User data.
    -> m GType
    -- ^ __Returns:__ A t'GType' to use for the remote object. The returned type
    --   must be a t'GI.Gio.Objects.DBusProxy.DBusProxy' or t'GI.Gio.Objects.DBusObjectProxy.DBusObjectProxy' -derived
    --   type.
dynamic_DBusProxyTypeFunc :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDBusObjectManagerClient a) =>
FunPtr C_DBusProxyTypeFunc
-> a -> Text -> Maybe Text -> Ptr () -> m GType
dynamic_DBusProxyTypeFunc FunPtr C_DBusProxyTypeFunc
__funPtr a
manager Text
objectPath Maybe Text
interfaceName Ptr ()
userData = IO GType -> m GType
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GType -> m GType) -> IO GType -> m GType
forall a b. (a -> b) -> a -> b
$ do
    Ptr DBusObjectManagerClient
manager' <- a -> IO (Ptr DBusObjectManagerClient)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
manager
    CString
objectPath' <- Text -> IO CString
textToCString Text
objectPath
    CString
maybeInterfaceName <- case Maybe Text
interfaceName of
        Maybe Text
Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just Text
jInterfaceName -> do
            CString
jInterfaceName' <- Text -> IO CString
textToCString Text
jInterfaceName
            CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jInterfaceName'
    Word64
result <- (FunPtr C_DBusProxyTypeFunc -> C_DBusProxyTypeFunc
__dynamic_C_DBusProxyTypeFunc FunPtr C_DBusProxyTypeFunc
__funPtr) Ptr DBusObjectManagerClient
manager' CString
objectPath' CString
maybeInterfaceName Ptr ()
userData
    let result' :: GType
result' = Word64 -> GType
GType Word64
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
manager
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
objectPath'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeInterfaceName
    GType -> IO GType
forall (m :: * -> *) a. Monad m => a -> m a
return GType
result'

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

-- | Function signature for a function used to determine the t'GType' to
-- use for an interface proxy (if /@interfaceName@/ is not 'P.Nothing') or
-- object proxy (if /@interfaceName@/ is 'P.Nothing').
-- 
-- This function is called in the
-- [thread-default main loop][g-main-context-push-thread-default]
-- that /@manager@/ was constructed in.
-- 
-- /Since: 2.30/
type DBusProxyTypeFunc =
    Gio.DBusObjectManagerClient.DBusObjectManagerClient
    -- ^ /@manager@/: A t'GI.Gio.Objects.DBusObjectManagerClient.DBusObjectManagerClient'.
    -> T.Text
    -- ^ /@objectPath@/: The object path of the remote object.
    -> Maybe T.Text
    -- ^ /@interfaceName@/: The interface name of the remote object or 'P.Nothing' if a t'GI.Gio.Objects.DBusObjectProxy.DBusObjectProxy' t'GType' is requested.
    -> IO GType
    -- ^ __Returns:__ A t'GType' to use for the remote object. The returned type
    --   must be a t'GI.Gio.Objects.DBusProxy.DBusProxy' or t'GI.Gio.Objects.DBusObjectProxy.DBusObjectProxy' -derived
    --   type.

-- | A convenience synonym for @`Nothing` :: `Maybe` `DBusProxyTypeFunc`@.
noDBusProxyTypeFunc :: Maybe DBusProxyTypeFunc
noDBusProxyTypeFunc :: Maybe DBusProxyTypeFunc
noDBusProxyTypeFunc = Maybe DBusProxyTypeFunc
forall a. Maybe a
Nothing

-- | Function signature for a function used to determine the t'GType' to
-- use for an interface proxy (if /@interfaceName@/ is not 'P.Nothing') or
-- object proxy (if /@interfaceName@/ is 'P.Nothing').
-- 
-- This function is called in the
-- [thread-default main loop][g-main-context-push-thread-default]
-- that /@manager@/ was constructed in.
-- 
-- /Since: 2.30/
type DBusProxyTypeFunc_WithClosures =
    Gio.DBusObjectManagerClient.DBusObjectManagerClient
    -- ^ /@manager@/: A t'GI.Gio.Objects.DBusObjectManagerClient.DBusObjectManagerClient'.
    -> T.Text
    -- ^ /@objectPath@/: The object path of the remote object.
    -> Maybe T.Text
    -- ^ /@interfaceName@/: The interface name of the remote object or 'P.Nothing' if a t'GI.Gio.Objects.DBusObjectProxy.DBusObjectProxy' t'GType' is requested.
    -> Ptr ()
    -- ^ /@userData@/: User data.
    -> IO GType
    -- ^ __Returns:__ A t'GType' to use for the remote object. The returned type
    --   must be a t'GI.Gio.Objects.DBusProxy.DBusProxy' or t'GI.Gio.Objects.DBusObjectProxy.DBusObjectProxy' -derived
    --   type.

-- | A convenience synonym for @`Nothing` :: `Maybe` `DBusProxyTypeFunc_WithClosures`@.
noDBusProxyTypeFunc_WithClosures :: Maybe DBusProxyTypeFunc_WithClosures
noDBusProxyTypeFunc_WithClosures :: Maybe DBusProxyTypeFunc_WithClosures
noDBusProxyTypeFunc_WithClosures = Maybe DBusProxyTypeFunc_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_DBusProxyTypeFunc :: DBusProxyTypeFunc -> DBusProxyTypeFunc_WithClosures
drop_closures_DBusProxyTypeFunc :: DBusProxyTypeFunc -> DBusProxyTypeFunc_WithClosures
drop_closures_DBusProxyTypeFunc DBusProxyTypeFunc
_f DBusObjectManagerClient
manager Text
objectPath Maybe Text
interfaceName Ptr ()
_ = DBusProxyTypeFunc
_f DBusObjectManagerClient
manager Text
objectPath Maybe Text
interfaceName

-- | Wrap the callback into a `GClosure`.
genClosure_DBusProxyTypeFunc :: MonadIO m => DBusProxyTypeFunc -> m (GClosure C_DBusProxyTypeFunc)
genClosure_DBusProxyTypeFunc :: forall (m :: * -> *).
MonadIO m =>
DBusProxyTypeFunc -> m (GClosure C_DBusProxyTypeFunc)
genClosure_DBusProxyTypeFunc DBusProxyTypeFunc
cb = IO (GClosure C_DBusProxyTypeFunc)
-> m (GClosure C_DBusProxyTypeFunc)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DBusProxyTypeFunc)
 -> m (GClosure C_DBusProxyTypeFunc))
-> IO (GClosure C_DBusProxyTypeFunc)
-> m (GClosure C_DBusProxyTypeFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: DBusProxyTypeFunc_WithClosures
cb' = DBusProxyTypeFunc -> DBusProxyTypeFunc_WithClosures
drop_closures_DBusProxyTypeFunc DBusProxyTypeFunc
cb
    let cb'' :: C_DBusProxyTypeFunc
cb'' = Maybe (Ptr (FunPtr C_DBusProxyTypeFunc))
-> DBusProxyTypeFunc_WithClosures -> C_DBusProxyTypeFunc
wrap_DBusProxyTypeFunc Maybe (Ptr (FunPtr C_DBusProxyTypeFunc))
forall a. Maybe a
Nothing DBusProxyTypeFunc_WithClosures
cb'
    C_DBusProxyTypeFunc -> IO (FunPtr C_DBusProxyTypeFunc)
mk_DBusProxyTypeFunc C_DBusProxyTypeFunc
cb'' IO (FunPtr C_DBusProxyTypeFunc)
-> (FunPtr C_DBusProxyTypeFunc
    -> IO (GClosure C_DBusProxyTypeFunc))
-> IO (GClosure C_DBusProxyTypeFunc)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DBusProxyTypeFunc -> IO (GClosure C_DBusProxyTypeFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `DBusProxyTypeFunc` into a `C_DBusProxyTypeFunc`.
wrap_DBusProxyTypeFunc :: 
    Maybe (Ptr (FunPtr C_DBusProxyTypeFunc)) ->
    DBusProxyTypeFunc_WithClosures ->
    C_DBusProxyTypeFunc
wrap_DBusProxyTypeFunc :: Maybe (Ptr (FunPtr C_DBusProxyTypeFunc))
-> DBusProxyTypeFunc_WithClosures -> C_DBusProxyTypeFunc
wrap_DBusProxyTypeFunc Maybe (Ptr (FunPtr C_DBusProxyTypeFunc))
gi'funptrptr DBusProxyTypeFunc_WithClosures
gi'cb Ptr DBusObjectManagerClient
manager CString
objectPath CString
interfaceName Ptr ()
userData = do
    DBusObjectManagerClient
manager' <- ((ManagedPtr DBusObjectManagerClient -> DBusObjectManagerClient)
-> Ptr DBusObjectManagerClient -> IO DBusObjectManagerClient
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr DBusObjectManagerClient -> DBusObjectManagerClient
Gio.DBusObjectManagerClient.DBusObjectManagerClient) Ptr DBusObjectManagerClient
manager
    Text
objectPath' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
objectPath
    Maybe Text
maybeInterfaceName <-
        if CString
interfaceName CString -> CString -> Bool
forall a. Eq a => a -> a -> Bool
== CString
forall a. Ptr a
nullPtr
        then Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
forall a. Maybe a
Nothing
        else do
            Text
interfaceName' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
interfaceName
            Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Text -> IO (Maybe Text)) -> Maybe Text -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ Text -> Maybe Text
forall a. a -> Maybe a
Just Text
interfaceName'
    GType
result <- DBusProxyTypeFunc_WithClosures
gi'cb  DBusObjectManagerClient
manager' Text
objectPath' Maybe Text
maybeInterfaceName Ptr ()
userData
    Maybe (Ptr (FunPtr C_DBusProxyTypeFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_DBusProxyTypeFunc))
gi'funptrptr
    let result' :: Word64
result' = GType -> Word64
gtypeToCGType GType
result
    Word64 -> IO Word64
forall (m :: * -> *) a. Monad m => a -> m a
return Word64
result'


-- callback DBusMessageFilterFunction
{- Callable
  { returnType =
      Just (TInterface Name { namespace = "Gio" , name = "DBusMessage" })
  , returnMayBeNull = True
  , returnTransfer = TransferEverything
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just
              "A #GDBusMessage that will be freed with\ng_object_unref() or %NULL to drop the message. Passive filter\nfunctions can simply return the passed @message object."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "connection"
          , argType =
              TInterface Name { namespace = "Gio" , name = "DBusConnection" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "A #GDBusConnection."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "message"
          , argType =
              TInterface Name { namespace = "Gio" , name = "DBusMessage" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "A locked #GDBusMessage that the filter function takes ownership of."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferEverything
          }
      , Arg
          { argCName = "incoming"
          , argType = TBasicType TBoolean
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "%TRUE if it is a message received from the other peer, %FALSE if it is\na message to be sent to the other peer."
                , 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 "User data passed when adding the filter."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 3
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Signature for function used in g_dbus_connection_add_filter().\n\nA filter function is passed a #GDBusMessage and expected to return\na #GDBusMessage too. Passive filter functions that don't modify the\nmessage can simply return the @message object:\n|[\nstatic GDBusMessage *\npassive_filter (GDBusConnection *connection\n                GDBusMessage    *message,\n                gboolean         incoming,\n                gpointer         user_data)\n{\n  // inspect @message\n  return message;\n}\n]|\nFilter functions that wants to drop a message can simply return %NULL:\n|[\nstatic GDBusMessage *\ndrop_filter (GDBusConnection *connection\n             GDBusMessage    *message,\n             gboolean         incoming,\n             gpointer         user_data)\n{\n  if (should_drop_message)\n    {\n      g_object_unref (message);\n      message = NULL;\n    }\n  return message;\n}\n]|\nFinally, a filter function may modify a message by copying it:\n|[\nstatic GDBusMessage *\nmodifying_filter (GDBusConnection *connection\n                  GDBusMessage    *message,\n                  gboolean         incoming,\n                  gpointer         user_data)\n{\n  GDBusMessage *copy;\n  GError *error;\n\n  error = NULL;\n  copy = g_dbus_message_copy (message, &error);\n  // handle @error being set\n  g_object_unref (message);\n\n  // modify @copy\n\n  return copy;\n}\n]|\nIf the returned #GDBusMessage is different from @message and cannot\nbe sent on @connection (it could use features, such as file\ndescriptors, not compatible with @connection), then a warning is\nlogged to standard error. Applications can\ncheck this ahead of time using g_dbus_message_to_blob() passing a\n#GDBusCapabilityFlags value obtained from @connection."
        , sinceVersion = Just "2.26"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_DBusMessageFilterFunction =
    Ptr Gio.DBusConnection.DBusConnection ->
    Ptr Gio.DBusMessage.DBusMessage ->
    CInt ->
    Ptr () ->
    IO (Ptr Gio.DBusMessage.DBusMessage)

-- Args: [ Arg
--           { argCName = "connection"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "DBusConnection" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GDBusConnection."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "message"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "DBusMessage" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "A locked #GDBusMessage that the filter function takes ownership of."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "incoming"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "%TRUE if it is a message received from the other peer, %FALSE if it is\na message to be sent to the other peer."
--                 , 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 "User data passed when adding the filter."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 3
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gio" , name = "DBusMessage" })
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DBusMessageFilterFunction :: FunPtr C_DBusMessageFilterFunction -> C_DBusMessageFilterFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_DBusMessageFilterFunction ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.DBusConnection.IsDBusConnection a, Gio.DBusMessage.IsDBusMessage b) =>
    FunPtr C_DBusMessageFilterFunction
    -> a
    -- ^ /@connection@/: A t'GI.Gio.Objects.DBusConnection.DBusConnection'.
    -> b
    -- ^ /@message@/: A locked t'GI.Gio.Objects.DBusMessage.DBusMessage' that the filter function takes ownership of.
    -> Bool
    -- ^ /@incoming@/: 'P.True' if it is a message received from the other peer, 'P.False' if it is
    -- a message to be sent to the other peer.
    -> Ptr ()
    -- ^ /@userData@/: User data passed when adding the filter.
    -> m (Maybe Gio.DBusMessage.DBusMessage)
    -- ^ __Returns:__ A t'GI.Gio.Objects.DBusMessage.DBusMessage' that will be freed with
    -- 'GI.GObject.Objects.Object.objectUnref' or 'P.Nothing' to drop the message. Passive filter
    -- functions can simply return the passed /@message@/ object.
dynamic_DBusMessageFilterFunction :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsDBusConnection a, IsDBusMessage b) =>
FunPtr C_DBusMessageFilterFunction
-> a -> b -> Bool -> Ptr () -> m (Maybe DBusMessage)
dynamic_DBusMessageFilterFunction FunPtr C_DBusMessageFilterFunction
__funPtr a
connection b
message Bool
incoming Ptr ()
userData = IO (Maybe DBusMessage) -> m (Maybe DBusMessage)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe DBusMessage) -> m (Maybe DBusMessage))
-> IO (Maybe DBusMessage) -> m (Maybe DBusMessage)
forall a b. (a -> b) -> a -> b
$ do
    Ptr DBusConnection
connection' <- a -> IO (Ptr DBusConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
    Ptr DBusMessage
message' <- b -> IO (Ptr DBusMessage)
forall a b. (HasCallStack, GObject a) => a -> IO (Ptr b)
B.ManagedPtr.disownObject b
message
    let incoming' :: CInt
incoming' = (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
incoming
    Ptr DBusMessage
result <- (FunPtr C_DBusMessageFilterFunction -> C_DBusMessageFilterFunction
__dynamic_C_DBusMessageFilterFunction FunPtr C_DBusMessageFilterFunction
__funPtr) Ptr DBusConnection
connection' Ptr DBusMessage
message' CInt
incoming' Ptr ()
userData
    Maybe DBusMessage
maybeResult <- Ptr DBusMessage
-> (Ptr DBusMessage -> IO DBusMessage) -> IO (Maybe DBusMessage)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr DBusMessage
result ((Ptr DBusMessage -> IO DBusMessage) -> IO (Maybe DBusMessage))
-> (Ptr DBusMessage -> IO DBusMessage) -> IO (Maybe DBusMessage)
forall a b. (a -> b) -> a -> b
$ \Ptr DBusMessage
result' -> do
        DBusMessage
result'' <- ((ManagedPtr DBusMessage -> DBusMessage)
-> Ptr DBusMessage -> IO DBusMessage
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr DBusMessage -> DBusMessage
Gio.DBusMessage.DBusMessage) Ptr DBusMessage
result'
        DBusMessage -> IO DBusMessage
forall (m :: * -> *) a. Monad m => a -> m a
return DBusMessage
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
connection
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
message
    Maybe DBusMessage -> IO (Maybe DBusMessage)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe DBusMessage
maybeResult

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

-- | Signature for function used in 'GI.Gio.Objects.DBusConnection.dBusConnectionAddFilter'.
-- 
-- A filter function is passed a t'GI.Gio.Objects.DBusMessage.DBusMessage' and expected to return
-- a t'GI.Gio.Objects.DBusMessage.DBusMessage' too. Passive filter functions that don\'t modify the
-- message can simply return the /@message@/ object:
-- >
-- >static GDBusMessage *
-- >passive_filter (GDBusConnection *connection
-- >                GDBusMessage    *message,
-- >                gboolean         incoming,
-- >                gpointer         user_data)
-- >{
-- >  // inspect @message
-- >  return message;
-- >}
-- 
-- Filter functions that wants to drop a message can simply return 'P.Nothing':
-- >
-- >static GDBusMessage *
-- >drop_filter (GDBusConnection *connection
-- >             GDBusMessage    *message,
-- >             gboolean         incoming,
-- >             gpointer         user_data)
-- >{
-- >  if (should_drop_message)
-- >    {
-- >      g_object_unref (message);
-- >      message = NULL;
-- >    }
-- >  return message;
-- >}
-- 
-- Finally, a filter function may modify a message by copying it:
-- >
-- >static GDBusMessage *
-- >modifying_filter (GDBusConnection *connection
-- >                  GDBusMessage    *message,
-- >                  gboolean         incoming,
-- >                  gpointer         user_data)
-- >{
-- >  GDBusMessage *copy;
-- >  GError *error;
-- >
-- >  error = NULL;
-- >  copy = g_dbus_message_copy (message, &error);
-- >  // handle @error being set
-- >  g_object_unref (message);
-- >
-- >  // modify @copy
-- >
-- >  return copy;
-- >}
-- 
-- If the returned t'GI.Gio.Objects.DBusMessage.DBusMessage' is different from /@message@/ and cannot
-- be sent on /@connection@/ (it could use features, such as file
-- descriptors, not compatible with /@connection@/), then a warning is
-- logged to standard error. Applications can
-- check this ahead of time using 'GI.Gio.Objects.DBusMessage.dBusMessageToBlob' passing a
-- t'GI.Gio.Flags.DBusCapabilityFlags' value obtained from /@connection@/.
-- 
-- /Since: 2.26/
type DBusMessageFilterFunction =
    Gio.DBusConnection.DBusConnection
    -- ^ /@connection@/: A t'GI.Gio.Objects.DBusConnection.DBusConnection'.
    -> Gio.DBusMessage.DBusMessage
    -- ^ /@message@/: A locked t'GI.Gio.Objects.DBusMessage.DBusMessage' that the filter function takes ownership of.
    -> Bool
    -- ^ /@incoming@/: 'P.True' if it is a message received from the other peer, 'P.False' if it is
    -- a message to be sent to the other peer.
    -> IO (Maybe Gio.DBusMessage.DBusMessage)
    -- ^ __Returns:__ A t'GI.Gio.Objects.DBusMessage.DBusMessage' that will be freed with
    -- 'GI.GObject.Objects.Object.objectUnref' or 'P.Nothing' to drop the message. Passive filter
    -- functions can simply return the passed /@message@/ object.

-- | A convenience synonym for @`Nothing` :: `Maybe` `DBusMessageFilterFunction`@.
noDBusMessageFilterFunction :: Maybe DBusMessageFilterFunction
noDBusMessageFilterFunction :: Maybe DBusMessageFilterFunction
noDBusMessageFilterFunction = Maybe DBusMessageFilterFunction
forall a. Maybe a
Nothing

-- | Signature for function used in 'GI.Gio.Objects.DBusConnection.dBusConnectionAddFilter'.
-- 
-- A filter function is passed a t'GI.Gio.Objects.DBusMessage.DBusMessage' and expected to return
-- a t'GI.Gio.Objects.DBusMessage.DBusMessage' too. Passive filter functions that don\'t modify the
-- message can simply return the /@message@/ object:
-- >
-- >static GDBusMessage *
-- >passive_filter (GDBusConnection *connection
-- >                GDBusMessage    *message,
-- >                gboolean         incoming,
-- >                gpointer         user_data)
-- >{
-- >  // inspect @message
-- >  return message;
-- >}
-- 
-- Filter functions that wants to drop a message can simply return 'P.Nothing':
-- >
-- >static GDBusMessage *
-- >drop_filter (GDBusConnection *connection
-- >             GDBusMessage    *message,
-- >             gboolean         incoming,
-- >             gpointer         user_data)
-- >{
-- >  if (should_drop_message)
-- >    {
-- >      g_object_unref (message);
-- >      message = NULL;
-- >    }
-- >  return message;
-- >}
-- 
-- Finally, a filter function may modify a message by copying it:
-- >
-- >static GDBusMessage *
-- >modifying_filter (GDBusConnection *connection
-- >                  GDBusMessage    *message,
-- >                  gboolean         incoming,
-- >                  gpointer         user_data)
-- >{
-- >  GDBusMessage *copy;
-- >  GError *error;
-- >
-- >  error = NULL;
-- >  copy = g_dbus_message_copy (message, &error);
-- >  // handle @error being set
-- >  g_object_unref (message);
-- >
-- >  // modify @copy
-- >
-- >  return copy;
-- >}
-- 
-- If the returned t'GI.Gio.Objects.DBusMessage.DBusMessage' is different from /@message@/ and cannot
-- be sent on /@connection@/ (it could use features, such as file
-- descriptors, not compatible with /@connection@/), then a warning is
-- logged to standard error. Applications can
-- check this ahead of time using 'GI.Gio.Objects.DBusMessage.dBusMessageToBlob' passing a
-- t'GI.Gio.Flags.DBusCapabilityFlags' value obtained from /@connection@/.
-- 
-- /Since: 2.26/
type DBusMessageFilterFunction_WithClosures =
    Gio.DBusConnection.DBusConnection
    -- ^ /@connection@/: A t'GI.Gio.Objects.DBusConnection.DBusConnection'.
    -> Gio.DBusMessage.DBusMessage
    -- ^ /@message@/: A locked t'GI.Gio.Objects.DBusMessage.DBusMessage' that the filter function takes ownership of.
    -> Bool
    -- ^ /@incoming@/: 'P.True' if it is a message received from the other peer, 'P.False' if it is
    -- a message to be sent to the other peer.
    -> Ptr ()
    -- ^ /@userData@/: User data passed when adding the filter.
    -> IO (Maybe Gio.DBusMessage.DBusMessage)
    -- ^ __Returns:__ A t'GI.Gio.Objects.DBusMessage.DBusMessage' that will be freed with
    -- 'GI.GObject.Objects.Object.objectUnref' or 'P.Nothing' to drop the message. Passive filter
    -- functions can simply return the passed /@message@/ object.

-- | A convenience synonym for @`Nothing` :: `Maybe` `DBusMessageFilterFunction_WithClosures`@.
noDBusMessageFilterFunction_WithClosures :: Maybe DBusMessageFilterFunction_WithClosures
noDBusMessageFilterFunction_WithClosures :: Maybe DBusMessageFilterFunction_WithClosures
noDBusMessageFilterFunction_WithClosures = Maybe DBusMessageFilterFunction_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_DBusMessageFilterFunction :: DBusMessageFilterFunction -> DBusMessageFilterFunction_WithClosures
drop_closures_DBusMessageFilterFunction :: DBusMessageFilterFunction -> DBusMessageFilterFunction_WithClosures
drop_closures_DBusMessageFilterFunction DBusMessageFilterFunction
_f DBusConnection
connection DBusMessage
message Bool
incoming Ptr ()
_ = DBusMessageFilterFunction
_f DBusConnection
connection DBusMessage
message Bool
incoming

-- | Wrap the callback into a `GClosure`.
genClosure_DBusMessageFilterFunction :: MonadIO m => DBusMessageFilterFunction -> m (GClosure C_DBusMessageFilterFunction)
genClosure_DBusMessageFilterFunction :: forall (m :: * -> *).
MonadIO m =>
DBusMessageFilterFunction
-> m (GClosure C_DBusMessageFilterFunction)
genClosure_DBusMessageFilterFunction DBusMessageFilterFunction
cb = IO (GClosure C_DBusMessageFilterFunction)
-> m (GClosure C_DBusMessageFilterFunction)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DBusMessageFilterFunction)
 -> m (GClosure C_DBusMessageFilterFunction))
-> IO (GClosure C_DBusMessageFilterFunction)
-> m (GClosure C_DBusMessageFilterFunction)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: DBusMessageFilterFunction_WithClosures
cb' = DBusMessageFilterFunction -> DBusMessageFilterFunction_WithClosures
drop_closures_DBusMessageFilterFunction DBusMessageFilterFunction
cb
    let cb'' :: C_DBusMessageFilterFunction
cb'' = Maybe (Ptr (FunPtr C_DBusMessageFilterFunction))
-> DBusMessageFilterFunction_WithClosures
-> C_DBusMessageFilterFunction
wrap_DBusMessageFilterFunction Maybe (Ptr (FunPtr C_DBusMessageFilterFunction))
forall a. Maybe a
Nothing DBusMessageFilterFunction_WithClosures
cb'
    C_DBusMessageFilterFunction
-> IO (FunPtr C_DBusMessageFilterFunction)
mk_DBusMessageFilterFunction C_DBusMessageFilterFunction
cb'' IO (FunPtr C_DBusMessageFilterFunction)
-> (FunPtr C_DBusMessageFilterFunction
    -> IO (GClosure C_DBusMessageFilterFunction))
-> IO (GClosure C_DBusMessageFilterFunction)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DBusMessageFilterFunction
-> IO (GClosure C_DBusMessageFilterFunction)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `DBusMessageFilterFunction` into a `C_DBusMessageFilterFunction`.
wrap_DBusMessageFilterFunction :: 
    Maybe (Ptr (FunPtr C_DBusMessageFilterFunction)) ->
    DBusMessageFilterFunction_WithClosures ->
    C_DBusMessageFilterFunction
wrap_DBusMessageFilterFunction :: Maybe (Ptr (FunPtr C_DBusMessageFilterFunction))
-> DBusMessageFilterFunction_WithClosures
-> C_DBusMessageFilterFunction
wrap_DBusMessageFilterFunction Maybe (Ptr (FunPtr C_DBusMessageFilterFunction))
gi'funptrptr DBusMessageFilterFunction_WithClosures
gi'cb Ptr DBusConnection
connection Ptr DBusMessage
message CInt
incoming Ptr ()
userData = do
    DBusConnection
connection' <- ((ManagedPtr DBusConnection -> DBusConnection)
-> Ptr DBusConnection -> IO DBusConnection
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr DBusConnection -> DBusConnection
Gio.DBusConnection.DBusConnection) Ptr DBusConnection
connection
    DBusMessage
message' <- ((ManagedPtr DBusMessage -> DBusMessage)
-> Ptr DBusMessage -> IO DBusMessage
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr DBusMessage -> DBusMessage
Gio.DBusMessage.DBusMessage) Ptr DBusMessage
message
    let incoming' :: Bool
incoming' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
incoming
    Maybe DBusMessage
result <- DBusMessageFilterFunction_WithClosures
gi'cb  DBusConnection
connection' DBusMessage
message' Bool
incoming' Ptr ()
userData
    Maybe (Ptr (FunPtr C_DBusMessageFilterFunction)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_DBusMessageFilterFunction))
gi'funptrptr
    Ptr DBusMessage
-> Maybe DBusMessage
-> (DBusMessage -> IO (Ptr DBusMessage))
-> IO (Ptr DBusMessage)
forall (m :: * -> *) b a.
Monad m =>
b -> Maybe a -> (a -> m b) -> m b
maybeM Ptr DBusMessage
forall a. Ptr a
FP.nullPtr Maybe DBusMessage
result ((DBusMessage -> IO (Ptr DBusMessage)) -> IO (Ptr DBusMessage))
-> (DBusMessage -> IO (Ptr DBusMessage)) -> IO (Ptr DBusMessage)
forall a b. (a -> b) -> a -> b
$ \DBusMessage
result' -> do
        Ptr DBusMessage
result'' <- DBusMessage -> IO (Ptr DBusMessage)
forall a b. (HasCallStack, GObject a) => a -> IO (Ptr b)
B.ManagedPtr.disownObject DBusMessage
result'
        Ptr DBusMessage -> IO (Ptr DBusMessage)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr DBusMessage
result''


-- callback DBusInterfaceSetPropertyFunc
{- Callable
  { returnType = Just (TBasicType TBoolean)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just
              "%TRUE if the property was set to @value, %FALSE if @error is set."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "connection"
          , argType =
              TInterface Name { namespace = "Gio" , name = "DBusConnection" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "A #GDBusConnection."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "sender"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The unique bus name of the remote caller."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "object_path"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just "The object path that the method was invoked on."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "interface_name"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The D-Bus interface name for the property."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "property_name"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The name of the property to get the value of."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "value"
          , argType = TVariant
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The value to set the property to."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "error"
          , argType = TError
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "Return location for error."
                , 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 @user_data #gpointer passed to g_dbus_connection_register_object()."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 7
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "The type of the @set_property function in #GDBusInterfaceVTable."
        , sinceVersion = Just "2.26"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_DBusInterfaceSetPropertyFunc =
    Ptr Gio.DBusConnection.DBusConnection ->
    CString ->
    CString ->
    CString ->
    CString ->
    Ptr GVariant ->
    Ptr GError ->
    Ptr () ->
    IO CInt

-- Args: [ Arg
--           { argCName = "connection"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "DBusConnection" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GDBusConnection."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "sender"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The unique bus name of the remote caller."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "object_path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The object path that the method was invoked on."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "interface_name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The D-Bus interface name for the property."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "property_name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The name of the property to get the value of."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "value"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The value to set the property to."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "error"
--           , argType = TError
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Return location for error."
--                 , 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 @user_data #gpointer passed to g_dbus_connection_register_object()."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 7
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DBusInterfaceSetPropertyFunc :: FunPtr C_DBusInterfaceSetPropertyFunc -> C_DBusInterfaceSetPropertyFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_DBusInterfaceSetPropertyFunc ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.DBusConnection.IsDBusConnection a) =>
    FunPtr C_DBusInterfaceSetPropertyFunc
    -> a
    -- ^ /@connection@/: A t'GI.Gio.Objects.DBusConnection.DBusConnection'.
    -> T.Text
    -- ^ /@sender@/: The unique bus name of the remote caller.
    -> T.Text
    -- ^ /@objectPath@/: The object path that the method was invoked on.
    -> T.Text
    -- ^ /@interfaceName@/: The D-Bus interface name for the property.
    -> T.Text
    -- ^ /@propertyName@/: The name of the property to get the value of.
    -> GVariant
    -- ^ /@value@/: The value to set the property to.
    -> GError
    -- ^ /@error@/: Return location for error.
    -> Ptr ()
    -- ^ /@userData@/: The /@userData@/ @/gpointer/@ passed to @/g_dbus_connection_register_object()/@.
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the property was set to /@value@/, 'P.False' if /@error@/ is set.
dynamic_DBusInterfaceSetPropertyFunc :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDBusConnection a) =>
FunPtr C_DBusInterfaceSetPropertyFunc
-> a
-> Text
-> Text
-> Text
-> Text
-> GVariant
-> GError
-> Ptr ()
-> m Bool
dynamic_DBusInterfaceSetPropertyFunc FunPtr C_DBusInterfaceSetPropertyFunc
__funPtr a
connection Text
sender Text
objectPath Text
interfaceName Text
propertyName GVariant
value GError
error_ Ptr ()
userData = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr DBusConnection
connection' <- a -> IO (Ptr DBusConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
    CString
sender' <- Text -> IO CString
textToCString Text
sender
    CString
objectPath' <- Text -> IO CString
textToCString Text
objectPath
    CString
interfaceName' <- Text -> IO CString
textToCString Text
interfaceName
    CString
propertyName' <- Text -> IO CString
textToCString Text
propertyName
    Ptr GVariant
value' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
value
    Ptr GError
error_' <- GError -> IO (Ptr GError)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GError
error_
    CInt
result <- (FunPtr C_DBusInterfaceSetPropertyFunc
-> C_DBusInterfaceSetPropertyFunc
__dynamic_C_DBusInterfaceSetPropertyFunc FunPtr C_DBusInterfaceSetPropertyFunc
__funPtr) Ptr DBusConnection
connection' CString
sender' CString
objectPath' CString
interfaceName' CString
propertyName' Ptr GVariant
value' Ptr GError
error_' Ptr ()
userData
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
connection
    GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
value
    GError -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GError
error_
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
sender'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
objectPath'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
interfaceName'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
propertyName'
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

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

-- | The type of the /@setProperty@/ function in t'GI.Gio.Structs.DBusInterfaceVTable.DBusInterfaceVTable'.
-- 
-- /Since: 2.26/
type DBusInterfaceSetPropertyFunc =
    Gio.DBusConnection.DBusConnection
    -- ^ /@connection@/: A t'GI.Gio.Objects.DBusConnection.DBusConnection'.
    -> T.Text
    -- ^ /@sender@/: The unique bus name of the remote caller.
    -> T.Text
    -- ^ /@objectPath@/: The object path that the method was invoked on.
    -> T.Text
    -- ^ /@interfaceName@/: The D-Bus interface name for the property.
    -> T.Text
    -- ^ /@propertyName@/: The name of the property to get the value of.
    -> GVariant
    -- ^ /@value@/: The value to set the property to.
    -> GError
    -- ^ /@error@/: Return location for error.
    -> IO Bool
    -- ^ __Returns:__ 'P.True' if the property was set to /@value@/, 'P.False' if /@error@/ is set.

-- | A convenience synonym for @`Nothing` :: `Maybe` `DBusInterfaceSetPropertyFunc`@.
noDBusInterfaceSetPropertyFunc :: Maybe DBusInterfaceSetPropertyFunc
noDBusInterfaceSetPropertyFunc :: Maybe DBusInterfaceSetPropertyFunc
noDBusInterfaceSetPropertyFunc = Maybe DBusInterfaceSetPropertyFunc
forall a. Maybe a
Nothing

-- | The type of the /@setProperty@/ function in t'GI.Gio.Structs.DBusInterfaceVTable.DBusInterfaceVTable'.
-- 
-- /Since: 2.26/
type DBusInterfaceSetPropertyFunc_WithClosures =
    Gio.DBusConnection.DBusConnection
    -- ^ /@connection@/: A t'GI.Gio.Objects.DBusConnection.DBusConnection'.
    -> T.Text
    -- ^ /@sender@/: The unique bus name of the remote caller.
    -> T.Text
    -- ^ /@objectPath@/: The object path that the method was invoked on.
    -> T.Text
    -- ^ /@interfaceName@/: The D-Bus interface name for the property.
    -> T.Text
    -- ^ /@propertyName@/: The name of the property to get the value of.
    -> GVariant
    -- ^ /@value@/: The value to set the property to.
    -> GError
    -- ^ /@error@/: Return location for error.
    -> Ptr ()
    -- ^ /@userData@/: The /@userData@/ @/gpointer/@ passed to @/g_dbus_connection_register_object()/@.
    -> IO Bool
    -- ^ __Returns:__ 'P.True' if the property was set to /@value@/, 'P.False' if /@error@/ is set.

-- | A convenience synonym for @`Nothing` :: `Maybe` `DBusInterfaceSetPropertyFunc_WithClosures`@.
noDBusInterfaceSetPropertyFunc_WithClosures :: Maybe DBusInterfaceSetPropertyFunc_WithClosures
noDBusInterfaceSetPropertyFunc_WithClosures :: Maybe DBusInterfaceSetPropertyFunc_WithClosures
noDBusInterfaceSetPropertyFunc_WithClosures = Maybe DBusInterfaceSetPropertyFunc_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_DBusInterfaceSetPropertyFunc :: DBusInterfaceSetPropertyFunc -> DBusInterfaceSetPropertyFunc_WithClosures
drop_closures_DBusInterfaceSetPropertyFunc :: DBusInterfaceSetPropertyFunc
-> DBusInterfaceSetPropertyFunc_WithClosures
drop_closures_DBusInterfaceSetPropertyFunc DBusInterfaceSetPropertyFunc
_f DBusConnection
connection Text
sender Text
objectPath Text
interfaceName Text
propertyName GVariant
value GError
error_ Ptr ()
_ = DBusInterfaceSetPropertyFunc
_f DBusConnection
connection Text
sender Text
objectPath Text
interfaceName Text
propertyName GVariant
value GError
error_

-- | Wrap the callback into a `GClosure`.
genClosure_DBusInterfaceSetPropertyFunc :: MonadIO m => DBusInterfaceSetPropertyFunc -> m (GClosure C_DBusInterfaceSetPropertyFunc)
genClosure_DBusInterfaceSetPropertyFunc :: forall (m :: * -> *).
MonadIO m =>
DBusInterfaceSetPropertyFunc
-> m (GClosure C_DBusInterfaceSetPropertyFunc)
genClosure_DBusInterfaceSetPropertyFunc DBusInterfaceSetPropertyFunc
cb = IO (GClosure C_DBusInterfaceSetPropertyFunc)
-> m (GClosure C_DBusInterfaceSetPropertyFunc)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DBusInterfaceSetPropertyFunc)
 -> m (GClosure C_DBusInterfaceSetPropertyFunc))
-> IO (GClosure C_DBusInterfaceSetPropertyFunc)
-> m (GClosure C_DBusInterfaceSetPropertyFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: DBusInterfaceSetPropertyFunc_WithClosures
cb' = DBusInterfaceSetPropertyFunc
-> DBusInterfaceSetPropertyFunc_WithClosures
drop_closures_DBusInterfaceSetPropertyFunc DBusInterfaceSetPropertyFunc
cb
    let cb'' :: C_DBusInterfaceSetPropertyFunc
cb'' = Maybe (Ptr (FunPtr C_DBusInterfaceSetPropertyFunc))
-> DBusInterfaceSetPropertyFunc_WithClosures
-> C_DBusInterfaceSetPropertyFunc
wrap_DBusInterfaceSetPropertyFunc Maybe (Ptr (FunPtr C_DBusInterfaceSetPropertyFunc))
forall a. Maybe a
Nothing DBusInterfaceSetPropertyFunc_WithClosures
cb'
    C_DBusInterfaceSetPropertyFunc
-> IO (FunPtr C_DBusInterfaceSetPropertyFunc)
mk_DBusInterfaceSetPropertyFunc C_DBusInterfaceSetPropertyFunc
cb'' IO (FunPtr C_DBusInterfaceSetPropertyFunc)
-> (FunPtr C_DBusInterfaceSetPropertyFunc
    -> IO (GClosure C_DBusInterfaceSetPropertyFunc))
-> IO (GClosure C_DBusInterfaceSetPropertyFunc)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DBusInterfaceSetPropertyFunc
-> IO (GClosure C_DBusInterfaceSetPropertyFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `DBusInterfaceSetPropertyFunc` into a `C_DBusInterfaceSetPropertyFunc`.
wrap_DBusInterfaceSetPropertyFunc :: 
    Maybe (Ptr (FunPtr C_DBusInterfaceSetPropertyFunc)) ->
    DBusInterfaceSetPropertyFunc_WithClosures ->
    C_DBusInterfaceSetPropertyFunc
wrap_DBusInterfaceSetPropertyFunc :: Maybe (Ptr (FunPtr C_DBusInterfaceSetPropertyFunc))
-> DBusInterfaceSetPropertyFunc_WithClosures
-> C_DBusInterfaceSetPropertyFunc
wrap_DBusInterfaceSetPropertyFunc Maybe (Ptr (FunPtr C_DBusInterfaceSetPropertyFunc))
gi'funptrptr DBusInterfaceSetPropertyFunc_WithClosures
gi'cb Ptr DBusConnection
connection CString
sender CString
objectPath CString
interfaceName CString
propertyName Ptr GVariant
value Ptr GError
error_ Ptr ()
userData = do
    DBusConnection
connection' <- ((ManagedPtr DBusConnection -> DBusConnection)
-> Ptr DBusConnection -> IO DBusConnection
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr DBusConnection -> DBusConnection
Gio.DBusConnection.DBusConnection) Ptr DBusConnection
connection
    Text
sender' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
sender
    Text
objectPath' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
objectPath
    Text
interfaceName' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
interfaceName
    Text
propertyName' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
propertyName
    GVariant
value' <- Ptr GVariant -> IO GVariant
B.GVariant.newGVariantFromPtr Ptr GVariant
value
    GError
error_' <- ((ManagedPtr GError -> GError) -> Ptr GError -> IO GError
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr GError -> GError
GError) Ptr GError
error_
    Bool
result <- DBusInterfaceSetPropertyFunc_WithClosures
gi'cb  DBusConnection
connection' Text
sender' Text
objectPath' Text
interfaceName' Text
propertyName' GVariant
value' GError
error_' Ptr ()
userData
    Maybe (Ptr (FunPtr C_DBusInterfaceSetPropertyFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_DBusInterfaceSetPropertyFunc))
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 (m :: * -> *) a. Monad m => a -> m a
return CInt
result'


-- callback DBusInterfaceMethodCallFunc
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "connection"
          , argType =
              TInterface Name { namespace = "Gio" , name = "DBusConnection" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "A #GDBusConnection."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "sender"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The unique bus name of the remote caller."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "object_path"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just "The object path that the method was invoked on."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "interface_name"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just "The D-Bus interface name the method was invoked on."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "method_name"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The name of the method that was invoked."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "parameters"
          , argType = TVariant
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "A #GVariant tuple with parameters."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "invocation"
          , argType =
              TInterface
                Name { namespace = "Gio" , name = "DBusMethodInvocation" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "A #GDBusMethodInvocation object that must be used to return a value or error."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferEverything
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "The @user_data #gpointer passed to g_dbus_connection_register_object()."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 7
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "The type of the @method_call function in #GDBusInterfaceVTable."
        , sinceVersion = Just "2.26"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_DBusInterfaceMethodCallFunc =
    Ptr Gio.DBusConnection.DBusConnection ->
    CString ->
    CString ->
    CString ->
    CString ->
    Ptr GVariant ->
    Ptr Gio.DBusMethodInvocation.DBusMethodInvocation ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "connection"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "DBusConnection" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GDBusConnection."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "sender"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The unique bus name of the remote caller."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "object_path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The object path that the method was invoked on."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "interface_name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The D-Bus interface name the method was invoked on."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "method_name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The name of the method that was invoked."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "parameters"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GVariant tuple with parameters."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "invocation"
--           , argType =
--               TInterface
--                 Name { namespace = "Gio" , name = "DBusMethodInvocation" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "A #GDBusMethodInvocation object that must be used to return a value or error."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "The @user_data #gpointer passed to g_dbus_connection_register_object()."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 7
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DBusInterfaceMethodCallFunc :: FunPtr C_DBusInterfaceMethodCallFunc -> C_DBusInterfaceMethodCallFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_DBusInterfaceMethodCallFunc ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.DBusConnection.IsDBusConnection a, Gio.DBusMethodInvocation.IsDBusMethodInvocation b) =>
    FunPtr C_DBusInterfaceMethodCallFunc
    -> a
    -- ^ /@connection@/: A t'GI.Gio.Objects.DBusConnection.DBusConnection'.
    -> T.Text
    -- ^ /@sender@/: The unique bus name of the remote caller.
    -> T.Text
    -- ^ /@objectPath@/: The object path that the method was invoked on.
    -> T.Text
    -- ^ /@interfaceName@/: The D-Bus interface name the method was invoked on.
    -> T.Text
    -- ^ /@methodName@/: The name of the method that was invoked.
    -> GVariant
    -- ^ /@parameters@/: A t'GVariant' tuple with parameters.
    -> b
    -- ^ /@invocation@/: A t'GI.Gio.Objects.DBusMethodInvocation.DBusMethodInvocation' object that must be used to return a value or error.
    -> Ptr ()
    -- ^ /@userData@/: The /@userData@/ @/gpointer/@ passed to @/g_dbus_connection_register_object()/@.
    -> m ()
dynamic_DBusInterfaceMethodCallFunc :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsDBusConnection a,
 IsDBusMethodInvocation b) =>
FunPtr C_DBusInterfaceMethodCallFunc
-> a
-> Text
-> Text
-> Text
-> Text
-> GVariant
-> b
-> Ptr ()
-> m ()
dynamic_DBusInterfaceMethodCallFunc FunPtr C_DBusInterfaceMethodCallFunc
__funPtr a
connection Text
sender Text
objectPath Text
interfaceName Text
methodName GVariant
parameters b
invocation Ptr ()
userData = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr DBusConnection
connection' <- a -> IO (Ptr DBusConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
    CString
sender' <- Text -> IO CString
textToCString Text
sender
    CString
objectPath' <- Text -> IO CString
textToCString Text
objectPath
    CString
interfaceName' <- Text -> IO CString
textToCString Text
interfaceName
    CString
methodName' <- Text -> IO CString
textToCString Text
methodName
    Ptr GVariant
parameters' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
parameters
    Ptr DBusMethodInvocation
invocation' <- b -> IO (Ptr DBusMethodInvocation)
forall a b. (HasCallStack, GObject a) => a -> IO (Ptr b)
B.ManagedPtr.disownObject b
invocation
    (FunPtr C_DBusInterfaceMethodCallFunc
-> C_DBusInterfaceMethodCallFunc
__dynamic_C_DBusInterfaceMethodCallFunc FunPtr C_DBusInterfaceMethodCallFunc
__funPtr) Ptr DBusConnection
connection' CString
sender' CString
objectPath' CString
interfaceName' CString
methodName' Ptr GVariant
parameters' Ptr DBusMethodInvocation
invocation' Ptr ()
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
connection
    GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
parameters
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
invocation
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
sender'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
objectPath'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
interfaceName'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
methodName'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | The type of the /@methodCall@/ function in t'GI.Gio.Structs.DBusInterfaceVTable.DBusInterfaceVTable'.
-- 
-- /Since: 2.26/
type DBusInterfaceMethodCallFunc =
    Gio.DBusConnection.DBusConnection
    -- ^ /@connection@/: A t'GI.Gio.Objects.DBusConnection.DBusConnection'.
    -> T.Text
    -- ^ /@sender@/: The unique bus name of the remote caller.
    -> T.Text
    -- ^ /@objectPath@/: The object path that the method was invoked on.
    -> T.Text
    -- ^ /@interfaceName@/: The D-Bus interface name the method was invoked on.
    -> T.Text
    -- ^ /@methodName@/: The name of the method that was invoked.
    -> GVariant
    -- ^ /@parameters@/: A t'GVariant' tuple with parameters.
    -> Gio.DBusMethodInvocation.DBusMethodInvocation
    -- ^ /@invocation@/: A t'GI.Gio.Objects.DBusMethodInvocation.DBusMethodInvocation' object that must be used to return a value or error.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `DBusInterfaceMethodCallFunc`@.
noDBusInterfaceMethodCallFunc :: Maybe DBusInterfaceMethodCallFunc
noDBusInterfaceMethodCallFunc :: Maybe DBusInterfaceMethodCallFunc
noDBusInterfaceMethodCallFunc = Maybe DBusInterfaceMethodCallFunc
forall a. Maybe a
Nothing

-- | The type of the /@methodCall@/ function in t'GI.Gio.Structs.DBusInterfaceVTable.DBusInterfaceVTable'.
-- 
-- /Since: 2.26/
type DBusInterfaceMethodCallFunc_WithClosures =
    Gio.DBusConnection.DBusConnection
    -- ^ /@connection@/: A t'GI.Gio.Objects.DBusConnection.DBusConnection'.
    -> T.Text
    -- ^ /@sender@/: The unique bus name of the remote caller.
    -> T.Text
    -- ^ /@objectPath@/: The object path that the method was invoked on.
    -> T.Text
    -- ^ /@interfaceName@/: The D-Bus interface name the method was invoked on.
    -> T.Text
    -- ^ /@methodName@/: The name of the method that was invoked.
    -> GVariant
    -- ^ /@parameters@/: A t'GVariant' tuple with parameters.
    -> Gio.DBusMethodInvocation.DBusMethodInvocation
    -- ^ /@invocation@/: A t'GI.Gio.Objects.DBusMethodInvocation.DBusMethodInvocation' object that must be used to return a value or error.
    -> Ptr ()
    -- ^ /@userData@/: The /@userData@/ @/gpointer/@ passed to @/g_dbus_connection_register_object()/@.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `DBusInterfaceMethodCallFunc_WithClosures`@.
noDBusInterfaceMethodCallFunc_WithClosures :: Maybe DBusInterfaceMethodCallFunc_WithClosures
noDBusInterfaceMethodCallFunc_WithClosures :: Maybe DBusInterfaceMethodCallFunc_WithClosures
noDBusInterfaceMethodCallFunc_WithClosures = Maybe DBusInterfaceMethodCallFunc_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_DBusInterfaceMethodCallFunc :: DBusInterfaceMethodCallFunc -> DBusInterfaceMethodCallFunc_WithClosures
drop_closures_DBusInterfaceMethodCallFunc :: DBusInterfaceMethodCallFunc
-> DBusInterfaceMethodCallFunc_WithClosures
drop_closures_DBusInterfaceMethodCallFunc DBusInterfaceMethodCallFunc
_f DBusConnection
connection Text
sender Text
objectPath Text
interfaceName Text
methodName GVariant
parameters DBusMethodInvocation
invocation Ptr ()
_ = DBusInterfaceMethodCallFunc
_f DBusConnection
connection Text
sender Text
objectPath Text
interfaceName Text
methodName GVariant
parameters DBusMethodInvocation
invocation

-- | Wrap the callback into a `GClosure`.
genClosure_DBusInterfaceMethodCallFunc :: MonadIO m => DBusInterfaceMethodCallFunc -> m (GClosure C_DBusInterfaceMethodCallFunc)
genClosure_DBusInterfaceMethodCallFunc :: forall (m :: * -> *).
MonadIO m =>
DBusInterfaceMethodCallFunc
-> m (GClosure C_DBusInterfaceMethodCallFunc)
genClosure_DBusInterfaceMethodCallFunc DBusInterfaceMethodCallFunc
cb = IO (GClosure C_DBusInterfaceMethodCallFunc)
-> m (GClosure C_DBusInterfaceMethodCallFunc)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DBusInterfaceMethodCallFunc)
 -> m (GClosure C_DBusInterfaceMethodCallFunc))
-> IO (GClosure C_DBusInterfaceMethodCallFunc)
-> m (GClosure C_DBusInterfaceMethodCallFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: DBusInterfaceMethodCallFunc_WithClosures
cb' = DBusInterfaceMethodCallFunc
-> DBusInterfaceMethodCallFunc_WithClosures
drop_closures_DBusInterfaceMethodCallFunc DBusInterfaceMethodCallFunc
cb
    let cb'' :: C_DBusInterfaceMethodCallFunc
cb'' = Maybe (Ptr (FunPtr C_DBusInterfaceMethodCallFunc))
-> DBusInterfaceMethodCallFunc_WithClosures
-> C_DBusInterfaceMethodCallFunc
wrap_DBusInterfaceMethodCallFunc Maybe (Ptr (FunPtr C_DBusInterfaceMethodCallFunc))
forall a. Maybe a
Nothing DBusInterfaceMethodCallFunc_WithClosures
cb'
    C_DBusInterfaceMethodCallFunc
-> IO (FunPtr C_DBusInterfaceMethodCallFunc)
mk_DBusInterfaceMethodCallFunc C_DBusInterfaceMethodCallFunc
cb'' IO (FunPtr C_DBusInterfaceMethodCallFunc)
-> (FunPtr C_DBusInterfaceMethodCallFunc
    -> IO (GClosure C_DBusInterfaceMethodCallFunc))
-> IO (GClosure C_DBusInterfaceMethodCallFunc)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DBusInterfaceMethodCallFunc
-> IO (GClosure C_DBusInterfaceMethodCallFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `DBusInterfaceMethodCallFunc` into a `C_DBusInterfaceMethodCallFunc`.
wrap_DBusInterfaceMethodCallFunc :: 
    Maybe (Ptr (FunPtr C_DBusInterfaceMethodCallFunc)) ->
    DBusInterfaceMethodCallFunc_WithClosures ->
    C_DBusInterfaceMethodCallFunc
wrap_DBusInterfaceMethodCallFunc :: Maybe (Ptr (FunPtr C_DBusInterfaceMethodCallFunc))
-> DBusInterfaceMethodCallFunc_WithClosures
-> C_DBusInterfaceMethodCallFunc
wrap_DBusInterfaceMethodCallFunc Maybe (Ptr (FunPtr C_DBusInterfaceMethodCallFunc))
gi'funptrptr DBusInterfaceMethodCallFunc_WithClosures
gi'cb Ptr DBusConnection
connection CString
sender CString
objectPath CString
interfaceName CString
methodName Ptr GVariant
parameters Ptr DBusMethodInvocation
invocation Ptr ()
userData = do
    DBusConnection
connection' <- ((ManagedPtr DBusConnection -> DBusConnection)
-> Ptr DBusConnection -> IO DBusConnection
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr DBusConnection -> DBusConnection
Gio.DBusConnection.DBusConnection) Ptr DBusConnection
connection
    Text
sender' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
sender
    Text
objectPath' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
objectPath
    Text
interfaceName' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
interfaceName
    Text
methodName' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
methodName
    GVariant
parameters' <- Ptr GVariant -> IO GVariant
B.GVariant.newGVariantFromPtr Ptr GVariant
parameters
    DBusMethodInvocation
invocation' <- ((ManagedPtr DBusMethodInvocation -> DBusMethodInvocation)
-> Ptr DBusMethodInvocation -> IO DBusMethodInvocation
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr DBusMethodInvocation -> DBusMethodInvocation
Gio.DBusMethodInvocation.DBusMethodInvocation) Ptr DBusMethodInvocation
invocation
    DBusInterfaceMethodCallFunc_WithClosures
gi'cb  DBusConnection
connection' Text
sender' Text
objectPath' Text
interfaceName' Text
methodName' GVariant
parameters' DBusMethodInvocation
invocation' Ptr ()
userData
    Maybe (Ptr (FunPtr C_DBusInterfaceMethodCallFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_DBusInterfaceMethodCallFunc))
gi'funptrptr


-- callback DBusInterfaceGetPropertyFunc
{- Callable
  { returnType = Just TVariant
  , returnMayBeNull = False
  , returnTransfer = TransferEverything
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just
              "A #GVariant with the value for @property_name or %NULL if\n    @error is set. If the returned #GVariant is floating, it is\n    consumed - otherwise its reference count is decreased by one."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "connection"
          , argType =
              TInterface Name { namespace = "Gio" , name = "DBusConnection" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "A #GDBusConnection."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "sender"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The unique bus name of the remote caller."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "object_path"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just "The object path that the method was invoked on."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "interface_name"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The D-Bus interface name for the property."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "property_name"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The name of the property to get the value of."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "error"
          , argType = TError
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "Return location for error."
                , 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 @user_data #gpointer passed to g_dbus_connection_register_object()."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 6
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "The type of the @get_property function in #GDBusInterfaceVTable."
        , sinceVersion = Just "2.26"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_DBusInterfaceGetPropertyFunc =
    Ptr Gio.DBusConnection.DBusConnection ->
    CString ->
    CString ->
    CString ->
    CString ->
    Ptr GError ->
    Ptr () ->
    IO (Ptr GVariant)

-- Args: [ Arg
--           { argCName = "connection"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "DBusConnection" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GDBusConnection."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "sender"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The unique bus name of the remote caller."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "object_path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The object path that the method was invoked on."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "interface_name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The D-Bus interface name for the property."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "property_name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The name of the property to get the value of."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "error"
--           , argType = TError
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Return location for error."
--                 , 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 @user_data #gpointer passed to g_dbus_connection_register_object()."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 6
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just TVariant
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DBusInterfaceGetPropertyFunc :: FunPtr C_DBusInterfaceGetPropertyFunc -> C_DBusInterfaceGetPropertyFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_DBusInterfaceGetPropertyFunc ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.DBusConnection.IsDBusConnection a) =>
    FunPtr C_DBusInterfaceGetPropertyFunc
    -> a
    -- ^ /@connection@/: A t'GI.Gio.Objects.DBusConnection.DBusConnection'.
    -> T.Text
    -- ^ /@sender@/: The unique bus name of the remote caller.
    -> T.Text
    -- ^ /@objectPath@/: The object path that the method was invoked on.
    -> T.Text
    -- ^ /@interfaceName@/: The D-Bus interface name for the property.
    -> T.Text
    -- ^ /@propertyName@/: The name of the property to get the value of.
    -> GError
    -- ^ /@error@/: Return location for error.
    -> Ptr ()
    -- ^ /@userData@/: The /@userData@/ @/gpointer/@ passed to @/g_dbus_connection_register_object()/@.
    -> m GVariant
    -- ^ __Returns:__ A t'GVariant' with the value for /@propertyName@/ or 'P.Nothing' if
    --     /@error@/ is set. If the returned t'GVariant' is floating, it is
    --     consumed - otherwise its reference count is decreased by one.
dynamic_DBusInterfaceGetPropertyFunc :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDBusConnection a) =>
FunPtr C_DBusInterfaceGetPropertyFunc
-> a
-> Text
-> Text
-> Text
-> Text
-> GError
-> Ptr ()
-> m GVariant
dynamic_DBusInterfaceGetPropertyFunc FunPtr C_DBusInterfaceGetPropertyFunc
__funPtr a
connection Text
sender Text
objectPath Text
interfaceName Text
propertyName GError
error_ Ptr ()
userData = IO GVariant -> m GVariant
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GVariant -> m GVariant) -> IO GVariant -> m GVariant
forall a b. (a -> b) -> a -> b
$ do
    Ptr DBusConnection
connection' <- a -> IO (Ptr DBusConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
    CString
sender' <- Text -> IO CString
textToCString Text
sender
    CString
objectPath' <- Text -> IO CString
textToCString Text
objectPath
    CString
interfaceName' <- Text -> IO CString
textToCString Text
interfaceName
    CString
propertyName' <- Text -> IO CString
textToCString Text
propertyName
    Ptr GError
error_' <- GError -> IO (Ptr GError)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GError
error_
    Ptr GVariant
result <- (FunPtr C_DBusInterfaceGetPropertyFunc
-> C_DBusInterfaceGetPropertyFunc
__dynamic_C_DBusInterfaceGetPropertyFunc FunPtr C_DBusInterfaceGetPropertyFunc
__funPtr) Ptr DBusConnection
connection' CString
sender' CString
objectPath' CString
interfaceName' CString
propertyName' Ptr GError
error_' Ptr ()
userData
    Text -> Ptr GVariant -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"dBusInterfaceGetPropertyFunc" Ptr GVariant
result
    GVariant
result' <- Ptr GVariant -> IO GVariant
B.GVariant.wrapGVariantPtr Ptr GVariant
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
connection
    GError -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GError
error_
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
sender'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
objectPath'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
interfaceName'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
propertyName'
    GVariant -> IO GVariant
forall (m :: * -> *) a. Monad m => a -> m a
return GVariant
result'

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

-- | The type of the /@getProperty@/ function in t'GI.Gio.Structs.DBusInterfaceVTable.DBusInterfaceVTable'.
-- 
-- /Since: 2.26/
type DBusInterfaceGetPropertyFunc =
    Gio.DBusConnection.DBusConnection
    -- ^ /@connection@/: A t'GI.Gio.Objects.DBusConnection.DBusConnection'.
    -> T.Text
    -- ^ /@sender@/: The unique bus name of the remote caller.
    -> T.Text
    -- ^ /@objectPath@/: The object path that the method was invoked on.
    -> T.Text
    -- ^ /@interfaceName@/: The D-Bus interface name for the property.
    -> T.Text
    -- ^ /@propertyName@/: The name of the property to get the value of.
    -> GError
    -- ^ /@error@/: Return location for error.
    -> IO GVariant
    -- ^ __Returns:__ A t'GVariant' with the value for /@propertyName@/ or 'P.Nothing' if
    --     /@error@/ is set. If the returned t'GVariant' is floating, it is
    --     consumed - otherwise its reference count is decreased by one.

-- | A convenience synonym for @`Nothing` :: `Maybe` `DBusInterfaceGetPropertyFunc`@.
noDBusInterfaceGetPropertyFunc :: Maybe DBusInterfaceGetPropertyFunc
noDBusInterfaceGetPropertyFunc :: Maybe DBusInterfaceGetPropertyFunc
noDBusInterfaceGetPropertyFunc = Maybe DBusInterfaceGetPropertyFunc
forall a. Maybe a
Nothing

-- | The type of the /@getProperty@/ function in t'GI.Gio.Structs.DBusInterfaceVTable.DBusInterfaceVTable'.
-- 
-- /Since: 2.26/
type DBusInterfaceGetPropertyFunc_WithClosures =
    Gio.DBusConnection.DBusConnection
    -- ^ /@connection@/: A t'GI.Gio.Objects.DBusConnection.DBusConnection'.
    -> T.Text
    -- ^ /@sender@/: The unique bus name of the remote caller.
    -> T.Text
    -- ^ /@objectPath@/: The object path that the method was invoked on.
    -> T.Text
    -- ^ /@interfaceName@/: The D-Bus interface name for the property.
    -> T.Text
    -- ^ /@propertyName@/: The name of the property to get the value of.
    -> GError
    -- ^ /@error@/: Return location for error.
    -> Ptr ()
    -- ^ /@userData@/: The /@userData@/ @/gpointer/@ passed to @/g_dbus_connection_register_object()/@.
    -> IO GVariant
    -- ^ __Returns:__ A t'GVariant' with the value for /@propertyName@/ or 'P.Nothing' if
    --     /@error@/ is set. If the returned t'GVariant' is floating, it is
    --     consumed - otherwise its reference count is decreased by one.

-- | A convenience synonym for @`Nothing` :: `Maybe` `DBusInterfaceGetPropertyFunc_WithClosures`@.
noDBusInterfaceGetPropertyFunc_WithClosures :: Maybe DBusInterfaceGetPropertyFunc_WithClosures
noDBusInterfaceGetPropertyFunc_WithClosures :: Maybe DBusInterfaceGetPropertyFunc_WithClosures
noDBusInterfaceGetPropertyFunc_WithClosures = Maybe DBusInterfaceGetPropertyFunc_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_DBusInterfaceGetPropertyFunc :: DBusInterfaceGetPropertyFunc -> DBusInterfaceGetPropertyFunc_WithClosures
drop_closures_DBusInterfaceGetPropertyFunc :: DBusInterfaceGetPropertyFunc
-> DBusInterfaceGetPropertyFunc_WithClosures
drop_closures_DBusInterfaceGetPropertyFunc DBusInterfaceGetPropertyFunc
_f DBusConnection
connection Text
sender Text
objectPath Text
interfaceName Text
propertyName GError
error_ Ptr ()
_ = DBusInterfaceGetPropertyFunc
_f DBusConnection
connection Text
sender Text
objectPath Text
interfaceName Text
propertyName GError
error_

-- | Wrap the callback into a `GClosure`.
genClosure_DBusInterfaceGetPropertyFunc :: MonadIO m => DBusInterfaceGetPropertyFunc -> m (GClosure C_DBusInterfaceGetPropertyFunc)
genClosure_DBusInterfaceGetPropertyFunc :: forall (m :: * -> *).
MonadIO m =>
DBusInterfaceGetPropertyFunc
-> m (GClosure C_DBusInterfaceGetPropertyFunc)
genClosure_DBusInterfaceGetPropertyFunc DBusInterfaceGetPropertyFunc
cb = IO (GClosure C_DBusInterfaceGetPropertyFunc)
-> m (GClosure C_DBusInterfaceGetPropertyFunc)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DBusInterfaceGetPropertyFunc)
 -> m (GClosure C_DBusInterfaceGetPropertyFunc))
-> IO (GClosure C_DBusInterfaceGetPropertyFunc)
-> m (GClosure C_DBusInterfaceGetPropertyFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: DBusInterfaceGetPropertyFunc_WithClosures
cb' = DBusInterfaceGetPropertyFunc
-> DBusInterfaceGetPropertyFunc_WithClosures
drop_closures_DBusInterfaceGetPropertyFunc DBusInterfaceGetPropertyFunc
cb
    let cb'' :: C_DBusInterfaceGetPropertyFunc
cb'' = Maybe (Ptr (FunPtr C_DBusInterfaceGetPropertyFunc))
-> DBusInterfaceGetPropertyFunc_WithClosures
-> C_DBusInterfaceGetPropertyFunc
wrap_DBusInterfaceGetPropertyFunc Maybe (Ptr (FunPtr C_DBusInterfaceGetPropertyFunc))
forall a. Maybe a
Nothing DBusInterfaceGetPropertyFunc_WithClosures
cb'
    C_DBusInterfaceGetPropertyFunc
-> IO (FunPtr C_DBusInterfaceGetPropertyFunc)
mk_DBusInterfaceGetPropertyFunc C_DBusInterfaceGetPropertyFunc
cb'' IO (FunPtr C_DBusInterfaceGetPropertyFunc)
-> (FunPtr C_DBusInterfaceGetPropertyFunc
    -> IO (GClosure C_DBusInterfaceGetPropertyFunc))
-> IO (GClosure C_DBusInterfaceGetPropertyFunc)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DBusInterfaceGetPropertyFunc
-> IO (GClosure C_DBusInterfaceGetPropertyFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `DBusInterfaceGetPropertyFunc` into a `C_DBusInterfaceGetPropertyFunc`.
wrap_DBusInterfaceGetPropertyFunc :: 
    Maybe (Ptr (FunPtr C_DBusInterfaceGetPropertyFunc)) ->
    DBusInterfaceGetPropertyFunc_WithClosures ->
    C_DBusInterfaceGetPropertyFunc
wrap_DBusInterfaceGetPropertyFunc :: Maybe (Ptr (FunPtr C_DBusInterfaceGetPropertyFunc))
-> DBusInterfaceGetPropertyFunc_WithClosures
-> C_DBusInterfaceGetPropertyFunc
wrap_DBusInterfaceGetPropertyFunc Maybe (Ptr (FunPtr C_DBusInterfaceGetPropertyFunc))
gi'funptrptr DBusInterfaceGetPropertyFunc_WithClosures
gi'cb Ptr DBusConnection
connection CString
sender CString
objectPath CString
interfaceName CString
propertyName Ptr GError
error_ Ptr ()
userData = do
    DBusConnection
connection' <- ((ManagedPtr DBusConnection -> DBusConnection)
-> Ptr DBusConnection -> IO DBusConnection
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr DBusConnection -> DBusConnection
Gio.DBusConnection.DBusConnection) Ptr DBusConnection
connection
    Text
sender' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
sender
    Text
objectPath' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
objectPath
    Text
interfaceName' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
interfaceName
    Text
propertyName' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
propertyName
    GError
error_' <- ((ManagedPtr GError -> GError) -> Ptr GError -> IO GError
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr GError -> GError
GError) Ptr GError
error_
    GVariant
result <- DBusInterfaceGetPropertyFunc_WithClosures
gi'cb  DBusConnection
connection' Text
sender' Text
objectPath' Text
interfaceName' Text
propertyName' GError
error_' Ptr ()
userData
    Maybe (Ptr (FunPtr C_DBusInterfaceGetPropertyFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_DBusInterfaceGetPropertyFunc))
gi'funptrptr
    Ptr GVariant
result' <- GVariant -> IO (Ptr GVariant)
B.GVariant.disownGVariant GVariant
result
    Ptr GVariant -> IO (Ptr GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GVariant
result'


-- callback CancellableSourceFunc
{- Callable
  { returnType = Just (TBasicType TBoolean)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just "it should return %FALSE if the source should be removed."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "cancellable"
          , argType =
              TInterface Name { namespace = "Gio" , name = "Cancellable" }
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "the #GCancellable" , 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 "data passed in by the user."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "This is the function type of the callback used for the #GSource\nreturned by g_cancellable_source_new()."
        , sinceVersion = Just "2.28"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_CancellableSourceFunc =
    Ptr Gio.Cancellable.Cancellable ->
    Ptr () ->
    IO CInt

-- Args: [ Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #GCancellable" , 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 "data passed in by the user."
--                 , 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_CancellableSourceFunc :: FunPtr C_CancellableSourceFunc -> C_CancellableSourceFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_CancellableSourceFunc ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
    FunPtr C_CancellableSourceFunc
    -> Maybe (a)
    -- ^ /@cancellable@/: the t'GI.Gio.Objects.Cancellable.Cancellable'
    -> Ptr ()
    -- ^ /@userData@/: data passed in by the user.
    -> m Bool
    -- ^ __Returns:__ it should return 'P.False' if the source should be removed.
dynamic_CancellableSourceFunc :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCancellable a) =>
FunPtr C_CancellableSourceFunc -> Maybe a -> Ptr () -> m Bool
dynamic_CancellableSourceFunc FunPtr C_CancellableSourceFunc
__funPtr Maybe a
cancellable Ptr ()
userData = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr Cancellable
maybeCancellable <- case Maybe a
cancellable of
        Maybe a
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just a
jCancellable -> do
            Ptr Cancellable
jCancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    CInt
result <- (FunPtr C_CancellableSourceFunc -> C_CancellableSourceFunc
__dynamic_C_CancellableSourceFunc FunPtr C_CancellableSourceFunc
__funPtr) Ptr Cancellable
maybeCancellable Ptr ()
userData
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Maybe a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
cancellable a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

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

-- | This is the function type of the callback used for the t'GI.GLib.Structs.Source.Source'
-- returned by 'GI.Gio.Objects.Cancellable.cancellableSourceNew'.
-- 
-- /Since: 2.28/
type CancellableSourceFunc =
    Maybe Gio.Cancellable.Cancellable
    -- ^ /@cancellable@/: the t'GI.Gio.Objects.Cancellable.Cancellable'
    -> IO Bool
    -- ^ __Returns:__ it should return 'P.False' if the source should be removed.

-- | A convenience synonym for @`Nothing` :: `Maybe` `CancellableSourceFunc`@.
noCancellableSourceFunc :: Maybe CancellableSourceFunc
noCancellableSourceFunc :: Maybe CancellableSourceFunc
noCancellableSourceFunc = Maybe CancellableSourceFunc
forall a. Maybe a
Nothing

-- | This is the function type of the callback used for the t'GI.GLib.Structs.Source.Source'
-- returned by 'GI.Gio.Objects.Cancellable.cancellableSourceNew'.
-- 
-- /Since: 2.28/
type CancellableSourceFunc_WithClosures =
    Maybe Gio.Cancellable.Cancellable
    -- ^ /@cancellable@/: the t'GI.Gio.Objects.Cancellable.Cancellable'
    -> Ptr ()
    -- ^ /@userData@/: data passed in by the user.
    -> IO Bool
    -- ^ __Returns:__ it should return 'P.False' if the source should be removed.

-- | A convenience synonym for @`Nothing` :: `Maybe` `CancellableSourceFunc_WithClosures`@.
noCancellableSourceFunc_WithClosures :: Maybe CancellableSourceFunc_WithClosures
noCancellableSourceFunc_WithClosures :: Maybe CancellableSourceFunc_WithClosures
noCancellableSourceFunc_WithClosures = Maybe CancellableSourceFunc_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_CancellableSourceFunc :: CancellableSourceFunc -> CancellableSourceFunc_WithClosures
drop_closures_CancellableSourceFunc :: CancellableSourceFunc -> CancellableSourceFunc_WithClosures
drop_closures_CancellableSourceFunc CancellableSourceFunc
_f Maybe Cancellable
cancellable Ptr ()
_ = CancellableSourceFunc
_f Maybe Cancellable
cancellable

-- | Wrap the callback into a `GClosure`.
genClosure_CancellableSourceFunc :: MonadIO m => CancellableSourceFunc -> m (GClosure C_CancellableSourceFunc)
genClosure_CancellableSourceFunc :: forall (m :: * -> *).
MonadIO m =>
CancellableSourceFunc -> m (GClosure C_CancellableSourceFunc)
genClosure_CancellableSourceFunc CancellableSourceFunc
cb = IO (GClosure C_CancellableSourceFunc)
-> m (GClosure C_CancellableSourceFunc)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_CancellableSourceFunc)
 -> m (GClosure C_CancellableSourceFunc))
-> IO (GClosure C_CancellableSourceFunc)
-> m (GClosure C_CancellableSourceFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: CancellableSourceFunc_WithClosures
cb' = CancellableSourceFunc -> CancellableSourceFunc_WithClosures
drop_closures_CancellableSourceFunc CancellableSourceFunc
cb
    let cb'' :: C_CancellableSourceFunc
cb'' = Maybe (Ptr (FunPtr C_CancellableSourceFunc))
-> CancellableSourceFunc_WithClosures -> C_CancellableSourceFunc
wrap_CancellableSourceFunc Maybe (Ptr (FunPtr C_CancellableSourceFunc))
forall a. Maybe a
Nothing CancellableSourceFunc_WithClosures
cb'
    C_CancellableSourceFunc -> IO (FunPtr C_CancellableSourceFunc)
mk_CancellableSourceFunc C_CancellableSourceFunc
cb'' IO (FunPtr C_CancellableSourceFunc)
-> (FunPtr C_CancellableSourceFunc
    -> IO (GClosure C_CancellableSourceFunc))
-> IO (GClosure C_CancellableSourceFunc)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_CancellableSourceFunc
-> IO (GClosure C_CancellableSourceFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `CancellableSourceFunc` into a `C_CancellableSourceFunc`.
wrap_CancellableSourceFunc :: 
    Maybe (Ptr (FunPtr C_CancellableSourceFunc)) ->
    CancellableSourceFunc_WithClosures ->
    C_CancellableSourceFunc
wrap_CancellableSourceFunc :: Maybe (Ptr (FunPtr C_CancellableSourceFunc))
-> CancellableSourceFunc_WithClosures -> C_CancellableSourceFunc
wrap_CancellableSourceFunc Maybe (Ptr (FunPtr C_CancellableSourceFunc))
gi'funptrptr CancellableSourceFunc_WithClosures
gi'cb Ptr Cancellable
cancellable Ptr ()
userData = do
    Maybe Cancellable
maybeCancellable <-
        if Ptr Cancellable
cancellable Ptr Cancellable -> Ptr Cancellable -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr Cancellable
forall a. Ptr a
nullPtr
        then Maybe Cancellable -> IO (Maybe Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Cancellable
forall a. Maybe a
Nothing
        else do
            Cancellable
cancellable' <- ((ManagedPtr Cancellable -> Cancellable)
-> Ptr Cancellable -> IO Cancellable
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Cancellable -> Cancellable
Gio.Cancellable.Cancellable) Ptr Cancellable
cancellable
            Maybe Cancellable -> IO (Maybe Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Cancellable -> IO (Maybe Cancellable))
-> Maybe Cancellable -> IO (Maybe Cancellable)
forall a b. (a -> b) -> a -> b
$ Cancellable -> Maybe Cancellable
forall a. a -> Maybe a
Just Cancellable
cancellable'
    Bool
result <- CancellableSourceFunc_WithClosures
gi'cb  Maybe Cancellable
maybeCancellable Ptr ()
userData
    Maybe (Ptr (FunPtr C_CancellableSourceFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_CancellableSourceFunc))
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 (m :: * -> *) a. Monad m => a -> m a
return CInt
result'


-- callback BusNameVanishedCallback
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "connection"
          , argType =
              TInterface Name { namespace = "Gio" , name = "DBusConnection" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "The #GDBusConnection the name is being watched on, or\n    %NULL."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "name"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The name being watched."
                , 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 "User data passed to g_bus_watch_name()."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Invoked when the name being watched is known not to have to have an owner.\n\nThis is also invoked when the #GDBusConnection on which the watch was\nestablished has been closed.  In that case, @connection will be\n%NULL."
        , sinceVersion = Just "2.26"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_BusNameVanishedCallback =
    Ptr Gio.DBusConnection.DBusConnection ->
    CString ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "connection"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "DBusConnection" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "The #GDBusConnection the name is being watched on, or\n    %NULL."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The name being watched."
--                 , 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 "User data passed to g_bus_watch_name()."
--                 , 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_BusNameVanishedCallback :: FunPtr C_BusNameVanishedCallback -> C_BusNameVanishedCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_BusNameVanishedCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.DBusConnection.IsDBusConnection a) =>
    FunPtr C_BusNameVanishedCallback
    -> a
    -- ^ /@connection@/: The t'GI.Gio.Objects.DBusConnection.DBusConnection' the name is being watched on, or
    --     'P.Nothing'.
    -> T.Text
    -- ^ /@name@/: The name being watched.
    -> Ptr ()
    -- ^ /@userData@/: User data passed to @/g_bus_watch_name()/@.
    -> m ()
dynamic_BusNameVanishedCallback :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDBusConnection a) =>
FunPtr C_BusNameVanishedCallback -> a -> Text -> Ptr () -> m ()
dynamic_BusNameVanishedCallback FunPtr C_BusNameVanishedCallback
__funPtr a
connection Text
name Ptr ()
userData = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr DBusConnection
connection' <- a -> IO (Ptr DBusConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
    CString
name' <- Text -> IO CString
textToCString Text
name
    (FunPtr C_BusNameVanishedCallback -> C_BusNameVanishedCallback
__dynamic_C_BusNameVanishedCallback FunPtr C_BusNameVanishedCallback
__funPtr) Ptr DBusConnection
connection' CString
name' Ptr ()
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
connection
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | Invoked when the name being watched is known not to have to have an owner.
-- 
-- This is also invoked when the t'GI.Gio.Objects.DBusConnection.DBusConnection' on which the watch was
-- established has been closed.  In that case, /@connection@/ will be
-- 'P.Nothing'.
-- 
-- /Since: 2.26/
type BusNameVanishedCallback =
    Gio.DBusConnection.DBusConnection
    -- ^ /@connection@/: The t'GI.Gio.Objects.DBusConnection.DBusConnection' the name is being watched on, or
    --     'P.Nothing'.
    -> T.Text
    -- ^ /@name@/: The name being watched.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `BusNameVanishedCallback`@.
noBusNameVanishedCallback :: Maybe BusNameVanishedCallback
noBusNameVanishedCallback :: Maybe BusNameVanishedCallback
noBusNameVanishedCallback = Maybe BusNameVanishedCallback
forall a. Maybe a
Nothing

-- | Invoked when the name being watched is known not to have to have an owner.
-- 
-- This is also invoked when the t'GI.Gio.Objects.DBusConnection.DBusConnection' on which the watch was
-- established has been closed.  In that case, /@connection@/ will be
-- 'P.Nothing'.
-- 
-- /Since: 2.26/
type BusNameVanishedCallback_WithClosures =
    Gio.DBusConnection.DBusConnection
    -- ^ /@connection@/: The t'GI.Gio.Objects.DBusConnection.DBusConnection' the name is being watched on, or
    --     'P.Nothing'.
    -> T.Text
    -- ^ /@name@/: The name being watched.
    -> Ptr ()
    -- ^ /@userData@/: User data passed to @/g_bus_watch_name()/@.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `BusNameVanishedCallback_WithClosures`@.
noBusNameVanishedCallback_WithClosures :: Maybe BusNameVanishedCallback_WithClosures
noBusNameVanishedCallback_WithClosures :: Maybe BusNameVanishedCallback_WithClosures
noBusNameVanishedCallback_WithClosures = Maybe BusNameVanishedCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_BusNameVanishedCallback :: BusNameVanishedCallback -> BusNameVanishedCallback_WithClosures
drop_closures_BusNameVanishedCallback :: BusNameVanishedCallback -> BusNameVanishedCallback_WithClosures
drop_closures_BusNameVanishedCallback BusNameVanishedCallback
_f DBusConnection
connection Text
name Ptr ()
_ = BusNameVanishedCallback
_f DBusConnection
connection Text
name

-- | Wrap the callback into a `GClosure`.
genClosure_BusNameVanishedCallback :: MonadIO m => BusNameVanishedCallback -> m (GClosure C_BusNameVanishedCallback)
genClosure_BusNameVanishedCallback :: forall (m :: * -> *).
MonadIO m =>
BusNameVanishedCallback -> m (GClosure C_BusNameVanishedCallback)
genClosure_BusNameVanishedCallback BusNameVanishedCallback
cb = IO (GClosure C_BusNameVanishedCallback)
-> m (GClosure C_BusNameVanishedCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_BusNameVanishedCallback)
 -> m (GClosure C_BusNameVanishedCallback))
-> IO (GClosure C_BusNameVanishedCallback)
-> m (GClosure C_BusNameVanishedCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: BusNameVanishedCallback_WithClosures
cb' = BusNameVanishedCallback -> BusNameVanishedCallback_WithClosures
drop_closures_BusNameVanishedCallback BusNameVanishedCallback
cb
    let cb'' :: C_BusNameVanishedCallback
cb'' = Maybe (Ptr (FunPtr C_BusNameVanishedCallback))
-> BusNameVanishedCallback_WithClosures
-> C_BusNameVanishedCallback
wrap_BusNameVanishedCallback Maybe (Ptr (FunPtr C_BusNameVanishedCallback))
forall a. Maybe a
Nothing BusNameVanishedCallback_WithClosures
cb'
    C_BusNameVanishedCallback -> IO (FunPtr C_BusNameVanishedCallback)
mk_BusNameVanishedCallback C_BusNameVanishedCallback
cb'' IO (FunPtr C_BusNameVanishedCallback)
-> (FunPtr C_BusNameVanishedCallback
    -> IO (GClosure C_BusNameVanishedCallback))
-> IO (GClosure C_BusNameVanishedCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_BusNameVanishedCallback
-> IO (GClosure C_BusNameVanishedCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `BusNameVanishedCallback` into a `C_BusNameVanishedCallback`.
wrap_BusNameVanishedCallback :: 
    Maybe (Ptr (FunPtr C_BusNameVanishedCallback)) ->
    BusNameVanishedCallback_WithClosures ->
    C_BusNameVanishedCallback
wrap_BusNameVanishedCallback :: Maybe (Ptr (FunPtr C_BusNameVanishedCallback))
-> BusNameVanishedCallback_WithClosures
-> C_BusNameVanishedCallback
wrap_BusNameVanishedCallback Maybe (Ptr (FunPtr C_BusNameVanishedCallback))
gi'funptrptr BusNameVanishedCallback_WithClosures
gi'cb Ptr DBusConnection
connection CString
name Ptr ()
userData = do
    DBusConnection
connection' <- ((ManagedPtr DBusConnection -> DBusConnection)
-> Ptr DBusConnection -> IO DBusConnection
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr DBusConnection -> DBusConnection
Gio.DBusConnection.DBusConnection) Ptr DBusConnection
connection
    Text
name' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
name
    BusNameVanishedCallback_WithClosures
gi'cb  DBusConnection
connection' Text
name' Ptr ()
userData
    Maybe (Ptr (FunPtr C_BusNameVanishedCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_BusNameVanishedCallback))
gi'funptrptr


-- callback BusNameLostCallback
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "connection"
          , argType =
              TInterface Name { namespace = "Gio" , name = "DBusConnection" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "The #GDBusConnection on which to acquire the name or %NULL if\nthe connection was disconnected."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "name"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The name being owned."
                , 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
                      "User data passed to g_bus_own_name() or g_bus_own_name_on_connection()."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Invoked when the name is lost or @connection has been closed."
        , sinceVersion = Just "2.26"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_BusNameLostCallback =
    Ptr Gio.DBusConnection.DBusConnection ->
    CString ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "connection"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "DBusConnection" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "The #GDBusConnection on which to acquire the name or %NULL if\nthe connection was disconnected."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The name being owned."
--                 , 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
--                       "User data passed to g_bus_own_name() or g_bus_own_name_on_connection()."
--                 , 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_BusNameLostCallback :: FunPtr C_BusNameLostCallback -> C_BusNameLostCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_BusNameLostCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.DBusConnection.IsDBusConnection a) =>
    FunPtr C_BusNameLostCallback
    -> a
    -- ^ /@connection@/: The t'GI.Gio.Objects.DBusConnection.DBusConnection' on which to acquire the name or 'P.Nothing' if
    -- the connection was disconnected.
    -> T.Text
    -- ^ /@name@/: The name being owned.
    -> Ptr ()
    -- ^ /@userData@/: User data passed to @/g_bus_own_name()/@ or @/g_bus_own_name_on_connection()/@.
    -> m ()
dynamic_BusNameLostCallback :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDBusConnection a) =>
FunPtr C_BusNameVanishedCallback -> a -> Text -> Ptr () -> m ()
dynamic_BusNameLostCallback FunPtr C_BusNameVanishedCallback
__funPtr a
connection Text
name Ptr ()
userData = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr DBusConnection
connection' <- a -> IO (Ptr DBusConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
    CString
name' <- Text -> IO CString
textToCString Text
name
    (FunPtr C_BusNameVanishedCallback -> C_BusNameVanishedCallback
__dynamic_C_BusNameLostCallback FunPtr C_BusNameVanishedCallback
__funPtr) Ptr DBusConnection
connection' CString
name' Ptr ()
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
connection
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | Invoked when the name is lost or /@connection@/ has been closed.
-- 
-- /Since: 2.26/
type BusNameLostCallback =
    Gio.DBusConnection.DBusConnection
    -- ^ /@connection@/: The t'GI.Gio.Objects.DBusConnection.DBusConnection' on which to acquire the name or 'P.Nothing' if
    -- the connection was disconnected.
    -> T.Text
    -- ^ /@name@/: The name being owned.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `BusNameLostCallback`@.
noBusNameLostCallback :: Maybe BusNameLostCallback
noBusNameLostCallback :: Maybe BusNameVanishedCallback
noBusNameLostCallback = Maybe BusNameVanishedCallback
forall a. Maybe a
Nothing

-- | Invoked when the name is lost or /@connection@/ has been closed.
-- 
-- /Since: 2.26/
type BusNameLostCallback_WithClosures =
    Gio.DBusConnection.DBusConnection
    -- ^ /@connection@/: The t'GI.Gio.Objects.DBusConnection.DBusConnection' on which to acquire the name or 'P.Nothing' if
    -- the connection was disconnected.
    -> T.Text
    -- ^ /@name@/: The name being owned.
    -> Ptr ()
    -- ^ /@userData@/: User data passed to @/g_bus_own_name()/@ or @/g_bus_own_name_on_connection()/@.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `BusNameLostCallback_WithClosures`@.
noBusNameLostCallback_WithClosures :: Maybe BusNameLostCallback_WithClosures
noBusNameLostCallback_WithClosures :: Maybe BusNameVanishedCallback_WithClosures
noBusNameLostCallback_WithClosures = Maybe BusNameVanishedCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_BusNameLostCallback :: BusNameLostCallback -> BusNameLostCallback_WithClosures
drop_closures_BusNameLostCallback :: BusNameVanishedCallback -> BusNameVanishedCallback_WithClosures
drop_closures_BusNameLostCallback BusNameVanishedCallback
_f DBusConnection
connection Text
name Ptr ()
_ = BusNameVanishedCallback
_f DBusConnection
connection Text
name

-- | Wrap the callback into a `GClosure`.
genClosure_BusNameLostCallback :: MonadIO m => BusNameLostCallback -> m (GClosure C_BusNameLostCallback)
genClosure_BusNameLostCallback :: forall (m :: * -> *).
MonadIO m =>
BusNameVanishedCallback -> m (GClosure C_BusNameVanishedCallback)
genClosure_BusNameLostCallback BusNameVanishedCallback
cb = IO (GClosure C_BusNameVanishedCallback)
-> m (GClosure C_BusNameVanishedCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_BusNameVanishedCallback)
 -> m (GClosure C_BusNameVanishedCallback))
-> IO (GClosure C_BusNameVanishedCallback)
-> m (GClosure C_BusNameVanishedCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: BusNameVanishedCallback_WithClosures
cb' = BusNameVanishedCallback -> BusNameVanishedCallback_WithClosures
drop_closures_BusNameLostCallback BusNameVanishedCallback
cb
    let cb'' :: C_BusNameVanishedCallback
cb'' = Maybe (Ptr (FunPtr C_BusNameVanishedCallback))
-> BusNameVanishedCallback_WithClosures
-> C_BusNameVanishedCallback
wrap_BusNameLostCallback Maybe (Ptr (FunPtr C_BusNameVanishedCallback))
forall a. Maybe a
Nothing BusNameVanishedCallback_WithClosures
cb'
    C_BusNameVanishedCallback -> IO (FunPtr C_BusNameVanishedCallback)
mk_BusNameLostCallback C_BusNameVanishedCallback
cb'' IO (FunPtr C_BusNameVanishedCallback)
-> (FunPtr C_BusNameVanishedCallback
    -> IO (GClosure C_BusNameVanishedCallback))
-> IO (GClosure C_BusNameVanishedCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_BusNameVanishedCallback
-> IO (GClosure C_BusNameVanishedCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `BusNameLostCallback` into a `C_BusNameLostCallback`.
wrap_BusNameLostCallback :: 
    Maybe (Ptr (FunPtr C_BusNameLostCallback)) ->
    BusNameLostCallback_WithClosures ->
    C_BusNameLostCallback
wrap_BusNameLostCallback :: Maybe (Ptr (FunPtr C_BusNameVanishedCallback))
-> BusNameVanishedCallback_WithClosures
-> C_BusNameVanishedCallback
wrap_BusNameLostCallback Maybe (Ptr (FunPtr C_BusNameVanishedCallback))
gi'funptrptr BusNameVanishedCallback_WithClosures
gi'cb Ptr DBusConnection
connection CString
name Ptr ()
userData = do
    DBusConnection
connection' <- ((ManagedPtr DBusConnection -> DBusConnection)
-> Ptr DBusConnection -> IO DBusConnection
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr DBusConnection -> DBusConnection
Gio.DBusConnection.DBusConnection) Ptr DBusConnection
connection
    Text
name' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
name
    BusNameVanishedCallback_WithClosures
gi'cb  DBusConnection
connection' Text
name' Ptr ()
userData
    Maybe (Ptr (FunPtr C_BusNameVanishedCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_BusNameVanishedCallback))
gi'funptrptr


-- callback BusNameAppearedCallback
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "connection"
          , argType =
              TInterface Name { namespace = "Gio" , name = "DBusConnection" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just "The #GDBusConnection the name is being watched on."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "name"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The name being watched."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "name_owner"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just "Unique name of the owner of the name being watched."
                , 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 "User data passed to g_bus_watch_name()."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 3
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Invoked when the name being watched is known to have to have an owner."
        , sinceVersion = Just "2.26"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_BusNameAppearedCallback =
    Ptr Gio.DBusConnection.DBusConnection ->
    CString ->
    CString ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "connection"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "DBusConnection" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The #GDBusConnection the name is being watched on."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The name being watched."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name_owner"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "Unique name of the owner of the name being watched."
--                 , 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 "User data passed to g_bus_watch_name()."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 3
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_BusNameAppearedCallback :: FunPtr C_BusNameAppearedCallback -> C_BusNameAppearedCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_BusNameAppearedCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.DBusConnection.IsDBusConnection a) =>
    FunPtr C_BusNameAppearedCallback
    -> a
    -- ^ /@connection@/: The t'GI.Gio.Objects.DBusConnection.DBusConnection' the name is being watched on.
    -> T.Text
    -- ^ /@name@/: The name being watched.
    -> T.Text
    -- ^ /@nameOwner@/: Unique name of the owner of the name being watched.
    -> Ptr ()
    -- ^ /@userData@/: User data passed to @/g_bus_watch_name()/@.
    -> m ()
dynamic_BusNameAppearedCallback :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDBusConnection a) =>
FunPtr C_BusNameAppearedCallback
-> a -> Text -> Text -> Ptr () -> m ()
dynamic_BusNameAppearedCallback FunPtr C_BusNameAppearedCallback
__funPtr a
connection Text
name Text
nameOwner Ptr ()
userData = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr DBusConnection
connection' <- a -> IO (Ptr DBusConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
    CString
name' <- Text -> IO CString
textToCString Text
name
    CString
nameOwner' <- Text -> IO CString
textToCString Text
nameOwner
    (FunPtr C_BusNameAppearedCallback -> C_BusNameAppearedCallback
__dynamic_C_BusNameAppearedCallback FunPtr C_BusNameAppearedCallback
__funPtr) Ptr DBusConnection
connection' CString
name' CString
nameOwner' Ptr ()
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
connection
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
nameOwner'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | Invoked when the name being watched is known to have to have an owner.
-- 
-- /Since: 2.26/
type BusNameAppearedCallback =
    Gio.DBusConnection.DBusConnection
    -- ^ /@connection@/: The t'GI.Gio.Objects.DBusConnection.DBusConnection' the name is being watched on.
    -> T.Text
    -- ^ /@name@/: The name being watched.
    -> T.Text
    -- ^ /@nameOwner@/: Unique name of the owner of the name being watched.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `BusNameAppearedCallback`@.
noBusNameAppearedCallback :: Maybe BusNameAppearedCallback
noBusNameAppearedCallback :: Maybe BusNameAppearedCallback
noBusNameAppearedCallback = Maybe BusNameAppearedCallback
forall a. Maybe a
Nothing

-- | Invoked when the name being watched is known to have to have an owner.
-- 
-- /Since: 2.26/
type BusNameAppearedCallback_WithClosures =
    Gio.DBusConnection.DBusConnection
    -- ^ /@connection@/: The t'GI.Gio.Objects.DBusConnection.DBusConnection' the name is being watched on.
    -> T.Text
    -- ^ /@name@/: The name being watched.
    -> T.Text
    -- ^ /@nameOwner@/: Unique name of the owner of the name being watched.
    -> Ptr ()
    -- ^ /@userData@/: User data passed to @/g_bus_watch_name()/@.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `BusNameAppearedCallback_WithClosures`@.
noBusNameAppearedCallback_WithClosures :: Maybe BusNameAppearedCallback_WithClosures
noBusNameAppearedCallback_WithClosures :: Maybe BusNameAppearedCallback_WithClosures
noBusNameAppearedCallback_WithClosures = Maybe BusNameAppearedCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_BusNameAppearedCallback :: BusNameAppearedCallback -> BusNameAppearedCallback_WithClosures
drop_closures_BusNameAppearedCallback :: BusNameAppearedCallback -> BusNameAppearedCallback_WithClosures
drop_closures_BusNameAppearedCallback BusNameAppearedCallback
_f DBusConnection
connection Text
name Text
nameOwner Ptr ()
_ = BusNameAppearedCallback
_f DBusConnection
connection Text
name Text
nameOwner

-- | Wrap the callback into a `GClosure`.
genClosure_BusNameAppearedCallback :: MonadIO m => BusNameAppearedCallback -> m (GClosure C_BusNameAppearedCallback)
genClosure_BusNameAppearedCallback :: forall (m :: * -> *).
MonadIO m =>
BusNameAppearedCallback -> m (GClosure C_BusNameAppearedCallback)
genClosure_BusNameAppearedCallback BusNameAppearedCallback
cb = IO (GClosure C_BusNameAppearedCallback)
-> m (GClosure C_BusNameAppearedCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_BusNameAppearedCallback)
 -> m (GClosure C_BusNameAppearedCallback))
-> IO (GClosure C_BusNameAppearedCallback)
-> m (GClosure C_BusNameAppearedCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: BusNameAppearedCallback_WithClosures
cb' = BusNameAppearedCallback -> BusNameAppearedCallback_WithClosures
drop_closures_BusNameAppearedCallback BusNameAppearedCallback
cb
    let cb'' :: C_BusNameAppearedCallback
cb'' = Maybe (Ptr (FunPtr C_BusNameAppearedCallback))
-> BusNameAppearedCallback_WithClosures
-> C_BusNameAppearedCallback
wrap_BusNameAppearedCallback Maybe (Ptr (FunPtr C_BusNameAppearedCallback))
forall a. Maybe a
Nothing BusNameAppearedCallback_WithClosures
cb'
    C_BusNameAppearedCallback -> IO (FunPtr C_BusNameAppearedCallback)
mk_BusNameAppearedCallback C_BusNameAppearedCallback
cb'' IO (FunPtr C_BusNameAppearedCallback)
-> (FunPtr C_BusNameAppearedCallback
    -> IO (GClosure C_BusNameAppearedCallback))
-> IO (GClosure C_BusNameAppearedCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_BusNameAppearedCallback
-> IO (GClosure C_BusNameAppearedCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `BusNameAppearedCallback` into a `C_BusNameAppearedCallback`.
wrap_BusNameAppearedCallback :: 
    Maybe (Ptr (FunPtr C_BusNameAppearedCallback)) ->
    BusNameAppearedCallback_WithClosures ->
    C_BusNameAppearedCallback
wrap_BusNameAppearedCallback :: Maybe (Ptr (FunPtr C_BusNameAppearedCallback))
-> BusNameAppearedCallback_WithClosures
-> C_BusNameAppearedCallback
wrap_BusNameAppearedCallback Maybe (Ptr (FunPtr C_BusNameAppearedCallback))
gi'funptrptr BusNameAppearedCallback_WithClosures
gi'cb Ptr DBusConnection
connection CString
name CString
nameOwner Ptr ()
userData = do
    DBusConnection
connection' <- ((ManagedPtr DBusConnection -> DBusConnection)
-> Ptr DBusConnection -> IO DBusConnection
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr DBusConnection -> DBusConnection
Gio.DBusConnection.DBusConnection) Ptr DBusConnection
connection
    Text
name' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
name
    Text
nameOwner' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
nameOwner
    BusNameAppearedCallback_WithClosures
gi'cb  DBusConnection
connection' Text
name' Text
nameOwner' Ptr ()
userData
    Maybe (Ptr (FunPtr C_BusNameAppearedCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_BusNameAppearedCallback))
gi'funptrptr


-- callback BusNameAcquiredCallback
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "connection"
          , argType =
              TInterface Name { namespace = "Gio" , name = "DBusConnection" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just "The #GDBusConnection on which to acquired the name."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "name"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The name being owned."
                , 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
                      "User data passed to g_bus_own_name() or g_bus_own_name_on_connection()."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText = Just "Invoked when the name is acquired."
        , sinceVersion = Just "2.26"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_BusNameAcquiredCallback =
    Ptr Gio.DBusConnection.DBusConnection ->
    CString ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "connection"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "DBusConnection" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The #GDBusConnection on which to acquired the name."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The name being owned."
--                 , 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
--                       "User data passed to g_bus_own_name() or g_bus_own_name_on_connection()."
--                 , 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_BusNameAcquiredCallback :: FunPtr C_BusNameAcquiredCallback -> C_BusNameAcquiredCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_BusNameAcquiredCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.DBusConnection.IsDBusConnection a) =>
    FunPtr C_BusNameAcquiredCallback
    -> a
    -- ^ /@connection@/: The t'GI.Gio.Objects.DBusConnection.DBusConnection' on which to acquired the name.
    -> T.Text
    -- ^ /@name@/: The name being owned.
    -> Ptr ()
    -- ^ /@userData@/: User data passed to @/g_bus_own_name()/@ or @/g_bus_own_name_on_connection()/@.
    -> m ()
dynamic_BusNameAcquiredCallback :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDBusConnection a) =>
FunPtr C_BusNameVanishedCallback -> a -> Text -> Ptr () -> m ()
dynamic_BusNameAcquiredCallback FunPtr C_BusNameVanishedCallback
__funPtr a
connection Text
name Ptr ()
userData = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr DBusConnection
connection' <- a -> IO (Ptr DBusConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
    CString
name' <- Text -> IO CString
textToCString Text
name
    (FunPtr C_BusNameVanishedCallback -> C_BusNameVanishedCallback
__dynamic_C_BusNameAcquiredCallback FunPtr C_BusNameVanishedCallback
__funPtr) Ptr DBusConnection
connection' CString
name' Ptr ()
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
connection
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | Invoked when the name is acquired.
-- 
-- /Since: 2.26/
type BusNameAcquiredCallback =
    Gio.DBusConnection.DBusConnection
    -- ^ /@connection@/: The t'GI.Gio.Objects.DBusConnection.DBusConnection' on which to acquired the name.
    -> T.Text
    -- ^ /@name@/: The name being owned.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `BusNameAcquiredCallback`@.
noBusNameAcquiredCallback :: Maybe BusNameAcquiredCallback
noBusNameAcquiredCallback :: Maybe BusNameVanishedCallback
noBusNameAcquiredCallback = Maybe BusNameVanishedCallback
forall a. Maybe a
Nothing

-- | Invoked when the name is acquired.
-- 
-- /Since: 2.26/
type BusNameAcquiredCallback_WithClosures =
    Gio.DBusConnection.DBusConnection
    -- ^ /@connection@/: The t'GI.Gio.Objects.DBusConnection.DBusConnection' on which to acquired the name.
    -> T.Text
    -- ^ /@name@/: The name being owned.
    -> Ptr ()
    -- ^ /@userData@/: User data passed to @/g_bus_own_name()/@ or @/g_bus_own_name_on_connection()/@.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `BusNameAcquiredCallback_WithClosures`@.
noBusNameAcquiredCallback_WithClosures :: Maybe BusNameAcquiredCallback_WithClosures
noBusNameAcquiredCallback_WithClosures :: Maybe BusNameVanishedCallback_WithClosures
noBusNameAcquiredCallback_WithClosures = Maybe BusNameVanishedCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_BusNameAcquiredCallback :: BusNameAcquiredCallback -> BusNameAcquiredCallback_WithClosures
drop_closures_BusNameAcquiredCallback :: BusNameVanishedCallback -> BusNameVanishedCallback_WithClosures
drop_closures_BusNameAcquiredCallback BusNameVanishedCallback
_f DBusConnection
connection Text
name Ptr ()
_ = BusNameVanishedCallback
_f DBusConnection
connection Text
name

-- | Wrap the callback into a `GClosure`.
genClosure_BusNameAcquiredCallback :: MonadIO m => BusNameAcquiredCallback -> m (GClosure C_BusNameAcquiredCallback)
genClosure_BusNameAcquiredCallback :: forall (m :: * -> *).
MonadIO m =>
BusNameVanishedCallback -> m (GClosure C_BusNameVanishedCallback)
genClosure_BusNameAcquiredCallback BusNameVanishedCallback
cb = IO (GClosure C_BusNameVanishedCallback)
-> m (GClosure C_BusNameVanishedCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_BusNameVanishedCallback)
 -> m (GClosure C_BusNameVanishedCallback))
-> IO (GClosure C_BusNameVanishedCallback)
-> m (GClosure C_BusNameVanishedCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: BusNameVanishedCallback_WithClosures
cb' = BusNameVanishedCallback -> BusNameVanishedCallback_WithClosures
drop_closures_BusNameAcquiredCallback BusNameVanishedCallback
cb
    let cb'' :: C_BusNameVanishedCallback
cb'' = Maybe (Ptr (FunPtr C_BusNameVanishedCallback))
-> BusNameVanishedCallback_WithClosures
-> C_BusNameVanishedCallback
wrap_BusNameAcquiredCallback Maybe (Ptr (FunPtr C_BusNameVanishedCallback))
forall a. Maybe a
Nothing BusNameVanishedCallback_WithClosures
cb'
    C_BusNameVanishedCallback -> IO (FunPtr C_BusNameVanishedCallback)
mk_BusNameAcquiredCallback C_BusNameVanishedCallback
cb'' IO (FunPtr C_BusNameVanishedCallback)
-> (FunPtr C_BusNameVanishedCallback
    -> IO (GClosure C_BusNameVanishedCallback))
-> IO (GClosure C_BusNameVanishedCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_BusNameVanishedCallback
-> IO (GClosure C_BusNameVanishedCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `BusNameAcquiredCallback` into a `C_BusNameAcquiredCallback`.
wrap_BusNameAcquiredCallback :: 
    Maybe (Ptr (FunPtr C_BusNameAcquiredCallback)) ->
    BusNameAcquiredCallback_WithClosures ->
    C_BusNameAcquiredCallback
wrap_BusNameAcquiredCallback :: Maybe (Ptr (FunPtr C_BusNameVanishedCallback))
-> BusNameVanishedCallback_WithClosures
-> C_BusNameVanishedCallback
wrap_BusNameAcquiredCallback Maybe (Ptr (FunPtr C_BusNameVanishedCallback))
gi'funptrptr BusNameVanishedCallback_WithClosures
gi'cb Ptr DBusConnection
connection CString
name Ptr ()
userData = do
    DBusConnection
connection' <- ((ManagedPtr DBusConnection -> DBusConnection)
-> Ptr DBusConnection -> IO DBusConnection
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr DBusConnection -> DBusConnection
Gio.DBusConnection.DBusConnection) Ptr DBusConnection
connection
    Text
name' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
name
    BusNameVanishedCallback_WithClosures
gi'cb  DBusConnection
connection' Text
name' Ptr ()
userData
    Maybe (Ptr (FunPtr C_BusNameVanishedCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_BusNameVanishedCallback))
gi'funptrptr


-- callback BusAcquiredCallback
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "connection"
          , argType =
              TInterface Name { namespace = "Gio" , name = "DBusConnection" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The #GDBusConnection to a message bus."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "name"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The name that is requested to be owned."
                , 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 "User data passed to g_bus_own_name()."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Invoked when a connection to a message bus has been obtained."
        , sinceVersion = Just "2.26"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_BusAcquiredCallback =
    Ptr Gio.DBusConnection.DBusConnection ->
    CString ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "connection"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "DBusConnection" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #GDBusConnection to a message bus."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The name that is requested to be owned."
--                 , 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 "User data passed to g_bus_own_name()."
--                 , 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_BusAcquiredCallback :: FunPtr C_BusAcquiredCallback -> C_BusAcquiredCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_BusAcquiredCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.DBusConnection.IsDBusConnection a) =>
    FunPtr C_BusAcquiredCallback
    -> a
    -- ^ /@connection@/: The t'GI.Gio.Objects.DBusConnection.DBusConnection' to a message bus.
    -> T.Text
    -- ^ /@name@/: The name that is requested to be owned.
    -> Ptr ()
    -- ^ /@userData@/: User data passed to @/g_bus_own_name()/@.
    -> m ()
dynamic_BusAcquiredCallback :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDBusConnection a) =>
FunPtr C_BusNameVanishedCallback -> a -> Text -> Ptr () -> m ()
dynamic_BusAcquiredCallback FunPtr C_BusNameVanishedCallback
__funPtr a
connection Text
name Ptr ()
userData = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr DBusConnection
connection' <- a -> IO (Ptr DBusConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
    CString
name' <- Text -> IO CString
textToCString Text
name
    (FunPtr C_BusNameVanishedCallback -> C_BusNameVanishedCallback
__dynamic_C_BusAcquiredCallback FunPtr C_BusNameVanishedCallback
__funPtr) Ptr DBusConnection
connection' CString
name' Ptr ()
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
connection
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | Invoked when a connection to a message bus has been obtained.
-- 
-- /Since: 2.26/
type BusAcquiredCallback =
    Gio.DBusConnection.DBusConnection
    -- ^ /@connection@/: The t'GI.Gio.Objects.DBusConnection.DBusConnection' to a message bus.
    -> T.Text
    -- ^ /@name@/: The name that is requested to be owned.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `BusAcquiredCallback`@.
noBusAcquiredCallback :: Maybe BusAcquiredCallback
noBusAcquiredCallback :: Maybe BusNameVanishedCallback
noBusAcquiredCallback = Maybe BusNameVanishedCallback
forall a. Maybe a
Nothing

-- | Invoked when a connection to a message bus has been obtained.
-- 
-- /Since: 2.26/
type BusAcquiredCallback_WithClosures =
    Gio.DBusConnection.DBusConnection
    -- ^ /@connection@/: The t'GI.Gio.Objects.DBusConnection.DBusConnection' to a message bus.
    -> T.Text
    -- ^ /@name@/: The name that is requested to be owned.
    -> Ptr ()
    -- ^ /@userData@/: User data passed to @/g_bus_own_name()/@.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `BusAcquiredCallback_WithClosures`@.
noBusAcquiredCallback_WithClosures :: Maybe BusAcquiredCallback_WithClosures
noBusAcquiredCallback_WithClosures :: Maybe BusNameVanishedCallback_WithClosures
noBusAcquiredCallback_WithClosures = Maybe BusNameVanishedCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_BusAcquiredCallback :: BusAcquiredCallback -> BusAcquiredCallback_WithClosures
drop_closures_BusAcquiredCallback :: BusNameVanishedCallback -> BusNameVanishedCallback_WithClosures
drop_closures_BusAcquiredCallback BusNameVanishedCallback
_f DBusConnection
connection Text
name Ptr ()
_ = BusNameVanishedCallback
_f DBusConnection
connection Text
name

-- | Wrap the callback into a `GClosure`.
genClosure_BusAcquiredCallback :: MonadIO m => BusAcquiredCallback -> m (GClosure C_BusAcquiredCallback)
genClosure_BusAcquiredCallback :: forall (m :: * -> *).
MonadIO m =>
BusNameVanishedCallback -> m (GClosure C_BusNameVanishedCallback)
genClosure_BusAcquiredCallback BusNameVanishedCallback
cb = IO (GClosure C_BusNameVanishedCallback)
-> m (GClosure C_BusNameVanishedCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_BusNameVanishedCallback)
 -> m (GClosure C_BusNameVanishedCallback))
-> IO (GClosure C_BusNameVanishedCallback)
-> m (GClosure C_BusNameVanishedCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: BusNameVanishedCallback_WithClosures
cb' = BusNameVanishedCallback -> BusNameVanishedCallback_WithClosures
drop_closures_BusAcquiredCallback BusNameVanishedCallback
cb
    let cb'' :: C_BusNameVanishedCallback
cb'' = Maybe (Ptr (FunPtr C_BusNameVanishedCallback))
-> BusNameVanishedCallback_WithClosures
-> C_BusNameVanishedCallback
wrap_BusAcquiredCallback Maybe (Ptr (FunPtr C_BusNameVanishedCallback))
forall a. Maybe a
Nothing BusNameVanishedCallback_WithClosures
cb'
    C_BusNameVanishedCallback -> IO (FunPtr C_BusNameVanishedCallback)
mk_BusAcquiredCallback C_BusNameVanishedCallback
cb'' IO (FunPtr C_BusNameVanishedCallback)
-> (FunPtr C_BusNameVanishedCallback
    -> IO (GClosure C_BusNameVanishedCallback))
-> IO (GClosure C_BusNameVanishedCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_BusNameVanishedCallback
-> IO (GClosure C_BusNameVanishedCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `BusAcquiredCallback` into a `C_BusAcquiredCallback`.
wrap_BusAcquiredCallback :: 
    Maybe (Ptr (FunPtr C_BusAcquiredCallback)) ->
    BusAcquiredCallback_WithClosures ->
    C_BusAcquiredCallback
wrap_BusAcquiredCallback :: Maybe (Ptr (FunPtr C_BusNameVanishedCallback))
-> BusNameVanishedCallback_WithClosures
-> C_BusNameVanishedCallback
wrap_BusAcquiredCallback Maybe (Ptr (FunPtr C_BusNameVanishedCallback))
gi'funptrptr BusNameVanishedCallback_WithClosures
gi'cb Ptr DBusConnection
connection CString
name Ptr ()
userData = do
    DBusConnection
connection' <- ((ManagedPtr DBusConnection -> DBusConnection)
-> Ptr DBusConnection -> IO DBusConnection
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr DBusConnection -> DBusConnection
Gio.DBusConnection.DBusConnection) Ptr DBusConnection
connection
    Text
name' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
name
    BusNameVanishedCallback_WithClosures
gi'cb  DBusConnection
connection' Text
name' Ptr ()
userData
    Maybe (Ptr (FunPtr C_BusNameVanishedCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_BusNameVanishedCallback))
gi'funptrptr


-- callback AsyncReadyCallback
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "source_object"
          , argType =
              TInterface Name { namespace = "GObject" , name = "Object" }
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText =
                    Just "the object the asynchronous operation was started with."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "res"
          , argType =
              TInterface Name { namespace = "Gio" , name = "AsyncResult" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "a #GAsyncResult." , 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 "user data passed to the callback."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Type definition for a function that will be called back when an asynchronous\noperation within GIO has been completed. #GAsyncReadyCallback\ncallbacks from #GTask are guaranteed to be invoked in a later\niteration of the\n[thread-default main context][g-main-context-push-thread-default]\nwhere the #GTask was created. All other users of\n#GAsyncReadyCallback must likewise call it asynchronously in a\nlater iteration of the main context.\n\nThe asynchronous operation is guaranteed to have held a reference to\n@source_object from the time when the `*_async()` function was called, until\nafter this callback returns."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_AsyncReadyCallback =
    Ptr GObject.Object.Object ->
    Ptr Gio.AsyncResult.AsyncResult ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "source_object"
--           , argType =
--               TInterface Name { namespace = "GObject" , name = "Object" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the object the asynchronous operation was started with."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "res"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncResult" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GAsyncResult." , 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 "user data passed to the callback."
--                 , 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_AsyncReadyCallback :: FunPtr C_AsyncReadyCallback -> C_AsyncReadyCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_AsyncReadyCallback ::
    (B.CallStack.HasCallStack, MonadIO m, GObject.Object.IsObject a, Gio.AsyncResult.IsAsyncResult b) =>
    FunPtr C_AsyncReadyCallback
    -> Maybe (a)
    -- ^ /@sourceObject@/: the object the asynchronous operation was started with.
    -> b
    -- ^ /@res@/: a t'GI.Gio.Interfaces.AsyncResult.AsyncResult'.
    -> Ptr ()
    -- ^ /@userData@/: user data passed to the callback.
    -> m ()
dynamic_AsyncReadyCallback :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsObject a, IsAsyncResult b) =>
FunPtr C_AsyncReadyCallback -> Maybe a -> b -> Ptr () -> m ()
dynamic_AsyncReadyCallback FunPtr C_AsyncReadyCallback
__funPtr Maybe a
sourceObject b
res Ptr ()
userData = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Object
maybeSourceObject <- case Maybe a
sourceObject of
        Maybe a
Nothing -> Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
forall a. Ptr a
nullPtr
        Just a
jSourceObject -> do
            Ptr Object
jSourceObject' <- a -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jSourceObject
            Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
jSourceObject'
    Ptr AsyncResult
res' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
res
    (FunPtr C_AsyncReadyCallback -> C_AsyncReadyCallback
__dynamic_C_AsyncReadyCallback FunPtr C_AsyncReadyCallback
__funPtr) Ptr Object
maybeSourceObject Ptr AsyncResult
res' Ptr ()
userData
    Maybe a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
sourceObject a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
res
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | Type definition for a function that will be called back when an asynchronous
-- operation within GIO has been completed. t'GI.Gio.Callbacks.AsyncReadyCallback'
-- callbacks from t'GI.Gio.Objects.Task.Task' are guaranteed to be invoked in a later
-- iteration of the
-- [thread-default main context][g-main-context-push-thread-default]
-- where the t'GI.Gio.Objects.Task.Task' was created. All other users of
-- t'GI.Gio.Callbacks.AsyncReadyCallback' must likewise call it asynchronously in a
-- later iteration of the main context.
-- 
-- The asynchronous operation is guaranteed to have held a reference to
-- /@sourceObject@/ from the time when the @*_async()@ function was called, until
-- after this callback returns.
type AsyncReadyCallback =
    Maybe GObject.Object.Object
    -- ^ /@sourceObject@/: the object the asynchronous operation was started with.
    -> Gio.AsyncResult.AsyncResult
    -- ^ /@res@/: a t'GI.Gio.Interfaces.AsyncResult.AsyncResult'.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `AsyncReadyCallback`@.
noAsyncReadyCallback :: Maybe AsyncReadyCallback
noAsyncReadyCallback :: Maybe AsyncReadyCallback
noAsyncReadyCallback = Maybe AsyncReadyCallback
forall a. Maybe a
Nothing

-- | Type definition for a function that will be called back when an asynchronous
-- operation within GIO has been completed. t'GI.Gio.Callbacks.AsyncReadyCallback'
-- callbacks from t'GI.Gio.Objects.Task.Task' are guaranteed to be invoked in a later
-- iteration of the
-- [thread-default main context][g-main-context-push-thread-default]
-- where the t'GI.Gio.Objects.Task.Task' was created. All other users of
-- t'GI.Gio.Callbacks.AsyncReadyCallback' must likewise call it asynchronously in a
-- later iteration of the main context.
-- 
-- The asynchronous operation is guaranteed to have held a reference to
-- /@sourceObject@/ from the time when the @*_async()@ function was called, until
-- after this callback returns.
type AsyncReadyCallback_WithClosures =
    Maybe GObject.Object.Object
    -- ^ /@sourceObject@/: the object the asynchronous operation was started with.
    -> Gio.AsyncResult.AsyncResult
    -- ^ /@res@/: a t'GI.Gio.Interfaces.AsyncResult.AsyncResult'.
    -> Ptr ()
    -- ^ /@userData@/: user data passed to the callback.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `AsyncReadyCallback_WithClosures`@.
noAsyncReadyCallback_WithClosures :: Maybe AsyncReadyCallback_WithClosures
noAsyncReadyCallback_WithClosures :: Maybe AsyncReadyCallback_WithClosures
noAsyncReadyCallback_WithClosures = Maybe AsyncReadyCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_AsyncReadyCallback :: AsyncReadyCallback -> AsyncReadyCallback_WithClosures
drop_closures_AsyncReadyCallback :: AsyncReadyCallback -> AsyncReadyCallback_WithClosures
drop_closures_AsyncReadyCallback AsyncReadyCallback
_f Maybe Object
sourceObject AsyncResult
res Ptr ()
_ = AsyncReadyCallback
_f Maybe Object
sourceObject AsyncResult
res

-- | Wrap the callback into a `GClosure`.
genClosure_AsyncReadyCallback :: MonadIO m => AsyncReadyCallback -> m (GClosure C_AsyncReadyCallback)
genClosure_AsyncReadyCallback :: forall (m :: * -> *).
MonadIO m =>
AsyncReadyCallback -> m (GClosure C_AsyncReadyCallback)
genClosure_AsyncReadyCallback AsyncReadyCallback
cb = IO (GClosure C_AsyncReadyCallback)
-> m (GClosure C_AsyncReadyCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_AsyncReadyCallback)
 -> m (GClosure C_AsyncReadyCallback))
-> IO (GClosure C_AsyncReadyCallback)
-> m (GClosure C_AsyncReadyCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: AsyncReadyCallback_WithClosures
cb' = AsyncReadyCallback -> AsyncReadyCallback_WithClosures
drop_closures_AsyncReadyCallback AsyncReadyCallback
cb
    let cb'' :: C_AsyncReadyCallback
cb'' = Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
wrap_AsyncReadyCallback Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Maybe a
Nothing AsyncReadyCallback_WithClosures
cb'
    C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
mk_AsyncReadyCallback C_AsyncReadyCallback
cb'' IO (FunPtr C_AsyncReadyCallback)
-> (FunPtr C_AsyncReadyCallback
    -> IO (GClosure C_AsyncReadyCallback))
-> IO (GClosure C_AsyncReadyCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_AsyncReadyCallback -> IO (GClosure C_AsyncReadyCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `AsyncReadyCallback` into a `C_AsyncReadyCallback`.
wrap_AsyncReadyCallback :: 
    Maybe (Ptr (FunPtr C_AsyncReadyCallback)) ->
    AsyncReadyCallback_WithClosures ->
    C_AsyncReadyCallback
wrap_AsyncReadyCallback :: Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
wrap_AsyncReadyCallback Maybe (Ptr (FunPtr C_AsyncReadyCallback))
gi'funptrptr AsyncReadyCallback_WithClosures
gi'cb Ptr Object
sourceObject Ptr AsyncResult
res Ptr ()
userData = do
    Maybe Object
maybeSourceObject <-
        if Ptr Object
sourceObject Ptr Object -> Ptr Object -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr Object
forall a. Ptr a
nullPtr
        then Maybe Object -> IO (Maybe Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Object
forall a. Maybe a
Nothing
        else do
            Object
sourceObject' <- ((ManagedPtr Object -> Object) -> Ptr Object -> IO Object
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Object -> Object
GObject.Object.Object) Ptr Object
sourceObject
            Maybe Object -> IO (Maybe Object)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Object -> IO (Maybe Object))
-> Maybe Object -> IO (Maybe Object)
forall a b. (a -> b) -> a -> b
$ Object -> Maybe Object
forall a. a -> Maybe a
Just Object
sourceObject'
    AsyncResult
res' <- ((ManagedPtr AsyncResult -> AsyncResult)
-> Ptr AsyncResult -> IO AsyncResult
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr AsyncResult -> AsyncResult
Gio.AsyncResult.AsyncResult) Ptr AsyncResult
res
    AsyncReadyCallback_WithClosures
gi'cb  Maybe Object
maybeSourceObject AsyncResult
res' Ptr ()
userData
    Maybe (Ptr (FunPtr C_AsyncReadyCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_AsyncReadyCallback))
gi'funptrptr


-- callback ActionEntryChangeStateFieldCallback
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "action"
          , argType =
              TInterface Name { namespace = "Gio" , name = "SimpleAction" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "value"
          , argType = TVariant
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , 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 = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_ActionEntryChangeStateFieldCallback =
    Ptr Gio.SimpleAction.SimpleAction ->
    Ptr GVariant ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "action"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "SimpleAction" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "value"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , 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 = Nothing , 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_ActionEntryChangeStateFieldCallback :: FunPtr C_ActionEntryChangeStateFieldCallback -> C_ActionEntryChangeStateFieldCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_ActionEntryChangeStateFieldCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.SimpleAction.IsSimpleAction a) =>
    FunPtr C_ActionEntryChangeStateFieldCallback
    -> a
    -> GVariant
    -> Ptr ()
    -> m ()
dynamic_ActionEntryChangeStateFieldCallback :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSimpleAction a) =>
FunPtr C_ActionEntryChangeStateFieldCallback
-> a -> GVariant -> Ptr () -> m ()
dynamic_ActionEntryChangeStateFieldCallback FunPtr C_ActionEntryChangeStateFieldCallback
__funPtr a
action GVariant
value Ptr ()
userData = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr SimpleAction
action' <- a -> IO (Ptr SimpleAction)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
action
    Ptr GVariant
value' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
value
    (FunPtr C_ActionEntryChangeStateFieldCallback
-> C_ActionEntryChangeStateFieldCallback
__dynamic_C_ActionEntryChangeStateFieldCallback FunPtr C_ActionEntryChangeStateFieldCallback
__funPtr) Ptr SimpleAction
action' Ptr GVariant
value' Ptr ()
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
action
    GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
value
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | /No description available in the introspection data./
type ActionEntryChangeStateFieldCallback =
    Gio.SimpleAction.SimpleAction
    -> GVariant
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ActionEntryChangeStateFieldCallback`@.
noActionEntryChangeStateFieldCallback :: Maybe ActionEntryChangeStateFieldCallback
noActionEntryChangeStateFieldCallback :: Maybe ActionEntryChangeStateFieldCallback
noActionEntryChangeStateFieldCallback = Maybe ActionEntryChangeStateFieldCallback
forall a. Maybe a
Nothing

-- | /No description available in the introspection data./
type ActionEntryChangeStateFieldCallback_WithClosures =
    Gio.SimpleAction.SimpleAction
    -> GVariant
    -> Ptr ()
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ActionEntryChangeStateFieldCallback_WithClosures`@.
noActionEntryChangeStateFieldCallback_WithClosures :: Maybe ActionEntryChangeStateFieldCallback_WithClosures
noActionEntryChangeStateFieldCallback_WithClosures :: Maybe ActionEntryChangeStateFieldCallback_WithClosures
noActionEntryChangeStateFieldCallback_WithClosures = Maybe ActionEntryChangeStateFieldCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_ActionEntryChangeStateFieldCallback :: ActionEntryChangeStateFieldCallback -> ActionEntryChangeStateFieldCallback_WithClosures
drop_closures_ActionEntryChangeStateFieldCallback :: ActionEntryChangeStateFieldCallback
-> ActionEntryChangeStateFieldCallback_WithClosures
drop_closures_ActionEntryChangeStateFieldCallback ActionEntryChangeStateFieldCallback
_f SimpleAction
action GVariant
value Ptr ()
_ = ActionEntryChangeStateFieldCallback
_f SimpleAction
action GVariant
value

-- | Wrap the callback into a `GClosure`.
genClosure_ActionEntryChangeStateFieldCallback :: MonadIO m => ActionEntryChangeStateFieldCallback -> m (GClosure C_ActionEntryChangeStateFieldCallback)
genClosure_ActionEntryChangeStateFieldCallback :: forall (m :: * -> *).
MonadIO m =>
ActionEntryChangeStateFieldCallback
-> m (GClosure C_ActionEntryChangeStateFieldCallback)
genClosure_ActionEntryChangeStateFieldCallback ActionEntryChangeStateFieldCallback
cb = IO (GClosure C_ActionEntryChangeStateFieldCallback)
-> m (GClosure C_ActionEntryChangeStateFieldCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_ActionEntryChangeStateFieldCallback)
 -> m (GClosure C_ActionEntryChangeStateFieldCallback))
-> IO (GClosure C_ActionEntryChangeStateFieldCallback)
-> m (GClosure C_ActionEntryChangeStateFieldCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: ActionEntryChangeStateFieldCallback_WithClosures
cb' = ActionEntryChangeStateFieldCallback
-> ActionEntryChangeStateFieldCallback_WithClosures
drop_closures_ActionEntryChangeStateFieldCallback ActionEntryChangeStateFieldCallback
cb
    let cb'' :: C_ActionEntryChangeStateFieldCallback
cb'' = Maybe (Ptr (FunPtr C_ActionEntryChangeStateFieldCallback))
-> ActionEntryChangeStateFieldCallback_WithClosures
-> C_ActionEntryChangeStateFieldCallback
wrap_ActionEntryChangeStateFieldCallback Maybe (Ptr (FunPtr C_ActionEntryChangeStateFieldCallback))
forall a. Maybe a
Nothing ActionEntryChangeStateFieldCallback_WithClosures
cb'
    C_ActionEntryChangeStateFieldCallback
-> IO (FunPtr C_ActionEntryChangeStateFieldCallback)
mk_ActionEntryChangeStateFieldCallback C_ActionEntryChangeStateFieldCallback
cb'' IO (FunPtr C_ActionEntryChangeStateFieldCallback)
-> (FunPtr C_ActionEntryChangeStateFieldCallback
    -> IO (GClosure C_ActionEntryChangeStateFieldCallback))
-> IO (GClosure C_ActionEntryChangeStateFieldCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ActionEntryChangeStateFieldCallback
-> IO (GClosure C_ActionEntryChangeStateFieldCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `ActionEntryChangeStateFieldCallback` into a `C_ActionEntryChangeStateFieldCallback`.
wrap_ActionEntryChangeStateFieldCallback :: 
    Maybe (Ptr (FunPtr C_ActionEntryChangeStateFieldCallback)) ->
    ActionEntryChangeStateFieldCallback_WithClosures ->
    C_ActionEntryChangeStateFieldCallback
wrap_ActionEntryChangeStateFieldCallback :: Maybe (Ptr (FunPtr C_ActionEntryChangeStateFieldCallback))
-> ActionEntryChangeStateFieldCallback_WithClosures
-> C_ActionEntryChangeStateFieldCallback
wrap_ActionEntryChangeStateFieldCallback Maybe (Ptr (FunPtr C_ActionEntryChangeStateFieldCallback))
gi'funptrptr ActionEntryChangeStateFieldCallback_WithClosures
gi'cb Ptr SimpleAction
action Ptr GVariant
value Ptr ()
userData = do
    SimpleAction
action' <- ((ManagedPtr SimpleAction -> SimpleAction)
-> Ptr SimpleAction -> IO SimpleAction
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr SimpleAction -> SimpleAction
Gio.SimpleAction.SimpleAction) Ptr SimpleAction
action
    GVariant
value' <- Ptr GVariant -> IO GVariant
B.GVariant.newGVariantFromPtr Ptr GVariant
value
    ActionEntryChangeStateFieldCallback_WithClosures
gi'cb  SimpleAction
action' GVariant
value' Ptr ()
userData
    Maybe (Ptr (FunPtr C_ActionEntryChangeStateFieldCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_ActionEntryChangeStateFieldCallback))
gi'funptrptr


-- callback ActionEntryActivateFieldCallback
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "action"
          , argType =
              TInterface Name { namespace = "Gio" , name = "SimpleAction" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "parameter"
          , argType = TVariant
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation { rawDocText = Nothing , 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 = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_ActionEntryActivateFieldCallback =
    Ptr Gio.SimpleAction.SimpleAction ->
    Ptr GVariant ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "action"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "SimpleAction" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "parameter"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation { rawDocText = Nothing , 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 = Nothing , 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_ActionEntryActivateFieldCallback :: FunPtr C_ActionEntryActivateFieldCallback -> C_ActionEntryActivateFieldCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_ActionEntryActivateFieldCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.SimpleAction.IsSimpleAction a) =>
    FunPtr C_ActionEntryActivateFieldCallback
    -> a
    -> Maybe (GVariant)
    -> Ptr ()
    -> m ()
dynamic_ActionEntryActivateFieldCallback :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSimpleAction a) =>
FunPtr C_ActionEntryChangeStateFieldCallback
-> a -> Maybe GVariant -> Ptr () -> m ()
dynamic_ActionEntryActivateFieldCallback FunPtr C_ActionEntryChangeStateFieldCallback
__funPtr a
action Maybe GVariant
parameter Ptr ()
userData = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr SimpleAction
action' <- a -> IO (Ptr SimpleAction)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
action
    Ptr GVariant
maybeParameter <- case Maybe GVariant
parameter of
        Maybe GVariant
Nothing -> Ptr GVariant -> IO (Ptr GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GVariant
forall a. Ptr a
nullPtr
        Just GVariant
jParameter -> do
            Ptr GVariant
jParameter' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
jParameter
            Ptr GVariant -> IO (Ptr GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GVariant
jParameter'
    (FunPtr C_ActionEntryChangeStateFieldCallback
-> C_ActionEntryChangeStateFieldCallback
__dynamic_C_ActionEntryActivateFieldCallback FunPtr C_ActionEntryChangeStateFieldCallback
__funPtr) Ptr SimpleAction
action' Ptr GVariant
maybeParameter Ptr ()
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
action
    Maybe GVariant -> (GVariant -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe GVariant
parameter GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | /No description available in the introspection data./
type ActionEntryActivateFieldCallback =
    Gio.SimpleAction.SimpleAction
    -> Maybe GVariant
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ActionEntryActivateFieldCallback`@.
noActionEntryActivateFieldCallback :: Maybe ActionEntryActivateFieldCallback
noActionEntryActivateFieldCallback :: Maybe ActionEntryActivateFieldCallback
noActionEntryActivateFieldCallback = Maybe ActionEntryActivateFieldCallback
forall a. Maybe a
Nothing

-- | /No description available in the introspection data./
type ActionEntryActivateFieldCallback_WithClosures =
    Gio.SimpleAction.SimpleAction
    -> Maybe GVariant
    -> Ptr ()
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ActionEntryActivateFieldCallback_WithClosures`@.
noActionEntryActivateFieldCallback_WithClosures :: Maybe ActionEntryActivateFieldCallback_WithClosures
noActionEntryActivateFieldCallback_WithClosures :: Maybe ActionEntryActivateFieldCallback_WithClosures
noActionEntryActivateFieldCallback_WithClosures = Maybe ActionEntryActivateFieldCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_ActionEntryActivateFieldCallback :: ActionEntryActivateFieldCallback -> ActionEntryActivateFieldCallback_WithClosures
drop_closures_ActionEntryActivateFieldCallback :: ActionEntryActivateFieldCallback
-> ActionEntryActivateFieldCallback_WithClosures
drop_closures_ActionEntryActivateFieldCallback ActionEntryActivateFieldCallback
_f SimpleAction
action Maybe GVariant
parameter Ptr ()
_ = ActionEntryActivateFieldCallback
_f SimpleAction
action Maybe GVariant
parameter

-- | Wrap the callback into a `GClosure`.
genClosure_ActionEntryActivateFieldCallback :: MonadIO m => ActionEntryActivateFieldCallback -> m (GClosure C_ActionEntryActivateFieldCallback)
genClosure_ActionEntryActivateFieldCallback :: forall (m :: * -> *).
MonadIO m =>
ActionEntryActivateFieldCallback
-> m (GClosure C_ActionEntryChangeStateFieldCallback)
genClosure_ActionEntryActivateFieldCallback ActionEntryActivateFieldCallback
cb = IO (GClosure C_ActionEntryChangeStateFieldCallback)
-> m (GClosure C_ActionEntryChangeStateFieldCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_ActionEntryChangeStateFieldCallback)
 -> m (GClosure C_ActionEntryChangeStateFieldCallback))
-> IO (GClosure C_ActionEntryChangeStateFieldCallback)
-> m (GClosure C_ActionEntryChangeStateFieldCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: ActionEntryActivateFieldCallback_WithClosures
cb' = ActionEntryActivateFieldCallback
-> ActionEntryActivateFieldCallback_WithClosures
drop_closures_ActionEntryActivateFieldCallback ActionEntryActivateFieldCallback
cb
    let cb'' :: C_ActionEntryChangeStateFieldCallback
cb'' = Maybe (Ptr (FunPtr C_ActionEntryChangeStateFieldCallback))
-> ActionEntryActivateFieldCallback_WithClosures
-> C_ActionEntryChangeStateFieldCallback
wrap_ActionEntryActivateFieldCallback Maybe (Ptr (FunPtr C_ActionEntryChangeStateFieldCallback))
forall a. Maybe a
Nothing ActionEntryActivateFieldCallback_WithClosures
cb'
    C_ActionEntryChangeStateFieldCallback
-> IO (FunPtr C_ActionEntryChangeStateFieldCallback)
mk_ActionEntryActivateFieldCallback C_ActionEntryChangeStateFieldCallback
cb'' IO (FunPtr C_ActionEntryChangeStateFieldCallback)
-> (FunPtr C_ActionEntryChangeStateFieldCallback
    -> IO (GClosure C_ActionEntryChangeStateFieldCallback))
-> IO (GClosure C_ActionEntryChangeStateFieldCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ActionEntryChangeStateFieldCallback
-> IO (GClosure C_ActionEntryChangeStateFieldCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `ActionEntryActivateFieldCallback` into a `C_ActionEntryActivateFieldCallback`.
wrap_ActionEntryActivateFieldCallback :: 
    Maybe (Ptr (FunPtr C_ActionEntryActivateFieldCallback)) ->
    ActionEntryActivateFieldCallback_WithClosures ->
    C_ActionEntryActivateFieldCallback
wrap_ActionEntryActivateFieldCallback :: Maybe (Ptr (FunPtr C_ActionEntryChangeStateFieldCallback))
-> ActionEntryActivateFieldCallback_WithClosures
-> C_ActionEntryChangeStateFieldCallback
wrap_ActionEntryActivateFieldCallback Maybe (Ptr (FunPtr C_ActionEntryChangeStateFieldCallback))
gi'funptrptr ActionEntryActivateFieldCallback_WithClosures
gi'cb Ptr SimpleAction
action Ptr GVariant
parameter Ptr ()
userData = do
    SimpleAction
action' <- ((ManagedPtr SimpleAction -> SimpleAction)
-> Ptr SimpleAction -> IO SimpleAction
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr SimpleAction -> SimpleAction
Gio.SimpleAction.SimpleAction) Ptr SimpleAction
action
    Maybe GVariant
maybeParameter <-
        if Ptr GVariant
parameter Ptr GVariant -> Ptr GVariant -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr GVariant
forall a. Ptr a
nullPtr
        then Maybe GVariant -> IO (Maybe GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe GVariant
forall a. Maybe a
Nothing
        else do
            GVariant
parameter' <- Ptr GVariant -> IO GVariant
B.GVariant.newGVariantFromPtr Ptr GVariant
parameter
            Maybe GVariant -> IO (Maybe GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe GVariant -> IO (Maybe GVariant))
-> Maybe GVariant -> IO (Maybe GVariant)
forall a b. (a -> b) -> a -> b
$ GVariant -> Maybe GVariant
forall a. a -> Maybe a
Just GVariant
parameter'
    ActionEntryActivateFieldCallback_WithClosures
gi'cb  SimpleAction
action' Maybe GVariant
maybeParameter Ptr ()
userData
    Maybe (Ptr (FunPtr C_ActionEntryChangeStateFieldCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_ActionEntryChangeStateFieldCallback))
gi'funptrptr