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

module GI.Gio.Objects.DBusConnection
    ( 

-- * Exported types
    DBusConnection(..)                      ,
    DBusConnectionK                         ,
    toDBusConnection                        ,
    noDBusConnection                        ,


 -- * Methods
-- ** dBusConnectionAddFilter
    dBusConnectionAddFilter                 ,


-- ** dBusConnectionCall
    dBusConnectionCall                      ,


-- ** dBusConnectionCallFinish
    dBusConnectionCallFinish                ,


-- ** dBusConnectionCallSync
    dBusConnectionCallSync                  ,


-- ** dBusConnectionCallWithUnixFdList
    dBusConnectionCallWithUnixFdList        ,


-- ** dBusConnectionCallWithUnixFdListFinish
    dBusConnectionCallWithUnixFdListFinish  ,


-- ** dBusConnectionCallWithUnixFdListSync
    dBusConnectionCallWithUnixFdListSync    ,


-- ** dBusConnectionClose
    dBusConnectionClose                     ,


-- ** dBusConnectionCloseFinish
    dBusConnectionCloseFinish               ,


-- ** dBusConnectionCloseSync
    dBusConnectionCloseSync                 ,


-- ** dBusConnectionEmitSignal
    dBusConnectionEmitSignal                ,


-- ** dBusConnectionExportActionGroup
    dBusConnectionExportActionGroup         ,


-- ** dBusConnectionExportMenuModel
    dBusConnectionExportMenuModel           ,


-- ** dBusConnectionFlush
    dBusConnectionFlush                     ,


-- ** dBusConnectionFlushFinish
    dBusConnectionFlushFinish               ,


-- ** dBusConnectionFlushSync
    dBusConnectionFlushSync                 ,


-- ** dBusConnectionGetCapabilities
    dBusConnectionGetCapabilities           ,


-- ** dBusConnectionGetExitOnClose
    dBusConnectionGetExitOnClose            ,


-- ** dBusConnectionGetGuid
    dBusConnectionGetGuid                   ,


-- ** dBusConnectionGetLastSerial
    dBusConnectionGetLastSerial             ,


-- ** dBusConnectionGetPeerCredentials
    dBusConnectionGetPeerCredentials        ,


-- ** dBusConnectionGetStream
    dBusConnectionGetStream                 ,


-- ** dBusConnectionGetUniqueName
    dBusConnectionGetUniqueName             ,


-- ** dBusConnectionIsClosed
    dBusConnectionIsClosed                  ,


-- ** dBusConnectionNew
    dBusConnectionNew                       ,


-- ** dBusConnectionNewFinish
    dBusConnectionNewFinish                 ,


-- ** dBusConnectionNewForAddress
    dBusConnectionNewForAddress             ,


-- ** dBusConnectionNewForAddressFinish
    dBusConnectionNewForAddressFinish       ,


-- ** dBusConnectionNewForAddressSync
    dBusConnectionNewForAddressSync         ,


-- ** dBusConnectionNewSync
    dBusConnectionNewSync                   ,


-- ** dBusConnectionRegisterObject
    dBusConnectionRegisterObject            ,


-- ** dBusConnectionRegisterSubtree
    dBusConnectionRegisterSubtree           ,


-- ** dBusConnectionRemoveFilter
    dBusConnectionRemoveFilter              ,


-- ** dBusConnectionSendMessage
    dBusConnectionSendMessage               ,


-- ** dBusConnectionSendMessageWithReply
    dBusConnectionSendMessageWithReply      ,


-- ** dBusConnectionSendMessageWithReplyFinish
    dBusConnectionSendMessageWithReplyFinish,


-- ** dBusConnectionSendMessageWithReplySync
    dBusConnectionSendMessageWithReplySync  ,


-- ** dBusConnectionSetExitOnClose
    dBusConnectionSetExitOnClose            ,


-- ** dBusConnectionSignalSubscribe
    dBusConnectionSignalSubscribe           ,


-- ** dBusConnectionSignalUnsubscribe
    dBusConnectionSignalUnsubscribe         ,


-- ** dBusConnectionStartMessageProcessing
    dBusConnectionStartMessageProcessing    ,


-- ** dBusConnectionUnexportActionGroup
    dBusConnectionUnexportActionGroup       ,


-- ** dBusConnectionUnexportMenuModel
    dBusConnectionUnexportMenuModel         ,


-- ** dBusConnectionUnregisterObject
    dBusConnectionUnregisterObject          ,


-- ** dBusConnectionUnregisterSubtree
    dBusConnectionUnregisterSubtree         ,




 -- * Properties
-- ** Address
    DBusConnectionAddressPropertyInfo       ,
    constructDBusConnectionAddress          ,


-- ** AuthenticationObserver
    DBusConnectionAuthenticationObserverPropertyInfo,
    constructDBusConnectionAuthenticationObserver,


-- ** Capabilities
    DBusConnectionCapabilitiesPropertyInfo  ,
    getDBusConnectionCapabilities           ,


-- ** Closed
    DBusConnectionClosedPropertyInfo        ,
    getDBusConnectionClosed                 ,


-- ** ExitOnClose
    DBusConnectionExitOnClosePropertyInfo   ,
    constructDBusConnectionExitOnClose      ,
    getDBusConnectionExitOnClose            ,
    setDBusConnectionExitOnClose            ,


-- ** Flags
    DBusConnectionFlagsPropertyInfo         ,
    constructDBusConnectionFlags            ,


-- ** Guid
    DBusConnectionGuidPropertyInfo          ,
    constructDBusConnectionGuid             ,
    getDBusConnectionGuid                   ,


-- ** Stream
    DBusConnectionStreamPropertyInfo        ,
    constructDBusConnectionStream           ,
    getDBusConnectionStream                 ,


-- ** UniqueName
    DBusConnectionUniqueNamePropertyInfo    ,
    getDBusConnectionUniqueName             ,




 -- * Signals
-- ** Closed
    DBusConnectionClosedCallback            ,
    DBusConnectionClosedCallbackC           ,
    DBusConnectionClosedSignalInfo          ,
    afterDBusConnectionClosed               ,
    dBusConnectionClosedCallbackWrapper     ,
    dBusConnectionClosedClosure             ,
    mkDBusConnectionClosedCallback          ,
    noDBusConnectionClosedCallback          ,
    onDBusConnectionClosed                  ,




    ) where

import Prelude ()
import Data.GI.Base.ShortPrelude

import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map

import GI.Gio.Types
import GI.Gio.Callbacks
import qualified GI.GLib as GLib
import qualified GI.GObject as GObject

newtype DBusConnection = DBusConnection (ForeignPtr DBusConnection)
foreign import ccall "g_dbus_connection_get_type"
    c_g_dbus_connection_get_type :: IO GType

type instance ParentTypes DBusConnection = DBusConnectionParentTypes
type DBusConnectionParentTypes = '[GObject.Object, AsyncInitable, Initable]

instance GObject DBusConnection where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_g_dbus_connection_get_type
    

class GObject o => DBusConnectionK o
instance (GObject o, IsDescendantOf DBusConnection o) => DBusConnectionK o

toDBusConnection :: DBusConnectionK o => o -> IO DBusConnection
toDBusConnection = unsafeCastTo DBusConnection

noDBusConnection :: Maybe DBusConnection
noDBusConnection = Nothing

-- signal DBusConnection::closed
type DBusConnectionClosedCallback =
    Bool ->
    Maybe GError ->
    IO ()

noDBusConnectionClosedCallback :: Maybe DBusConnectionClosedCallback
noDBusConnectionClosedCallback = Nothing

type DBusConnectionClosedCallbackC =
    Ptr () ->                               -- object
    CInt ->
    Ptr GError ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mkDBusConnectionClosedCallback :: DBusConnectionClosedCallbackC -> IO (FunPtr DBusConnectionClosedCallbackC)

dBusConnectionClosedClosure :: DBusConnectionClosedCallback -> IO Closure
dBusConnectionClosedClosure cb = newCClosure =<< mkDBusConnectionClosedCallback wrapped
    where wrapped = dBusConnectionClosedCallbackWrapper cb

dBusConnectionClosedCallbackWrapper ::
    DBusConnectionClosedCallback ->
    Ptr () ->
    CInt ->
    Ptr GError ->
    Ptr () ->
    IO ()
dBusConnectionClosedCallbackWrapper _cb _ remote_peer_vanished error_ _ = do
    let remote_peer_vanished' = (/= 0) remote_peer_vanished
    maybeError_ <-
        if error_ == nullPtr
        then return Nothing
        else do
            error_' <- (newBoxed GError) error_
            return $ Just error_'
    _cb  remote_peer_vanished' maybeError_

onDBusConnectionClosed :: (GObject a, MonadIO m) => a -> DBusConnectionClosedCallback -> m SignalHandlerId
onDBusConnectionClosed obj cb = liftIO $ connectDBusConnectionClosed obj cb SignalConnectBefore
afterDBusConnectionClosed :: (GObject a, MonadIO m) => a -> DBusConnectionClosedCallback -> m SignalHandlerId
afterDBusConnectionClosed obj cb = connectDBusConnectionClosed obj cb SignalConnectAfter

connectDBusConnectionClosed :: (GObject a, MonadIO m) =>
                               a -> DBusConnectionClosedCallback -> SignalConnectMode -> m SignalHandlerId
connectDBusConnectionClosed obj cb after = liftIO $ do
    cb' <- mkDBusConnectionClosedCallback (dBusConnectionClosedCallbackWrapper cb)
    connectSignalFunPtr obj "closed" cb' after

-- VVV Prop "address"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyWritable,PropertyConstructOnly]

constructDBusConnectionAddress :: T.Text -> IO ([Char], GValue)
constructDBusConnectionAddress val = constructObjectPropertyString "address" val

data DBusConnectionAddressPropertyInfo
instance AttrInfo DBusConnectionAddressPropertyInfo where
    type AttrAllowedOps DBusConnectionAddressPropertyInfo = '[ 'AttrConstruct]
    type AttrSetTypeConstraint DBusConnectionAddressPropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint DBusConnectionAddressPropertyInfo = DBusConnectionK
    type AttrGetType DBusConnectionAddressPropertyInfo = ()
    type AttrLabel DBusConnectionAddressPropertyInfo = "DBusConnection::address"
    attrGet _ = undefined
    attrSet _ = undefined
    attrConstruct _ = constructDBusConnectionAddress

-- VVV Prop "authentication-observer"
   -- Type: TInterface "Gio" "DBusAuthObserver"
   -- Flags: [PropertyWritable,PropertyConstructOnly]

