{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Interfaces.DBusInterface
(
DBusInterface(..) ,
noDBusInterface ,
IsDBusInterface ,
toDBusInterface ,
#if defined(ENABLE_OVERLOADING)
ResolveDBusInterfaceMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
DBusInterfaceGetInfoMethodInfo ,
#endif
dBusInterfaceGetInfo ,
#if defined(ENABLE_OVERLOADING)
DBusInterfaceGetObjectMethodInfo ,
#endif
dBusInterfaceGetObject ,
#if defined(ENABLE_OVERLOADING)
DBusInterfaceSetObjectMethodInfo ,
#endif
dBusInterfaceSetObject ,
) 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.DBusObject as Gio.DBusObject
import {-# SOURCE #-} qualified GI.Gio.Structs.DBusInterfaceInfo as Gio.DBusInterfaceInfo
newtype DBusInterface = DBusInterface (ManagedPtr DBusInterface)
deriving (DBusInterface -> DBusInterface -> Bool
(DBusInterface -> DBusInterface -> Bool)
-> (DBusInterface -> DBusInterface -> Bool) -> Eq DBusInterface
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DBusInterface -> DBusInterface -> Bool
$c/= :: DBusInterface -> DBusInterface -> Bool
== :: DBusInterface -> DBusInterface -> Bool
$c== :: DBusInterface -> DBusInterface -> Bool
Eq)
noDBusInterface :: Maybe DBusInterface
noDBusInterface :: Maybe DBusInterface
noDBusInterface = Maybe DBusInterface
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList DBusInterface = DBusInterfaceSignalList
type DBusInterfaceSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_dbus_interface_get_type"
c_g_dbus_interface_get_type :: IO GType
instance GObject DBusInterface where
gobjectType :: IO GType
gobjectType = IO GType
c_g_dbus_interface_get_type
instance B.GValue.IsGValue DBusInterface where
toGValue :: DBusInterface -> IO GValue
toGValue o :: DBusInterface
o = do
GType
gtype <- IO GType
c_g_dbus_interface_get_type
DBusInterface -> (Ptr DBusInterface -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr DBusInterface
o (GType
-> (GValue -> Ptr DBusInterface -> IO ())
-> Ptr DBusInterface
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr DBusInterface -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
fromGValue :: GValue -> IO DBusInterface
fromGValue gv :: GValue
gv = do
Ptr DBusInterface
ptr <- GValue -> IO (Ptr DBusInterface)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr DBusInterface)
(ManagedPtr DBusInterface -> DBusInterface)
-> Ptr DBusInterface -> IO DBusInterface
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr DBusInterface -> DBusInterface
DBusInterface Ptr DBusInterface
ptr
class (GObject o, O.IsDescendantOf DBusInterface o) => IsDBusInterface o
instance (GObject o, O.IsDescendantOf DBusInterface o) => IsDBusInterface o
instance O.HasParentTypes DBusInterface
type instance O.ParentTypes DBusInterface = '[GObject.Object.Object]
toDBusInterface :: (MonadIO m, IsDBusInterface o) => o -> m DBusInterface
toDBusInterface :: o -> m DBusInterface
toDBusInterface = IO DBusInterface -> m DBusInterface
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DBusInterface -> m DBusInterface)
-> (o -> IO DBusInterface) -> o -> m DBusInterface
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr DBusInterface -> DBusInterface)
-> o -> IO DBusInterface
forall o o'.
(HasCallStack, GObject o, GObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr DBusInterface -> DBusInterface
DBusInterface
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList DBusInterface
type instance O.AttributeList DBusInterface = DBusInterfaceAttributeList
type DBusInterfaceAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveDBusInterfaceMethod (t :: Symbol) (o :: *) :: * where
ResolveDBusInterfaceMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveDBusInterfaceMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveDBusInterfaceMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveDBusInterfaceMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveDBusInterfaceMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveDBusInterfaceMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveDBusInterfaceMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveDBusInterfaceMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveDBusInterfaceMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveDBusInterfaceMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveDBusInterfaceMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveDBusInterfaceMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveDBusInterfaceMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveDBusInterfaceMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveDBusInterfaceMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveDBusInterfaceMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveDBusInterfaceMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveDBusInterfaceMethod "getInfo" o = DBusInterfaceGetInfoMethodInfo
ResolveDBusInterfaceMethod "getObject" o = DBusInterfaceGetObjectMethodInfo
ResolveDBusInterfaceMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveDBusInterfaceMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveDBusInterfaceMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveDBusInterfaceMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveDBusInterfaceMethod "setObject" o = DBusInterfaceSetObjectMethodInfo
ResolveDBusInterfaceMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveDBusInterfaceMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveDBusInterfaceMethod t DBusInterface, O.MethodInfo info DBusInterface p) => OL.IsLabel t (DBusInterface -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif
foreign import ccall "g_dbus_interface_dup_object" g_dbus_interface_dup_object ::
Ptr DBusInterface ->
IO (Ptr Gio.DBusObject.DBusObject)
dBusInterfaceGetObject ::
(B.CallStack.HasCallStack, MonadIO m, IsDBusInterface a) =>
a
-> m Gio.DBusObject.DBusObject
dBusInterfaceGetObject :: a -> m DBusObject
dBusInterfaceGetObject interface_ :: a
interface_ = IO DBusObject -> m DBusObject
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DBusObject -> m DBusObject) -> IO DBusObject -> m DBusObject
forall a b. (a -> b) -> a -> b
$ do
Ptr DBusInterface
interface_' <- a -> IO (Ptr DBusInterface)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
interface_
Ptr DBusObject
result <- Ptr DBusInterface -> IO (Ptr DBusObject)
g_dbus_interface_dup_object Ptr DBusInterface
interface_'
Text -> Ptr DBusObject -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "dBusInterfaceGetObject" Ptr DBusObject
result
DBusObject
result' <- ((ManagedPtr DBusObject -> DBusObject)
-> Ptr DBusObject -> IO DBusObject
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr DBusObject -> DBusObject
Gio.DBusObject.DBusObject) Ptr DBusObject
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
interface_
DBusObject -> IO DBusObject
forall (m :: * -> *) a. Monad m => a -> m a
return DBusObject
result'
#if defined(ENABLE_OVERLOADING)
data DBusInterfaceGetObjectMethodInfo
instance (signature ~ (m Gio.DBusObject.DBusObject), MonadIO m, IsDBusInterface a) => O.MethodInfo DBusInterfaceGetObjectMethodInfo a signature where
overloadedMethod = dBusInterfaceGetObject
#endif
foreign import ccall "g_dbus_interface_get_info" g_dbus_interface_get_info ::
Ptr DBusInterface ->
IO (Ptr Gio.DBusInterfaceInfo.DBusInterfaceInfo)
dBusInterfaceGetInfo ::
(B.CallStack.HasCallStack, MonadIO m, IsDBusInterface a) =>
a
-> m Gio.DBusInterfaceInfo.DBusInterfaceInfo
dBusInterfaceGetInfo :: a -> m DBusInterfaceInfo
dBusInterfaceGetInfo interface_ :: a
interface_ = IO DBusInterfaceInfo -> m DBusInterfaceInfo
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DBusInterfaceInfo -> m DBusInterfaceInfo)
-> IO DBusInterfaceInfo -> m DBusInterfaceInfo
forall a b. (a -> b) -> a -> b
$ do
Ptr DBusInterface
interface_' <- a -> IO (Ptr DBusInterface)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
interface_
Ptr DBusInterfaceInfo
result <- Ptr DBusInterface -> IO (Ptr DBusInterfaceInfo)
g_dbus_interface_get_info Ptr DBusInterface
interface_'
Text -> Ptr DBusInterfaceInfo -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "dBusInterfaceGetInfo" Ptr DBusInterfaceInfo
result
DBusInterfaceInfo
result' <- ((ManagedPtr DBusInterfaceInfo -> DBusInterfaceInfo)
-> Ptr DBusInterfaceInfo -> IO DBusInterfaceInfo
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr DBusInterfaceInfo -> DBusInterfaceInfo
Gio.DBusInterfaceInfo.DBusInterfaceInfo) Ptr DBusInterfaceInfo
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
interface_
DBusInterfaceInfo -> IO DBusInterfaceInfo
forall (m :: * -> *) a. Monad m => a -> m a
return DBusInterfaceInfo
result'
#if defined(ENABLE_OVERLOADING)
data DBusInterfaceGetInfoMethodInfo
instance (signature ~ (m Gio.DBusInterfaceInfo.DBusInterfaceInfo), MonadIO m, IsDBusInterface a) => O.MethodInfo DBusInterfaceGetInfoMethodInfo a signature where
overloadedMethod = dBusInterfaceGetInfo
#endif
foreign import ccall "g_dbus_interface_set_object" g_dbus_interface_set_object ::
Ptr DBusInterface ->
Ptr Gio.DBusObject.DBusObject ->
IO ()
dBusInterfaceSetObject ::
(B.CallStack.HasCallStack, MonadIO m, IsDBusInterface a, Gio.DBusObject.IsDBusObject b) =>
a
-> Maybe (b)
-> m ()
dBusInterfaceSetObject :: a -> Maybe b -> m ()
dBusInterfaceSetObject interface_ :: a
interface_ object :: Maybe b
object = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr DBusInterface
interface_' <- a -> IO (Ptr DBusInterface)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
interface_
Ptr DBusObject
maybeObject <- case Maybe b
object of
Nothing -> Ptr DBusObject -> IO (Ptr DBusObject)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr DBusObject
forall a. Ptr a
nullPtr
Just jObject :: b
jObject -> do
Ptr DBusObject
jObject' <- b -> IO (Ptr DBusObject)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jObject
Ptr DBusObject -> IO (Ptr DBusObject)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr DBusObject
jObject'
Ptr DBusInterface -> Ptr DBusObject -> IO ()
g_dbus_interface_set_object Ptr DBusInterface
interface_' Ptr DBusObject
maybeObject
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
interface_
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
object b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data DBusInterfaceSetObjectMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsDBusInterface a, Gio.DBusObject.IsDBusObject b) => O.MethodInfo DBusInterfaceSetObjectMethodInfo a signature where
overloadedMethod = dBusInterfaceSetObject
#endif