{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- The t'GI.Gio.Interfaces.DBusObject.DBusObject' type is the base type for D-Bus objects on both
-- the service side (see t'GI.Gio.Objects.DBusObjectSkeleton.DBusObjectSkeleton') and the client side
-- (see t'GI.Gio.Objects.DBusObjectProxy.DBusObjectProxy'). It is essentially just a container of
-- interfaces.

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

module GI.Gio.Interfaces.DBusObject
    ( 

-- * Exported types
    DBusObject(..)                          ,
    noDBusObject                            ,
    IsDBusObject                            ,
    toDBusObject                            ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveDBusObjectMethod                 ,
#endif


-- ** getInterface #method:getInterface#

#if defined(ENABLE_OVERLOADING)
    DBusObjectGetInterfaceMethodInfo        ,
#endif
    dBusObjectGetInterface                  ,


-- ** getInterfaces #method:getInterfaces#

#if defined(ENABLE_OVERLOADING)
    DBusObjectGetInterfacesMethodInfo       ,
#endif
    dBusObjectGetInterfaces                 ,


-- ** getObjectPath #method:getObjectPath#

#if defined(ENABLE_OVERLOADING)
    DBusObjectGetObjectPathMethodInfo       ,
#endif
    dBusObjectGetObjectPath                 ,




 -- * Signals
-- ** interfaceAdded #signal:interfaceAdded#

    C_DBusObjectInterfaceAddedCallback      ,
    DBusObjectInterfaceAddedCallback        ,
#if defined(ENABLE_OVERLOADING)
    DBusObjectInterfaceAddedSignalInfo      ,
#endif
    afterDBusObjectInterfaceAdded           ,
    genClosure_DBusObjectInterfaceAdded     ,
    mk_DBusObjectInterfaceAddedCallback     ,
    noDBusObjectInterfaceAddedCallback      ,
    onDBusObjectInterfaceAdded              ,
    wrap_DBusObjectInterfaceAddedCallback   ,


-- ** interfaceRemoved #signal:interfaceRemoved#

    C_DBusObjectInterfaceRemovedCallback    ,
    DBusObjectInterfaceRemovedCallback      ,
#if defined(ENABLE_OVERLOADING)
    DBusObjectInterfaceRemovedSignalInfo    ,
#endif
    afterDBusObjectInterfaceRemoved         ,
    genClosure_DBusObjectInterfaceRemoved   ,
    mk_DBusObjectInterfaceRemovedCallback   ,
    noDBusObjectInterfaceRemovedCallback    ,
    onDBusObjectInterfaceRemoved            ,
    wrap_DBusObjectInterfaceRemovedCallback ,




    ) 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.GI.Base.Signals as B.Signals
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 {-# SOURCE #-} qualified GI.Gio.Interfaces.DBusInterface as Gio.DBusInterface

-- interface DBusObject 
-- | Memory-managed wrapper type.
newtype DBusObject = DBusObject (ManagedPtr DBusObject)
    deriving (DBusObject -> DBusObject -> Bool
(DBusObject -> DBusObject -> Bool)
-> (DBusObject -> DBusObject -> Bool) -> Eq DBusObject
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DBusObject -> DBusObject -> Bool
$c/= :: DBusObject -> DBusObject -> Bool
== :: DBusObject -> DBusObject -> Bool
$c== :: DBusObject -> DBusObject -> Bool
Eq)
-- | A convenience alias for `Nothing` :: `Maybe` `DBusObject`.
noDBusObject :: Maybe DBusObject
noDBusObject :: Maybe DBusObject
noDBusObject = Maybe DBusObject
forall a. Maybe a
Nothing

-- signal DBusObject::interface-added
-- | Emitted when /@interface@/ is added to /@object@/.
-- 
-- /Since: 2.30/
type DBusObjectInterfaceAddedCallback =
    Gio.DBusInterface.DBusInterface
    -- ^ /@interface@/: The t'GI.Gio.Interfaces.DBusInterface.DBusInterface' that was added.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `DBusObjectInterfaceAddedCallback`@.
noDBusObjectInterfaceAddedCallback :: Maybe DBusObjectInterfaceAddedCallback
noDBusObjectInterfaceAddedCallback :: Maybe DBusObjectInterfaceAddedCallback
noDBusObjectInterfaceAddedCallback = Maybe DBusObjectInterfaceAddedCallback
forall a. Maybe a
Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_DBusObjectInterfaceAddedCallback =
    Ptr () ->                               -- object
    Ptr Gio.DBusInterface.DBusInterface ->
    Ptr () ->                               -- user_data
    IO ()

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

-- | Wrap the callback into a `GClosure`.
genClosure_DBusObjectInterfaceAdded :: MonadIO m => DBusObjectInterfaceAddedCallback -> m (GClosure C_DBusObjectInterfaceAddedCallback)
genClosure_DBusObjectInterfaceAdded :: DBusObjectInterfaceAddedCallback
-> m (GClosure C_DBusObjectInterfaceAddedCallback)
genClosure_DBusObjectInterfaceAdded cb :: DBusObjectInterfaceAddedCallback
cb = IO (GClosure C_DBusObjectInterfaceAddedCallback)
-> m (GClosure C_DBusObjectInterfaceAddedCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DBusObjectInterfaceAddedCallback)
 -> m (GClosure C_DBusObjectInterfaceAddedCallback))
-> IO (GClosure C_DBusObjectInterfaceAddedCallback)
-> m (GClosure C_DBusObjectInterfaceAddedCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_DBusObjectInterfaceAddedCallback
cb' = DBusObjectInterfaceAddedCallback
-> C_DBusObjectInterfaceAddedCallback
wrap_DBusObjectInterfaceAddedCallback DBusObjectInterfaceAddedCallback
cb
    C_DBusObjectInterfaceAddedCallback
-> IO (FunPtr C_DBusObjectInterfaceAddedCallback)
mk_DBusObjectInterfaceAddedCallback C_DBusObjectInterfaceAddedCallback
cb' IO (FunPtr C_DBusObjectInterfaceAddedCallback)
-> (FunPtr C_DBusObjectInterfaceAddedCallback
    -> IO (GClosure C_DBusObjectInterfaceAddedCallback))
-> IO (GClosure C_DBusObjectInterfaceAddedCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DBusObjectInterfaceAddedCallback
-> IO (GClosure C_DBusObjectInterfaceAddedCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `DBusObjectInterfaceAddedCallback` into a `C_DBusObjectInterfaceAddedCallback`.
wrap_DBusObjectInterfaceAddedCallback ::
    DBusObjectInterfaceAddedCallback ->
    C_DBusObjectInterfaceAddedCallback
wrap_DBusObjectInterfaceAddedCallback :: DBusObjectInterfaceAddedCallback
-> C_DBusObjectInterfaceAddedCallback
wrap_DBusObjectInterfaceAddedCallback _cb :: DBusObjectInterfaceAddedCallback
_cb _ interface :: Ptr DBusInterface
interface _ = do
    DBusInterface
interface' <- ((ManagedPtr DBusInterface -> DBusInterface)
-> Ptr DBusInterface -> IO DBusInterface
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr DBusInterface -> DBusInterface
Gio.DBusInterface.DBusInterface) Ptr DBusInterface
interface
    DBusObjectInterfaceAddedCallback
_cb  DBusInterface
interface'


-- | Connect a signal handler for the [interfaceAdded](#signal:interfaceAdded) 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' dBusObject #interfaceAdded callback
-- @
-- 
-- 
onDBusObjectInterfaceAdded :: (IsDBusObject a, MonadIO m) => a -> DBusObjectInterfaceAddedCallback -> m SignalHandlerId
onDBusObjectInterfaceAdded :: a -> DBusObjectInterfaceAddedCallback -> m SignalHandlerId
onDBusObjectInterfaceAdded obj :: a
obj cb :: DBusObjectInterfaceAddedCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_DBusObjectInterfaceAddedCallback
cb' = DBusObjectInterfaceAddedCallback
-> C_DBusObjectInterfaceAddedCallback
wrap_DBusObjectInterfaceAddedCallback DBusObjectInterfaceAddedCallback
cb
    FunPtr C_DBusObjectInterfaceAddedCallback
cb'' <- C_DBusObjectInterfaceAddedCallback
-> IO (FunPtr C_DBusObjectInterfaceAddedCallback)
mk_DBusObjectInterfaceAddedCallback C_DBusObjectInterfaceAddedCallback
cb'
    a
-> Text
-> FunPtr C_DBusObjectInterfaceAddedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "interface-added" FunPtr C_DBusObjectInterfaceAddedCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [interfaceAdded](#signal:interfaceAdded) 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' dBusObject #interfaceAdded callback
-- @
-- 
-- 
afterDBusObjectInterfaceAdded :: (IsDBusObject a, MonadIO m) => a -> DBusObjectInterfaceAddedCallback -> m SignalHandlerId
afterDBusObjectInterfaceAdded :: a -> DBusObjectInterfaceAddedCallback -> m SignalHandlerId
afterDBusObjectInterfaceAdded obj :: a
obj cb :: DBusObjectInterfaceAddedCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_DBusObjectInterfaceAddedCallback
cb' = DBusObjectInterfaceAddedCallback
-> C_DBusObjectInterfaceAddedCallback
wrap_DBusObjectInterfaceAddedCallback DBusObjectInterfaceAddedCallback
cb
    FunPtr C_DBusObjectInterfaceAddedCallback
cb'' <- C_DBusObjectInterfaceAddedCallback
-> IO (FunPtr C_DBusObjectInterfaceAddedCallback)
mk_DBusObjectInterfaceAddedCallback C_DBusObjectInterfaceAddedCallback
cb'
    a
-> Text
-> FunPtr C_DBusObjectInterfaceAddedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "interface-added" FunPtr C_DBusObjectInterfaceAddedCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data DBusObjectInterfaceAddedSignalInfo
instance SignalInfo DBusObjectInterfaceAddedSignalInfo where
    type HaskellCallbackType DBusObjectInterfaceAddedSignalInfo = DBusObjectInterfaceAddedCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_DBusObjectInterfaceAddedCallback cb
        cb'' <- mk_DBusObjectInterfaceAddedCallback cb'
        connectSignalFunPtr obj "interface-added" cb'' connectMode detail

#endif

-- signal DBusObject::interface-removed
-- | Emitted when /@interface@/ is removed from /@object@/.
-- 
-- /Since: 2.30/
type DBusObjectInterfaceRemovedCallback =
    Gio.DBusInterface.DBusInterface
    -- ^ /@interface@/: The t'GI.Gio.Interfaces.DBusInterface.DBusInterface' that was removed.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `DBusObjectInterfaceRemovedCallback`@.
noDBusObjectInterfaceRemovedCallback :: Maybe DBusObjectInterfaceRemovedCallback
noDBusObjectInterfaceRemovedCallback :: Maybe DBusObjectInterfaceAddedCallback
noDBusObjectInterfaceRemovedCallback = Maybe DBusObjectInterfaceAddedCallback
forall a. Maybe a
Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_DBusObjectInterfaceRemovedCallback =
    Ptr () ->                               -- object
    Ptr Gio.DBusInterface.DBusInterface ->
    Ptr () ->                               -- user_data
    IO ()

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

-- | Wrap the callback into a `GClosure`.
genClosure_DBusObjectInterfaceRemoved :: MonadIO m => DBusObjectInterfaceRemovedCallback -> m (GClosure C_DBusObjectInterfaceRemovedCallback)
genClosure_DBusObjectInterfaceRemoved :: DBusObjectInterfaceAddedCallback
-> m (GClosure C_DBusObjectInterfaceAddedCallback)
genClosure_DBusObjectInterfaceRemoved cb :: DBusObjectInterfaceAddedCallback
cb = IO (GClosure C_DBusObjectInterfaceAddedCallback)
-> m (GClosure C_DBusObjectInterfaceAddedCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DBusObjectInterfaceAddedCallback)
 -> m (GClosure C_DBusObjectInterfaceAddedCallback))
-> IO (GClosure C_DBusObjectInterfaceAddedCallback)
-> m (GClosure C_DBusObjectInterfaceAddedCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_DBusObjectInterfaceAddedCallback
cb' = DBusObjectInterfaceAddedCallback
-> C_DBusObjectInterfaceAddedCallback
wrap_DBusObjectInterfaceRemovedCallback DBusObjectInterfaceAddedCallback
cb
    C_DBusObjectInterfaceAddedCallback
-> IO (FunPtr C_DBusObjectInterfaceAddedCallback)
mk_DBusObjectInterfaceRemovedCallback C_DBusObjectInterfaceAddedCallback
cb' IO (FunPtr C_DBusObjectInterfaceAddedCallback)
-> (FunPtr C_DBusObjectInterfaceAddedCallback
    -> IO (GClosure C_DBusObjectInterfaceAddedCallback))
-> IO (GClosure C_DBusObjectInterfaceAddedCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DBusObjectInterfaceAddedCallback
-> IO (GClosure C_DBusObjectInterfaceAddedCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `DBusObjectInterfaceRemovedCallback` into a `C_DBusObjectInterfaceRemovedCallback`.
wrap_DBusObjectInterfaceRemovedCallback ::
    DBusObjectInterfaceRemovedCallback ->
    C_DBusObjectInterfaceRemovedCallback
wrap_DBusObjectInterfaceRemovedCallback :: DBusObjectInterfaceAddedCallback
-> C_DBusObjectInterfaceAddedCallback
wrap_DBusObjectInterfaceRemovedCallback _cb :: DBusObjectInterfaceAddedCallback
_cb _ interface :: Ptr DBusInterface
interface _ = do
    DBusInterface
interface' <- ((ManagedPtr DBusInterface -> DBusInterface)
-> Ptr DBusInterface -> IO DBusInterface
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr DBusInterface -> DBusInterface
Gio.DBusInterface.DBusInterface) Ptr DBusInterface
interface
    DBusObjectInterfaceAddedCallback
_cb  DBusInterface
interface'


-- | Connect a signal handler for the [interfaceRemoved](#signal:interfaceRemoved) 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' dBusObject #interfaceRemoved callback
-- @
-- 
-- 
onDBusObjectInterfaceRemoved :: (IsDBusObject a, MonadIO m) => a -> DBusObjectInterfaceRemovedCallback -> m SignalHandlerId
onDBusObjectInterfaceRemoved :: a -> DBusObjectInterfaceAddedCallback -> m SignalHandlerId
onDBusObjectInterfaceRemoved obj :: a
obj cb :: DBusObjectInterfaceAddedCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_DBusObjectInterfaceAddedCallback
cb' = DBusObjectInterfaceAddedCallback
-> C_DBusObjectInterfaceAddedCallback
wrap_DBusObjectInterfaceRemovedCallback DBusObjectInterfaceAddedCallback
cb
    FunPtr C_DBusObjectInterfaceAddedCallback
cb'' <- C_DBusObjectInterfaceAddedCallback
-> IO (FunPtr C_DBusObjectInterfaceAddedCallback)
mk_DBusObjectInterfaceRemovedCallback C_DBusObjectInterfaceAddedCallback
cb'
    a
-> Text
-> FunPtr C_DBusObjectInterfaceAddedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "interface-removed" FunPtr C_DBusObjectInterfaceAddedCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [interfaceRemoved](#signal:interfaceRemoved) 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' dBusObject #interfaceRemoved callback
-- @
-- 
-- 
afterDBusObjectInterfaceRemoved :: (IsDBusObject a, MonadIO m) => a -> DBusObjectInterfaceRemovedCallback -> m SignalHandlerId
afterDBusObjectInterfaceRemoved :: a -> DBusObjectInterfaceAddedCallback -> m SignalHandlerId
afterDBusObjectInterfaceRemoved obj :: a
obj cb :: DBusObjectInterfaceAddedCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_DBusObjectInterfaceAddedCallback
cb' = DBusObjectInterfaceAddedCallback
-> C_DBusObjectInterfaceAddedCallback
wrap_DBusObjectInterfaceRemovedCallback DBusObjectInterfaceAddedCallback
cb
    FunPtr C_DBusObjectInterfaceAddedCallback
cb'' <- C_DBusObjectInterfaceAddedCallback
-> IO (FunPtr C_DBusObjectInterfaceAddedCallback)
mk_DBusObjectInterfaceRemovedCallback C_DBusObjectInterfaceAddedCallback
cb'
    a
-> Text
-> FunPtr C_DBusObjectInterfaceAddedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "interface-removed" FunPtr C_DBusObjectInterfaceAddedCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data DBusObjectInterfaceRemovedSignalInfo
instance SignalInfo DBusObjectInterfaceRemovedSignalInfo where
    type HaskellCallbackType DBusObjectInterfaceRemovedSignalInfo = DBusObjectInterfaceRemovedCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_DBusObjectInterfaceRemovedCallback cb
        cb'' <- mk_DBusObjectInterfaceRemovedCallback cb'
        connectSignalFunPtr obj "interface-removed" cb'' connectMode detail

#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList DBusObject = DBusObjectSignalList
type DBusObjectSignalList = ('[ '("interfaceAdded", DBusObjectInterfaceAddedSignalInfo), '("interfaceRemoved", DBusObjectInterfaceRemovedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

foreign import ccall "g_dbus_object_get_type"
    c_g_dbus_object_get_type :: IO GType

instance GObject DBusObject where
    gobjectType :: IO GType
gobjectType = IO GType
c_g_dbus_object_get_type
    

-- | Convert 'DBusObject' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue DBusObject where
    toGValue :: DBusObject -> IO GValue
toGValue o :: DBusObject
o = do
        GType
gtype <- IO GType
c_g_dbus_object_get_type
        DBusObject -> (Ptr DBusObject -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr DBusObject
o (GType
-> (GValue -> Ptr DBusObject -> IO ())
-> Ptr DBusObject
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr DBusObject -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
        
    fromGValue :: GValue -> IO DBusObject
fromGValue gv :: GValue
gv = do
        Ptr DBusObject
ptr <- GValue -> IO (Ptr DBusObject)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr DBusObject)
        (ManagedPtr DBusObject -> DBusObject)
-> Ptr DBusObject -> IO DBusObject
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr DBusObject -> DBusObject
DBusObject Ptr DBusObject
ptr
        
    

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

instance O.HasParentTypes DBusObject
type instance O.ParentTypes DBusObject = '[GObject.Object.Object]

-- | Cast to `DBusObject`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toDBusObject :: (MonadIO m, IsDBusObject o) => o -> m DBusObject
toDBusObject :: o -> m DBusObject
toDBusObject = IO DBusObject -> m DBusObject
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DBusObject -> m DBusObject)
-> (o -> IO DBusObject) -> o -> m DBusObject
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr DBusObject -> DBusObject) -> o -> IO DBusObject
forall o o'.
(HasCallStack, GObject o, GObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr DBusObject -> DBusObject
DBusObject

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList DBusObject
type instance O.AttributeList DBusObject = DBusObjectAttributeList
type DBusObjectAttributeList = ('[ ] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveDBusObjectMethod (t :: Symbol) (o :: *) :: * where
    ResolveDBusObjectMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveDBusObjectMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveDBusObjectMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveDBusObjectMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveDBusObjectMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveDBusObjectMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveDBusObjectMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveDBusObjectMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveDBusObjectMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveDBusObjectMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveDBusObjectMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveDBusObjectMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveDBusObjectMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveDBusObjectMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveDBusObjectMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveDBusObjectMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveDBusObjectMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveDBusObjectMethod "getInterface" o = DBusObjectGetInterfaceMethodInfo
    ResolveDBusObjectMethod "getInterfaces" o = DBusObjectGetInterfacesMethodInfo
    ResolveDBusObjectMethod "getObjectPath" o = DBusObjectGetObjectPathMethodInfo
    ResolveDBusObjectMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveDBusObjectMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveDBusObjectMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveDBusObjectMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveDBusObjectMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveDBusObjectMethod l o = O.MethodResolutionFailed l o

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

#endif

-- method DBusObject::get_interface
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "object"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "DBusObject" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GDBusObject." , 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
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Gio" , name = "DBusInterface" })
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_object_get_interface" g_dbus_object_get_interface :: 
    Ptr DBusObject ->                       -- object : TInterface (Name {namespace = "Gio", name = "DBusObject"})
    CString ->                              -- interface_name : TBasicType TUTF8
    IO (Ptr Gio.DBusInterface.DBusInterface)

-- | Gets the D-Bus interface with name /@interfaceName@/ associated with
-- /@object@/, if any.
-- 
-- /Since: 2.30/
dBusObjectGetInterface ::
    (B.CallStack.HasCallStack, MonadIO m, IsDBusObject a) =>
    a
    -- ^ /@object@/: A t'GI.Gio.Interfaces.DBusObject.DBusObject'.
    -> T.Text
    -- ^ /@interfaceName@/: A D-Bus interface name.
    -> m Gio.DBusInterface.DBusInterface
    -- ^ __Returns:__ 'P.Nothing' if not found, otherwise a
    --   t'GI.Gio.Interfaces.DBusInterface.DBusInterface' that must be freed with 'GI.GObject.Objects.Object.objectUnref'.
dBusObjectGetInterface :: a -> Text -> m DBusInterface
dBusObjectGetInterface object :: a
object interfaceName :: Text
interfaceName = IO DBusInterface -> m DBusInterface
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DBusInterface -> m DBusInterface)
-> IO DBusInterface -> m DBusInterface
forall a b. (a -> b) -> a -> b
$ do
    Ptr DBusObject
object' <- a -> IO (Ptr DBusObject)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
object
    CString
interfaceName' <- Text -> IO CString
textToCString Text
interfaceName
    Ptr DBusInterface
result <- Ptr DBusObject -> CString -> IO (Ptr DBusInterface)
g_dbus_object_get_interface Ptr DBusObject
object' CString
interfaceName'
    Text -> Ptr DBusInterface -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "dBusObjectGetInterface" Ptr DBusInterface
result
    DBusInterface
result' <- ((ManagedPtr DBusInterface -> DBusInterface)
-> Ptr DBusInterface -> IO DBusInterface
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr DBusInterface -> DBusInterface
Gio.DBusInterface.DBusInterface) Ptr DBusInterface
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
object
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
interfaceName'
    DBusInterface -> IO DBusInterface
forall (m :: * -> *) a. Monad m => a -> m a
return DBusInterface
result'

#if defined(ENABLE_OVERLOADING)
data DBusObjectGetInterfaceMethodInfo
instance (signature ~ (T.Text -> m Gio.DBusInterface.DBusInterface), MonadIO m, IsDBusObject a) => O.MethodInfo DBusObjectGetInterfaceMethodInfo a signature where
    overloadedMethod = dBusObjectGetInterface

#endif

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

foreign import ccall "g_dbus_object_get_interfaces" g_dbus_object_get_interfaces :: 
    Ptr DBusObject ->                       -- object : TInterface (Name {namespace = "Gio", name = "DBusObject"})
    IO (Ptr (GList (Ptr Gio.DBusInterface.DBusInterface)))

-- | Gets the D-Bus interfaces associated with /@object@/.
-- 
-- /Since: 2.30/
dBusObjectGetInterfaces ::
    (B.CallStack.HasCallStack, MonadIO m, IsDBusObject a) =>
    a
    -- ^ /@object@/: A t'GI.Gio.Interfaces.DBusObject.DBusObject'.
    -> m [Gio.DBusInterface.DBusInterface]
    -- ^ __Returns:__ A list of t'GI.Gio.Interfaces.DBusInterface.DBusInterface' instances.
    --   The returned list must be freed by @/g_list_free()/@ after each element has been freed
    --   with 'GI.GObject.Objects.Object.objectUnref'.
dBusObjectGetInterfaces :: a -> m [DBusInterface]
dBusObjectGetInterfaces object :: a
object = IO [DBusInterface] -> m [DBusInterface]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [DBusInterface] -> m [DBusInterface])
-> IO [DBusInterface] -> m [DBusInterface]
forall a b. (a -> b) -> a -> b
$ do
    Ptr DBusObject
object' <- a -> IO (Ptr DBusObject)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
object
    Ptr (GList (Ptr DBusInterface))
result <- Ptr DBusObject -> IO (Ptr (GList (Ptr DBusInterface)))
g_dbus_object_get_interfaces Ptr DBusObject
object'
    [Ptr DBusInterface]
result' <- Ptr (GList (Ptr DBusInterface)) -> IO [Ptr DBusInterface]
forall a. Ptr (GList (Ptr a)) -> IO [Ptr a]
unpackGList Ptr (GList (Ptr DBusInterface))
result
    [DBusInterface]
result'' <- (Ptr DBusInterface -> IO DBusInterface)
-> [Ptr DBusInterface] -> IO [DBusInterface]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((ManagedPtr DBusInterface -> DBusInterface)
-> Ptr DBusInterface -> IO DBusInterface
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr DBusInterface -> DBusInterface
Gio.DBusInterface.DBusInterface) [Ptr DBusInterface]
result'
    Ptr (GList (Ptr DBusInterface)) -> IO ()
forall a. Ptr (GList a) -> IO ()
g_list_free Ptr (GList (Ptr DBusInterface))
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
object
    [DBusInterface] -> IO [DBusInterface]
forall (m :: * -> *) a. Monad m => a -> m a
return [DBusInterface]
result''

#if defined(ENABLE_OVERLOADING)
data DBusObjectGetInterfacesMethodInfo
instance (signature ~ (m [Gio.DBusInterface.DBusInterface]), MonadIO m, IsDBusObject a) => O.MethodInfo DBusObjectGetInterfacesMethodInfo a signature where
    overloadedMethod = dBusObjectGetInterfaces

#endif

-- method DBusObject::get_object_path
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "object"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "DBusObject" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GDBusObject." , 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_object_get_object_path" g_dbus_object_get_object_path :: 
    Ptr DBusObject ->                       -- object : TInterface (Name {namespace = "Gio", name = "DBusObject"})
    IO CString

-- | Gets the object path for /@object@/.
-- 
-- /Since: 2.30/
dBusObjectGetObjectPath ::
    (B.CallStack.HasCallStack, MonadIO m, IsDBusObject a) =>
    a
    -- ^ /@object@/: A t'GI.Gio.Interfaces.DBusObject.DBusObject'.
    -> m T.Text
    -- ^ __Returns:__ A string owned by /@object@/. Do not free.
dBusObjectGetObjectPath :: a -> m Text
dBusObjectGetObjectPath object :: a
object = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr DBusObject
object' <- a -> IO (Ptr DBusObject)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
object
    CString
result <- Ptr DBusObject -> IO CString
g_dbus_object_get_object_path Ptr DBusObject
object'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "dBusObjectGetObjectPath" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
object
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

#if defined(ENABLE_OVERLOADING)
data DBusObjectGetObjectPathMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsDBusObject a) => O.MethodInfo DBusObjectGetObjectPathMethodInfo a signature where
    overloadedMethod = dBusObjectGetObjectPath

#endif