constructDBusConnectionAuthenticationObserver :: (DBusAuthObserverK a) => a -> IO ([Char], GValue)
constructDBusConnectionAuthenticationObserver val = constructObjectPropertyObject "authentication-observer" val

data DBusConnectionAuthenticationObserverPropertyInfo
instance AttrInfo DBusConnectionAuthenticationObserverPropertyInfo where
    type AttrAllowedOps DBusConnectionAuthenticationObserverPropertyInfo = '[ 'AttrConstruct]
    type AttrSetTypeConstraint DBusConnectionAuthenticationObserverPropertyInfo = DBusAuthObserverK
    type AttrBaseTypeConstraint DBusConnectionAuthenticationObserverPropertyInfo = DBusConnectionK
    type AttrGetType DBusConnectionAuthenticationObserverPropertyInfo = ()
    type AttrLabel DBusConnectionAuthenticationObserverPropertyInfo = "DBusConnection::authentication-observer"
    attrGet _ = undefined
    attrSet _ = undefined
    attrConstruct _ = constructDBusConnectionAuthenticationObserver

-- VVV Prop "capabilities"
   -- Type: TInterface "Gio" "DBusCapabilityFlags"
   -- Flags: [PropertyReadable]

getDBusConnectionCapabilities :: (MonadIO m, DBusConnectionK o) => o -> m [DBusCapabilityFlags]
getDBusConnectionCapabilities obj = liftIO $ getObjectPropertyFlags obj "capabilities"

data DBusConnectionCapabilitiesPropertyInfo
instance AttrInfo DBusConnectionCapabilitiesPropertyInfo where
    type AttrAllowedOps DBusConnectionCapabilitiesPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DBusConnectionCapabilitiesPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DBusConnectionCapabilitiesPropertyInfo = DBusConnectionK
    type AttrGetType DBusConnectionCapabilitiesPropertyInfo = [DBusCapabilityFlags]
    type AttrLabel DBusConnectionCapabilitiesPropertyInfo = "DBusConnection::capabilities"
    attrGet _ = getDBusConnectionCapabilities
    attrSet _ = undefined
    attrConstruct _ = undefined

-- VVV Prop "closed"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable]

getDBusConnectionClosed :: (MonadIO m, DBusConnectionK o) => o -> m Bool
getDBusConnectionClosed obj = liftIO $ getObjectPropertyBool obj "closed"

data DBusConnectionClosedPropertyInfo
instance AttrInfo DBusConnectionClosedPropertyInfo where
    type AttrAllowedOps DBusConnectionClosedPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DBusConnectionClosedPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DBusConnectionClosedPropertyInfo = DBusConnectionK
    type AttrGetType DBusConnectionClosedPropertyInfo = Bool
    type AttrLabel DBusConnectionClosedPropertyInfo = "DBusConnection::closed"
    attrGet _ = getDBusConnectionClosed
    attrSet _ = undefined
    attrConstruct _ = undefined

-- VVV Prop "exit-on-close"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable]

getDBusConnectionExitOnClose :: (MonadIO m, DBusConnectionK o) => o -> m Bool
getDBusConnectionExitOnClose obj = liftIO $ getObjectPropertyBool obj "exit-on-close"

setDBusConnectionExitOnClose :: (MonadIO m, DBusConnectionK o) => o -> Bool -> m ()
setDBusConnectionExitOnClose obj val = liftIO $ setObjectPropertyBool obj "exit-on-close" val

constructDBusConnectionExitOnClose :: Bool -> IO ([Char], GValue)
constructDBusConnectionExitOnClose val = constructObjectPropertyBool "exit-on-close" val

data DBusConnectionExitOnClosePropertyInfo
instance AttrInfo DBusConnectionExitOnClosePropertyInfo where
    type AttrAllowedOps DBusConnectionExitOnClosePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint DBusConnectionExitOnClosePropertyInfo = (~) Bool
    type AttrBaseTypeConstraint DBusConnectionExitOnClosePropertyInfo = DBusConnectionK
    type AttrGetType DBusConnectionExitOnClosePropertyInfo = Bool
    type AttrLabel DBusConnectionExitOnClosePropertyInfo = "DBusConnection::exit-on-close"
    attrGet _ = getDBusConnectionExitOnClose
    attrSet _ = setDBusConnectionExitOnClose
    attrConstruct _ = constructDBusConnectionExitOnClose

-- VVV Prop "flags"
   -- Type: TInterface "Gio" "DBusConnectionFlags"
   -- Flags: [PropertyWritable,PropertyConstructOnly]

constructDBusConnectionFlags :: [DBusConnectionFlags] -> IO ([Char], GValue)
constructDBusConnectionFlags val = constructObjectPropertyFlags "flags" val

data DBusConnectionFlagsPropertyInfo
instance AttrInfo DBusConnectionFlagsPropertyInfo where
    type AttrAllowedOps DBusConnectionFlagsPropertyInfo = '[ 'AttrConstruct]
    type AttrSetTypeConstraint DBusConnectionFlagsPropertyInfo = (~) [DBusConnectionFlags]
    type AttrBaseTypeConstraint DBusConnectionFlagsPropertyInfo = DBusConnectionK
    type AttrGetType DBusConnectionFlagsPropertyInfo = ()
    type AttrLabel DBusConnectionFlagsPropertyInfo = "DBusConnection::flags"
    attrGet _ = undefined
    attrSet _ = undefined
    attrConstruct _ = constructDBusConnectionFlags

-- VVV Prop "guid"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]

getDBusConnectionGuid :: (MonadIO m, DBusConnectionK o) => o -> m T.Text
getDBusConnectionGuid obj = liftIO $ getObjectPropertyString obj "guid"

constructDBusConnectionGuid :: T.Text -> IO ([Char], GValue)
constructDBusConnectionGuid val = constructObjectPropertyString "guid" val

data DBusConnectionGuidPropertyInfo
instance AttrInfo DBusConnectionGuidPropertyInfo where
    type AttrAllowedOps DBusConnectionGuidPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint DBusConnectionGuidPropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint DBusConnectionGuidPropertyInfo = DBusConnectionK
    type AttrGetType DBusConnectionGuidPropertyInfo = T.Text
    type AttrLabel DBusConnectionGuidPropertyInfo = "DBusConnection::guid"
    attrGet _ = getDBusConnectionGuid
    attrSet _ = undefined
    attrConstruct _ = constructDBusConnectionGuid

-- VVV Prop "stream"
   -- Type: TInterface "Gio" "IOStream"
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]

getDBusConnectionStream :: (MonadIO m, DBusConnectionK o) => o -> m IOStream
getDBusConnectionStream obj = liftIO $ getObjectPropertyObject obj "stream" IOStream

constructDBusConnectionStream :: (IOStreamK a) => a -> IO ([Char], GValue)
constructDBusConnectionStream val = constructObjectPropertyObject "stream" val

data DBusConnectionStreamPropertyInfo
instance AttrInfo DBusConnectionStreamPropertyInfo where
    type AttrAllowedOps DBusConnectionStreamPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint DBusConnectionStreamPropertyInfo = IOStreamK
    type AttrBaseTypeConstraint DBusConnectionStreamPropertyInfo = DBusConnectionK
    type AttrGetType DBusConnectionStreamPropertyInfo = IOStream
    type AttrLabel DBusConnectionStreamPropertyInfo = "DBusConnection::stream"
    attrGet _ = getDBusConnectionStream
    attrSet _ = undefined
    attrConstruct _ = constructDBusConnectionStream

-- VVV Prop "unique-name"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable]

getDBusConnectionUniqueName :: (MonadIO m, DBusConnectionK o) => o -> m T.Text
getDBusConnectionUniqueName obj = liftIO $ getObjectPropertyString obj "unique-name"

data DBusConnectionUniqueNamePropertyInfo
instance AttrInfo DBusConnectionUniqueNamePropertyInfo where
    type AttrAllowedOps DBusConnectionUniqueNamePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DBusConnectionUniqueNamePropertyInfo = (~) ()
    type AttrBaseTypeConstraint DBusConnectionUniqueNamePropertyInfo = DBusConnectionK
    type AttrGetType DBusConnectionUniqueNamePropertyInfo = T.Text
    type AttrLabel DBusConnectionUniqueNamePropertyInfo = "DBusConnection::unique-name"
    attrGet _ = getDBusConnectionUniqueName
    attrSet _ = undefined
    attrConstruct _ = undefined

type instance AttributeList DBusConnection = DBusConnectionAttributeList
type DBusConnectionAttributeList = ('[ '("address", DBusConnectionAddressPropertyInfo), '("authentication-observer", DBusConnectionAuthenticationObserverPropertyInfo), '("capabilities", DBusConnectionCapabilitiesPropertyInfo), '("closed", DBusConnectionClosedPropertyInfo), '("exit-on-close", DBusConnectionExitOnClosePropertyInfo), '("flags", DBusConnectionFlagsPropertyInfo), '("guid", DBusConnectionGuidPropertyInfo), '("stream", DBusConnectionStreamPropertyInfo), '("unique-name", DBusConnectionUniqueNamePropertyInfo)] :: [(Symbol, *)])

data DBusConnectionClosedSignalInfo
instance SignalInfo DBusConnectionClosedSignalInfo where
    type HaskellCallbackType DBusConnectionClosedSignalInfo = DBusConnectionClosedCallback
    connectSignal _ = connectDBusConnectionClosed

