{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

'GI.Gio.Objects.DBusProxy.DBusProxy' is a base class used for proxies to access a D-Bus
interface on a remote object. A 'GI.Gio.Objects.DBusProxy.DBusProxy' can be constructed for
both well-known and unique names.

By default, 'GI.Gio.Objects.DBusProxy.DBusProxy' will cache all properties (and listen to
changes) of the remote object, and proxy all signals that get
emitted. This behaviour can be changed by passing suitable
'GI.Gio.Flags.DBusProxyFlags' when the proxy is created. If the proxy is for a
well-known name, the property cache is flushed when the name owner
vanishes and reloaded when a name owner appears.

The unique name owner of the proxy\'s name is tracked and can be read from
'GI.Gio.Objects.DBusProxy.DBusProxy':@/g-name-owner/@. Connect to the 'GI.GObject.Objects.Object.Object'::@/notify/@ signal to
get notified of changes. Additionally, only signals and property
changes emitted from the current name owner are considered and
calls are always sent to the current name owner. This avoids a
number of race conditions when the name is lost by one owner and
claimed by another. However, if no name owner currently exists,
then calls will be sent to the well-known name which may result in
the message bus launching an owner (unless
'GI.Gio.Flags.DBusProxyFlagsDoNotAutoStart' is set).

The generic 'GI.Gio.Objects.DBusProxy.DBusProxy'::@/g-properties-changed/@ and
'GI.Gio.Objects.DBusProxy.DBusProxy'::@/g-signal/@ signals are not very convenient to work with.
Therefore, the recommended way of working with proxies is to subclass
'GI.Gio.Objects.DBusProxy.DBusProxy', and have more natural properties and signals in your derived
class. This [example][gdbus-example-gdbus-codegen] shows how this can
easily be done using the [gdbus-codegen][gdbus-codegen] tool.

A 'GI.Gio.Objects.DBusProxy.DBusProxy' instance can be used from multiple threads but note
that all signals (e.g. 'GI.Gio.Objects.DBusProxy.DBusProxy'::@/g-signal/@, 'GI.Gio.Objects.DBusProxy.DBusProxy'::@/g-properties-changed/@
and 'GI.GObject.Objects.Object.Object'::@/notify/@) are emitted in the
[thread-default main context][g-main-context-push-thread-default]
of the thread where the instance was constructed.

An example using a proxy for a well-known name can be found in
<https://git.gnome.org/browse/glib/tree/gio/tests/gdbus-example-watch-proxy.c gdbus-example-watch-proxy.c>

/Since: 2.26/
-}

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