type instance SignalList DBusConnection = DBusConnectionSignalList
type DBusConnectionSignalList = ('[ '("closed", DBusConnectionClosedSignalInfo), '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method DBusConnection::new_finish
-- method type : Constructor
-- Args : [Arg {argName = "res", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "res", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "DBusConnection"
-- throws : True
-- Skip return : False

foreign import ccall "g_dbus_connection_new_finish" g_dbus_connection_new_finish :: 
    Ptr AsyncResult ->                      -- res : TInterface "Gio" "AsyncResult"
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr DBusConnection)


dBusConnectionNewFinish ::
    (MonadIO m, AsyncResultK a) =>
    a ->                                    -- res
    m DBusConnection
dBusConnectionNewFinish res = liftIO $ do
    let res' = unsafeManagedPtrCastPtr res
    onException (do
        result <- propagateGError $ g_dbus_connection_new_finish res'
        checkUnexpectedReturnNULL "g_dbus_connection_new_finish" result
        result' <- (wrapObject DBusConnection) result
        touchManagedPtr res
        return result'
     ) (do
        return ()
     )

-- method DBusConnection::new_for_address_finish
-- method type : Constructor
-- Args : [Arg {argName = "res", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "res", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "DBusConnection"
-- throws : True
-- Skip return : False

foreign import ccall "g_dbus_connection_new_for_address_finish" g_dbus_connection_new_for_address_finish :: 
    Ptr AsyncResult ->                      -- res : TInterface "Gio" "AsyncResult"
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr DBusConnection)


dBusConnectionNewForAddressFinish ::
    (MonadIO m, AsyncResultK a) =>
    a ->                                    -- res
    m DBusConnection
dBusConnectionNewForAddressFinish res = liftIO $ do
    let res' = unsafeManagedPtrCastPtr res
    onException (do
        result <- propagateGError $ g_dbus_connection_new_for_address_finish res'
        checkUnexpectedReturnNULL "g_dbus_connection_new_for_address_finish" result
        result' <- (wrapObject DBusConnection) result
        touchManagedPtr res
        return result'
     ) (do
        return ()
     )

-- method DBusConnection::new_for_address_sync
-- method type : Constructor
-- Args : [Arg {argName = "address", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "DBusConnectionFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "observer", argType = TInterface "Gio" "DBusAuthObserver", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "address", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "DBusConnectionFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "observer", argType = TInterface "Gio" "DBusAuthObserver", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "DBusConnection"
-- throws : True
-- Skip return : False

foreign import ccall "g_dbus_connection_new_for_address_sync" g_dbus_connection_new_for_address_sync :: 
    CString ->                              -- address : TBasicType TUTF8
    CUInt ->                                -- flags : TInterface "Gio" "DBusConnectionFlags"
    Ptr DBusAuthObserver ->                 -- observer : TInterface "Gio" "DBusAuthObserver"
    Ptr Cancellable ->                      -- cancellable : TInterface "Gio" "Cancellable"
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr DBusConnection)


dBusConnectionNewForAddressSync ::
    (MonadIO m, DBusAuthObserverK a, CancellableK b) =>
    T.Text ->                               -- address
    [DBusConnectionFlags] ->                -- flags
    Maybe (a) ->                            -- observer
    Maybe (b) ->                            -- cancellable
    m DBusConnection
dBusConnectionNewForAddressSync address flags observer cancellable = liftIO $ do
    address' <- textToCString address
    let flags' = gflagsToWord flags
    maybeObserver <- case observer of
        Nothing -> return nullPtr
        Just jObserver -> do
            let jObserver' = unsafeManagedPtrCastPtr jObserver
            return jObserver'
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            let jCancellable' = unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        result <- propagateGError $ g_dbus_connection_new_for_address_sync address' flags' maybeObserver maybeCancellable
        checkUnexpectedReturnNULL "g_dbus_connection_new_for_address_sync" result
        result' <- (wrapObject DBusConnection) result
        whenJust observer touchManagedPtr
        whenJust cancellable touchManagedPtr
        freeMem address'
        return result'
     ) (do
        freeMem address'
     )

-- method DBusConnection::new_sync
-- method type : Constructor
-- Args : [Arg {argName = "stream", argType = TInterface "Gio" "IOStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "guid", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "DBusConnectionFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "observer", argType = TInterface "Gio" "DBusAuthObserver", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "stream", argType = TInterface "Gio" "IOStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "guid", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "DBusConnectionFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "observer", argType = TInterface "Gio" "DBusAuthObserver", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "DBusConnection"
-- throws : True
-- Skip return : False

foreign import ccall "g_dbus_connection_new_sync" g_dbus_connection_new_sync :: 
    Ptr IOStream ->                         -- stream : TInterface "Gio" "IOStream"
    CString ->                              -- guid : TBasicType TUTF8
    CUInt ->                                -- flags : TInterface "Gio" "DBusConnectionFlags"
    Ptr DBusAuthObserver ->                 -- observer : TInterface "Gio" "DBusAuthObserver"
    Ptr Cancellable ->                      -- cancellable : TInterface "Gio" "Cancellable"
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr DBusConnection)


dBusConnectionNewSync ::
    (MonadIO m, IOStreamK a, DBusAuthObserverK b, CancellableK c) =>
    a ->                                    -- stream
    Maybe (T.Text) ->                       -- guid
    [DBusConnectionFlags] ->                -- flags
    Maybe (b) ->                            -- observer
    Maybe (c) ->                            -- cancellable
    m DBusConnection
dBusConnectionNewSync stream guid flags observer cancellable = liftIO $ do
    let stream' = unsafeManagedPtrCastPtr stream
    maybeGuid <- case guid of
        Nothing -> return nullPtr
        Just jGuid -> do
            jGuid' <- textToCString jGuid
            return jGuid'
    let flags' = gflagsToWord flags
    maybeObserver <- case observer of
        Nothing -> return nullPtr
        Just jObserver -> do
            let jObserver' = unsafeManagedPtrCastPtr jObserver
            return jObserver'
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            let jCancellable' = unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        result <- propagateGError $ g_dbus_connection_new_sync stream' maybeGuid flags' maybeObserver maybeCancellable
        checkUnexpectedReturnNULL "g_dbus_connection_new_sync" result
        result' <- (wrapObject DBusConnection) result
        touchManagedPtr stream
        whenJust observer touchManagedPtr
        whenJust cancellable touchManagedPtr
        freeMem maybeGuid
        return result'
     ) (do
        freeMem maybeGuid
     )

-- method DBusConnection::add_filter
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "filter_function", argType = TInterface "Gio" "DBusMessageFilterFunction", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeNotified, argClosure = 2, argDestroy = 3, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data_free_func", argType = TInterface "GLib" "DestroyNotify", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "filter_function", argType = TInterface "Gio" "DBusMessageFilterFunction", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeNotified, argClosure = 2, argDestroy = 3, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_connection_add_filter" g_dbus_connection_add_filter :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    FunPtr DBusMessageFilterFunctionC ->    -- filter_function : TInterface "Gio" "DBusMessageFilterFunction"
    Ptr () ->                               -- user_data : TBasicType TVoid
    FunPtr GLib.DestroyNotifyC ->           -- user_data_free_func : TInterface "GLib" "DestroyNotify"
    IO Word32


dBusConnectionAddFilter ::
    (MonadIO m, DBusConnectionK a) =>
    a ->                                    -- _obj
    DBusMessageFilterFunction ->            -- filter_function
    m Word32
dBusConnectionAddFilter _obj filter_function = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    filter_function' <- mkDBusMessageFilterFunction (dBusMessageFilterFunctionWrapper Nothing filter_function)
    let user_data = castFunPtrToPtr filter_function'
    let user_data_free_func = safeFreeFunPtrPtr
    result <- g_dbus_connection_add_filter _obj' filter_function' user_data user_data_free_func
    touchManagedPtr _obj
    return result

-- method DBusConnection::call
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "bus_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "interface_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "method_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "parameters", argType = TVariant, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "reply_type", argType = TInterface "GLib" "VariantType", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "DBusCallFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "timeout_msec", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 11, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "bus_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "interface_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "method_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "parameters", argType = TVariant, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "reply_type", argType = TInterface "GLib" "VariantType", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "DBusCallFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "timeout_msec", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 11, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_connection_call" g_dbus_connection_call :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    CString ->                              -- bus_name : TBasicType TUTF8
    CString ->                              -- object_path : TBasicType TUTF8
    CString ->                              -- interface_name : TBasicType TUTF8
    CString ->                              -- method_name : TBasicType TUTF8
    Ptr GVariant ->                         -- parameters : TVariant
    Ptr GLib.VariantType ->                 -- reply_type : TInterface "GLib" "VariantType"
    CUInt ->                                -- flags : TInterface "Gio" "DBusCallFlags"
    Int32 ->                                -- timeout_msec : TBasicType TInt32
    Ptr Cancellable ->                      -- cancellable : TInterface "Gio" "Cancellable"
    FunPtr AsyncReadyCallbackC ->           -- callback : TInterface "Gio" "AsyncReadyCallback"
    Ptr () ->                               -- user_data : TBasicType TVoid
    IO ()


dBusConnectionCall ::
    (MonadIO m, DBusConnectionK a, CancellableK b) =>
    a ->                                    -- _obj
    Maybe (T.Text) ->                       -- bus_name
    T.Text ->                               -- object_path
    T.Text ->                               -- interface_name
    T.Text ->                               -- method_name
    Maybe (GVariant) ->                     -- parameters
    Maybe (GLib.VariantType) ->             -- reply_type
    [DBusCallFlags] ->                      -- flags
    Int32 ->                                -- timeout_msec
    Maybe (b) ->                            -- cancellable
    Maybe (AsyncReadyCallback) ->           -- callback
    m ()
dBusConnectionCall _obj bus_name object_path interface_name method_name parameters reply_type flags timeout_msec cancellable callback = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeBus_name <- case bus_name of
        Nothing -> return nullPtr
        Just jBus_name -> do
            jBus_name' <- textToCString jBus_name
            return jBus_name'
    object_path' <- textToCString object_path
    interface_name' <- textToCString interface_name
    method_name' <- textToCString method_name
    maybeParameters <- case parameters of
        Nothing -> return nullPtr
        Just jParameters -> do
            let jParameters' = unsafeManagedPtrGetPtr jParameters
            return jParameters'
    maybeReply_type <- case reply_type of
        Nothing -> return nullPtr
        Just jReply_type -> do
            let jReply_type' = unsafeManagedPtrGetPtr jReply_type
            return jReply_type'
    let flags' = gflagsToWord flags
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            let jCancellable' = unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    ptrcallback <- callocMem :: IO (Ptr (FunPtr AsyncReadyCallbackC))
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            jCallback' <- mkAsyncReadyCallback (asyncReadyCallbackWrapper (Just ptrcallback) jCallback)
            poke ptrcallback jCallback'
            return jCallback'
    let user_data = nullPtr
    g_dbus_connection_call _obj' maybeBus_name object_path' interface_name' method_name' maybeParameters maybeReply_type flags' timeout_msec maybeCancellable maybeCallback user_data
    touchManagedPtr _obj
    whenJust reply_type touchManagedPtr
    whenJust cancellable touchManagedPtr
    freeMem maybeBus_name
    freeMem object_path'
    freeMem interface_name'
    freeMem method_name'
    return ()

-- method DBusConnection::call_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "res", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "res", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TVariant
-- throws : True
-- Skip return : False

foreign import ccall "g_dbus_connection_call_finish" g_dbus_connection_call_finish :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    Ptr AsyncResult ->                      -- res : TInterface "Gio" "AsyncResult"
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr GVariant)


dBusConnectionCallFinish ::
    (MonadIO m, DBusConnectionK a, AsyncResultK b) =>
    a ->                                    -- _obj
    b ->                                    -- res
    m GVariant
dBusConnectionCallFinish _obj res = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let res' = unsafeManagedPtrCastPtr res
    onException (do
        result <- propagateGError $ g_dbus_connection_call_finish _obj' res'
        checkUnexpectedReturnNULL "g_dbus_connection_call_finish" result
        result' <- wrapGVariantPtr result
        touchManagedPtr _obj
        touchManagedPtr res
        return result'
     ) (do
        return ()
     )

-- method DBusConnection::call_sync
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "bus_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "interface_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "method_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "parameters", argType = TVariant, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "reply_type", argType = TInterface "GLib" "VariantType", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "DBusCallFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "timeout_msec", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "bus_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "interface_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "method_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "parameters", argType = TVariant, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "reply_type", argType = TInterface "GLib" "VariantType", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "DBusCallFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "timeout_msec", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TVariant
-- throws : True
-- Skip return : False

foreign import ccall "g_dbus_connection_call_sync" g_dbus_connection_call_sync :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    CString ->                              -- bus_name : TBasicType TUTF8
    CString ->                              -- object_path : TBasicType TUTF8
    CString ->                              -- interface_name : TBasicType TUTF8
    CString ->                              -- method_name : TBasicType TUTF8
    Ptr GVariant ->                         -- parameters : TVariant
    Ptr GLib.VariantType ->                 -- reply_type : TInterface "GLib" "VariantType"
    CUInt ->                                -- flags : TInterface "Gio" "DBusCallFlags"
    Int32 ->                                -- timeout_msec : TBasicType TInt32
    Ptr Cancellable ->                      -- cancellable : TInterface "Gio" "Cancellable"
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr GVariant)


dBusConnectionCallSync ::
    (MonadIO m, DBusConnectionK a, CancellableK b) =>
    a ->                                    -- _obj
    Maybe (T.Text) ->                       -- bus_name
    T.Text ->                               -- object_path
    T.Text ->                               -- interface_name
    T.Text ->                               -- method_name
    Maybe (GVariant) ->                     -- parameters
    Maybe (GLib.VariantType) ->             -- reply_type
    [DBusCallFlags] ->                      -- flags
    Int32 ->                                -- timeout_msec
    Maybe (b) ->                            -- cancellable
    m GVariant
dBusConnectionCallSync _obj bus_name object_path interface_name method_name parameters reply_type flags timeout_msec cancellable = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeBus_name <- case bus_name of
        Nothing -> return nullPtr
        Just jBus_name -> do
            jBus_name' <- textToCString jBus_name
            return jBus_name'
    object_path' <- textToCString object_path
    interface_name' <- textToCString interface_name
    method_name' <- textToCString method_name
    maybeParameters <- case parameters of
        Nothing -> return nullPtr
        Just jParameters -> do
            let jParameters' = unsafeManagedPtrGetPtr jParameters
            return jParameters'
    maybeReply_type <- case reply_type of
        Nothing -> return nullPtr
        Just jReply_type -> do
            let jReply_type' = unsafeManagedPtrGetPtr jReply_type
            return jReply_type'
    let flags' = gflagsToWord flags
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            let jCancellable' = unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        result <- propagateGError $ g_dbus_connection_call_sync _obj' maybeBus_name object_path' interface_name' method_name' maybeParameters maybeReply_type flags' timeout_msec maybeCancellable
        checkUnexpectedReturnNULL "g_dbus_connection_call_sync" result
        result' <- wrapGVariantPtr result
        touchManagedPtr _obj
        whenJust reply_type touchManagedPtr
        whenJust cancellable touchManagedPtr
        freeMem maybeBus_name
        freeMem object_path'
        freeMem interface_name'
        freeMem method_name'
        return result'
     ) (do
        freeMem maybeBus_name
        freeMem object_path'
        freeMem interface_name'
        freeMem method_name'
     )

-- method DBusConnection::call_with_unix_fd_list
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "bus_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "interface_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "method_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "parameters", argType = TVariant, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "reply_type", argType = TInterface "GLib" "VariantType", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "DBusCallFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "timeout_msec", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "fd_list", argType = TInterface "Gio" "UnixFDList", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 12, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "bus_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "interface_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "method_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "parameters", argType = TVariant, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "reply_type", argType = TInterface "GLib" "VariantType", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "DBusCallFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "timeout_msec", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "fd_list", argType = TInterface "Gio" "UnixFDList", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 12, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_connection_call_with_unix_fd_list" g_dbus_connection_call_with_unix_fd_list :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    CString ->                              -- bus_name : TBasicType TUTF8
    CString ->                              -- object_path : TBasicType TUTF8
    CString ->                              -- interface_name : TBasicType TUTF8
    CString ->                              -- method_name : TBasicType TUTF8
    Ptr GVariant ->                         -- parameters : TVariant
    Ptr GLib.VariantType ->                 -- reply_type : TInterface "GLib" "VariantType"
    CUInt ->                                -- flags : TInterface "Gio" "DBusCallFlags"
    Int32 ->                                -- timeout_msec : TBasicType TInt32
    Ptr UnixFDList ->                       -- fd_list : TInterface "Gio" "UnixFDList"
    Ptr Cancellable ->                      -- cancellable : TInterface "Gio" "Cancellable"
    FunPtr AsyncReadyCallbackC ->           -- callback : TInterface "Gio" "AsyncReadyCallback"
    Ptr () ->                               -- user_data : TBasicType TVoid
    IO ()


dBusConnectionCallWithUnixFdList ::
    (MonadIO m, DBusConnectionK a, UnixFDListK b, CancellableK c) =>
    a ->                                    -- _obj
    Maybe (T.Text) ->                       -- bus_name
    T.Text ->                               -- object_path
    T.Text ->                               -- interface_name
    T.Text ->                               -- method_name
    Maybe (GVariant) ->                     -- parameters
    Maybe (GLib.VariantType) ->             -- reply_type
    [DBusCallFlags] ->                      -- flags
    Int32 ->                                -- timeout_msec
    Maybe (b) ->                            -- fd_list
    Maybe (c) ->                            -- cancellable
    Maybe (AsyncReadyCallback) ->           -- callback
    m ()
dBusConnectionCallWithUnixFdList _obj bus_name object_path interface_name method_name parameters reply_type flags timeout_msec fd_list cancellable callback = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeBus_name <- case bus_name of
        Nothing -> return nullPtr
        Just jBus_name -> do
            jBus_name' <- textToCString jBus_name
            return jBus_name'
    object_path' <- textToCString object_path
    interface_name' <- textToCString interface_name
    method_name' <- textToCString method_name
    maybeParameters <- case parameters of
        Nothing -> return nullPtr
        Just jParameters -> do
            let jParameters' = unsafeManagedPtrGetPtr jParameters
            return jParameters'
    maybeReply_type <- case reply_type of
        Nothing -> return nullPtr
        Just jReply_type -> do
            let jReply_type' = unsafeManagedPtrGetPtr jReply_type
            return jReply_type'
    let flags' = gflagsToWord flags
    maybeFd_list <- case fd_list of
        Nothing -> return nullPtr
        Just jFd_list -> do
            let jFd_list' = unsafeManagedPtrCastPtr jFd_list
            return jFd_list'
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            let jCancellable' = unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    ptrcallback <- callocMem :: IO (Ptr (FunPtr AsyncReadyCallbackC))
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            jCallback' <- mkAsyncReadyCallback (asyncReadyCallbackWrapper (Just ptrcallback) jCallback)
            poke ptrcallback jCallback'
            return jCallback'
    let user_data = nullPtr
    g_dbus_connection_call_with_unix_fd_list _obj' maybeBus_name object_path' interface_name' method_name' maybeParameters maybeReply_type flags' timeout_msec maybeFd_list maybeCancellable maybeCallback user_data
    touchManagedPtr _obj
    whenJust reply_type touchManagedPtr
    whenJust fd_list touchManagedPtr
    whenJust cancellable touchManagedPtr
    freeMem maybeBus_name
    freeMem object_path'
    freeMem interface_name'
    freeMem method_name'
    return ()

-- method DBusConnection::call_with_unix_fd_list_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "out_fd_list", argType = TInterface "Gio" "UnixFDList", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "res", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "res", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TVariant
-- throws : True
-- Skip return : False

foreign import ccall "g_dbus_connection_call_with_unix_fd_list_finish" g_dbus_connection_call_with_unix_fd_list_finish :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    Ptr (Ptr UnixFDList) ->                 -- out_fd_list : TInterface "Gio" "UnixFDList"
    Ptr AsyncResult ->                      -- res : TInterface "Gio" "AsyncResult"
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr GVariant)


dBusConnectionCallWithUnixFdListFinish ::
    (MonadIO m, DBusConnectionK a, AsyncResultK b) =>
    a ->                                    -- _obj
    b ->                                    -- res
    m (GVariant,UnixFDList)
dBusConnectionCallWithUnixFdListFinish _obj res = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    out_fd_list <- allocMem :: IO (Ptr (Ptr UnixFDList))
    let res' = unsafeManagedPtrCastPtr res
    onException (do
        result <- propagateGError $ g_dbus_connection_call_with_unix_fd_list_finish _obj' out_fd_list res'
        checkUnexpectedReturnNULL "g_dbus_connection_call_with_unix_fd_list_finish" result
        result' <- wrapGVariantPtr result
        out_fd_list' <- peek out_fd_list
        out_fd_list'' <- (wrapObject UnixFDList) out_fd_list'
        touchManagedPtr _obj
        touchManagedPtr res
        freeMem out_fd_list
        return (result', out_fd_list'')
     ) (do
        freeMem out_fd_list
     )

-- method DBusConnection::call_with_unix_fd_list_sync
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "bus_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "interface_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "method_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "parameters", argType = TVariant, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "reply_type", argType = TInterface "GLib" "VariantType", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "DBusCallFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "timeout_msec", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "fd_list", argType = TInterface "Gio" "UnixFDList", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "out_fd_list", argType = TInterface "Gio" "UnixFDList", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "bus_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "interface_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "method_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "parameters", argType = TVariant, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "reply_type", argType = TInterface "GLib" "VariantType", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "DBusCallFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "timeout_msec", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "fd_list", argType = TInterface "Gio" "UnixFDList", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TVariant
-- throws : True
-- Skip return : False

foreign import ccall "g_dbus_connection_call_with_unix_fd_list_sync" g_dbus_connection_call_with_unix_fd_list_sync :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    CString ->                              -- bus_name : TBasicType TUTF8
    CString ->                              -- object_path : TBasicType TUTF8
    CString ->                              -- interface_name : TBasicType TUTF8
    CString ->                              -- method_name : TBasicType TUTF8
    Ptr GVariant ->                         -- parameters : TVariant
    Ptr GLib.VariantType ->                 -- reply_type : TInterface "GLib" "VariantType"
    CUInt ->                                -- flags : TInterface "Gio" "DBusCallFlags"
    Int32 ->                                -- timeout_msec : TBasicType TInt32
    Ptr UnixFDList ->                       -- fd_list : TInterface "Gio" "UnixFDList"
    Ptr (Ptr UnixFDList) ->                 -- out_fd_list : TInterface "Gio" "UnixFDList"
    Ptr Cancellable ->                      -- cancellable : TInterface "Gio" "Cancellable"
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr GVariant)