module GI.Gio.Objects.DBusProxy
    (

-- * Exported types
    DBusProxy(..)                           ,
    IsDBusProxy                             ,
    toDBusProxy                             ,
    noDBusProxy                             ,


 -- * Methods
-- ** call #method:call#

#if ENABLE_OVERLOADING
    DBusProxyCallMethodInfo                 ,
#endif
    dBusProxyCall                           ,


-- ** callFinish #method:callFinish#

#if ENABLE_OVERLOADING
    DBusProxyCallFinishMethodInfo           ,
#endif
    dBusProxyCallFinish                     ,


-- ** callSync #method:callSync#

#if ENABLE_OVERLOADING
    DBusProxyCallSyncMethodInfo             ,
#endif
    dBusProxyCallSync                       ,


-- ** callWithUnixFdList #method:callWithUnixFdList#

#if ENABLE_OVERLOADING
    DBusProxyCallWithUnixFdListMethodInfo   ,
#endif
    dBusProxyCallWithUnixFdList             ,


-- ** callWithUnixFdListFinish #method:callWithUnixFdListFinish#

#if ENABLE_OVERLOADING
    DBusProxyCallWithUnixFdListFinishMethodInfo,
#endif
    dBusProxyCallWithUnixFdListFinish       ,


-- ** callWithUnixFdListSync #method:callWithUnixFdListSync#

#if ENABLE_OVERLOADING
    DBusProxyCallWithUnixFdListSyncMethodInfo,
#endif
    dBusProxyCallWithUnixFdListSync         ,


-- ** getCachedProperty #method:getCachedProperty#

#if ENABLE_OVERLOADING
    DBusProxyGetCachedPropertyMethodInfo    ,
#endif
    dBusProxyGetCachedProperty              ,


-- ** getCachedPropertyNames #method:getCachedPropertyNames#

#if ENABLE_OVERLOADING
    DBusProxyGetCachedPropertyNamesMethodInfo,
#endif
    dBusProxyGetCachedPropertyNames         ,


-- ** getConnection #method:getConnection#

#if ENABLE_OVERLOADING
    DBusProxyGetConnectionMethodInfo        ,
#endif
    dBusProxyGetConnection                  ,


-- ** getDefaultTimeout #method:getDefaultTimeout#

#if ENABLE_OVERLOADING
    DBusProxyGetDefaultTimeoutMethodInfo    ,
#endif
    dBusProxyGetDefaultTimeout              ,


-- ** getFlags #method:getFlags#

#if ENABLE_OVERLOADING
    DBusProxyGetFlagsMethodInfo             ,
#endif
    dBusProxyGetFlags                       ,


-- ** getInterfaceInfo #method:getInterfaceInfo#

#if ENABLE_OVERLOADING
    DBusProxyGetInterfaceInfoMethodInfo     ,
#endif
    dBusProxyGetInterfaceInfo               ,


-- ** getInterfaceName #method:getInterfaceName#

#if ENABLE_OVERLOADING
    DBusProxyGetInterfaceNameMethodInfo     ,
#endif
    dBusProxyGetInterfaceName               ,


-- ** getName #method:getName#

#if ENABLE_OVERLOADING
    DBusProxyGetNameMethodInfo              ,
#endif
    dBusProxyGetName                        ,


-- ** getNameOwner #method:getNameOwner#

#if ENABLE_OVERLOADING
    DBusProxyGetNameOwnerMethodInfo         ,
#endif
    dBusProxyGetNameOwner                   ,


-- ** getObjectPath #method:getObjectPath#

#if ENABLE_OVERLOADING
    DBusProxyGetObjectPathMethodInfo        ,
#endif
    dBusProxyGetObjectPath                  ,


-- ** new #method:new#

    dBusProxyNew                            ,


-- ** newFinish #method:newFinish#

    dBusProxyNewFinish                      ,


-- ** newForBus #method:newForBus#

    dBusProxyNewForBus                      ,


-- ** newForBusFinish #method:newForBusFinish#

    dBusProxyNewForBusFinish                ,


-- ** newForBusSync #method:newForBusSync#

    dBusProxyNewForBusSync                  ,


-- ** newSync #method:newSync#

    dBusProxyNewSync                        ,


-- ** setCachedProperty #method:setCachedProperty#

#if ENABLE_OVERLOADING
    DBusProxySetCachedPropertyMethodInfo    ,
#endif
    dBusProxySetCachedProperty              ,


-- ** setDefaultTimeout #method:setDefaultTimeout#

#if ENABLE_OVERLOADING
    DBusProxySetDefaultTimeoutMethodInfo    ,
#endif
    dBusProxySetDefaultTimeout              ,


-- ** setInterfaceInfo #method:setInterfaceInfo#

#if ENABLE_OVERLOADING
    DBusProxySetInterfaceInfoMethodInfo     ,
#endif
    dBusProxySetInterfaceInfo               ,




 -- * Properties
-- ** gBusType #attr:gBusType#
{- | If this property is not 'GI.Gio.Enums.BusTypeNone', then
'GI.Gio.Objects.DBusProxy.DBusProxy':@/g-connection/@ must be 'Nothing' and will be set to the
'GI.Gio.Objects.DBusConnection.DBusConnection' obtained by calling 'GI.Gio.Functions.busGet' with the value
of this property.

/Since: 2.26/
-}
#if ENABLE_OVERLOADING
    DBusProxyGBusTypePropertyInfo           ,
#endif
    constructDBusProxyGBusType              ,
#if ENABLE_OVERLOADING
    dBusProxyGBusType                       ,
#endif


-- ** gConnection #attr:gConnection#
{- | The 'GI.Gio.Objects.DBusConnection.DBusConnection' the proxy is for.

/Since: 2.26/
-}
#if ENABLE_OVERLOADING
    DBusProxyGConnectionPropertyInfo        ,
#endif
    constructDBusProxyGConnection           ,
#if ENABLE_OVERLOADING
    dBusProxyGConnection                    ,
#endif
    getDBusProxyGConnection                 ,


-- ** gDefaultTimeout #attr:gDefaultTimeout#
{- | The timeout to use if -1 (specifying default timeout) is passed
as /@timeoutMsec@/ in the 'GI.Gio.Objects.DBusProxy.dBusProxyCall' and
'GI.Gio.Objects.DBusProxy.dBusProxyCallSync' functions.

This allows applications to set a proxy-wide timeout for all
remote method invocations on the proxy. If this property is -1,
the default timeout (typically 25 seconds) is used. If set to
@/G_MAXINT/@, then no timeout is used.

/Since: 2.26/
-}
#if ENABLE_OVERLOADING
    DBusProxyGDefaultTimeoutPropertyInfo    ,
#endif
    constructDBusProxyGDefaultTimeout       ,
#if ENABLE_OVERLOADING
    dBusProxyGDefaultTimeout                ,
#endif
    getDBusProxyGDefaultTimeout             ,
    setDBusProxyGDefaultTimeout             ,


-- ** gFlags #attr:gFlags#
{- | Flags from the 'GI.Gio.Flags.DBusProxyFlags' enumeration.

/Since: 2.26/
-}
#if ENABLE_OVERLOADING
    DBusProxyGFlagsPropertyInfo             ,
#endif
    constructDBusProxyGFlags                ,
#if ENABLE_OVERLOADING
    dBusProxyGFlags                         ,
#endif
    getDBusProxyGFlags                      ,


-- ** gInterfaceInfo #attr:gInterfaceInfo#
{- | Ensure that interactions with this proxy conform to the given
interface. This is mainly to ensure that malformed data received
from the other peer is ignored. The given 'GI.Gio.Structs.DBusInterfaceInfo.DBusInterfaceInfo' is
said to be the \"expected interface\".

The checks performed are:

* When completing a method call, if the type signature of
the reply message isn\'t what\'s expected, the reply is
discarded and the 'GError' is set to 'GI.Gio.Enums.IOErrorEnumInvalidArgument'.
* Received signals that have a type signature mismatch are dropped and
a warning is logged via @/g_warning()/@.
* Properties received via the initial @GetAll()@ call or via the
@::PropertiesChanged@ signal (on the
<http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties org.freedesktop.DBus.Properties>
interface) or set using 'GI.Gio.Objects.DBusProxy.dBusProxySetCachedProperty'
with a type signature mismatch are ignored and a warning is
logged via @/g_warning()/@.


Note that these checks are never done on methods, signals and
properties that are not referenced in the given
'GI.Gio.Structs.DBusInterfaceInfo.DBusInterfaceInfo', since extending a D-Bus interface on the
service-side is not considered an ABI break.

/Since: 2.26/
-}
#if ENABLE_OVERLOADING
    DBusProxyGInterfaceInfoPropertyInfo     ,
#endif
    clearDBusProxyGInterfaceInfo            ,
    constructDBusProxyGInterfaceInfo        ,
#if ENABLE_OVERLOADING
    dBusProxyGInterfaceInfo                 ,
#endif
    getDBusProxyGInterfaceInfo              ,
    setDBusProxyGInterfaceInfo              ,


-- ** gInterfaceName #attr:gInterfaceName#
{- | The D-Bus interface name the proxy is for.

/Since: 2.26/
-}
#if ENABLE_OVERLOADING
    DBusProxyGInterfaceNamePropertyInfo     ,
#endif
    constructDBusProxyGInterfaceName        ,
#if ENABLE_OVERLOADING
    dBusProxyGInterfaceName                 ,
#endif
    getDBusProxyGInterfaceName              ,


-- ** gName #attr:gName#
{- | The well-known or unique name that the proxy is for.

/Since: 2.26/
-}
#if ENABLE_OVERLOADING
    DBusProxyGNamePropertyInfo              ,
#endif
    constructDBusProxyGName                 ,
#if ENABLE_OVERLOADING
    dBusProxyGName                          ,
#endif
    getDBusProxyGName                       ,


-- ** gNameOwner #attr:gNameOwner#
{- | The unique name that owns 'GI.Gio.Objects.DBusProxy.DBusProxy':@/g-name/@ or 'Nothing' if no-one
currently owns that name. You may connect to 'GI.GObject.Objects.Object.Object'::@/notify/@ signal to
track changes to this property.

/Since: 2.26/
-}
#if ENABLE_OVERLOADING
    DBusProxyGNameOwnerPropertyInfo         ,
#endif
#if ENABLE_OVERLOADING
    dBusProxyGNameOwner                     ,
#endif
    getDBusProxyGNameOwner                  ,


-- ** gObjectPath #attr:gObjectPath#
{- | The object path the proxy is for.

/Since: 2.26/
-}
#if ENABLE_OVERLOADING
    DBusProxyGObjectPathPropertyInfo        ,
#endif
    constructDBusProxyGObjectPath           ,
#if ENABLE_OVERLOADING
    dBusProxyGObjectPath                    ,
#endif
    getDBusProxyGObjectPath                 ,




 -- * Signals
-- ** gPropertiesChanged #signal:gPropertiesChanged#

    C_DBusProxyGPropertiesChangedCallback   ,
    DBusProxyGPropertiesChangedCallback     ,
#if ENABLE_OVERLOADING
    DBusProxyGPropertiesChangedSignalInfo   ,
#endif
    afterDBusProxyGPropertiesChanged        ,
    genClosure_DBusProxyGPropertiesChanged  ,
    mk_DBusProxyGPropertiesChangedCallback  ,
    noDBusProxyGPropertiesChangedCallback   ,
    onDBusProxyGPropertiesChanged           ,
    wrap_DBusProxyGPropertiesChangedCallback,


-- ** gSignal #signal:gSignal#

    C_DBusProxyGSignalCallback              ,
    DBusProxyGSignalCallback                ,
#if ENABLE_OVERLOADING
    DBusProxyGSignalSignalInfo              ,
#endif
    afterDBusProxyGSignal                   ,
    genClosure_DBusProxyGSignal             ,
    mk_DBusProxyGSignalCallback             ,
    noDBusProxyGSignalCallback              ,
    onDBusProxyGSignal                      ,
    wrap_DBusProxyGSignalCallback           ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL

import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import {-# SOURCE #-} qualified GI.Gio.Enums as Gio.Enums
import {-# SOURCE #-} qualified GI.Gio.Flags as Gio.Flags
import {-# SOURCE #-} qualified GI.Gio.Interfaces.AsyncInitable as Gio.AsyncInitable
import {-# SOURCE #-} qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import {-# SOURCE #-} qualified GI.Gio.Interfaces.DBusInterface as Gio.DBusInterface
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Initable as Gio.Initable
import {-# SOURCE #-} qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.Gio.Objects.DBusConnection as Gio.DBusConnection
import {-# SOURCE #-} qualified GI.Gio.Objects.UnixFDList as Gio.UnixFDList
import {-# SOURCE #-} qualified GI.Gio.Structs.DBusInterfaceInfo as Gio.DBusInterfaceInfo

-- | Memory-managed wrapper type.
newtype DBusProxy = DBusProxy (ManagedPtr DBusProxy)
foreign import ccall "g_dbus_proxy_get_type"
    c_g_dbus_proxy_get_type :: IO GType

instance GObject DBusProxy where
    gobjectType = c_g_dbus_proxy_get_type


-- | Type class for types which can be safely cast to `DBusProxy`, for instance with `toDBusProxy`.
class (GObject o, O.IsDescendantOf DBusProxy o) => IsDBusProxy o
instance (GObject o, O.IsDescendantOf DBusProxy o) => IsDBusProxy o

instance O.HasParentTypes DBusProxy
type instance O.ParentTypes DBusProxy = '[GObject.Object.Object, Gio.AsyncInitable.AsyncInitable, Gio.DBusInterface.DBusInterface, Gio.Initable.Initable]

-- | Cast to `DBusProxy`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toDBusProxy :: (MonadIO m, IsDBusProxy o) => o -> m DBusProxy
toDBusProxy = liftIO . unsafeCastTo DBusProxy

-- | A convenience alias for `Nothing` :: `Maybe` `DBusProxy`.
noDBusProxy :: Maybe DBusProxy
noDBusProxy = Nothing

#if ENABLE_OVERLOADING
type family ResolveDBusProxyMethod (t :: Symbol) (o :: *) :: * where
    ResolveDBusProxyMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveDBusProxyMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveDBusProxyMethod "call" o = DBusProxyCallMethodInfo
    ResolveDBusProxyMethod "callFinish" o = DBusProxyCallFinishMethodInfo
    ResolveDBusProxyMethod "callSync" o = DBusProxyCallSyncMethodInfo
    ResolveDBusProxyMethod "callWithUnixFdList" o = DBusProxyCallWithUnixFdListMethodInfo
    ResolveDBusProxyMethod "callWithUnixFdListFinish" o = DBusProxyCallWithUnixFdListFinishMethodInfo
    ResolveDBusProxyMethod "callWithUnixFdListSync" o = DBusProxyCallWithUnixFdListSyncMethodInfo
    ResolveDBusProxyMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveDBusProxyMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveDBusProxyMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveDBusProxyMethod "init" o = Gio.Initable.InitableInitMethodInfo
    ResolveDBusProxyMethod "initAsync" o = Gio.AsyncInitable.AsyncInitableInitAsyncMethodInfo
    ResolveDBusProxyMethod "initFinish" o = Gio.AsyncInitable.AsyncInitableInitFinishMethodInfo
    ResolveDBusProxyMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveDBusProxyMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveDBusProxyMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveDBusProxyMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveDBusProxyMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveDBusProxyMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveDBusProxyMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveDBusProxyMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveDBusProxyMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveDBusProxyMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveDBusProxyMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveDBusProxyMethod "getCachedProperty" o = DBusProxyGetCachedPropertyMethodInfo
    ResolveDBusProxyMethod "getCachedPropertyNames" o = DBusProxyGetCachedPropertyNamesMethodInfo
    ResolveDBusProxyMethod "getConnection" o = DBusProxyGetConnectionMethodInfo
    ResolveDBusProxyMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveDBusProxyMethod "getDefaultTimeout" o = DBusProxyGetDefaultTimeoutMethodInfo
    ResolveDBusProxyMethod "getFlags" o = DBusProxyGetFlagsMethodInfo
    ResolveDBusProxyMethod "getInfo" o = Gio.DBusInterface.DBusInterfaceGetInfoMethodInfo
    ResolveDBusProxyMethod "getInterfaceInfo" o = DBusProxyGetInterfaceInfoMethodInfo
    ResolveDBusProxyMethod "getInterfaceName" o = DBusProxyGetInterfaceNameMethodInfo
    ResolveDBusProxyMethod "getName" o = DBusProxyGetNameMethodInfo
    ResolveDBusProxyMethod "getNameOwner" o = DBusProxyGetNameOwnerMethodInfo
    ResolveDBusProxyMethod "getObject" o = Gio.DBusInterface.DBusInterfaceGetObjectMethodInfo
    ResolveDBusProxyMethod "getObjectPath" o = DBusProxyGetObjectPathMethodInfo
    ResolveDBusProxyMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveDBusProxyMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveDBusProxyMethod "setCachedProperty" o = DBusProxySetCachedPropertyMethodInfo
    ResolveDBusProxyMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveDBusProxyMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveDBusProxyMethod "setDefaultTimeout" o = DBusProxySetDefaultTimeoutMethodInfo
    ResolveDBusProxyMethod "setInterfaceInfo" o = DBusProxySetInterfaceInfoMethodInfo
    ResolveDBusProxyMethod "setObject" o = Gio.DBusInterface.DBusInterfaceSetObjectMethodInfo
    ResolveDBusProxyMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveDBusProxyMethod l o = O.MethodResolutionFailed l o

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

#endif

-- signal DBusProxy::g-properties-changed
{- |
Emitted when one or more D-Bus properties on /@proxy@/ changes. The
local cache has already been updated when this signal fires. Note
that both /@changedProperties@/ and /@invalidatedProperties@/ are
guaranteed to never be 'Nothing' (either may be empty though).

If the proxy has the flag
'GI.Gio.Flags.DBusProxyFlagsGetInvalidatedProperties' set, then
/@invalidatedProperties@/ will always be empty.

This signal corresponds to the
@PropertiesChanged@ D-Bus signal on the
@org.freedesktop.DBus.Properties@ interface.

/Since: 2.26/
-}
type DBusProxyGPropertiesChangedCallback =
    GVariant
    {- ^ /@changedProperties@/: A 'GVariant' containing the properties that changed (type: @a{sv}@) -}
    -> [T.Text]
    {- ^ /@invalidatedProperties@/: A 'Nothing' terminated array of properties that was invalidated -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `DBusProxyGPropertiesChangedCallback`@.
noDBusProxyGPropertiesChangedCallback :: Maybe DBusProxyGPropertiesChangedCallback
noDBusProxyGPropertiesChangedCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_DBusProxyGPropertiesChangedCallback =
    Ptr () ->                               -- object
    Ptr GVariant ->
    Ptr CString ->
    Ptr () ->                               -- user_data
    IO ()

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

-- | Wrap the callback into a `GClosure`.
genClosure_DBusProxyGPropertiesChanged :: MonadIO m => DBusProxyGPropertiesChangedCallback -> m (GClosure C_DBusProxyGPropertiesChangedCallback)
genClosure_DBusProxyGPropertiesChanged cb = liftIO $ do
    let cb' = wrap_DBusProxyGPropertiesChangedCallback cb
    mk_DBusProxyGPropertiesChangedCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `DBusProxyGPropertiesChangedCallback` into a `C_DBusProxyGPropertiesChangedCallback`.
wrap_DBusProxyGPropertiesChangedCallback ::
    DBusProxyGPropertiesChangedCallback ->
    C_DBusProxyGPropertiesChangedCallback
wrap_DBusProxyGPropertiesChangedCallback _cb _ changedProperties invalidatedProperties _ = do
    changedProperties' <- B.GVariant.newGVariantFromPtr changedProperties
    invalidatedProperties' <- unpackZeroTerminatedUTF8CArray invalidatedProperties
    _cb  changedProperties' invalidatedProperties'


{- |
Connect a signal handler for the “@g-properties-changed@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' dBusProxy #gPropertiesChanged callback
@
-}
onDBusProxyGPropertiesChanged :: (IsDBusProxy a, MonadIO m) => a -> DBusProxyGPropertiesChangedCallback -> m SignalHandlerId
onDBusProxyGPropertiesChanged obj cb = liftIO $ do
    let cb' = wrap_DBusProxyGPropertiesChangedCallback cb
    cb'' <- mk_DBusProxyGPropertiesChangedCallback cb'
    connectSignalFunPtr obj "g-properties-changed" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@g-properties-changed@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' dBusProxy #gPropertiesChanged callback
@
-}
afterDBusProxyGPropertiesChanged :: (IsDBusProxy a, MonadIO m) => a -> DBusProxyGPropertiesChangedCallback -> m SignalHandlerId
afterDBusProxyGPropertiesChanged obj cb = liftIO $ do
    let cb' = wrap_DBusProxyGPropertiesChangedCallback cb
    cb'' <- mk_DBusProxyGPropertiesChangedCallback cb'
    connectSignalFunPtr obj "g-properties-changed" cb'' SignalConnectAfter


-- signal DBusProxy::g-signal
{- |
Emitted when a signal from the remote object and interface that /@proxy@/ is for, has been received.

/Since: 2.26/
-}
type DBusProxyGSignalCallback =
    Maybe T.Text
    {- ^ /@senderName@/: The sender of the signal or 'Nothing' if the connection is not a bus connection. -}
    -> T.Text
    {- ^ /@signalName@/: The name of the signal. -}
    -> GVariant
    {- ^ /@parameters@/: A 'GVariant' tuple with parameters for the signal. -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `DBusProxyGSignalCallback`@.
noDBusProxyGSignalCallback :: Maybe DBusProxyGSignalCallback
noDBusProxyGSignalCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_DBusProxyGSignalCallback =
    Ptr () ->                               -- object
    CString ->
    CString ->
    Ptr GVariant ->
    Ptr () ->                               -- user_data
    IO ()

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

-- | Wrap the callback into a `GClosure`.
genClosure_DBusProxyGSignal :: MonadIO m => DBusProxyGSignalCallback -> m (GClosure C_DBusProxyGSignalCallback)
genClosure_DBusProxyGSignal cb = liftIO $ do
    let cb' = wrap_DBusProxyGSignalCallback cb
    mk_DBusProxyGSignalCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `DBusProxyGSignalCallback` into a `C_DBusProxyGSignalCallback`.
wrap_DBusProxyGSignalCallback ::
    DBusProxyGSignalCallback ->
    C_DBusProxyGSignalCallback
wrap_DBusProxyGSignalCallback _cb _ senderName signalName parameters _ = do
    maybeSenderName <-
        if senderName == nullPtr
        then return Nothing
        else do
            senderName' <- cstringToText senderName
            return $ Just senderName'
    signalName' <- cstringToText signalName
    parameters' <- B.GVariant.newGVariantFromPtr parameters
    _cb  maybeSenderName signalName' parameters'


{- |
Connect a signal handler for the “@g-signal@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' dBusProxy #gSignal callback
@
-}
onDBusProxyGSignal :: (IsDBusProxy a, MonadIO m) => a -> DBusProxyGSignalCallback -> m SignalHandlerId
onDBusProxyGSignal obj cb = liftIO $ do
    let cb' = wrap_DBusProxyGSignalCallback cb
    cb'' <- mk_DBusProxyGSignalCallback cb'
    connectSignalFunPtr obj "g-signal" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@g-signal@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' dBusProxy #gSignal callback
@
-}
afterDBusProxyGSignal :: (IsDBusProxy a, MonadIO m) => a -> DBusProxyGSignalCallback -> m SignalHandlerId
afterDBusProxyGSignal obj cb = liftIO $ do
    let cb' = wrap_DBusProxyGSignalCallback cb
    cb'' <- mk_DBusProxyGSignalCallback cb'
    connectSignalFunPtr obj "g-signal" cb'' SignalConnectAfter


-- VVV Prop "g-bus-type"
   -- Type: TInterface (Name {namespace = "Gio", name = "BusType"})
   -- Flags: [PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

{- |
Construct a `GValueConstruct` with valid value for the “@g-bus-type@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructDBusProxyGBusType :: (IsDBusProxy o) => Gio.Enums.BusType -> IO (GValueConstruct o)
constructDBusProxyGBusType val = B.Properties.constructObjectPropertyEnum "g-bus-type" val

#if ENABLE_OVERLOADING
data DBusProxyGBusTypePropertyInfo
instance AttrInfo DBusProxyGBusTypePropertyInfo where
    type AttrAllowedOps DBusProxyGBusTypePropertyInfo = '[ 'AttrConstruct]
    type AttrSetTypeConstraint DBusProxyGBusTypePropertyInfo = (~) Gio.Enums.BusType
    type AttrBaseTypeConstraint DBusProxyGBusTypePropertyInfo = IsDBusProxy
    type AttrGetType DBusProxyGBusTypePropertyInfo = ()
    type AttrLabel DBusProxyGBusTypePropertyInfo = "g-bus-type"
    type AttrOrigin DBusProxyGBusTypePropertyInfo = DBusProxy
    attrGet _ = undefined
    attrSet _ = undefined
    attrConstruct _ = constructDBusProxyGBusType
    attrClear _ = undefined
#endif

-- VVV Prop "g-connection"
   -- Type: TInterface (Name {namespace = "Gio", name = "DBusConnection"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@g-connection@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' dBusProxy #gConnection
@
-}
getDBusProxyGConnection :: (MonadIO m, IsDBusProxy o) => o -> m (Maybe Gio.DBusConnection.DBusConnection)
getDBusProxyGConnection obj = liftIO $ B.Properties.getObjectPropertyObject obj "g-connection" Gio.DBusConnection.DBusConnection

{- |
Construct a `GValueConstruct` with valid value for the “@g-connection@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructDBusProxyGConnection :: (IsDBusProxy o, Gio.DBusConnection.IsDBusConnection a) => a -> IO (GValueConstruct o)
constructDBusProxyGConnection val = B.Properties.constructObjectPropertyObject "g-connection" (Just val)

#if ENABLE_OVERLOADING
data DBusProxyGConnectionPropertyInfo
instance AttrInfo DBusProxyGConnectionPropertyInfo where
    type AttrAllowedOps DBusProxyGConnectionPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DBusProxyGConnectionPropertyInfo = Gio.DBusConnection.IsDBusConnection
    type AttrBaseTypeConstraint DBusProxyGConnectionPropertyInfo = IsDBusProxy
    type AttrGetType DBusProxyGConnectionPropertyInfo = (Maybe Gio.DBusConnection.DBusConnection)
    type AttrLabel DBusProxyGConnectionPropertyInfo = "g-connection"
    type AttrOrigin DBusProxyGConnectionPropertyInfo = DBusProxy
    attrGet _ = getDBusProxyGConnection
    attrSet _ = undefined
    attrConstruct _ = constructDBusProxyGConnection
    attrClear _ = undefined
#endif

-- VVV Prop "g-default-timeout"
   -- Type: TBasicType TInt
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@g-default-timeout@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' dBusProxy #gDefaultTimeout
@
-}
getDBusProxyGDefaultTimeout :: (MonadIO m, IsDBusProxy o) => o -> m Int32
getDBusProxyGDefaultTimeout obj = liftIO $ B.Properties.getObjectPropertyInt32 obj "g-default-timeout"

{- |
Set the value of the “@g-default-timeout@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' dBusProxy [ #gDefaultTimeout 'Data.GI.Base.Attributes.:=' value ]
@
-}
setDBusProxyGDefaultTimeout :: (MonadIO m, IsDBusProxy o) => o -> Int32 -> m ()
setDBusProxyGDefaultTimeout obj val = liftIO $ B.Properties.setObjectPropertyInt32 obj "g-default-timeout" val

{- |
Construct a `GValueConstruct` with valid value for the “@g-default-timeout@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructDBusProxyGDefaultTimeout :: (IsDBusProxy o) => Int32 -> IO (GValueConstruct o)
constructDBusProxyGDefaultTimeout val = B.Properties.constructObjectPropertyInt32 "g-default-timeout" val

#if ENABLE_OVERLOADING
data DBusProxyGDefaultTimeoutPropertyInfo
instance AttrInfo DBusProxyGDefaultTimeoutPropertyInfo where
    type AttrAllowedOps DBusProxyGDefaultTimeoutPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint DBusProxyGDefaultTimeoutPropertyInfo = (~) Int32
    type AttrBaseTypeConstraint DBusProxyGDefaultTimeoutPropertyInfo = IsDBusProxy
    type AttrGetType DBusProxyGDefaultTimeoutPropertyInfo = Int32
    type AttrLabel DBusProxyGDefaultTimeoutPropertyInfo = "g-default-timeout"
    type AttrOrigin DBusProxyGDefaultTimeoutPropertyInfo = DBusProxy
    attrGet _ = getDBusProxyGDefaultTimeout
    attrSet _ = setDBusProxyGDefaultTimeout
    attrConstruct _ = constructDBusProxyGDefaultTimeout
    attrClear _ = undefined
#endif

-- VVV Prop "g-flags"
   -- Type: TInterface (Name {namespace = "Gio", name = "DBusProxyFlags"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@g-flags@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' dBusProxy #gFlags
@
-}
getDBusProxyGFlags :: (MonadIO m, IsDBusProxy o) => o -> m [Gio.Flags.DBusProxyFlags]
getDBusProxyGFlags obj = liftIO $ B.Properties.getObjectPropertyFlags obj "g-flags"

{- |
Construct a `GValueConstruct` with valid value for the “@g-flags@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructDBusProxyGFlags :: (IsDBusProxy o) => [Gio.Flags.DBusProxyFlags] -> IO (GValueConstruct o)
constructDBusProxyGFlags val = B.Properties.constructObjectPropertyFlags "g-flags" val

#if ENABLE_OVERLOADING
data DBusProxyGFlagsPropertyInfo
instance AttrInfo DBusProxyGFlagsPropertyInfo where
    type AttrAllowedOps DBusProxyGFlagsPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint DBusProxyGFlagsPropertyInfo = (~) [Gio.Flags.DBusProxyFlags]
    type AttrBaseTypeConstraint DBusProxyGFlagsPropertyInfo = IsDBusProxy
    type AttrGetType DBusProxyGFlagsPropertyInfo = [Gio.Flags.DBusProxyFlags]
    type AttrLabel DBusProxyGFlagsPropertyInfo = "g-flags"
    type AttrOrigin DBusProxyGFlagsPropertyInfo = DBusProxy
    attrGet _ = getDBusProxyGFlags
    attrSet _ = undefined
    attrConstruct _ = constructDBusProxyGFlags
    attrClear _ = undefined
#endif

-- VVV Prop "g-interface-info"
   -- Type: TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"})
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@g-interface-info@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' dBusProxy #gInterfaceInfo
@
-}
getDBusProxyGInterfaceInfo :: (MonadIO m, IsDBusProxy o) => o -> m (Maybe Gio.DBusInterfaceInfo.DBusInterfaceInfo)
getDBusProxyGInterfaceInfo obj = liftIO $ B.Properties.getObjectPropertyBoxed obj "g-interface-info" Gio.DBusInterfaceInfo.DBusInterfaceInfo

{- |
Set the value of the “@g-interface-info@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' dBusProxy [ #gInterfaceInfo 'Data.GI.Base.Attributes.:=' value ]
@
-}
setDBusProxyGInterfaceInfo :: (MonadIO m, IsDBusProxy o) => o -> Gio.DBusInterfaceInfo.DBusInterfaceInfo -> m ()
setDBusProxyGInterfaceInfo obj val = liftIO $ B.Properties.setObjectPropertyBoxed obj "g-interface-info" (Just val)

{- |
Construct a `GValueConstruct` with valid value for the “@g-interface-info@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructDBusProxyGInterfaceInfo :: (IsDBusProxy o) => Gio.DBusInterfaceInfo.DBusInterfaceInfo -> IO (GValueConstruct o)
constructDBusProxyGInterfaceInfo val = B.Properties.constructObjectPropertyBoxed "g-interface-info" (Just val)

{- |
Set the value of the “@g-interface-info@” property to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.clear' #gInterfaceInfo
@
-}
clearDBusProxyGInterfaceInfo :: (MonadIO m, IsDBusProxy o) => o -> m ()
clearDBusProxyGInterfaceInfo obj = liftIO $ B.Properties.setObjectPropertyBoxed obj "g-interface-info" (Nothing :: Maybe Gio.DBusInterfaceInfo.DBusInterfaceInfo)

#if ENABLE_OVERLOADING
data DBusProxyGInterfaceInfoPropertyInfo
instance AttrInfo DBusProxyGInterfaceInfoPropertyInfo where
    type AttrAllowedOps DBusProxyGInterfaceInfoPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DBusProxyGInterfaceInfoPropertyInfo = (~) Gio.DBusInterfaceInfo.DBusInterfaceInfo
    type AttrBaseTypeConstraint DBusProxyGInterfaceInfoPropertyInfo = IsDBusProxy
    type AttrGetType DBusProxyGInterfaceInfoPropertyInfo = (Maybe Gio.DBusInterfaceInfo.DBusInterfaceInfo)
    type AttrLabel DBusProxyGInterfaceInfoPropertyInfo = "g-interface-info"
    type AttrOrigin DBusProxyGInterfaceInfoPropertyInfo = DBusProxy
    attrGet _ = getDBusProxyGInterfaceInfo
    attrSet _ = setDBusProxyGInterfaceInfo
    attrConstruct _ = constructDBusProxyGInterfaceInfo
    attrClear _ = clearDBusProxyGInterfaceInfo
#endif

-- VVV Prop "g-interface-name"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@g-interface-name@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' dBusProxy #gInterfaceName
@
-}
getDBusProxyGInterfaceName :: (MonadIO m, IsDBusProxy o) => o -> m (Maybe T.Text)
getDBusProxyGInterfaceName obj = liftIO $ B.Properties.getObjectPropertyString obj "g-interface-name"

{- |
Construct a `GValueConstruct` with valid value for the “@g-interface-name@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructDBusProxyGInterfaceName :: (IsDBusProxy o) => T.Text -> IO (GValueConstruct o)
constructDBusProxyGInterfaceName val = B.Properties.constructObjectPropertyString "g-interface-name" (Just val)

#if ENABLE_OVERLOADING
data DBusProxyGInterfaceNamePropertyInfo
instance AttrInfo DBusProxyGInterfaceNamePropertyInfo where
    type AttrAllowedOps DBusProxyGInterfaceNamePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DBusProxyGInterfaceNamePropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint DBusProxyGInterfaceNamePropertyInfo = IsDBusProxy
    type AttrGetType DBusProxyGInterfaceNamePropertyInfo = (Maybe T.Text)
    type AttrLabel DBusProxyGInterfaceNamePropertyInfo = "g-interface-name"
    type AttrOrigin DBusProxyGInterfaceNamePropertyInfo = DBusProxy
    attrGet _ = getDBusProxyGInterfaceName
    attrSet _ = undefined
    attrConstruct _ = constructDBusProxyGInterfaceName
    attrClear _ = undefined
#endif

-- VVV Prop "g-name"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@g-name@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' dBusProxy #gName
@
-}
getDBusProxyGName :: (MonadIO m, IsDBusProxy o) => o -> m (Maybe T.Text)
getDBusProxyGName obj = liftIO $ B.Properties.getObjectPropertyString obj "g-name"

{- |
Construct a `GValueConstruct` with valid value for the “@g-name@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructDBusProxyGName :: (IsDBusProxy o) => T.Text -> IO (GValueConstruct o)
constructDBusProxyGName val = B.Properties.constructObjectPropertyString "g-name" (Just val)

#if ENABLE_OVERLOADING
data DBusProxyGNamePropertyInfo
instance AttrInfo DBusProxyGNamePropertyInfo where
    type AttrAllowedOps DBusProxyGNamePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DBusProxyGNamePropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint DBusProxyGNamePropertyInfo = IsDBusProxy
    type AttrGetType DBusProxyGNamePropertyInfo = (Maybe T.Text)
    type AttrLabel DBusProxyGNamePropertyInfo = "g-name"
    type AttrOrigin DBusProxyGNamePropertyInfo = DBusProxy
    attrGet _ = getDBusProxyGName
    attrSet _ = undefined
    attrConstruct _ = constructDBusProxyGName
    attrClear _ = undefined
#endif

-- VVV Prop "g-name-owner"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@g-name-owner@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' dBusProxy #gNameOwner
@
-}
getDBusProxyGNameOwner :: (MonadIO m, IsDBusProxy o) => o -> m (Maybe T.Text)
getDBusProxyGNameOwner obj = liftIO $ B.Properties.getObjectPropertyString obj "g-name-owner"

#if ENABLE_OVERLOADING
data DBusProxyGNameOwnerPropertyInfo
instance AttrInfo DBusProxyGNameOwnerPropertyInfo where
    type AttrAllowedOps DBusProxyGNameOwnerPropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DBusProxyGNameOwnerPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DBusProxyGNameOwnerPropertyInfo = IsDBusProxy
    type AttrGetType DBusProxyGNameOwnerPropertyInfo = (Maybe T.Text)
    type AttrLabel DBusProxyGNameOwnerPropertyInfo = "g-name-owner"
    type AttrOrigin DBusProxyGNameOwnerPropertyInfo = DBusProxy
    attrGet _ = getDBusProxyGNameOwner
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined
#endif

-- VVV Prop "g-object-path"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@g-object-path@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' dBusProxy #gObjectPath
@
-}
getDBusProxyGObjectPath :: (MonadIO m, IsDBusProxy o) => o -> m (Maybe T.Text)
getDBusProxyGObjectPath obj = liftIO $ B.Properties.getObjectPropertyString obj "g-object-path"

{- |
Construct a `GValueConstruct` with valid value for the “@g-object-path@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructDBusProxyGObjectPath :: (IsDBusProxy o) => T.Text -> IO (GValueConstruct o)
constructDBusProxyGObjectPath val = B.Properties.constructObjectPropertyString "g-object-path" (Just val)

#if ENABLE_OVERLOADING
data DBusProxyGObjectPathPropertyInfo
instance AttrInfo DBusProxyGObjectPathPropertyInfo where
    type AttrAllowedOps DBusProxyGObjectPathPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DBusProxyGObjectPathPropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint DBusProxyGObjectPathPropertyInfo = IsDBusProxy
    type AttrGetType DBusProxyGObjectPathPropertyInfo = (Maybe T.Text)
    type AttrLabel DBusProxyGObjectPathPropertyInfo = "g-object-path"
    type AttrOrigin DBusProxyGObjectPathPropertyInfo = DBusProxy
    attrGet _ = getDBusProxyGObjectPath
    attrSet _ = undefined
    attrConstruct _ = constructDBusProxyGObjectPath
    attrClear _ = undefined
#endif

#if ENABLE_OVERLOADING
instance O.HasAttributeList DBusProxy
type instance O.AttributeList DBusProxy = DBusProxyAttributeList
type DBusProxyAttributeList = ('[ '("gBusType", DBusProxyGBusTypePropertyInfo), '("gConnection", DBusProxyGConnectionPropertyInfo), '("gDefaultTimeout", DBusProxyGDefaultTimeoutPropertyInfo), '("gFlags", DBusProxyGFlagsPropertyInfo), '("gInterfaceInfo", DBusProxyGInterfaceInfoPropertyInfo), '("gInterfaceName", DBusProxyGInterfaceNamePropertyInfo), '("gName", DBusProxyGNamePropertyInfo), '("gNameOwner", DBusProxyGNameOwnerPropertyInfo), '("gObjectPath", DBusProxyGObjectPathPropertyInfo)] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
dBusProxyGBusType :: AttrLabelProxy "gBusType"
dBusProxyGBusType = AttrLabelProxy

dBusProxyGConnection :: AttrLabelProxy "gConnection"
dBusProxyGConnection = AttrLabelProxy

dBusProxyGDefaultTimeout :: AttrLabelProxy "gDefaultTimeout"
dBusProxyGDefaultTimeout = AttrLabelProxy

dBusProxyGFlags :: AttrLabelProxy "gFlags"
dBusProxyGFlags = AttrLabelProxy

dBusProxyGInterfaceInfo :: AttrLabelProxy "gInterfaceInfo"
dBusProxyGInterfaceInfo = AttrLabelProxy

dBusProxyGInterfaceName :: AttrLabelProxy "gInterfaceName"
dBusProxyGInterfaceName = AttrLabelProxy

dBusProxyGName :: AttrLabelProxy "gName"
dBusProxyGName = AttrLabelProxy

dBusProxyGNameOwner :: AttrLabelProxy "gNameOwner"
dBusProxyGNameOwner = AttrLabelProxy

dBusProxyGObjectPath :: AttrLabelProxy "gObjectPath"
dBusProxyGObjectPath = AttrLabelProxy

#endif

#if ENABLE_OVERLOADING
data DBusProxyGPropertiesChangedSignalInfo
instance SignalInfo DBusProxyGPropertiesChangedSignalInfo where
    type HaskellCallbackType DBusProxyGPropertiesChangedSignalInfo = DBusProxyGPropertiesChangedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_DBusProxyGPropertiesChangedCallback cb
        cb'' <- mk_DBusProxyGPropertiesChangedCallback cb'
        connectSignalFunPtr obj "g-properties-changed" cb'' connectMode

data DBusProxyGSignalSignalInfo
instance SignalInfo DBusProxyGSignalSignalInfo where
    type HaskellCallbackType DBusProxyGSignalSignalInfo = DBusProxyGSignalCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_DBusProxyGSignalCallback cb
        cb'' <- mk_DBusProxyGSignalCallback cb'
        connectSignalFunPtr obj "g-signal" cb'' connectMode

type instance O.SignalList DBusProxy = DBusProxySignalList
type DBusProxySignalList = ('[ '("gPropertiesChanged", DBusProxyGPropertiesChangedSignalInfo), '("gSignal", DBusProxyGSignalSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method DBusProxy::new_finish
-- method type : Constructor
-- Args : [Arg {argCName = "res", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GAsyncResult obtained from the #GAsyncReadyCallback function passed to g_dbus_proxy_new().", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "DBusProxy"}))
-- throws : True
-- Skip return : False

foreign import ccall "g_dbus_proxy_new_finish" g_dbus_proxy_new_finish ::
    Ptr Gio.AsyncResult.AsyncResult ->      -- res : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr DBusProxy)

{- |
Finishes creating a 'GI.Gio.Objects.DBusProxy.DBusProxy'.

/Since: 2.26/
-}
dBusProxyNewFinish ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.AsyncResult.IsAsyncResult a) =>
    a
    {- ^ /@res@/: A 'GI.Gio.Interfaces.AsyncResult.AsyncResult' obtained from the 'GI.Gio.Callbacks.AsyncReadyCallback' function passed to 'GI.Gio.Objects.DBusProxy.dBusProxyNew'. -}
    -> m DBusProxy
    {- ^ __Returns:__ A 'GI.Gio.Objects.DBusProxy.DBusProxy' or 'Nothing' if /@error@/ is set.
   Free with 'GI.GObject.Objects.Object.objectUnref'. /(Can throw 'Data.GI.Base.GError.GError')/ -}
dBusProxyNewFinish res = liftIO $ do
    res' <- unsafeManagedPtrCastPtr res
    onException (do
        result <- propagateGError $ g_dbus_proxy_new_finish res'
        checkUnexpectedReturnNULL "dBusProxyNewFinish" result
        result' <- (wrapObject DBusProxy) result
        touchManagedPtr res
        return result'
     ) (do
        return ()
     )

#if ENABLE_OVERLOADING
#endif

-- method DBusProxy::new_for_bus_finish
-- method type : Constructor
-- Args : [Arg {argCName = "res", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GAsyncResult obtained from the #GAsyncReadyCallback function passed to g_dbus_proxy_new_for_bus().", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "DBusProxy"}))
-- throws : True
-- Skip return : False

foreign import ccall "g_dbus_proxy_new_for_bus_finish" g_dbus_proxy_new_for_bus_finish ::
    Ptr Gio.AsyncResult.AsyncResult ->      -- res : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr DBusProxy)

{- |
Finishes creating a 'GI.Gio.Objects.DBusProxy.DBusProxy'.

/Since: 2.26/
-}
dBusProxyNewForBusFinish ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.AsyncResult.IsAsyncResult a) =>
    a
    {- ^ /@res@/: A 'GI.Gio.Interfaces.AsyncResult.AsyncResult' obtained from the 'GI.Gio.Callbacks.AsyncReadyCallback' function passed to 'GI.Gio.Objects.DBusProxy.dBusProxyNewForBus'. -}
    -> m DBusProxy
    {- ^ __Returns:__ A 'GI.Gio.Objects.DBusProxy.DBusProxy' or 'Nothing' if /@error@/ is set.
   Free with 'GI.GObject.Objects.Object.objectUnref'. /(Can throw 'Data.GI.Base.GError.GError')/ -}
dBusProxyNewForBusFinish res = liftIO $ do
    res' <- unsafeManagedPtrCastPtr res
    onException (do
        result <- propagateGError $ g_dbus_proxy_new_for_bus_finish res'
        checkUnexpectedReturnNULL "dBusProxyNewForBusFinish" result
        result' <- (wrapObject DBusProxy) result
        touchManagedPtr res
        return result'
     ) (do
        return ()
     )

#if ENABLE_OVERLOADING
#endif

-- method DBusProxy::new_for_bus_sync
-- method type : Constructor
-- Args : [Arg {argCName = "bus_type", argType = TInterface (Name {namespace = "Gio", name = "BusType"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GBusType.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gio", name = "DBusProxyFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Flags used when constructing the proxy.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "info", argType = TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #GDBusInterfaceInfo specifying the minimal interface\n       that @proxy conforms to or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A bus name (well-known or unique).", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "object_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "An object path.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "interface_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A D-Bus interface name.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #GCancellable or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "DBusProxy"}))
-- throws : True
-- Skip return : False

foreign import ccall "g_dbus_proxy_new_for_bus_sync" g_dbus_proxy_new_for_bus_sync ::
    CInt ->                                 -- bus_type : TInterface (Name {namespace = "Gio", name = "BusType"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gio", name = "DBusProxyFlags"})
    Ptr Gio.DBusInterfaceInfo.DBusInterfaceInfo -> -- info : TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"})
    CString ->                              -- name : TBasicType TUTF8
    CString ->                              -- object_path : TBasicType TUTF8
    CString ->                              -- interface_name : TBasicType TUTF8
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr DBusProxy)

{- |
Like 'GI.Gio.Objects.DBusProxy.dBusProxyNewSync' but takes a 'GI.Gio.Enums.BusType' instead of a 'GI.Gio.Objects.DBusConnection.DBusConnection'.

'GI.Gio.Objects.DBusProxy.DBusProxy' is used in this [example][gdbus-wellknown-proxy].

/Since: 2.26/
-}
dBusProxyNewForBusSync ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
    Gio.Enums.BusType
    {- ^ /@busType@/: A 'GI.Gio.Enums.BusType'. -}
    -> [Gio.Flags.DBusProxyFlags]
    {- ^ /@flags@/: Flags used when constructing the proxy. -}
    -> Maybe (Gio.DBusInterfaceInfo.DBusInterfaceInfo)
    {- ^ /@info@/: A 'GI.Gio.Structs.DBusInterfaceInfo.DBusInterfaceInfo' specifying the minimal interface
       that /@proxy@/ conforms to or 'Nothing'. -}
    -> T.Text
    {- ^ /@name@/: A bus name (well-known or unique). -}
    -> T.Text
    {- ^ /@objectPath@/: An object path. -}
    -> T.Text
    {- ^ /@interfaceName@/: A D-Bus interface name. -}
    -> Maybe (a)
    {- ^ /@cancellable@/: A 'GI.Gio.Objects.Cancellable.Cancellable' or 'Nothing'. -}
    -> m DBusProxy
    {- ^ __Returns:__ A 'GI.Gio.Objects.DBusProxy.DBusProxy' or 'Nothing' if error is set.
   Free with 'GI.GObject.Objects.Object.objectUnref'. /(Can throw 'Data.GI.Base.GError.GError')/ -}
dBusProxyNewForBusSync busType flags info name objectPath interfaceName cancellable = liftIO $ do
    let busType' = (fromIntegral . fromEnum) busType
    let flags' = gflagsToWord flags
    maybeInfo <- case info of
        Nothing -> return nullPtr
        Just jInfo -> do
            jInfo' <- unsafeManagedPtrGetPtr jInfo
            return jInfo'
    name' <- textToCString name
    objectPath' <- textToCString objectPath
    interfaceName' <- textToCString interfaceName
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        result <- propagateGError $ g_dbus_proxy_new_for_bus_sync busType' flags' maybeInfo name' objectPath' interfaceName' maybeCancellable
        checkUnexpectedReturnNULL "dBusProxyNewForBusSync" result
        result' <- (wrapObject DBusProxy) result
        whenJust info touchManagedPtr
        whenJust cancellable touchManagedPtr
        freeMem name'
        freeMem objectPath'
        freeMem interfaceName'
        return result'
     ) (do
        freeMem name'
        freeMem objectPath'
        freeMem interfaceName'
     )

#if ENABLE_OVERLOADING
#endif

-- method DBusProxy::new_sync
-- method type : Constructor
-- Args : [Arg {argCName = "connection", argType = TInterface (Name {namespace = "Gio", name = "DBusConnection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusConnection.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gio", name = "DBusProxyFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Flags used when constructing the proxy.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "info", argType = TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #GDBusInterfaceInfo specifying the minimal interface that @proxy conforms to or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "object_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "An object path.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "interface_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A D-Bus interface name.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #GCancellable or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "DBusProxy"}))
-- throws : True
-- Skip return : False

foreign import ccall "g_dbus_proxy_new_sync" g_dbus_proxy_new_sync ::
    Ptr Gio.DBusConnection.DBusConnection -> -- connection : TInterface (Name {namespace = "Gio", name = "DBusConnection"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gio", name = "DBusProxyFlags"})
    Ptr Gio.DBusInterfaceInfo.DBusInterfaceInfo -> -- info : TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"})
    CString ->                              -- name : TBasicType TUTF8
    CString ->                              -- object_path : TBasicType TUTF8
    CString ->                              -- interface_name : TBasicType TUTF8
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr DBusProxy)

{- |
Creates a proxy for accessing /@interfaceName@/ on the remote object
at /@objectPath@/ owned by /@name@/ at /@connection@/ and synchronously
loads D-Bus properties unless the
'GI.Gio.Flags.DBusProxyFlagsDoNotLoadProperties' flag is used.

If the 'GI.Gio.Flags.DBusProxyFlagsDoNotConnectSignals' flag is not set, also sets up
match rules for signals. Connect to the 'GI.Gio.Objects.DBusProxy.DBusProxy'::@/g-signal/@ signal
to handle signals from the remote object.

If both 'GI.Gio.Flags.DBusProxyFlagsDoNotLoadProperties' and
'GI.Gio.Flags.DBusProxyFlagsDoNotConnectSignals' are set, this constructor is
guaranteed to return immediately without blocking.

If /@name@/ is a well-known name and the
'GI.Gio.Flags.DBusProxyFlagsDoNotAutoStart' and 'GI.Gio.Flags.DBusProxyFlagsDoNotAutoStartAtConstruction'
flags aren\'t set and no name owner currently exists, the message bus
will be requested to launch a name owner for the name.

This is a synchronous failable constructor. See 'GI.Gio.Objects.DBusProxy.dBusProxyNew'
and 'GI.Gio.Objects.DBusProxy.dBusProxyNewFinish' for the asynchronous version.

'GI.Gio.Objects.DBusProxy.DBusProxy' is used in this [example][gdbus-wellknown-proxy].

/Since: 2.26/
-}
dBusProxyNewSync ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.DBusConnection.IsDBusConnection a, Gio.Cancellable.IsCancellable b) =>
    a
    {- ^ /@connection@/: A 'GI.Gio.Objects.DBusConnection.DBusConnection'. -}
    -> [Gio.Flags.DBusProxyFlags]
    {- ^ /@flags@/: Flags used when constructing the proxy. -}
    -> Maybe (Gio.DBusInterfaceInfo.DBusInterfaceInfo)
    {- ^ /@info@/: A 'GI.Gio.Structs.DBusInterfaceInfo.DBusInterfaceInfo' specifying the minimal interface that /@proxy@/ conforms to or 'Nothing'. -}
    -> Maybe (T.Text)
    {- ^ /@name@/: A bus name (well-known or unique) or 'Nothing' if /@connection@/ is not a message bus connection. -}
    -> T.Text
    {- ^ /@objectPath@/: An object path. -}
    -> T.Text
    {- ^ /@interfaceName@/: A D-Bus interface name. -}
    -> Maybe (b)
    {- ^ /@cancellable@/: A 'GI.Gio.Objects.Cancellable.Cancellable' or 'Nothing'. -}
    -> m DBusProxy
    {- ^ __Returns:__ A 'GI.Gio.Objects.DBusProxy.DBusProxy' or 'Nothing' if error is set.
   Free with 'GI.GObject.Objects.Object.objectUnref'. /(Can throw 'Data.GI.Base.GError.GError')/ -}
dBusProxyNewSync connection flags info name objectPath interfaceName cancellable = liftIO $ do
    connection' <- unsafeManagedPtrCastPtr connection
    let flags' = gflagsToWord flags
    maybeInfo <- case info of
        Nothing -> return nullPtr
        Just jInfo -> do
            jInfo' <- unsafeManagedPtrGetPtr jInfo
            return jInfo'
    maybeName <- case name of
        Nothing -> return nullPtr
        Just jName -> do
            jName' <- textToCString jName
            return jName'
    objectPath' <- textToCString objectPath
    interfaceName' <- textToCString interfaceName
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        result <- propagateGError $ g_dbus_proxy_new_sync connection' flags' maybeInfo maybeName objectPath' interfaceName' maybeCancellable
        checkUnexpectedReturnNULL "dBusProxyNewSync" result
        result' <- (wrapObject DBusProxy) result
        touchManagedPtr connection
        whenJust info touchManagedPtr
        whenJust cancellable touchManagedPtr
        freeMem maybeName
        freeMem objectPath'
        freeMem interfaceName'
        return result'
     ) (do
        freeMem maybeName
        freeMem objectPath'
        freeMem interfaceName'
     )

#if ENABLE_OVERLOADING
#endif

-- method DBusProxy::call
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proxy", argType = TInterface (Name {namespace = "Gio", name = "DBusProxy"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusProxy.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "method_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Name of method to invoke.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parameters", argType = TVariant, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #GVariant tuple with parameters for the signal or %NULL if not passing parameters.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gio", name = "DBusCallFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Flags from the #GDBusCallFlags enumeration.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "timeout_msec", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The timeout in milliseconds (with %G_MAXINT meaning\n               \"infinite\") or -1 to use the proxy default timeout.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #GCancellable or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #GAsyncReadyCallback to call when the request is satisfied or %NULL if you don't\ncare about the result of the method invocation.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 7, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The data to pass to @callback.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_proxy_call" g_dbus_proxy_call ::
    Ptr DBusProxy ->                        -- proxy : TInterface (Name {namespace = "Gio", name = "DBusProxy"})
    CString ->                              -- method_name : TBasicType TUTF8
    Ptr GVariant ->                         -- parameters : TVariant
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gio", name = "DBusCallFlags"})
    Int32 ->                                -- timeout_msec : TBasicType TInt
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

{- |
Asynchronously invokes the /@methodName@/ method on /@proxy@/.

If /@methodName@/ contains any dots, then /@name@/ is split into interface and
method name parts. This allows using /@proxy@/ for invoking methods on
other interfaces.

If the 'GI.Gio.Objects.DBusConnection.DBusConnection' associated with /@proxy@/ is closed then
the operation will fail with 'GI.Gio.Enums.IOErrorEnumClosed'. If
/@cancellable@/ is canceled, the operation will fail with
'GI.Gio.Enums.IOErrorEnumCancelled'. If /@parameters@/ contains a value not
compatible with the D-Bus protocol, the operation fails with
'GI.Gio.Enums.IOErrorEnumInvalidArgument'.

If the /@parameters@/ 'GVariant' is floating, it is consumed. This allows
convenient \'inline\' use of @/g_variant_new()/@, e.g.:

=== /C code/
>
> g_dbus_proxy_call (proxy,
>                    "TwoStrings",
>                    g_variant_new ("(ss)",
>                                   "Thing One",
>                                   "Thing Two"),
>                    G_DBUS_CALL_FLAGS_NONE,
>                    -1,
>                    NULL,
>                    (GAsyncReadyCallback) two_strings_done,
>                    &data);


If /@proxy@/ has an expected interface (see
'GI.Gio.Objects.DBusProxy.DBusProxy':@/g-interface-info/@) and /@methodName@/ is referenced by it,
then the return value is checked against the return type.

This is an asynchronous method. When the operation is finished,
/@callback@/ will be invoked in the
[thread-default main context][g-main-context-push-thread-default]
of the thread you are calling this method from.
You can then call 'GI.Gio.Objects.DBusProxy.dBusProxyCallFinish' to get the result of
the operation. See 'GI.Gio.Objects.DBusProxy.dBusProxyCallSync' for the synchronous
version of this method.

If /@callback@/ is 'Nothing' then the D-Bus method call message will be sent with
the 'GI.Gio.Flags.DBusMessageFlagsNoReplyExpected' flag set.

/Since: 2.26/
-}
dBusProxyCall ::
    (B.CallStack.HasCallStack, MonadIO m, IsDBusProxy a, Gio.Cancellable.IsCancellable b) =>
    a
    {- ^ /@proxy@/: A 'GI.Gio.Objects.DBusProxy.DBusProxy'. -}
    -> T.Text
    {- ^ /@methodName@/: Name of method to invoke. -}
    -> Maybe (GVariant)
    {- ^ /@parameters@/: A 'GVariant' tuple with parameters for the signal or 'Nothing' if not passing parameters. -}
    -> [Gio.Flags.DBusCallFlags]
    {- ^ /@flags@/: Flags from the 'GI.Gio.Flags.DBusCallFlags' enumeration. -}
    -> Int32
    {- ^ /@timeoutMsec@/: The timeout in milliseconds (with @/G_MAXINT/@ meaning
               \"infinite\") or -1 to use the proxy default timeout. -}
    -> Maybe (b)
    {- ^ /@cancellable@/: A 'GI.Gio.Objects.Cancellable.Cancellable' or 'Nothing'. -}
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    {- ^ /@callback@/: A 'GI.Gio.Callbacks.AsyncReadyCallback' to call when the request is satisfied or 'Nothing' if you don\'t
care about the result of the method invocation. -}
    -> m ()
dBusProxyCall proxy methodName parameters flags timeoutMsec cancellable callback = liftIO $ do
    proxy' <- unsafeManagedPtrCastPtr proxy
    methodName' <- textToCString methodName
    maybeParameters <- case parameters of
        Nothing -> return nullPtr
        Just jParameters -> do
            jParameters' <- unsafeManagedPtrGetPtr jParameters
            return jParameters'
    let flags' = gflagsToWord flags
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
            poke ptrcallback jCallback'
            return jCallback'
    let userData = nullPtr
    g_dbus_proxy_call proxy' methodName' maybeParameters flags' timeoutMsec maybeCancellable maybeCallback userData
    touchManagedPtr proxy
    whenJust parameters touchManagedPtr
    whenJust cancellable touchManagedPtr
    freeMem methodName'
    return ()

#if ENABLE_OVERLOADING
data DBusProxyCallMethodInfo
instance (signature ~ (T.Text -> Maybe (GVariant) -> [Gio.Flags.DBusCallFlags] -> Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsDBusProxy a, Gio.Cancellable.IsCancellable b) => O.MethodInfo DBusProxyCallMethodInfo a signature where
    overloadedMethod _ = dBusProxyCall

#endif

-- method DBusProxy::call_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proxy", argType = TInterface (Name {namespace = "Gio", name = "DBusProxy"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusProxy.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "res", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_proxy_call().", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just TVariant
-- throws : True
-- Skip return : False

foreign import ccall "g_dbus_proxy_call_finish" g_dbus_proxy_call_finish ::
    Ptr DBusProxy ->                        -- proxy : TInterface (Name {namespace = "Gio", name = "DBusProxy"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- res : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr GVariant)

{- |
Finishes an operation started with 'GI.Gio.Objects.DBusProxy.dBusProxyCall'.

/Since: 2.26/
-}
dBusProxyCallFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsDBusProxy a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    {- ^ /@proxy@/: A 'GI.Gio.Objects.DBusProxy.DBusProxy'. -}
    -> b
    {- ^ /@res@/: A 'GI.Gio.Interfaces.AsyncResult.AsyncResult' obtained from the 'GI.Gio.Callbacks.AsyncReadyCallback' passed to 'GI.Gio.Objects.DBusProxy.dBusProxyCall'. -}
    -> m GVariant
    {- ^ __Returns:__ 'Nothing' if /@error@/ is set. Otherwise a 'GVariant' tuple with
return values. Free with 'GI.GLib.Structs.Variant.variantUnref'. /(Can throw 'Data.GI.Base.GError.GError')/ -}
dBusProxyCallFinish proxy res = liftIO $ do
    proxy' <- unsafeManagedPtrCastPtr proxy
    res' <- unsafeManagedPtrCastPtr res
    onException (do
        result <- propagateGError $ g_dbus_proxy_call_finish proxy' res'
        checkUnexpectedReturnNULL "dBusProxyCallFinish" result
        result' <- B.GVariant.wrapGVariantPtr result
        touchManagedPtr proxy
        touchManagedPtr res
        return result'
     ) (do
        return ()
     )

#if ENABLE_OVERLOADING
data DBusProxyCallFinishMethodInfo
instance (signature ~ (b -> m GVariant), MonadIO m, IsDBusProxy a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo DBusProxyCallFinishMethodInfo a signature where
    overloadedMethod _ = dBusProxyCallFinish

#endif

-- method DBusProxy::call_sync
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proxy", argType = TInterface (Name {namespace = "Gio", name = "DBusProxy"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusProxy.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "method_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Name of method to invoke.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parameters", argType = TVariant, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #GVariant tuple with parameters for the signal\n             or %NULL if not passing parameters.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gio", name = "DBusCallFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Flags from the #GDBusCallFlags enumeration.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "timeout_msec", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The timeout in milliseconds (with %G_MAXINT meaning\n               \"infinite\") or -1 to use the proxy default timeout.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #GCancellable or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just TVariant
-- throws : True
-- Skip return : False

foreign import ccall "g_dbus_proxy_call_sync" g_dbus_proxy_call_sync ::
    Ptr DBusProxy ->                        -- proxy : TInterface (Name {namespace = "Gio", name = "DBusProxy"})
    CString ->                              -- method_name : TBasicType TUTF8
    Ptr GVariant ->                         -- parameters : TVariant
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gio", name = "DBusCallFlags"})
    Int32 ->                                -- timeout_msec : TBasicType TInt
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr GVariant)

{- |
Synchronously invokes the /@methodName@/ method on /@proxy@/.

If /@methodName@/ contains any dots, then /@name@/ is split into interface and
method name parts. This allows using /@proxy@/ for invoking methods on
other interfaces.

If the 'GI.Gio.Objects.DBusConnection.DBusConnection' associated with /@proxy@/ is disconnected then
the operation will fail with 'GI.Gio.Enums.IOErrorEnumClosed'. If
/@cancellable@/ is canceled, the operation will fail with
'GI.Gio.Enums.IOErrorEnumCancelled'. If /@parameters@/ contains a value not
compatible with the D-Bus protocol, the operation fails with
'GI.Gio.Enums.IOErrorEnumInvalidArgument'.

If the /@parameters@/ 'GVariant' is floating, it is consumed. This allows
convenient \'inline\' use of @/g_variant_new()/@, e.g.:

=== /C code/
>
> g_dbus_proxy_call_sync (proxy,
>                         "TwoStrings",
>                         g_variant_new ("(ss)",
>                                        "Thing One",
>                                        "Thing Two"),
>                         G_DBUS_CALL_FLAGS_NONE,
>                         -1,
>                         NULL,
>                         &error);


The calling thread is blocked until a reply is received. See
'GI.Gio.Objects.DBusProxy.dBusProxyCall' for the asynchronous version of this
method.

If /@proxy@/ has an expected interface (see
'GI.Gio.Objects.DBusProxy.DBusProxy':@/g-interface-info/@) and /@methodName@/ is referenced by it,
then the return value is checked against the return type.

/Since: 2.26/
-}
dBusProxyCallSync ::
    (B.CallStack.HasCallStack, MonadIO m, IsDBusProxy a, Gio.Cancellable.IsCancellable b) =>
    a
    {- ^ /@proxy@/: A 'GI.Gio.Objects.DBusProxy.DBusProxy'. -}
    -> T.Text
    {- ^ /@methodName@/: Name of method to invoke. -}
    -> Maybe (GVariant)
    {- ^ /@parameters@/: A 'GVariant' tuple with parameters for the signal
             or 'Nothing' if not passing parameters. -}
    -> [Gio.Flags.DBusCallFlags]
    {- ^ /@flags@/: Flags from the 'GI.Gio.Flags.DBusCallFlags' enumeration. -}
    -> Int32
    {- ^ /@timeoutMsec@/: The timeout in milliseconds (with @/G_MAXINT/@ meaning
               \"infinite\") or -1 to use the proxy default timeout. -}
    -> Maybe (b)
    {- ^ /@cancellable@/: A 'GI.Gio.Objects.Cancellable.Cancellable' or 'Nothing'. -}
    -> m GVariant
    {- ^ __Returns:__ 'Nothing' if /@error@/ is set. Otherwise a 'GVariant' tuple with
return values. Free with 'GI.GLib.Structs.Variant.variantUnref'. /(Can throw 'Data.GI.Base.GError.GError')/ -}
dBusProxyCallSync proxy methodName parameters flags timeoutMsec cancellable = liftIO $ do
    proxy' <- unsafeManagedPtrCastPtr proxy
    methodName' <- textToCString methodName
    maybeParameters <- case parameters of
        Nothing -> return nullPtr
        Just jParameters -> do
            jParameters' <- unsafeManagedPtrGetPtr jParameters
            return jParameters'
    let flags' = gflagsToWord flags
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        result <- propagateGError $ g_dbus_proxy_call_sync proxy' methodName' maybeParameters flags' timeoutMsec maybeCancellable
        checkUnexpectedReturnNULL "dBusProxyCallSync" result
        result' <- B.GVariant.wrapGVariantPtr result
        touchManagedPtr proxy
        whenJust parameters touchManagedPtr
        whenJust cancellable touchManagedPtr
        freeMem methodName'
        return result'
     ) (do
        freeMem methodName'
     )

#if ENABLE_OVERLOADING
data DBusProxyCallSyncMethodInfo
instance (signature ~ (T.Text -> Maybe (GVariant) -> [Gio.Flags.DBusCallFlags] -> Int32 -> Maybe (b) -> m GVariant), MonadIO m, IsDBusProxy a, Gio.Cancellable.IsCancellable b) => O.MethodInfo DBusProxyCallSyncMethodInfo a signature where
    overloadedMethod _ = dBusProxyCallSync

#endif

-- method DBusProxy::call_with_unix_fd_list
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proxy", argType = TInterface (Name {namespace = "Gio", name = "DBusProxy"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusProxy.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "method_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Name of method to invoke.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parameters", argType = TVariant, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #GVariant tuple with parameters for the signal or %NULL if not passing parameters.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gio", name = "DBusCallFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Flags from the #GDBusCallFlags enumeration.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "timeout_msec", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The timeout in milliseconds (with %G_MAXINT meaning\n               \"infinite\") or -1 to use the proxy default timeout.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fd_list", argType = TInterface (Name {namespace = "Gio", name = "UnixFDList"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #GUnixFDList or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #GCancellable or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #GAsyncReadyCallback to call when the request is satisfied or %NULL if you don't\ncare about the result of the method invocation.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 8, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The data to pass to @callback.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_proxy_call_with_unix_fd_list" g_dbus_proxy_call_with_unix_fd_list ::
    Ptr DBusProxy ->                        -- proxy : TInterface (Name {namespace = "Gio", name = "DBusProxy"})
    CString ->                              -- method_name : TBasicType TUTF8
    Ptr GVariant ->                         -- parameters : TVariant
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gio", name = "DBusCallFlags"})
    Int32 ->                                -- timeout_msec : TBasicType TInt
    Ptr Gio.UnixFDList.UnixFDList ->        -- fd_list : TInterface (Name {namespace = "Gio", name = "UnixFDList"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

{- |
Like 'GI.Gio.Objects.DBusProxy.dBusProxyCall' but also takes a 'GI.Gio.Objects.UnixFDList.UnixFDList' object.

This method is only available on UNIX.

/Since: 2.30/
-}
dBusProxyCallWithUnixFdList ::
    (B.CallStack.HasCallStack, MonadIO m, IsDBusProxy a, Gio.UnixFDList.IsUnixFDList b, Gio.Cancellable.IsCancellable c) =>
    a
    {- ^ /@proxy@/: A 'GI.Gio.Objects.DBusProxy.DBusProxy'. -}
    -> T.Text
    {- ^ /@methodName@/: Name of method to invoke. -}
    -> Maybe (GVariant)
    {- ^ /@parameters@/: A 'GVariant' tuple with parameters for the signal or 'Nothing' if not passing parameters. -}
    -> [Gio.Flags.DBusCallFlags]
    {- ^ /@flags@/: Flags from the 'GI.Gio.Flags.DBusCallFlags' enumeration. -}
    -> Int32
    {- ^ /@timeoutMsec@/: The timeout in milliseconds (with @/G_MAXINT/@ meaning
               \"infinite\") or -1 to use the proxy default timeout. -}
    -> Maybe (b)
    {- ^ /@fdList@/: A 'GI.Gio.Objects.UnixFDList.UnixFDList' or 'Nothing'. -}
    -> Maybe (c)
    {- ^ /@cancellable@/: A 'GI.Gio.Objects.Cancellable.Cancellable' or 'Nothing'. -}
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    {- ^ /@callback@/: A 'GI.Gio.Callbacks.AsyncReadyCallback' to call when the request is satisfied or 'Nothing' if you don\'t
care about the result of the method invocation. -}
    -> m ()
dBusProxyCallWithUnixFdList proxy methodName parameters flags timeoutMsec fdList cancellable callback = liftIO $ do
    proxy' <- unsafeManagedPtrCastPtr proxy
    methodName' <- textToCString methodName
    maybeParameters <- case parameters of
        Nothing -> return nullPtr
        Just jParameters -> do
            jParameters' <- unsafeManagedPtrGetPtr jParameters
            return jParameters'
    let flags' = gflagsToWord flags
    maybeFdList <- case fdList of
        Nothing -> return nullPtr
        Just jFdList -> do
            jFdList' <- unsafeManagedPtrCastPtr jFdList
            return jFdList'
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
            poke ptrcallback jCallback'
            return jCallback'
    let userData = nullPtr
    g_dbus_proxy_call_with_unix_fd_list proxy' methodName' maybeParameters flags' timeoutMsec maybeFdList maybeCancellable maybeCallback userData
    touchManagedPtr proxy
    whenJust parameters touchManagedPtr
    whenJust fdList touchManagedPtr
    whenJust cancellable touchManagedPtr
    freeMem methodName'
    return ()

#if ENABLE_OVERLOADING
data DBusProxyCallWithUnixFdListMethodInfo
instance (signature ~ (T.Text -> Maybe (GVariant) -> [Gio.Flags.DBusCallFlags] -> Int32 -> Maybe (b) -> Maybe (c) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsDBusProxy a, Gio.UnixFDList.IsUnixFDList b, Gio.Cancellable.IsCancellable c) => O.MethodInfo DBusProxyCallWithUnixFdListMethodInfo a signature where
    overloadedMethod _ = dBusProxyCallWithUnixFdList

#endif

-- method DBusProxy::call_with_unix_fd_list_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proxy", argType = TInterface (Name {namespace = "Gio", name = "DBusProxy"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusProxy.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "out_fd_list", argType = TInterface (Name {namespace = "Gio", name = "UnixFDList"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Return location for a #GUnixFDList or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "res", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_proxy_call_with_unix_fd_list().", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just TVariant
-- throws : True
-- Skip return : False

foreign import ccall "g_dbus_proxy_call_with_unix_fd_list_finish" g_dbus_proxy_call_with_unix_fd_list_finish ::
    Ptr DBusProxy ->                        -- proxy : TInterface (Name {namespace = "Gio", name = "DBusProxy"})
    Ptr (Ptr Gio.UnixFDList.UnixFDList) ->  -- out_fd_list : TInterface (Name {namespace = "Gio", name = "UnixFDList"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- res : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr GVariant)

{- |
Finishes an operation started with 'GI.Gio.Objects.DBusProxy.dBusProxyCallWithUnixFdList'.

/Since: 2.30/
-}
dBusProxyCallWithUnixFdListFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsDBusProxy a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    {- ^ /@proxy@/: A 'GI.Gio.Objects.DBusProxy.DBusProxy'. -}
    -> b
    {- ^ /@res@/: A 'GI.Gio.Interfaces.AsyncResult.AsyncResult' obtained from the 'GI.Gio.Callbacks.AsyncReadyCallback' passed to 'GI.Gio.Objects.DBusProxy.dBusProxyCallWithUnixFdList'. -}
    -> m ((GVariant, Gio.UnixFDList.UnixFDList))
    {- ^ __Returns:__ 'Nothing' if /@error@/ is set. Otherwise a 'GVariant' tuple with
return values. Free with 'GI.GLib.Structs.Variant.variantUnref'. /(Can throw 'Data.GI.Base.GError.GError')/ -}
dBusProxyCallWithUnixFdListFinish proxy res = liftIO $ do
    proxy' <- unsafeManagedPtrCastPtr proxy
    outFdList <- allocMem :: IO (Ptr (Ptr Gio.UnixFDList.UnixFDList))
    res' <- unsafeManagedPtrCastPtr res
    onException (do
        result <- propagateGError $ g_dbus_proxy_call_with_unix_fd_list_finish proxy' outFdList res'
        checkUnexpectedReturnNULL "dBusProxyCallWithUnixFdListFinish" result
        result' <- B.GVariant.wrapGVariantPtr result
        outFdList' <- peek outFdList
        outFdList'' <- (wrapObject Gio.UnixFDList.UnixFDList) outFdList'
        touchManagedPtr proxy
        touchManagedPtr res
        freeMem outFdList
        return (result', outFdList'')
     ) (do
        freeMem outFdList
     )

#if ENABLE_OVERLOADING
data DBusProxyCallWithUnixFdListFinishMethodInfo
instance (signature ~ (b -> m ((GVariant, Gio.UnixFDList.UnixFDList))), MonadIO m, IsDBusProxy a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo DBusProxyCallWithUnixFdListFinishMethodInfo a signature where
    overloadedMethod _ = dBusProxyCallWithUnixFdListFinish

#endif

-- method DBusProxy::call_with_unix_fd_list_sync
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proxy", argType = TInterface (Name {namespace = "Gio", name = "DBusProxy"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusProxy.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "method_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Name of method to invoke.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parameters", argType = TVariant, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #GVariant tuple with parameters for the signal\n             or %NULL if not passing parameters.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gio", name = "DBusCallFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Flags from the #GDBusCallFlags enumeration.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "timeout_msec", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The timeout in milliseconds (with %G_MAXINT meaning\n               \"infinite\") or -1 to use the proxy default timeout.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fd_list", argType = TInterface (Name {namespace = "Gio", name = "UnixFDList"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #GUnixFDList or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "out_fd_list", argType = TInterface (Name {namespace = "Gio", name = "UnixFDList"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Return location for a #GUnixFDList or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #GCancellable or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just TVariant
-- throws : True
-- Skip return : False

foreign import ccall "g_dbus_proxy_call_with_unix_fd_list_sync" g_dbus_proxy_call_with_unix_fd_list_sync ::
    Ptr DBusProxy ->                        -- proxy : TInterface (Name {namespace = "Gio", name = "DBusProxy"})
    CString ->                              -- method_name : TBasicType TUTF8
    Ptr GVariant ->                         -- parameters : TVariant
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gio", name = "DBusCallFlags"})
    Int32 ->                                -- timeout_msec : TBasicType TInt
    Ptr Gio.UnixFDList.UnixFDList ->        -- fd_list : TInterface (Name {namespace = "Gio", name = "UnixFDList"})
    Ptr (Ptr Gio.UnixFDList.UnixFDList) ->  -- out_fd_list : TInterface (Name {namespace = "Gio", name = "UnixFDList"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr GVariant)

{- |
Like 'GI.Gio.Objects.DBusProxy.dBusProxyCallSync' but also takes and returns 'GI.Gio.Objects.UnixFDList.UnixFDList' objects.

This method is only available on UNIX.

/Since: 2.30/
-}
dBusProxyCallWithUnixFdListSync ::
    (B.CallStack.HasCallStack, MonadIO m, IsDBusProxy a, Gio.UnixFDList.IsUnixFDList b, Gio.Cancellable.IsCancellable c) =>
    a
    {- ^ /@proxy@/: A 'GI.Gio.Objects.DBusProxy.DBusProxy'. -}
    -> T.Text
    {- ^ /@methodName@/: Name of method to invoke. -}
    -> Maybe (GVariant)
    {- ^ /@parameters@/: A 'GVariant' tuple with parameters for the signal
             or 'Nothing' if not passing parameters. -}
    -> [Gio.Flags.DBusCallFlags]
    {- ^ /@flags@/: Flags from the 'GI.Gio.Flags.DBusCallFlags' enumeration. -}
    -> Int32
    {- ^ /@timeoutMsec@/: The timeout in milliseconds (with @/G_MAXINT/@ meaning
               \"infinite\") or -1 to use the proxy default timeout. -}
    -> Maybe (b)
    {- ^ /@fdList@/: A 'GI.Gio.Objects.UnixFDList.UnixFDList' or 'Nothing'. -}
    -> Maybe (c)
    {- ^ /@cancellable@/: A 'GI.Gio.Objects.Cancellable.Cancellable' or 'Nothing'. -}
    -> m ((GVariant, Gio.UnixFDList.UnixFDList))
    {- ^ __Returns:__ 'Nothing' if /@error@/ is set. Otherwise a 'GVariant' tuple with
return values. Free with 'GI.GLib.Structs.Variant.variantUnref'. /(Can throw 'Data.GI.Base.GError.GError')/ -}
dBusProxyCallWithUnixFdListSync proxy methodName parameters flags timeoutMsec fdList cancellable = liftIO $ do
    proxy' <- unsafeManagedPtrCastPtr proxy
    methodName' <- textToCString methodName
    maybeParameters <- case parameters of
        Nothing -> return nullPtr
        Just jParameters -> do
            jParameters' <- unsafeManagedPtrGetPtr jParameters
            return jParameters'
    let flags' = gflagsToWord flags
    maybeFdList <- case fdList of
        Nothing -> return nullPtr
        Just jFdList -> do
            jFdList' <- unsafeManagedPtrCastPtr jFdList
            return jFdList'
    outFdList <- allocMem :: IO (Ptr (Ptr Gio.UnixFDList.UnixFDList))
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        result <- propagateGError $ g_dbus_proxy_call_with_unix_fd_list_sync proxy' methodName' maybeParameters flags' timeoutMsec maybeFdList outFdList maybeCancellable
        checkUnexpectedReturnNULL "dBusProxyCallWithUnixFdListSync" result
        result' <- B.GVariant.wrapGVariantPtr result
        outFdList' <- peek outFdList
        outFdList'' <- (wrapObject Gio.UnixFDList.UnixFDList) outFdList'
        touchManagedPtr proxy
        whenJust parameters touchManagedPtr
        whenJust fdList touchManagedPtr
        whenJust cancellable touchManagedPtr
        freeMem methodName'
        freeMem outFdList
        return (result', outFdList'')
     ) (do
        freeMem methodName'
        freeMem outFdList
     )

#if ENABLE_OVERLOADING
data DBusProxyCallWithUnixFdListSyncMethodInfo
instance (signature ~ (T.Text -> Maybe (GVariant) -> [Gio.Flags.DBusCallFlags] -> Int32 -> Maybe (b) -> Maybe (c) -> m ((GVariant, Gio.UnixFDList.UnixFDList))), MonadIO m, IsDBusProxy a, Gio.UnixFDList.IsUnixFDList b, Gio.Cancellable.IsCancellable c) => O.MethodInfo DBusProxyCallWithUnixFdListSyncMethodInfo a signature where
    overloadedMethod _ = dBusProxyCallWithUnixFdListSync

#endif

-- method DBusProxy::get_cached_property
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proxy", argType = TInterface (Name {namespace = "Gio", name = "DBusProxy"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusProxy.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "property_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Property name.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just TVariant
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_proxy_get_cached_property" g_dbus_proxy_get_cached_property ::
    Ptr DBusProxy ->                        -- proxy : TInterface (Name {namespace = "Gio", name = "DBusProxy"})
    CString ->                              -- property_name : TBasicType TUTF8
    IO (Ptr GVariant)

{- |
Looks up the value for a property from the cache. This call does no
blocking IO.

If /@proxy@/ has an expected interface (see
'GI.Gio.Objects.DBusProxy.DBusProxy':@/g-interface-info/@) and /@propertyName@/ is referenced by
it, then /@value@/ is checked against the type of the property.

/Since: 2.26/
-}
dBusProxyGetCachedProperty ::
    (B.CallStack.HasCallStack, MonadIO m, IsDBusProxy a) =>
    a
    {- ^ /@proxy@/: A 'GI.Gio.Objects.DBusProxy.DBusProxy'. -}
    -> T.Text
    {- ^ /@propertyName@/: Property name. -}
    -> m (Maybe GVariant)
    {- ^ __Returns:__ A reference to the 'GVariant' instance
   that holds the value for /@propertyName@/ or 'Nothing' if the value is not in
   the cache. The returned reference must be freed with 'GI.GLib.Structs.Variant.variantUnref'. -}
dBusProxyGetCachedProperty proxy propertyName = liftIO $ do
    proxy' <- unsafeManagedPtrCastPtr proxy
    propertyName' <- textToCString propertyName
    result <- g_dbus_proxy_get_cached_property proxy' propertyName'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- B.GVariant.wrapGVariantPtr result'
        return result''
    touchManagedPtr proxy
    freeMem propertyName'
    return maybeResult

#if ENABLE_OVERLOADING
data DBusProxyGetCachedPropertyMethodInfo
instance (signature ~ (T.Text -> m (Maybe GVariant)), MonadIO m, IsDBusProxy a) => O.MethodInfo DBusProxyGetCachedPropertyMethodInfo a signature where
    overloadedMethod _ = dBusProxyGetCachedProperty

#endif

-- method DBusProxy::get_cached_property_names
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proxy", argType = TInterface (Name {namespace = "Gio", name = "DBusProxy"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusProxy.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_proxy_get_cached_property_names" g_dbus_proxy_get_cached_property_names ::
    Ptr DBusProxy ->                        -- proxy : TInterface (Name {namespace = "Gio", name = "DBusProxy"})
    IO (Ptr CString)

{- |
Gets the names of all cached properties on /@proxy@/.

/Since: 2.26/
-}
dBusProxyGetCachedPropertyNames ::
    (B.CallStack.HasCallStack, MonadIO m, IsDBusProxy a) =>
    a
    {- ^ /@proxy@/: A 'GI.Gio.Objects.DBusProxy.DBusProxy'. -}
    -> m (Maybe [T.Text])
    {- ^ __Returns:__ A
         'Nothing'-terminated array of strings or 'Nothing' if
         /@proxy@/ has no cached properties. Free the returned array with
         'GI.GLib.Functions.strfreev'. -}
dBusProxyGetCachedPropertyNames proxy = liftIO $ do
    proxy' <- unsafeManagedPtrCastPtr proxy
    result <- g_dbus_proxy_get_cached_property_names proxy'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- unpackZeroTerminatedUTF8CArray result'
        mapZeroTerminatedCArray freeMem result'
        freeMem result'
        return result''
    touchManagedPtr proxy
    return maybeResult

#if ENABLE_OVERLOADING
data DBusProxyGetCachedPropertyNamesMethodInfo
instance (signature ~ (m (Maybe [T.Text])), MonadIO m, IsDBusProxy a) => O.MethodInfo DBusProxyGetCachedPropertyNamesMethodInfo a signature where
    overloadedMethod _ = dBusProxyGetCachedPropertyNames

#endif

-- method DBusProxy::get_connection
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proxy", argType = TInterface (Name {namespace = "Gio", name = "DBusProxy"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusProxy.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "DBusConnection"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_proxy_get_connection" g_dbus_proxy_get_connection ::
    Ptr DBusProxy ->                        -- proxy : TInterface (Name {namespace = "Gio", name = "DBusProxy"})
    IO (Ptr Gio.DBusConnection.DBusConnection)

{- |
Gets the connection /@proxy@/ is for.

/Since: 2.26/
-}
dBusProxyGetConnection ::
    (B.CallStack.HasCallStack, MonadIO m, IsDBusProxy a) =>
    a
    {- ^ /@proxy@/: A 'GI.Gio.Objects.DBusProxy.DBusProxy'. -}
    -> m Gio.DBusConnection.DBusConnection
    {- ^ __Returns:__ A 'GI.Gio.Objects.DBusConnection.DBusConnection' owned by /@proxy@/. Do not free. -}
dBusProxyGetConnection proxy = liftIO $ do
    proxy' <- unsafeManagedPtrCastPtr proxy
    result <- g_dbus_proxy_get_connection proxy'
    checkUnexpectedReturnNULL "dBusProxyGetConnection" result
    result' <- (newObject Gio.DBusConnection.DBusConnection) result
    touchManagedPtr proxy
    return result'

#if ENABLE_OVERLOADING
data DBusProxyGetConnectionMethodInfo
instance (signature ~ (m Gio.DBusConnection.DBusConnection), MonadIO m, IsDBusProxy a) => O.MethodInfo DBusProxyGetConnectionMethodInfo a signature where
    overloadedMethod _ = dBusProxyGetConnection

#endif

-- method DBusProxy::get_default_timeout
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proxy", argType = TInterface (Name {namespace = "Gio", name = "DBusProxy"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusProxy.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_proxy_get_default_timeout" g_dbus_proxy_get_default_timeout ::
    Ptr DBusProxy ->                        -- proxy : TInterface (Name {namespace = "Gio", name = "DBusProxy"})
    IO Int32

{- |
Gets the timeout to use if -1 (specifying default timeout) is
passed as /@timeoutMsec@/ in the 'GI.Gio.Objects.DBusProxy.dBusProxyCall' and
'GI.Gio.Objects.DBusProxy.dBusProxyCallSync' functions.

See the 'GI.Gio.Objects.DBusProxy.DBusProxy':@/g-default-timeout/@ property for more details.

/Since: 2.26/
-}
dBusProxyGetDefaultTimeout ::
    (B.CallStack.HasCallStack, MonadIO m, IsDBusProxy a) =>
    a
    {- ^ /@proxy@/: A 'GI.Gio.Objects.DBusProxy.DBusProxy'. -}
    -> m Int32
    {- ^ __Returns:__ Timeout to use for /@proxy@/. -}
dBusProxyGetDefaultTimeout proxy = liftIO $ do
    proxy' <- unsafeManagedPtrCastPtr proxy
    result <- g_dbus_proxy_get_default_timeout proxy'
    touchManagedPtr proxy
    return result

#if ENABLE_OVERLOADING
data DBusProxyGetDefaultTimeoutMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsDBusProxy a) => O.MethodInfo DBusProxyGetDefaultTimeoutMethodInfo a signature where
    overloadedMethod _ = dBusProxyGetDefaultTimeout

#endif

-- method DBusProxy::get_flags
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proxy", argType = TInterface (Name {namespace = "Gio", name = "DBusProxy"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusProxy.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "DBusProxyFlags"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_proxy_get_flags" g_dbus_proxy_get_flags ::
    Ptr DBusProxy ->                        -- proxy : TInterface (Name {namespace = "Gio", name = "DBusProxy"})
    IO CUInt

{- |
Gets the flags that /@proxy@/ was constructed with.

/Since: 2.26/
-}
dBusProxyGetFlags ::
    (B.CallStack.HasCallStack, MonadIO m, IsDBusProxy a) =>
    a
    {- ^ /@proxy@/: A 'GI.Gio.Objects.DBusProxy.DBusProxy'. -}
    -> m [Gio.Flags.DBusProxyFlags]
    {- ^ __Returns:__ Flags from the 'GI.Gio.Flags.DBusProxyFlags' enumeration. -}
dBusProxyGetFlags proxy = liftIO $ do
    proxy' <- unsafeManagedPtrCastPtr proxy
    result <- g_dbus_proxy_get_flags proxy'
    let result' = wordToGFlags result
    touchManagedPtr proxy
    return result'

#if ENABLE_OVERLOADING
data DBusProxyGetFlagsMethodInfo
instance (signature ~ (m [Gio.Flags.DBusProxyFlags]), MonadIO m, IsDBusProxy a) => O.MethodInfo DBusProxyGetFlagsMethodInfo a signature where
    overloadedMethod _ = dBusProxyGetFlags

#endif

-- method DBusProxy::get_interface_info
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proxy", argType = TInterface (Name {namespace = "Gio", name = "DBusProxy"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusProxy", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_proxy_get_interface_info" g_dbus_proxy_get_interface_info ::
    Ptr DBusProxy ->                        -- proxy : TInterface (Name {namespace = "Gio", name = "DBusProxy"})
    IO (Ptr Gio.DBusInterfaceInfo.DBusInterfaceInfo)

{- |
Returns the 'GI.Gio.Structs.DBusInterfaceInfo.DBusInterfaceInfo', if any, specifying the interface
that /@proxy@/ conforms to. See the 'GI.Gio.Objects.DBusProxy.DBusProxy':@/g-interface-info/@
property for more details.

/Since: 2.26/
-}
dBusProxyGetInterfaceInfo ::
    (B.CallStack.HasCallStack, MonadIO m, IsDBusProxy a) =>
    a
    {- ^ /@proxy@/: A 'GI.Gio.Objects.DBusProxy.DBusProxy' -}
    -> m (Maybe Gio.DBusInterfaceInfo.DBusInterfaceInfo)
    {- ^ __Returns:__ A 'GI.Gio.Structs.DBusInterfaceInfo.DBusInterfaceInfo' or 'Nothing'.
   Do not unref the returned object, it is owned by /@proxy@/. -}
dBusProxyGetInterfaceInfo proxy = liftIO $ do
    proxy' <- unsafeManagedPtrCastPtr proxy
    result <- g_dbus_proxy_get_interface_info proxy'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newBoxed Gio.DBusInterfaceInfo.DBusInterfaceInfo) result'
        return result''
    touchManagedPtr proxy
    return maybeResult

#if ENABLE_OVERLOADING
data DBusProxyGetInterfaceInfoMethodInfo
instance (signature ~ (m (Maybe Gio.DBusInterfaceInfo.DBusInterfaceInfo)), MonadIO m, IsDBusProxy a) => O.MethodInfo DBusProxyGetInterfaceInfoMethodInfo a signature where
    overloadedMethod _ = dBusProxyGetInterfaceInfo

#endif

-- method DBusProxy::get_interface_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proxy", argType = TInterface (Name {namespace = "Gio", name = "DBusProxy"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusProxy.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_proxy_get_interface_name" g_dbus_proxy_get_interface_name ::
    Ptr DBusProxy ->                        -- proxy : TInterface (Name {namespace = "Gio", name = "DBusProxy"})
    IO CString

{- |
Gets the D-Bus interface name /@proxy@/ is for.

/Since: 2.26/
-}
dBusProxyGetInterfaceName ::
    (B.CallStack.HasCallStack, MonadIO m, IsDBusProxy a) =>
    a
    {- ^ /@proxy@/: A 'GI.Gio.Objects.DBusProxy.DBusProxy'. -}
    -> m T.Text
    {- ^ __Returns:__ A string owned by /@proxy@/. Do not free. -}
dBusProxyGetInterfaceName proxy = liftIO $ do
    proxy' <- unsafeManagedPtrCastPtr proxy
    result <- g_dbus_proxy_get_interface_name proxy'
    checkUnexpectedReturnNULL "dBusProxyGetInterfaceName" result
    result' <- cstringToText result
    touchManagedPtr proxy
    return result'

#if ENABLE_OVERLOADING
data DBusProxyGetInterfaceNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsDBusProxy a) => O.MethodInfo DBusProxyGetInterfaceNameMethodInfo a signature where
    overloadedMethod _ = dBusProxyGetInterfaceName

#endif

-- method DBusProxy::get_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proxy", argType = TInterface (Name {namespace = "Gio", name = "DBusProxy"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusProxy.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_proxy_get_name" g_dbus_proxy_get_name ::
    Ptr DBusProxy ->                        -- proxy : TInterface (Name {namespace = "Gio", name = "DBusProxy"})
    IO CString

{- |
Gets the name that /@proxy@/ was constructed for.

/Since: 2.26/
-}
dBusProxyGetName ::
    (B.CallStack.HasCallStack, MonadIO m, IsDBusProxy a) =>
    a
    {- ^ /@proxy@/: A 'GI.Gio.Objects.DBusProxy.DBusProxy'. -}
    -> m T.Text
    {- ^ __Returns:__ A string owned by /@proxy@/. Do not free. -}
dBusProxyGetName proxy = liftIO $ do
    proxy' <- unsafeManagedPtrCastPtr proxy
    result <- g_dbus_proxy_get_name proxy'
    checkUnexpectedReturnNULL "dBusProxyGetName" result
    result' <- cstringToText result
    touchManagedPtr proxy
    return result'

#if ENABLE_OVERLOADING
data DBusProxyGetNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsDBusProxy a) => O.MethodInfo DBusProxyGetNameMethodInfo a signature where
    overloadedMethod _ = dBusProxyGetName

#endif

-- method DBusProxy::get_name_owner
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proxy", argType = TInterface (Name {namespace = "Gio", name = "DBusProxy"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusProxy.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_proxy_get_name_owner" g_dbus_proxy_get_name_owner ::
    Ptr DBusProxy ->                        -- proxy : TInterface (Name {namespace = "Gio", name = "DBusProxy"})
    IO CString

{- |
The unique name that owns the name that /@proxy@/ is for or 'Nothing' if
no-one currently owns that name. You may connect to the
'GI.GObject.Objects.Object.Object'::@/notify/@ signal to track changes to the
'GI.Gio.Objects.DBusProxy.DBusProxy':@/g-name-owner/@ property.

/Since: 2.26/
-}
dBusProxyGetNameOwner ::
    (B.CallStack.HasCallStack, MonadIO m, IsDBusProxy a) =>
    a
    {- ^ /@proxy@/: A 'GI.Gio.Objects.DBusProxy.DBusProxy'. -}
    -> m (Maybe T.Text)
    {- ^ __Returns:__ The name owner or 'Nothing' if no name
   owner exists. Free with 'GI.GLib.Functions.free'. -}
dBusProxyGetNameOwner proxy = liftIO $ do
    proxy' <- unsafeManagedPtrCastPtr proxy
    result <- g_dbus_proxy_get_name_owner proxy'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        freeMem result'
        return result''
    touchManagedPtr proxy
    return maybeResult

#if ENABLE_OVERLOADING
data DBusProxyGetNameOwnerMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsDBusProxy a) => O.MethodInfo DBusProxyGetNameOwnerMethodInfo a signature where
    overloadedMethod _ = dBusProxyGetNameOwner

#endif

-- method DBusProxy::get_object_path
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proxy", argType = TInterface (Name {namespace = "Gio", name = "DBusProxy"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusProxy.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_proxy_get_object_path" g_dbus_proxy_get_object_path ::
    Ptr DBusProxy ->                        -- proxy : TInterface (Name {namespace = "Gio", name = "DBusProxy"})
    IO CString

{- |
Gets the object path /@proxy@/ is for.

/Since: 2.26/
-}
dBusProxyGetObjectPath ::
    (B.CallStack.HasCallStack, MonadIO m, IsDBusProxy a) =>
    a
    {- ^ /@proxy@/: A 'GI.Gio.Objects.DBusProxy.DBusProxy'. -}
    -> m T.Text
    {- ^ __Returns:__ A string owned by /@proxy@/. Do not free. -}
dBusProxyGetObjectPath proxy = liftIO $ do
    proxy' <- unsafeManagedPtrCastPtr proxy
    result <- g_dbus_proxy_get_object_path proxy'
    checkUnexpectedReturnNULL "dBusProxyGetObjectPath" result
    result' <- cstringToText result
    touchManagedPtr proxy
    return result'

#if ENABLE_OVERLOADING
data DBusProxyGetObjectPathMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsDBusProxy a) => O.MethodInfo DBusProxyGetObjectPathMethodInfo a signature where
    overloadedMethod _ = dBusProxyGetObjectPath

#endif

-- method DBusProxy::set_cached_property
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proxy", argType = TInterface (Name {namespace = "Gio", name = "DBusProxy"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusProxy", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "property_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Property name.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TVariant, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "Value for the property or %NULL to remove it from the cache.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_proxy_set_cached_property" g_dbus_proxy_set_cached_property ::
    Ptr DBusProxy ->                        -- proxy : TInterface (Name {namespace = "Gio", name = "DBusProxy"})
    CString ->                              -- property_name : TBasicType TUTF8
    Ptr GVariant ->                         -- value : TVariant
    IO ()

{- |
If /@value@/ is not 'Nothing', sets the cached value for the property with
name /@propertyName@/ to the value in /@value@/.

If /@value@/ is 'Nothing', then the cached value is removed from the
property cache.

If /@proxy@/ has an expected interface (see
'GI.Gio.Objects.DBusProxy.DBusProxy':@/g-interface-info/@) and /@propertyName@/ is referenced by
it, then /@value@/ is checked against the type of the property.

If the /@value@/ 'GVariant' is floating, it is consumed. This allows
convenient \'inline\' use of @/g_variant_new()/@, e.g.

=== /C code/
>
> g_dbus_proxy_set_cached_property (proxy,
>                                   "SomeProperty",
>                                   g_variant_new ("(si)",
>                                                 "A String",
>                                                 42));


Normally you will not need to use this method since /@proxy@/
is tracking changes using the
@org.freedesktop.DBus.Properties.PropertiesChanged@
D-Bus signal. However, for performance reasons an object may
decide to not use this signal for some properties and instead
use a proprietary out-of-band mechanism to transmit changes.

As a concrete example, consider an object with a property
@ChatroomParticipants@ which is an array of strings. Instead of
transmitting the same (long) array every time the property changes,
it is more efficient to only transmit the delta using e.g. signals
@ChatroomParticipantJoined(String name)@ and
@ChatroomParticipantParted(String name)@.

/Since: 2.26/
-}
dBusProxySetCachedProperty ::
    (B.CallStack.HasCallStack, MonadIO m, IsDBusProxy a) =>
    a
    {- ^ /@proxy@/: A 'GI.Gio.Objects.DBusProxy.DBusProxy' -}
    -> T.Text
    {- ^ /@propertyName@/: Property name. -}
    -> Maybe (GVariant)
    {- ^ /@value@/: Value for the property or 'Nothing' to remove it from the cache. -}
    -> m ()
dBusProxySetCachedProperty proxy propertyName value = liftIO $ do
    proxy' <- unsafeManagedPtrCastPtr proxy
    propertyName' <- textToCString propertyName
    maybeValue <- case value of
        Nothing -> return nullPtr
        Just jValue -> do
            jValue' <- unsafeManagedPtrGetPtr jValue
            return jValue'
    g_dbus_proxy_set_cached_property proxy' propertyName' maybeValue
    touchManagedPtr proxy
    whenJust value touchManagedPtr
    freeMem propertyName'
    return ()

#if ENABLE_OVERLOADING
data DBusProxySetCachedPropertyMethodInfo
instance (signature ~ (T.Text -> Maybe (GVariant) -> m ()), MonadIO m, IsDBusProxy a) => O.MethodInfo DBusProxySetCachedPropertyMethodInfo a signature where
    overloadedMethod _ = dBusProxySetCachedProperty

#endif

-- method DBusProxy::set_default_timeout
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proxy", argType = TInterface (Name {namespace = "Gio", name = "DBusProxy"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusProxy.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "timeout_msec", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Timeout in milliseconds.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_proxy_set_default_timeout" g_dbus_proxy_set_default_timeout ::
    Ptr DBusProxy ->                        -- proxy : TInterface (Name {namespace = "Gio", name = "DBusProxy"})
    Int32 ->                                -- timeout_msec : TBasicType TInt
    IO ()

{- |
Sets the timeout to use if -1 (specifying default timeout) is
passed as /@timeoutMsec@/ in the 'GI.Gio.Objects.DBusProxy.dBusProxyCall' and
'GI.Gio.Objects.DBusProxy.dBusProxyCallSync' functions.

See the 'GI.Gio.Objects.DBusProxy.DBusProxy':@/g-default-timeout/@ property for more details.

/Since: 2.26/
-}
dBusProxySetDefaultTimeout ::
    (B.CallStack.HasCallStack, MonadIO m, IsDBusProxy a) =>
    a
    {- ^ /@proxy@/: A 'GI.Gio.Objects.DBusProxy.DBusProxy'. -}
    -> Int32
    {- ^ /@timeoutMsec@/: Timeout in milliseconds. -}
    -> m ()
dBusProxySetDefaultTimeout proxy timeoutMsec = liftIO $ do
    proxy' <- unsafeManagedPtrCastPtr proxy
    g_dbus_proxy_set_default_timeout proxy' timeoutMsec
    touchManagedPtr proxy
    return ()

#if ENABLE_OVERLOADING
data DBusProxySetDefaultTimeoutMethodInfo
instance (signature ~ (Int32 -> m ()), MonadIO m, IsDBusProxy a) => O.MethodInfo DBusProxySetDefaultTimeoutMethodInfo a signature where
    overloadedMethod _ = dBusProxySetDefaultTimeout

#endif

-- method DBusProxy::set_interface_info
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proxy", argType = TInterface (Name {namespace = "Gio", name = "DBusProxy"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusProxy", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "info", argType = TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "Minimum interface this proxy conforms to\n   or %NULL to unset.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_proxy_set_interface_info" g_dbus_proxy_set_interface_info ::
    Ptr DBusProxy ->                        -- proxy : TInterface (Name {namespace = "Gio", name = "DBusProxy"})
    Ptr Gio.DBusInterfaceInfo.DBusInterfaceInfo -> -- info : TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"})
    IO ()

{- |
Ensure that interactions with /@proxy@/ conform to the given
interface. See the 'GI.Gio.Objects.DBusProxy.DBusProxy':@/g-interface-info/@ property for more
details.

/Since: 2.26/
-}
dBusProxySetInterfaceInfo ::
    (B.CallStack.HasCallStack, MonadIO m, IsDBusProxy a) =>
    a
    {- ^ /@proxy@/: A 'GI.Gio.Objects.DBusProxy.DBusProxy' -}
    -> Maybe (Gio.DBusInterfaceInfo.DBusInterfaceInfo)
    {- ^ /@info@/: Minimum interface this proxy conforms to
   or 'Nothing' to unset. -}
    -> m ()
dBusProxySetInterfaceInfo proxy info = liftIO $ do
    proxy' <- unsafeManagedPtrCastPtr proxy
    maybeInfo <- case info of
        Nothing -> return nullPtr
        Just jInfo -> do
            jInfo' <- unsafeManagedPtrGetPtr jInfo
            return jInfo'
    g_dbus_proxy_set_interface_info proxy' maybeInfo
    touchManagedPtr proxy
    whenJust info touchManagedPtr
    return ()

#if ENABLE_OVERLOADING
data DBusProxySetInterfaceInfoMethodInfo
instance (signature ~ (Maybe (Gio.DBusInterfaceInfo.DBusInterfaceInfo) -> m ()), MonadIO m, IsDBusProxy a) => O.MethodInfo DBusProxySetInterfaceInfoMethodInfo a signature where
    overloadedMethod _ = dBusProxySetInterfaceInfo

#endif

-- method DBusProxy::new
-- method type : MemberFunction
-- Args : [Arg {argCName = "connection", argType = TInterface (Name {namespace = "Gio", name = "DBusConnection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDBusConnection.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gio", name = "DBusProxyFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Flags used when constructing the proxy.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "info", argType = TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #GDBusInterfaceInfo specifying the minimal interface that @proxy conforms to or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "object_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "An object path.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "interface_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A D-Bus interface name.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #GCancellable or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "Callback function to invoke when the proxy is ready.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 8, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "User data to pass to @callback.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_proxy_new" g_dbus_proxy_new ::
    Ptr Gio.DBusConnection.DBusConnection -> -- connection : TInterface (Name {namespace = "Gio", name = "DBusConnection"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gio", name = "DBusProxyFlags"})
    Ptr Gio.DBusInterfaceInfo.DBusInterfaceInfo -> -- info : TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"})
    CString ->                              -- name : TBasicType TUTF8
    CString ->                              -- object_path : TBasicType TUTF8
    CString ->                              -- interface_name : TBasicType TUTF8
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

{- |
Creates a proxy for accessing /@interfaceName@/ on the remote object
at /@objectPath@/ owned by /@name@/ at /@connection@/ and asynchronously
loads D-Bus properties unless the
'GI.Gio.Flags.DBusProxyFlagsDoNotLoadProperties' flag is used. Connect to
the 'GI.Gio.Objects.DBusProxy.DBusProxy'::@/g-properties-changed/@ signal to get notified about
property changes.

If the 'GI.Gio.Flags.DBusProxyFlagsDoNotConnectSignals' flag is not set, also sets up
match rules for signals. Connect to the 'GI.Gio.Objects.DBusProxy.DBusProxy'::@/g-signal/@ signal
to handle signals from the remote object.

If both 'GI.Gio.Flags.DBusProxyFlagsDoNotLoadProperties' and
'GI.Gio.Flags.DBusProxyFlagsDoNotConnectSignals' are set, this constructor is
guaranteed to complete immediately without blocking.

If /@name@/ is a well-known name and the
'GI.Gio.Flags.DBusProxyFlagsDoNotAutoStart' and 'GI.Gio.Flags.DBusProxyFlagsDoNotAutoStartAtConstruction'
flags aren\'t set and no name owner currently exists, the message bus
will be requested to launch a name owner for the name.

This is a failable asynchronous constructor - when the proxy is
ready, /@callback@/ will be invoked and you can use
'GI.Gio.Objects.DBusProxy.dBusProxyNewFinish' to get the result.

See 'GI.Gio.Objects.DBusProxy.dBusProxyNewSync' and for a synchronous version of this constructor.

'GI.Gio.Objects.DBusProxy.DBusProxy' is used in this [example][gdbus-wellknown-proxy].

/Since: 2.26/
-}
dBusProxyNew ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.DBusConnection.IsDBusConnection a, Gio.Cancellable.IsCancellable b) =>
    a
    {- ^ /@connection@/: A 'GI.Gio.Objects.DBusConnection.DBusConnection'. -}
    -> [Gio.Flags.DBusProxyFlags]
    {- ^ /@flags@/: Flags used when constructing the proxy. -}
    -> Maybe (Gio.DBusInterfaceInfo.DBusInterfaceInfo)
    {- ^ /@info@/: A 'GI.Gio.Structs.DBusInterfaceInfo.DBusInterfaceInfo' specifying the minimal interface that /@proxy@/ conforms to or 'Nothing'. -}
    -> Maybe (T.Text)
    {- ^ /@name@/: A bus name (well-known or unique) or 'Nothing' if /@connection@/ is not a message bus connection. -}
    -> T.Text
    {- ^ /@objectPath@/: An object path. -}
    -> T.Text
    {- ^ /@interfaceName@/: A D-Bus interface name. -}
    -> Maybe (b)
    {- ^ /@cancellable@/: A 'GI.Gio.Objects.Cancellable.Cancellable' or 'Nothing'. -}
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    {- ^ /@callback@/: Callback function to invoke when the proxy is ready. -}
    -> m ()
dBusProxyNew connection flags info name objectPath interfaceName cancellable callback = liftIO $ do
    connection' <- unsafeManagedPtrCastPtr connection
    let flags' = gflagsToWord flags
    maybeInfo <- case info of
        Nothing -> return nullPtr
        Just jInfo -> do
            jInfo' <- unsafeManagedPtrGetPtr jInfo
            return jInfo'
    maybeName <- case name of
        Nothing -> return nullPtr
        Just jName -> do
            jName' <- textToCString jName
            return jName'
    objectPath' <- textToCString objectPath
    interfaceName' <- textToCString interfaceName
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
            poke ptrcallback jCallback'
            return jCallback'
    let userData = nullPtr
    g_dbus_proxy_new connection' flags' maybeInfo maybeName objectPath' interfaceName' maybeCancellable maybeCallback userData
    touchManagedPtr connection
    whenJust info touchManagedPtr
    whenJust cancellable touchManagedPtr
    freeMem maybeName
    freeMem objectPath'
    freeMem interfaceName'
    return ()

#if ENABLE_OVERLOADING
#endif

-- method DBusProxy::new_for_bus
-- method type : MemberFunction
-- Args : [Arg {argCName = "bus_type", argType = TInterface (Name {namespace = "Gio", name = "BusType"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GBusType.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gio", name = "DBusProxyFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Flags used when constructing the proxy.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "info", argType = TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #GDBusInterfaceInfo specifying the minimal interface that @proxy conforms to or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A bus name (well-known or unique).", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "object_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "An object path.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "interface_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A D-Bus interface name.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #GCancellable or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "Callback function to invoke when the proxy is ready.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 8, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "User data to pass to @callback.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_proxy_new_for_bus" g_dbus_proxy_new_for_bus ::
    CInt ->                                 -- bus_type : TInterface (Name {namespace = "Gio", name = "BusType"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gio", name = "DBusProxyFlags"})
    Ptr Gio.DBusInterfaceInfo.DBusInterfaceInfo -> -- info : TInterface (Name {namespace = "Gio", name = "DBusInterfaceInfo"})
    CString ->                              -- name : TBasicType TUTF8
    CString ->                              -- object_path : TBasicType TUTF8
    CString ->                              -- interface_name : TBasicType TUTF8
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

{- |
Like 'GI.Gio.Objects.DBusProxy.dBusProxyNew' but takes a 'GI.Gio.Enums.BusType' instead of a 'GI.Gio.Objects.DBusConnection.DBusConnection'.

'GI.Gio.Objects.DBusProxy.DBusProxy' is used in this [example][gdbus-wellknown-proxy].

/Since: 2.26/
-}
dBusProxyNewForBus ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
    Gio.Enums.BusType
    {- ^ /@busType@/: A 'GI.Gio.Enums.BusType'. -}
    -> [Gio.Flags.DBusProxyFlags]
    {- ^ /@flags@/: Flags used when constructing the proxy. -}
    -> Maybe (Gio.DBusInterfaceInfo.DBusInterfaceInfo)
    {- ^ /@info@/: A 'GI.Gio.Structs.DBusInterfaceInfo.DBusInterfaceInfo' specifying the minimal interface that /@proxy@/ conforms to or 'Nothing'. -}
    -> T.Text
    {- ^ /@name@/: A bus name (well-known or unique). -}
    -> T.Text
    {- ^ /@objectPath@/: An object path. -}
    -> T.Text
    {- ^ /@interfaceName@/: A D-Bus interface name. -}
    -> Maybe (a)
    {- ^ /@cancellable@/: A 'GI.Gio.Objects.Cancellable.Cancellable' or 'Nothing'. -}
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    {- ^ /@callback@/: Callback function to invoke when the proxy is ready. -}
    -> m ()
dBusProxyNewForBus busType flags info name objectPath interfaceName cancellable callback = liftIO $ do
    let busType' = (fromIntegral . fromEnum) busType
    let flags' = gflagsToWord flags
    maybeInfo <- case info of
        Nothing -> return nullPtr
        Just jInfo -> do
            jInfo' <- unsafeManagedPtrGetPtr jInfo
            return jInfo'
    name' <- textToCString name
    objectPath' <- textToCString objectPath
    interfaceName' <- textToCString interfaceName
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
            poke ptrcallback jCallback'
            return jCallback'
    let userData = nullPtr
    g_dbus_proxy_new_for_bus busType' flags' maybeInfo name' objectPath' interfaceName' maybeCancellable maybeCallback userData
    whenJust info touchManagedPtr
    whenJust cancellable touchManagedPtr
    freeMem name'
    freeMem objectPath'
    freeMem interfaceName'
    return ()

#if ENABLE_OVERLOADING
#endif