dBusConnectionCallWithUnixFdListSync ::
    (MonadIO m, DBusConnectionK a, UnixFDListK b, CancellableK c) =>
    a ->                                    -- _obj
    Maybe (T.Text) ->                       -- bus_name
    T.Text ->                               -- object_path
    T.Text ->                               -- interface_name
    T.Text ->                               -- method_name
    Maybe (GVariant) ->                     -- parameters
    Maybe (GLib.VariantType) ->             -- reply_type
    [DBusCallFlags] ->                      -- flags
    Int32 ->                                -- timeout_msec
    Maybe (b) ->                            -- fd_list
    Maybe (c) ->                            -- cancellable
    m (GVariant,UnixFDList)
dBusConnectionCallWithUnixFdListSync _obj bus_name object_path interface_name method_name parameters reply_type flags timeout_msec fd_list cancellable = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeBus_name <- case bus_name of
        Nothing -> return nullPtr
        Just jBus_name -> do
            jBus_name' <- textToCString jBus_name
            return jBus_name'
    object_path' <- textToCString object_path
    interface_name' <- textToCString interface_name
    method_name' <- textToCString method_name
    maybeParameters <- case parameters of
        Nothing -> return nullPtr
        Just jParameters -> do
            let jParameters' = unsafeManagedPtrGetPtr jParameters
            return jParameters'
    maybeReply_type <- case reply_type of
        Nothing -> return nullPtr
        Just jReply_type -> do
            let jReply_type' = unsafeManagedPtrGetPtr jReply_type
            return jReply_type'
    let flags' = gflagsToWord flags
    maybeFd_list <- case fd_list of
        Nothing -> return nullPtr
        Just jFd_list -> do
            let jFd_list' = unsafeManagedPtrCastPtr jFd_list
            return jFd_list'
    out_fd_list <- allocMem :: IO (Ptr (Ptr UnixFDList))
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            let jCancellable' = unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        result <- propagateGError $ g_dbus_connection_call_with_unix_fd_list_sync _obj' maybeBus_name object_path' interface_name' method_name' maybeParameters maybeReply_type flags' timeout_msec maybeFd_list out_fd_list maybeCancellable
        checkUnexpectedReturnNULL "g_dbus_connection_call_with_unix_fd_list_sync" result
        result' <- wrapGVariantPtr result
        out_fd_list' <- peek out_fd_list
        out_fd_list'' <- (wrapObject UnixFDList) out_fd_list'
        touchManagedPtr _obj
        whenJust reply_type touchManagedPtr
        whenJust fd_list touchManagedPtr
        whenJust cancellable touchManagedPtr
        freeMem maybeBus_name
        freeMem object_path'
        freeMem interface_name'
        freeMem method_name'
        freeMem out_fd_list
        return (result', out_fd_list'')
     ) (do
        freeMem maybeBus_name
        freeMem object_path'
        freeMem interface_name'
        freeMem method_name'
        freeMem out_fd_list
     )

-- method DBusConnection::close
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 3, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 3, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_connection_close" g_dbus_connection_close :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    Ptr Cancellable ->                      -- cancellable : TInterface "Gio" "Cancellable"
    FunPtr AsyncReadyCallbackC ->           -- callback : TInterface "Gio" "AsyncReadyCallback"
    Ptr () ->                               -- user_data : TBasicType TVoid
    IO ()


dBusConnectionClose ::
    (MonadIO m, DBusConnectionK a, CancellableK b) =>
    a ->                                    -- _obj
    Maybe (b) ->                            -- cancellable
    Maybe (AsyncReadyCallback) ->           -- callback
    m ()
dBusConnectionClose _obj cancellable callback = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            let jCancellable' = unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    ptrcallback <- callocMem :: IO (Ptr (FunPtr AsyncReadyCallbackC))
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            jCallback' <- mkAsyncReadyCallback (asyncReadyCallbackWrapper (Just ptrcallback) jCallback)
            poke ptrcallback jCallback'
            return jCallback'
    let user_data = nullPtr
    g_dbus_connection_close _obj' maybeCancellable maybeCallback user_data
    touchManagedPtr _obj
    whenJust cancellable touchManagedPtr
    return ()

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

foreign import ccall "g_dbus_connection_close_finish" g_dbus_connection_close_finish :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    Ptr AsyncResult ->                      -- res : TInterface "Gio" "AsyncResult"
    Ptr (Ptr GError) ->                     -- error
    IO CInt


dBusConnectionCloseFinish ::
    (MonadIO m, DBusConnectionK a, AsyncResultK b) =>
    a ->                                    -- _obj
    b ->                                    -- res
    m ()
dBusConnectionCloseFinish _obj res = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let res' = unsafeManagedPtrCastPtr res
    onException (do
        _ <- propagateGError $ g_dbus_connection_close_finish _obj' res'
        touchManagedPtr _obj
        touchManagedPtr res
        return ()
     ) (do
        return ()
     )

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

foreign import ccall "g_dbus_connection_close_sync" g_dbus_connection_close_sync :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    Ptr Cancellable ->                      -- cancellable : TInterface "Gio" "Cancellable"
    Ptr (Ptr GError) ->                     -- error
    IO CInt


dBusConnectionCloseSync ::
    (MonadIO m, DBusConnectionK a, CancellableK b) =>
    a ->                                    -- _obj
    Maybe (b) ->                            -- cancellable
    m ()
dBusConnectionCloseSync _obj cancellable = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            let jCancellable' = unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        _ <- propagateGError $ g_dbus_connection_close_sync _obj' maybeCancellable
        touchManagedPtr _obj
        whenJust cancellable touchManagedPtr
        return ()
     ) (do
        return ()
     )

-- method DBusConnection::emit_signal
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "destination_bus_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "interface_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "signal_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "parameters", argType = TVariant, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "destination_bus_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "interface_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "signal_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "parameters", argType = TVariant, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : True
-- Skip return : False

foreign import ccall "g_dbus_connection_emit_signal" g_dbus_connection_emit_signal :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    CString ->                              -- destination_bus_name : TBasicType TUTF8
    CString ->                              -- object_path : TBasicType TUTF8
    CString ->                              -- interface_name : TBasicType TUTF8
    CString ->                              -- signal_name : TBasicType TUTF8
    Ptr GVariant ->                         -- parameters : TVariant
    Ptr (Ptr GError) ->                     -- error
    IO CInt


dBusConnectionEmitSignal ::
    (MonadIO m, DBusConnectionK a) =>
    a ->                                    -- _obj
    Maybe (T.Text) ->                       -- destination_bus_name
    T.Text ->                               -- object_path
    T.Text ->                               -- interface_name
    T.Text ->                               -- signal_name
    Maybe (GVariant) ->                     -- parameters
    m ()
dBusConnectionEmitSignal _obj destination_bus_name object_path interface_name signal_name parameters = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeDestination_bus_name <- case destination_bus_name of
        Nothing -> return nullPtr
        Just jDestination_bus_name -> do
            jDestination_bus_name' <- textToCString jDestination_bus_name
            return jDestination_bus_name'
    object_path' <- textToCString object_path
    interface_name' <- textToCString interface_name
    signal_name' <- textToCString signal_name
    maybeParameters <- case parameters of
        Nothing -> return nullPtr
        Just jParameters -> do
            let jParameters' = unsafeManagedPtrGetPtr jParameters
            return jParameters'
    onException (do
        _ <- propagateGError $ g_dbus_connection_emit_signal _obj' maybeDestination_bus_name object_path' interface_name' signal_name' maybeParameters
        touchManagedPtr _obj
        freeMem maybeDestination_bus_name
        freeMem object_path'
        freeMem interface_name'
        freeMem signal_name'
        return ()
     ) (do
        freeMem maybeDestination_bus_name
        freeMem object_path'
        freeMem interface_name'
        freeMem signal_name'
     )

-- method DBusConnection::export_action_group
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "action_group", argType = TInterface "Gio" "ActionGroup", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "action_group", argType = TInterface "Gio" "ActionGroup", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : True
-- Skip return : False

foreign import ccall "g_dbus_connection_export_action_group" g_dbus_connection_export_action_group :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    CString ->                              -- object_path : TBasicType TUTF8
    Ptr ActionGroup ->                      -- action_group : TInterface "Gio" "ActionGroup"
    Ptr (Ptr GError) ->                     -- error
    IO Word32


dBusConnectionExportActionGroup ::
    (MonadIO m, DBusConnectionK a, ActionGroupK b) =>
    a ->                                    -- _obj
    T.Text ->                               -- object_path
    b ->                                    -- action_group
    m Word32
dBusConnectionExportActionGroup _obj object_path action_group = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    object_path' <- textToCString object_path
    let action_group' = unsafeManagedPtrCastPtr action_group
    onException (do
        result <- propagateGError $ g_dbus_connection_export_action_group _obj' object_path' action_group'
        touchManagedPtr _obj
        touchManagedPtr action_group
        freeMem object_path'
        return result
     ) (do
        freeMem object_path'
     )

-- method DBusConnection::export_menu_model
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "menu", argType = TInterface "Gio" "MenuModel", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "menu", argType = TInterface "Gio" "MenuModel", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : True
-- Skip return : False

foreign import ccall "g_dbus_connection_export_menu_model" g_dbus_connection_export_menu_model :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    CString ->                              -- object_path : TBasicType TUTF8
    Ptr MenuModel ->                        -- menu : TInterface "Gio" "MenuModel"
    Ptr (Ptr GError) ->                     -- error
    IO Word32


dBusConnectionExportMenuModel ::
    (MonadIO m, DBusConnectionK a, MenuModelK b) =>
    a ->                                    -- _obj
    T.Text ->                               -- object_path
    b ->                                    -- menu
    m Word32
dBusConnectionExportMenuModel _obj object_path menu = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    object_path' <- textToCString object_path
    let menu' = unsafeManagedPtrCastPtr menu
    onException (do
        result <- propagateGError $ g_dbus_connection_export_menu_model _obj' object_path' menu'
        touchManagedPtr _obj
        touchManagedPtr menu
        freeMem object_path'
        return result
     ) (do
        freeMem object_path'
     )

-- method DBusConnection::flush
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 3, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 3, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_connection_flush" g_dbus_connection_flush :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    Ptr Cancellable ->                      -- cancellable : TInterface "Gio" "Cancellable"
    FunPtr AsyncReadyCallbackC ->           -- callback : TInterface "Gio" "AsyncReadyCallback"
    Ptr () ->                               -- user_data : TBasicType TVoid
    IO ()


dBusConnectionFlush ::
    (MonadIO m, DBusConnectionK a, CancellableK b) =>
    a ->                                    -- _obj
    Maybe (b) ->                            -- cancellable
    Maybe (AsyncReadyCallback) ->           -- callback
    m ()
dBusConnectionFlush _obj cancellable callback = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            let jCancellable' = unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    ptrcallback <- callocMem :: IO (Ptr (FunPtr AsyncReadyCallbackC))
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            jCallback' <- mkAsyncReadyCallback (asyncReadyCallbackWrapper (Just ptrcallback) jCallback)
            poke ptrcallback jCallback'
            return jCallback'
    let user_data = nullPtr
    g_dbus_connection_flush _obj' maybeCancellable maybeCallback user_data
    touchManagedPtr _obj
    whenJust cancellable touchManagedPtr
    return ()

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

foreign import ccall "g_dbus_connection_flush_finish" g_dbus_connection_flush_finish :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    Ptr AsyncResult ->                      -- res : TInterface "Gio" "AsyncResult"
    Ptr (Ptr GError) ->                     -- error
    IO CInt


dBusConnectionFlushFinish ::
    (MonadIO m, DBusConnectionK a, AsyncResultK b) =>
    a ->                                    -- _obj
    b ->                                    -- res
    m ()
dBusConnectionFlushFinish _obj res = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let res' = unsafeManagedPtrCastPtr res
    onException (do
        _ <- propagateGError $ g_dbus_connection_flush_finish _obj' res'
        touchManagedPtr _obj
        touchManagedPtr res
        return ()
     ) (do
        return ()
     )

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

foreign import ccall "g_dbus_connection_flush_sync" g_dbus_connection_flush_sync :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    Ptr Cancellable ->                      -- cancellable : TInterface "Gio" "Cancellable"
    Ptr (Ptr GError) ->                     -- error
    IO CInt


dBusConnectionFlushSync ::
    (MonadIO m, DBusConnectionK a, CancellableK b) =>
    a ->                                    -- _obj
    Maybe (b) ->                            -- cancellable
    m ()
dBusConnectionFlushSync _obj cancellable = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            let jCancellable' = unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        _ <- propagateGError $ g_dbus_connection_flush_sync _obj' maybeCancellable
        touchManagedPtr _obj
        whenJust cancellable touchManagedPtr
        return ()
     ) (do
        return ()
     )

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

foreign import ccall "g_dbus_connection_get_capabilities" g_dbus_connection_get_capabilities :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    IO CUInt


dBusConnectionGetCapabilities ::
    (MonadIO m, DBusConnectionK a) =>
    a ->                                    -- _obj
    m [DBusCapabilityFlags]
dBusConnectionGetCapabilities _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_dbus_connection_get_capabilities _obj'
    let result' = wordToGFlags result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "g_dbus_connection_get_exit_on_close" g_dbus_connection_get_exit_on_close :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    IO CInt


dBusConnectionGetExitOnClose ::
    (MonadIO m, DBusConnectionK a) =>
    a ->                                    -- _obj
    m Bool
dBusConnectionGetExitOnClose _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_dbus_connection_get_exit_on_close _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "g_dbus_connection_get_guid" g_dbus_connection_get_guid :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    IO CString


dBusConnectionGetGuid ::
    (MonadIO m, DBusConnectionK a) =>
    a ->                                    -- _obj
    m T.Text
dBusConnectionGetGuid _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_dbus_connection_get_guid _obj'
    checkUnexpectedReturnNULL "g_dbus_connection_get_guid" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "g_dbus_connection_get_last_serial" g_dbus_connection_get_last_serial :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    IO Word32


dBusConnectionGetLastSerial ::
    (MonadIO m, DBusConnectionK a) =>
    a ->                                    -- _obj
    m Word32
dBusConnectionGetLastSerial _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_dbus_connection_get_last_serial _obj'
    touchManagedPtr _obj
    return result

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

foreign import ccall "g_dbus_connection_get_peer_credentials" g_dbus_connection_get_peer_credentials :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    IO (Ptr Credentials)


dBusConnectionGetPeerCredentials ::
    (MonadIO m, DBusConnectionK a) =>
    a ->                                    -- _obj
    m Credentials
dBusConnectionGetPeerCredentials _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_dbus_connection_get_peer_credentials _obj'
    checkUnexpectedReturnNULL "g_dbus_connection_get_peer_credentials" result
    result' <- (newObject Credentials) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "g_dbus_connection_get_stream" g_dbus_connection_get_stream :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    IO (Ptr IOStream)


dBusConnectionGetStream ::
    (MonadIO m, DBusConnectionK a) =>
    a ->                                    -- _obj
    m IOStream
dBusConnectionGetStream _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_dbus_connection_get_stream _obj'
    checkUnexpectedReturnNULL "g_dbus_connection_get_stream" result
    result' <- (newObject IOStream) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "g_dbus_connection_get_unique_name" g_dbus_connection_get_unique_name :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    IO CString


dBusConnectionGetUniqueName ::
    (MonadIO m, DBusConnectionK a) =>
    a ->                                    -- _obj
    m T.Text
dBusConnectionGetUniqueName _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_dbus_connection_get_unique_name _obj'
    checkUnexpectedReturnNULL "g_dbus_connection_get_unique_name" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "g_dbus_connection_is_closed" g_dbus_connection_is_closed :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    IO CInt


dBusConnectionIsClosed ::
    (MonadIO m, DBusConnectionK a) =>
    a ->                                    -- _obj
    m Bool
dBusConnectionIsClosed _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_dbus_connection_is_closed _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method DBusConnection::register_object
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "interface_info", argType = TInterface "Gio" "DBusInterfaceInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "method_call_closure", argType = TInterface "GObject" "Closure", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "get_property_closure", argType = TInterface "GObject" "Closure", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "set_property_closure", argType = TInterface "GObject" "Closure", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "interface_info", argType = TInterface "Gio" "DBusInterfaceInfo", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "method_call_closure", argType = TInterface "GObject" "Closure", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "get_property_closure", argType = TInterface "GObject" "Closure", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "set_property_closure", argType = TInterface "GObject" "Closure", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : True
-- Skip return : False

foreign import ccall "g_dbus_connection_register_object_with_closures" g_dbus_connection_register_object_with_closures :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    CString ->                              -- object_path : TBasicType TUTF8
    Ptr DBusInterfaceInfo ->                -- interface_info : TInterface "Gio" "DBusInterfaceInfo"
    Ptr Closure ->                          -- method_call_closure : TInterface "GObject" "Closure"
    Ptr Closure ->                          -- get_property_closure : TInterface "GObject" "Closure"
    Ptr Closure ->                          -- set_property_closure : TInterface "GObject" "Closure"
    Ptr (Ptr GError) ->                     -- error
    IO Word32


dBusConnectionRegisterObject ::
    (MonadIO m, DBusConnectionK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- object_path
    DBusInterfaceInfo ->                    -- interface_info
    Maybe (Closure) ->                      -- method_call_closure
    Maybe (Closure) ->                      -- get_property_closure
    Maybe (Closure) ->                      -- set_property_closure
    m Word32
dBusConnectionRegisterObject _obj object_path interface_info method_call_closure get_property_closure_ set_property_closure_ = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    object_path' <- textToCString object_path
    let interface_info' = unsafeManagedPtrGetPtr interface_info
    maybeMethod_call_closure <- case method_call_closure of
        Nothing -> return nullPtr
        Just jMethod_call_closure -> do
            let jMethod_call_closure' = unsafeManagedPtrGetPtr jMethod_call_closure
            return jMethod_call_closure'
    maybeGet_property_closure_ <- case get_property_closure_ of
        Nothing -> return nullPtr
        Just jGet_property_closure_ -> do
            let jGet_property_closure_' = unsafeManagedPtrGetPtr jGet_property_closure_
            return jGet_property_closure_'
    maybeSet_property_closure_ <- case set_property_closure_ of
        Nothing -> return nullPtr
        Just jSet_property_closure_ -> do
            let jSet_property_closure_' = unsafeManagedPtrGetPtr jSet_property_closure_
            return jSet_property_closure_'
    onException (do
        result <- propagateGError $ g_dbus_connection_register_object_with_closures _obj' object_path' interface_info' maybeMethod_call_closure maybeGet_property_closure_ maybeSet_property_closure_
        touchManagedPtr _obj
        touchManagedPtr interface_info
        whenJust method_call_closure touchManagedPtr
        whenJust get_property_closure_ touchManagedPtr
        whenJust set_property_closure_ touchManagedPtr
        freeMem object_path'
        return result
     ) (do
        freeMem object_path'
     )

-- method DBusConnection::register_subtree
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "vtable", argType = TInterface "Gio" "DBusSubtreeVTable", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "DBusSubtreeFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data_free_func", argType = TInterface "GLib" "DestroyNotify", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "vtable", argType = TInterface "Gio" "DBusSubtreeVTable", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "DBusSubtreeFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data_free_func", argType = TInterface "GLib" "DestroyNotify", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : True
-- Skip return : False

foreign import ccall "g_dbus_connection_register_subtree" g_dbus_connection_register_subtree :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    CString ->                              -- object_path : TBasicType TUTF8
    Ptr DBusSubtreeVTable ->                -- vtable : TInterface "Gio" "DBusSubtreeVTable"
    CUInt ->                                -- flags : TInterface "Gio" "DBusSubtreeFlags"
    Ptr () ->                               -- user_data : TBasicType TVoid
    FunPtr GLib.DestroyNotifyC ->           -- user_data_free_func : TInterface "GLib" "DestroyNotify"
    Ptr (Ptr GError) ->                     -- error
    IO Word32


dBusConnectionRegisterSubtree ::
    (MonadIO m, DBusConnectionK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- object_path
    DBusSubtreeVTable ->                    -- vtable
    [DBusSubtreeFlags] ->                   -- flags
    Ptr () ->                               -- user_data
    GLib.DestroyNotify ->                   -- user_data_free_func
    m Word32
dBusConnectionRegisterSubtree _obj object_path vtable flags user_data user_data_free_func = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    object_path' <- textToCString object_path
    let vtable' = unsafeManagedPtrGetPtr vtable
    let flags' = gflagsToWord flags
    ptruser_data_free_func <- callocMem :: IO (Ptr (FunPtr GLib.DestroyNotifyC))
    user_data_free_func' <- GLib.mkDestroyNotify (GLib.destroyNotifyWrapper (Just ptruser_data_free_func) user_data_free_func)
    poke ptruser_data_free_func user_data_free_func'
    onException (do
        result <- propagateGError $ g_dbus_connection_register_subtree _obj' object_path' vtable' flags' user_data user_data_free_func'
        touchManagedPtr _obj
        touchManagedPtr vtable
        freeMem object_path'
        return result
     ) (do
        freeMem object_path'
     )

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

foreign import ccall "g_dbus_connection_remove_filter" g_dbus_connection_remove_filter :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    Word32 ->                               -- filter_id : TBasicType TUInt32
    IO ()


dBusConnectionRemoveFilter ::
    (MonadIO m, DBusConnectionK a) =>
    a ->                                    -- _obj
    Word32 ->                               -- filter_id
    m ()
dBusConnectionRemoveFilter _obj filter_id = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    g_dbus_connection_remove_filter _obj' filter_id
    touchManagedPtr _obj
    return ()

-- method DBusConnection::send_message
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "message", argType = TInterface "Gio" "DBusMessage", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "DBusSendMessageFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "out_serial", argType = TBasicType TUInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "message", argType = TInterface "Gio" "DBusMessage", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "DBusSendMessageFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : True
-- Skip return : False

foreign import ccall "g_dbus_connection_send_message" g_dbus_connection_send_message :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    Ptr DBusMessage ->                      -- message : TInterface "Gio" "DBusMessage"
    CUInt ->                                -- flags : TInterface "Gio" "DBusSendMessageFlags"
    Ptr Word32 ->                           -- out_serial : TBasicType TUInt32
    Ptr (Ptr GError) ->                     -- error
    IO CInt


dBusConnectionSendMessage ::
    (MonadIO m, DBusConnectionK a, DBusMessageK b) =>
    a ->                                    -- _obj
    b ->                                    -- message
    [DBusSendMessageFlags] ->               -- flags
    m (Word32)
dBusConnectionSendMessage _obj message flags = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let message' = unsafeManagedPtrCastPtr message
    let flags' = gflagsToWord flags
    out_serial <- allocMem :: IO (Ptr Word32)
    onException (do
        _ <- propagateGError $ g_dbus_connection_send_message _obj' message' flags' out_serial
        out_serial' <- peek out_serial
        touchManagedPtr _obj
        touchManagedPtr message
        freeMem out_serial
        return out_serial'
     ) (do
        freeMem out_serial
     )

-- method DBusConnection::send_message_with_reply
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "message", argType = TInterface "Gio" "DBusMessage", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "DBusSendMessageFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "timeout_msec", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "out_serial", argType = TBasicType TUInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 7, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "message", argType = TInterface "Gio" "DBusMessage", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "DBusSendMessageFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "timeout_msec", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 7, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_connection_send_message_with_reply" g_dbus_connection_send_message_with_reply :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    Ptr DBusMessage ->                      -- message : TInterface "Gio" "DBusMessage"
    CUInt ->                                -- flags : TInterface "Gio" "DBusSendMessageFlags"
    Int32 ->                                -- timeout_msec : TBasicType TInt32
    Ptr Word32 ->                           -- out_serial : TBasicType TUInt32
    Ptr Cancellable ->                      -- cancellable : TInterface "Gio" "Cancellable"
    FunPtr AsyncReadyCallbackC ->           -- callback : TInterface "Gio" "AsyncReadyCallback"
    Ptr () ->                               -- user_data : TBasicType TVoid
    IO ()


dBusConnectionSendMessageWithReply ::
    (MonadIO m, DBusConnectionK a, DBusMessageK b, CancellableK c) =>
    a ->                                    -- _obj
    b ->                                    -- message
    [DBusSendMessageFlags] ->               -- flags
    Int32 ->                                -- timeout_msec
    Maybe (c) ->                            -- cancellable
    Maybe (AsyncReadyCallback) ->           -- callback
    m (Word32)
dBusConnectionSendMessageWithReply _obj message flags timeout_msec cancellable callback = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let message' = unsafeManagedPtrCastPtr message
    let flags' = gflagsToWord flags
    out_serial <- allocMem :: IO (Ptr Word32)
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            let jCancellable' = unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    ptrcallback <- callocMem :: IO (Ptr (FunPtr AsyncReadyCallbackC))
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            jCallback' <- mkAsyncReadyCallback (asyncReadyCallbackWrapper (Just ptrcallback) jCallback)
            poke ptrcallback jCallback'
            return jCallback'
    let user_data = nullPtr
    g_dbus_connection_send_message_with_reply _obj' message' flags' timeout_msec out_serial maybeCancellable maybeCallback user_data
    out_serial' <- peek out_serial
    touchManagedPtr _obj
    touchManagedPtr message
    whenJust cancellable touchManagedPtr
    freeMem out_serial
    return out_serial'

-- method DBusConnection::send_message_with_reply_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "res", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "res", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "DBusMessage"
-- throws : True
-- Skip return : False

foreign import ccall "g_dbus_connection_send_message_with_reply_finish" g_dbus_connection_send_message_with_reply_finish :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    Ptr AsyncResult ->                      -- res : TInterface "Gio" "AsyncResult"
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr DBusMessage)


dBusConnectionSendMessageWithReplyFinish ::
    (MonadIO m, DBusConnectionK a, AsyncResultK b) =>
    a ->                                    -- _obj
    b ->                                    -- res
    m DBusMessage
dBusConnectionSendMessageWithReplyFinish _obj res = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let res' = unsafeManagedPtrCastPtr res
    onException (do
        result <- propagateGError $ g_dbus_connection_send_message_with_reply_finish _obj' res'
        checkUnexpectedReturnNULL "g_dbus_connection_send_message_with_reply_finish" result
        result' <- (wrapObject DBusMessage) result
        touchManagedPtr _obj
        touchManagedPtr res
        return result'
     ) (do
        return ()
     )

-- method DBusConnection::send_message_with_reply_sync
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "message", argType = TInterface "Gio" "DBusMessage", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "DBusSendMessageFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "timeout_msec", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "out_serial", argType = TBasicType TUInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "message", argType = TInterface "Gio" "DBusMessage", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "DBusSendMessageFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "timeout_msec", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "DBusMessage"
-- throws : True
-- Skip return : False

foreign import ccall "g_dbus_connection_send_message_with_reply_sync" g_dbus_connection_send_message_with_reply_sync :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    Ptr DBusMessage ->                      -- message : TInterface "Gio" "DBusMessage"
    CUInt ->                                -- flags : TInterface "Gio" "DBusSendMessageFlags"
    Int32 ->                                -- timeout_msec : TBasicType TInt32
    Ptr Word32 ->                           -- out_serial : TBasicType TUInt32
    Ptr Cancellable ->                      -- cancellable : TInterface "Gio" "Cancellable"
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr DBusMessage)


dBusConnectionSendMessageWithReplySync ::
    (MonadIO m, DBusConnectionK a, DBusMessageK b, CancellableK c) =>
    a ->                                    -- _obj
    b ->                                    -- message
    [DBusSendMessageFlags] ->               -- flags
    Int32 ->                                -- timeout_msec
    Maybe (c) ->                            -- cancellable
    m (DBusMessage,Word32)
dBusConnectionSendMessageWithReplySync _obj message flags timeout_msec cancellable = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let message' = unsafeManagedPtrCastPtr message
    let flags' = gflagsToWord flags
    out_serial <- allocMem :: IO (Ptr Word32)
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            let jCancellable' = unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        result <- propagateGError $ g_dbus_connection_send_message_with_reply_sync _obj' message' flags' timeout_msec out_serial maybeCancellable
        checkUnexpectedReturnNULL "g_dbus_connection_send_message_with_reply_sync" result
        result' <- (wrapObject DBusMessage) result
        out_serial' <- peek out_serial
        touchManagedPtr _obj
        touchManagedPtr message
        whenJust cancellable touchManagedPtr
        freeMem out_serial
        return (result', out_serial')
     ) (do
        freeMem out_serial
     )

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

foreign import ccall "g_dbus_connection_set_exit_on_close" g_dbus_connection_set_exit_on_close :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    CInt ->                                 -- exit_on_close : TBasicType TBoolean
    IO ()


dBusConnectionSetExitOnClose ::
    (MonadIO m, DBusConnectionK a) =>
    a ->                                    -- _obj
    Bool ->                                 -- exit_on_close
    m ()
dBusConnectionSetExitOnClose _obj exit_on_close = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let exit_on_close' = (fromIntegral . fromEnum) exit_on_close
    g_dbus_connection_set_exit_on_close _obj' exit_on_close'
    touchManagedPtr _obj
    return ()

-- method DBusConnection::signal_subscribe
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "sender", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "interface_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "member", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "arg0", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "DBusSignalFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "DBusSignalCallback", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeNotified, argClosure = 8, argDestroy = 9, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data_free_func", argType = TInterface "GLib" "DestroyNotify", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DBusConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "sender", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "interface_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "member", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "arg0", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "DBusSignalFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "DBusSignalCallback", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeNotified, argClosure = 8, argDestroy = 9, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_connection_signal_subscribe" g_dbus_connection_signal_subscribe :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    CString ->                              -- sender : TBasicType TUTF8
    CString ->                              -- interface_name : TBasicType TUTF8
    CString ->                              -- member : TBasicType TUTF8
    CString ->                              -- object_path : TBasicType TUTF8
    CString ->                              -- arg0 : TBasicType TUTF8
    CUInt ->                                -- flags : TInterface "Gio" "DBusSignalFlags"
    FunPtr DBusSignalCallbackC ->           -- callback : TInterface "Gio" "DBusSignalCallback"
    Ptr () ->                               -- user_data : TBasicType TVoid
    FunPtr GLib.DestroyNotifyC ->           -- user_data_free_func : TInterface "GLib" "DestroyNotify"
    IO Word32


dBusConnectionSignalSubscribe ::
    (MonadIO m, DBusConnectionK a) =>
    a ->                                    -- _obj
    Maybe (T.Text) ->                       -- sender
    Maybe (T.Text) ->                       -- interface_name
    Maybe (T.Text) ->                       -- member
    Maybe (T.Text) ->                       -- object_path
    Maybe (T.Text) ->                       -- arg0
    [DBusSignalFlags] ->                    -- flags
    DBusSignalCallback ->                   -- callback
    m Word32
dBusConnectionSignalSubscribe _obj sender interface_name member object_path arg0 flags callback = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeSender <- case sender of
        Nothing -> return nullPtr
        Just jSender -> do
            jSender' <- textToCString jSender
            return jSender'
    maybeInterface_name <- case interface_name of
        Nothing -> return nullPtr
        Just jInterface_name -> do
            jInterface_name' <- textToCString jInterface_name
            return jInterface_name'
    maybeMember <- case member of
        Nothing -> return nullPtr
        Just jMember -> do
            jMember' <- textToCString jMember
            return jMember'
    maybeObject_path <- case object_path of
        Nothing -> return nullPtr
        Just jObject_path -> do
            jObject_path' <- textToCString jObject_path
            return jObject_path'
    maybeArg0 <- case arg0 of
        Nothing -> return nullPtr
        Just jArg0 -> do
            jArg0' <- textToCString jArg0
            return jArg0'
    let flags' = gflagsToWord flags
    callback' <- mkDBusSignalCallback (dBusSignalCallbackWrapper Nothing callback)
    let user_data = castFunPtrToPtr callback'
    let user_data_free_func = safeFreeFunPtrPtr
    result <- g_dbus_connection_signal_subscribe _obj' maybeSender maybeInterface_name maybeMember maybeObject_path maybeArg0 flags' callback' user_data user_data_free_func
    touchManagedPtr _obj
    freeMem maybeSender
    freeMem maybeInterface_name
    freeMem maybeMember
    freeMem maybeObject_path
    freeMem maybeArg0
    return result

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

foreign import ccall "g_dbus_connection_signal_unsubscribe" g_dbus_connection_signal_unsubscribe :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    Word32 ->                               -- subscription_id : TBasicType TUInt32
    IO ()


dBusConnectionSignalUnsubscribe ::
    (MonadIO m, DBusConnectionK a) =>
    a ->                                    -- _obj
    Word32 ->                               -- subscription_id
    m ()
dBusConnectionSignalUnsubscribe _obj subscription_id = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    g_dbus_connection_signal_unsubscribe _obj' subscription_id
    touchManagedPtr _obj
    return ()

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

foreign import ccall "g_dbus_connection_start_message_processing" g_dbus_connection_start_message_processing :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    IO ()


dBusConnectionStartMessageProcessing ::
    (MonadIO m, DBusConnectionK a) =>
    a ->                                    -- _obj
    m ()
dBusConnectionStartMessageProcessing _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    g_dbus_connection_start_message_processing _obj'
    touchManagedPtr _obj
    return ()

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

foreign import ccall "g_dbus_connection_unexport_action_group" g_dbus_connection_unexport_action_group :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    Word32 ->                               -- export_id : TBasicType TUInt32
    IO ()


dBusConnectionUnexportActionGroup ::
    (MonadIO m, DBusConnectionK a) =>
    a ->                                    -- _obj
    Word32 ->                               -- export_id
    m ()
dBusConnectionUnexportActionGroup _obj export_id = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    g_dbus_connection_unexport_action_group _obj' export_id
    touchManagedPtr _obj
    return ()

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

foreign import ccall "g_dbus_connection_unexport_menu_model" g_dbus_connection_unexport_menu_model :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    Word32 ->                               -- export_id : TBasicType TUInt32
    IO ()


dBusConnectionUnexportMenuModel ::
    (MonadIO m, DBusConnectionK a) =>
    a ->                                    -- _obj
    Word32 ->                               -- export_id
    m ()
dBusConnectionUnexportMenuModel _obj export_id = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    g_dbus_connection_unexport_menu_model _obj' export_id
    touchManagedPtr _obj
    return ()

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

foreign import ccall "g_dbus_connection_unregister_object" g_dbus_connection_unregister_object :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    Word32 ->                               -- registration_id : TBasicType TUInt32
    IO CInt


dBusConnectionUnregisterObject ::
    (MonadIO m, DBusConnectionK a) =>
    a ->                                    -- _obj
    Word32 ->                               -- registration_id
    m Bool
dBusConnectionUnregisterObject _obj registration_id = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_dbus_connection_unregister_object _obj' registration_id
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "g_dbus_connection_unregister_subtree" g_dbus_connection_unregister_subtree :: 
    Ptr DBusConnection ->                   -- _obj : TInterface "Gio" "DBusConnection"
    Word32 ->                               -- registration_id : TBasicType TUInt32
    IO CInt


dBusConnectionUnregisterSubtree ::
    (MonadIO m, DBusConnectionK a) =>
    a ->                                    -- _obj
    Word32 ->                               -- registration_id
    m Bool
dBusConnectionUnregisterSubtree _obj registration_id = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_dbus_connection_unregister_subtree _obj' registration_id
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method DBusConnection::new
-- method type : MemberFunction
-- Args : [Arg {argName = "stream", argType = TInterface "Gio" "IOStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "guid", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "DBusConnectionFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "observer", argType = TInterface "Gio" "DBusAuthObserver", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 6, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "stream", argType = TInterface "Gio" "IOStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "guid", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "DBusConnectionFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "observer", argType = TInterface "Gio" "DBusAuthObserver", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 6, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_connection_new" g_dbus_connection_new :: 
    Ptr IOStream ->                         -- stream : TInterface "Gio" "IOStream"
    CString ->                              -- guid : TBasicType TUTF8
    CUInt ->                                -- flags : TInterface "Gio" "DBusConnectionFlags"
    Ptr DBusAuthObserver ->                 -- observer : TInterface "Gio" "DBusAuthObserver"
    Ptr Cancellable ->                      -- cancellable : TInterface "Gio" "Cancellable"
    FunPtr AsyncReadyCallbackC ->           -- callback : TInterface "Gio" "AsyncReadyCallback"
    Ptr () ->                               -- user_data : TBasicType TVoid
    IO ()


dBusConnectionNew ::
    (MonadIO m, IOStreamK a, DBusAuthObserverK b, CancellableK c) =>
    a ->                                    -- stream
    Maybe (T.Text) ->                       -- guid
    [DBusConnectionFlags] ->                -- flags
    Maybe (b) ->                            -- observer
    Maybe (c) ->                            -- cancellable
    Maybe (AsyncReadyCallback) ->           -- callback
    m ()
dBusConnectionNew stream guid flags observer cancellable callback = liftIO $ do
    let stream' = unsafeManagedPtrCastPtr stream
    maybeGuid <- case guid of
        Nothing -> return nullPtr
        Just jGuid -> do
            jGuid' <- textToCString jGuid
            return jGuid'
    let flags' = gflagsToWord flags
    maybeObserver <- case observer of
        Nothing -> return nullPtr
        Just jObserver -> do
            let jObserver' = unsafeManagedPtrCastPtr jObserver
            return jObserver'
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            let jCancellable' = unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    ptrcallback <- callocMem :: IO (Ptr (FunPtr AsyncReadyCallbackC))
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            jCallback' <- mkAsyncReadyCallback (asyncReadyCallbackWrapper (Just ptrcallback) jCallback)
            poke ptrcallback jCallback'
            return jCallback'
    let user_data = nullPtr
    g_dbus_connection_new stream' maybeGuid flags' maybeObserver maybeCancellable maybeCallback user_data
    touchManagedPtr stream
    whenJust observer touchManagedPtr
    whenJust cancellable touchManagedPtr
    freeMem maybeGuid
    return ()

-- method DBusConnection::new_for_address
-- method type : MemberFunction
-- Args : [Arg {argName = "address", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "DBusConnectionFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "observer", argType = TInterface "Gio" "DBusAuthObserver", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 5, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "address", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "DBusConnectionFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "observer", argType = TInterface "Gio" "DBusAuthObserver", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 5, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_connection_new_for_address" g_dbus_connection_new_for_address :: 
    CString ->                              -- address : TBasicType TUTF8
    CUInt ->                                -- flags : TInterface "Gio" "DBusConnectionFlags"
    Ptr DBusAuthObserver ->                 -- observer : TInterface "Gio" "DBusAuthObserver"
    Ptr Cancellable ->                      -- cancellable : TInterface "Gio" "Cancellable"
    FunPtr AsyncReadyCallbackC ->           -- callback : TInterface "Gio" "AsyncReadyCallback"
    Ptr () ->                               -- user_data : TBasicType TVoid
    IO ()


dBusConnectionNewForAddress ::
    (MonadIO m, DBusAuthObserverK a, CancellableK b) =>
    T.Text ->                               -- address
    [DBusConnectionFlags] ->                -- flags
    Maybe (a) ->                            -- observer
    Maybe (b) ->                            -- cancellable
    Maybe (AsyncReadyCallback) ->           -- callback
    m ()
dBusConnectionNewForAddress address flags observer cancellable callback = liftIO $ do
    address' <- textToCString address
    let flags' = gflagsToWord flags
    maybeObserver <- case observer of
        Nothing -> return nullPtr
        Just jObserver -> do
            let jObserver' = unsafeManagedPtrCastPtr jObserver
            return jObserver'
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            let jCancellable' = unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    ptrcallback <- callocMem :: IO (Ptr (FunPtr AsyncReadyCallbackC))
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            jCallback' <- mkAsyncReadyCallback (asyncReadyCallbackWrapper (Just ptrcallback) jCallback)
            poke ptrcallback jCallback'
            return jCallback'
    let user_data = nullPtr
    g_dbus_connection_new_for_address address' flags' maybeObserver maybeCancellable maybeCallback user_data
    whenJust observer touchManagedPtr
    whenJust cancellable touchManagedPtr
    freeMem address'
    return ()