{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- Virtual table for handling properties and method calls for a D-Bus
-- interface.
-- 
-- Since 2.38, if you want to handle getting\/setting D-Bus properties
-- asynchronously, give 'P.Nothing' as your @/get_property()/@ or @/set_property()/@
-- function. The D-Bus call will be directed to your /@methodCall@/ function,
-- with the provided /@interfaceName@/ set to \"org.freedesktop.DBus.Properties\".
-- 
-- Ownership of the t'GI.Gio.Objects.DBusMethodInvocation.DBusMethodInvocation' object passed to the
-- @/method_call()/@ function is transferred to your handler; you must
-- call one of the methods of t'GI.Gio.Objects.DBusMethodInvocation.DBusMethodInvocation' to return a reply
-- (possibly empty), or an error. These functions also take ownership
-- of the passed-in invocation object, so unless the invocation
-- object has otherwise been referenced, it will be then be freed.
-- Calling one of these functions may be done within your
-- @/method_call()/@ implementation but it also can be done at a later
-- point to handle the method asynchronously.
-- 
-- The usual checks on the validity of the calls is performed. For
-- @Get@ calls, an error is automatically returned if the property does
-- not exist or the permissions do not allow access. The same checks are
-- performed for @Set@ calls, and the provided value is also checked for
-- being the correct type.
-- 
-- For both @Get@ and @Set@ calls, the t'GI.Gio.Objects.DBusMethodInvocation.DBusMethodInvocation'
-- passed to the /@methodCall@/ handler can be queried with
-- 'GI.Gio.Objects.DBusMethodInvocation.dBusMethodInvocationGetPropertyInfo' to get a pointer
-- to the t'GI.Gio.Structs.DBusPropertyInfo.DBusPropertyInfo' of the property.
-- 
-- If you have readable properties specified in your interface info,
-- you must ensure that you either provide a non-'P.Nothing' /@getProperty@/()
-- function or provide implementations of both the @Get@ and @GetAll@
-- methods on org.freedesktop.DBus.Properties interface in your /@methodCall@/
-- function. Note that the required return type of the @Get@ call is
-- @(v)@, not the type of the property. @GetAll@ expects a return value
-- of type @a{sv}@.
-- 
-- If you have writable properties specified in your interface info,
-- you must ensure that you either provide a non-'P.Nothing' /@setProperty@/()
-- function or provide an implementation of the @Set@ call. If implementing
-- the call, you must return the value of type @/G_VARIANT_TYPE_UNIT/@.
-- 
-- /Since: 2.26/

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

module GI.Gio.Structs.DBusInterfaceVTable
    ( 

-- * Exported types
    DBusInterfaceVTable(..)                 ,
    newZeroDBusInterfaceVTable              ,


 -- * Methods

#if defined(ENABLE_OVERLOADING)
    ResolveDBusInterfaceVTableMethod        ,
#endif



 -- * Properties


-- ** getProperty #attr:getProperty#
-- | Function for getting a property.

    clearDBusInterfaceVTableGetProperty     ,
#if defined(ENABLE_OVERLOADING)
    dBusInterfaceVTable_getProperty         ,
#endif
    getDBusInterfaceVTableGetProperty       ,
    setDBusInterfaceVTableGetProperty       ,


-- ** methodCall #attr:methodCall#
-- | Function for handling incoming method calls.

    clearDBusInterfaceVTableMethodCall      ,
#if defined(ENABLE_OVERLOADING)
    dBusInterfaceVTable_methodCall          ,
#endif
    getDBusInterfaceVTableMethodCall        ,
    setDBusInterfaceVTableMethodCall        ,


-- ** setProperty #attr:setProperty#
-- | Function for setting a property.

    clearDBusInterfaceVTableSetProperty     ,
#if defined(ENABLE_OVERLOADING)
    dBusInterfaceVTable_setProperty         ,
#endif
    getDBusInterfaceVTableSetProperty       ,
    setDBusInterfaceVTableSetProperty       ,




    ) where

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

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R

import qualified GI.Gio.Callbacks as Gio.Callbacks

-- | Memory-managed wrapper type.
newtype DBusInterfaceVTable = DBusInterfaceVTable (SP.ManagedPtr DBusInterfaceVTable)
    deriving (DBusInterfaceVTable -> DBusInterfaceVTable -> Bool
(DBusInterfaceVTable -> DBusInterfaceVTable -> Bool)
-> (DBusInterfaceVTable -> DBusInterfaceVTable -> Bool)
-> Eq DBusInterfaceVTable
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DBusInterfaceVTable -> DBusInterfaceVTable -> Bool
$c/= :: DBusInterfaceVTable -> DBusInterfaceVTable -> Bool
== :: DBusInterfaceVTable -> DBusInterfaceVTable -> Bool
$c== :: DBusInterfaceVTable -> DBusInterfaceVTable -> Bool
Eq)

instance SP.ManagedPtrNewtype DBusInterfaceVTable where
    toManagedPtr :: DBusInterfaceVTable -> ManagedPtr DBusInterfaceVTable
toManagedPtr (DBusInterfaceVTable ManagedPtr DBusInterfaceVTable
p) = ManagedPtr DBusInterfaceVTable
p

instance BoxedPtr DBusInterfaceVTable where
    boxedPtrCopy :: DBusInterfaceVTable -> IO DBusInterfaceVTable
boxedPtrCopy = \DBusInterfaceVTable
p -> DBusInterfaceVTable
-> (Ptr DBusInterfaceVTable -> IO DBusInterfaceVTable)
-> IO DBusInterfaceVTable
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr DBusInterfaceVTable
p (Int -> Ptr DBusInterfaceVTable -> IO (Ptr DBusInterfaceVTable)
forall a. (HasCallStack, CallocPtr a) => Int -> Ptr a -> IO (Ptr a)
copyBytes Int
88 (Ptr DBusInterfaceVTable -> IO (Ptr DBusInterfaceVTable))
-> (Ptr DBusInterfaceVTable -> IO DBusInterfaceVTable)
-> Ptr DBusInterfaceVTable
-> IO DBusInterfaceVTable
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> (ManagedPtr DBusInterfaceVTable -> DBusInterfaceVTable)
-> Ptr DBusInterfaceVTable -> IO DBusInterfaceVTable
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.wrapPtr ManagedPtr DBusInterfaceVTable -> DBusInterfaceVTable
DBusInterfaceVTable)
    boxedPtrFree :: DBusInterfaceVTable -> IO ()
boxedPtrFree = \DBusInterfaceVTable
x -> DBusInterfaceVTable -> (Ptr DBusInterfaceVTable -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
SP.withManagedPtr DBusInterfaceVTable
x Ptr DBusInterfaceVTable -> IO ()
forall a. Ptr a -> IO ()
SP.freeMem
instance CallocPtr DBusInterfaceVTable where
    boxedPtrCalloc :: IO (Ptr DBusInterfaceVTable)
boxedPtrCalloc = Int -> IO (Ptr DBusInterfaceVTable)
forall a. Int -> IO (Ptr a)
callocBytes Int
88


-- | Construct a `DBusInterfaceVTable` struct initialized to zero.
newZeroDBusInterfaceVTable :: MonadIO m => m DBusInterfaceVTable
newZeroDBusInterfaceVTable :: forall (m :: * -> *). MonadIO m => m DBusInterfaceVTable
newZeroDBusInterfaceVTable = IO DBusInterfaceVTable -> m DBusInterfaceVTable
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DBusInterfaceVTable -> m DBusInterfaceVTable)
-> IO DBusInterfaceVTable -> m DBusInterfaceVTable
forall a b. (a -> b) -> a -> b
$ IO (Ptr DBusInterfaceVTable)
forall a. CallocPtr a => IO (Ptr a)
boxedPtrCalloc IO (Ptr DBusInterfaceVTable)
-> (Ptr DBusInterfaceVTable -> IO DBusInterfaceVTable)
-> IO DBusInterfaceVTable
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr DBusInterfaceVTable -> DBusInterfaceVTable)
-> Ptr DBusInterfaceVTable -> IO DBusInterfaceVTable
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr DBusInterfaceVTable -> DBusInterfaceVTable
DBusInterfaceVTable

instance tag ~ 'AttrSet => Constructible DBusInterfaceVTable tag where
    new :: forall (m :: * -> *).
MonadIO m =>
(ManagedPtr DBusInterfaceVTable -> DBusInterfaceVTable)
-> [AttrOp DBusInterfaceVTable tag] -> m DBusInterfaceVTable
new ManagedPtr DBusInterfaceVTable -> DBusInterfaceVTable
_ [AttrOp DBusInterfaceVTable tag]
attrs = do
        DBusInterfaceVTable
o <- m DBusInterfaceVTable
forall (m :: * -> *). MonadIO m => m DBusInterfaceVTable
newZeroDBusInterfaceVTable
        DBusInterfaceVTable
-> [AttrOp DBusInterfaceVTable 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set DBusInterfaceVTable
o [AttrOp DBusInterfaceVTable tag]
[AttrOp DBusInterfaceVTable 'AttrSet]
attrs
        DBusInterfaceVTable -> m DBusInterfaceVTable
forall (m :: * -> *) a. Monad m => a -> m a
return DBusInterfaceVTable
o


-- | Get the value of the “@method_call@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' dBusInterfaceVTable #methodCall
-- @
getDBusInterfaceVTableMethodCall :: MonadIO m => DBusInterfaceVTable -> m (Maybe Gio.Callbacks.DBusInterfaceMethodCallFunc_WithClosures)
getDBusInterfaceVTableMethodCall :: forall (m :: * -> *).
MonadIO m =>
DBusInterfaceVTable
-> m (Maybe DBusInterfaceMethodCallFunc_WithClosures)
getDBusInterfaceVTableMethodCall DBusInterfaceVTable
s = IO (Maybe DBusInterfaceMethodCallFunc_WithClosures)
-> m (Maybe DBusInterfaceMethodCallFunc_WithClosures)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe DBusInterfaceMethodCallFunc_WithClosures)
 -> m (Maybe DBusInterfaceMethodCallFunc_WithClosures))
-> IO (Maybe DBusInterfaceMethodCallFunc_WithClosures)
-> m (Maybe DBusInterfaceMethodCallFunc_WithClosures)
forall a b. (a -> b) -> a -> b
$ DBusInterfaceVTable
-> (Ptr DBusInterfaceVTable
    -> IO (Maybe DBusInterfaceMethodCallFunc_WithClosures))
-> IO (Maybe DBusInterfaceMethodCallFunc_WithClosures)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DBusInterfaceVTable
s ((Ptr DBusInterfaceVTable
  -> IO (Maybe DBusInterfaceMethodCallFunc_WithClosures))
 -> IO (Maybe DBusInterfaceMethodCallFunc_WithClosures))
-> (Ptr DBusInterfaceVTable
    -> IO (Maybe DBusInterfaceMethodCallFunc_WithClosures))
-> IO (Maybe DBusInterfaceMethodCallFunc_WithClosures)
forall a b. (a -> b) -> a -> b
$ \Ptr DBusInterfaceVTable
ptr -> do
    FunPtr C_DBusInterfaceMethodCallFunc
val <- Ptr (FunPtr C_DBusInterfaceMethodCallFunc)
-> IO (FunPtr C_DBusInterfaceMethodCallFunc)
forall a. Storable a => Ptr a -> IO a
peek (Ptr DBusInterfaceVTable
ptr Ptr DBusInterfaceVTable
-> Int -> Ptr (FunPtr C_DBusInterfaceMethodCallFunc)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) :: IO (FunPtr Gio.Callbacks.C_DBusInterfaceMethodCallFunc)
    Maybe DBusInterfaceMethodCallFunc_WithClosures
result <- FunPtr C_DBusInterfaceMethodCallFunc
-> (FunPtr C_DBusInterfaceMethodCallFunc
    -> IO DBusInterfaceMethodCallFunc_WithClosures)
-> IO (Maybe DBusInterfaceMethodCallFunc_WithClosures)
forall a b. FunPtr a -> (FunPtr a -> IO b) -> IO (Maybe b)
SP.convertFunPtrIfNonNull FunPtr C_DBusInterfaceMethodCallFunc
val ((FunPtr C_DBusInterfaceMethodCallFunc
  -> IO DBusInterfaceMethodCallFunc_WithClosures)
 -> IO (Maybe DBusInterfaceMethodCallFunc_WithClosures))
-> (FunPtr C_DBusInterfaceMethodCallFunc
    -> IO DBusInterfaceMethodCallFunc_WithClosures)
-> IO (Maybe DBusInterfaceMethodCallFunc_WithClosures)
forall a b. (a -> b) -> a -> b
$ \FunPtr C_DBusInterfaceMethodCallFunc
val' -> do
        let val'' :: DBusInterfaceMethodCallFunc_WithClosures
val'' = FunPtr C_DBusInterfaceMethodCallFunc
-> DBusInterfaceMethodCallFunc_WithClosures
forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsDBusConnection a,
 IsDBusMethodInvocation b) =>
FunPtr C_DBusInterfaceMethodCallFunc
-> a
-> Text
-> Text
-> Text
-> Text
-> GVariant
-> b
-> Ptr ()
-> m ()
Gio.Callbacks.dynamic_DBusInterfaceMethodCallFunc FunPtr C_DBusInterfaceMethodCallFunc
val'
        DBusInterfaceMethodCallFunc_WithClosures
-> IO DBusInterfaceMethodCallFunc_WithClosures
forall (m :: * -> *) a. Monad m => a -> m a
return DBusInterfaceMethodCallFunc_WithClosures
val''
    Maybe DBusInterfaceMethodCallFunc_WithClosures
-> IO (Maybe DBusInterfaceMethodCallFunc_WithClosures)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe DBusInterfaceMethodCallFunc_WithClosures
result

-- | Set the value of the “@method_call@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' dBusInterfaceVTable [ #methodCall 'Data.GI.Base.Attributes.:=' value ]
-- @
setDBusInterfaceVTableMethodCall :: MonadIO m => DBusInterfaceVTable -> FunPtr Gio.Callbacks.C_DBusInterfaceMethodCallFunc -> m ()
setDBusInterfaceVTableMethodCall :: forall (m :: * -> *).
MonadIO m =>
DBusInterfaceVTable -> FunPtr C_DBusInterfaceMethodCallFunc -> m ()
setDBusInterfaceVTableMethodCall DBusInterfaceVTable
s FunPtr C_DBusInterfaceMethodCallFunc
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ DBusInterfaceVTable -> (Ptr DBusInterfaceVTable -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DBusInterfaceVTable
s ((Ptr DBusInterfaceVTable -> IO ()) -> IO ())
-> (Ptr DBusInterfaceVTable -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr DBusInterfaceVTable
ptr -> do
    Ptr (FunPtr C_DBusInterfaceMethodCallFunc)
-> FunPtr C_DBusInterfaceMethodCallFunc -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr DBusInterfaceVTable
ptr Ptr DBusInterfaceVTable
-> Int -> Ptr (FunPtr C_DBusInterfaceMethodCallFunc)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (FunPtr C_DBusInterfaceMethodCallFunc
val :: FunPtr Gio.Callbacks.C_DBusInterfaceMethodCallFunc)

-- | Set the value of the “@method_call@” field to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #methodCall
-- @
clearDBusInterfaceVTableMethodCall :: MonadIO m => DBusInterfaceVTable -> m ()
clearDBusInterfaceVTableMethodCall :: forall (m :: * -> *). MonadIO m => DBusInterfaceVTable -> m ()
clearDBusInterfaceVTableMethodCall DBusInterfaceVTable
s = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ DBusInterfaceVTable -> (Ptr DBusInterfaceVTable -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DBusInterfaceVTable
s ((Ptr DBusInterfaceVTable -> IO ()) -> IO ())
-> (Ptr DBusInterfaceVTable -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr DBusInterfaceVTable
ptr -> do
    Ptr (FunPtr C_DBusInterfaceMethodCallFunc)
-> FunPtr C_DBusInterfaceMethodCallFunc -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr DBusInterfaceVTable
ptr Ptr DBusInterfaceVTable
-> Int -> Ptr (FunPtr C_DBusInterfaceMethodCallFunc)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (FunPtr C_DBusInterfaceMethodCallFunc
forall a. FunPtr a
FP.nullFunPtr :: FunPtr Gio.Callbacks.C_DBusInterfaceMethodCallFunc)

#if defined(ENABLE_OVERLOADING)
data DBusInterfaceVTableMethodCallFieldInfo
instance AttrInfo DBusInterfaceVTableMethodCallFieldInfo where
    type AttrBaseTypeConstraint DBusInterfaceVTableMethodCallFieldInfo = (~) DBusInterfaceVTable
    type AttrAllowedOps DBusInterfaceVTableMethodCallFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DBusInterfaceVTableMethodCallFieldInfo = (~) (FunPtr Gio.Callbacks.C_DBusInterfaceMethodCallFunc)
    type AttrTransferTypeConstraint DBusInterfaceVTableMethodCallFieldInfo = (~)Gio.Callbacks.DBusInterfaceMethodCallFunc_WithClosures
    type AttrTransferType DBusInterfaceVTableMethodCallFieldInfo = (FunPtr Gio.Callbacks.C_DBusInterfaceMethodCallFunc)
    type AttrGetType DBusInterfaceVTableMethodCallFieldInfo = Maybe Gio.Callbacks.DBusInterfaceMethodCallFunc_WithClosures
    type AttrLabel DBusInterfaceVTableMethodCallFieldInfo = "method_call"
    type AttrOrigin DBusInterfaceVTableMethodCallFieldInfo = DBusInterfaceVTable
    attrGet = getDBusInterfaceVTableMethodCall
    attrSet = setDBusInterfaceVTableMethodCall
    attrConstruct = undefined
    attrClear = clearDBusInterfaceVTableMethodCall
    attrTransfer _ v = do
        Gio.Callbacks.mk_DBusInterfaceMethodCallFunc (Gio.Callbacks.wrap_DBusInterfaceMethodCallFunc Nothing v)
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Structs.DBusInterfaceVTable.methodCall"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.29/docs/GI-Gio-Structs-DBusInterfaceVTable.html#g:attr:methodCall"
        })

dBusInterfaceVTable_methodCall :: AttrLabelProxy "methodCall"
dBusInterfaceVTable_methodCall = AttrLabelProxy

#endif


-- | Get the value of the “@get_property@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' dBusInterfaceVTable #getProperty
-- @
getDBusInterfaceVTableGetProperty :: MonadIO m => DBusInterfaceVTable -> m (Maybe Gio.Callbacks.DBusInterfaceGetPropertyFunc_WithClosures)
getDBusInterfaceVTableGetProperty :: forall (m :: * -> *).
MonadIO m =>
DBusInterfaceVTable
-> m (Maybe DBusInterfaceGetPropertyFunc_WithClosures)
getDBusInterfaceVTableGetProperty DBusInterfaceVTable
s = IO (Maybe DBusInterfaceGetPropertyFunc_WithClosures)
-> m (Maybe DBusInterfaceGetPropertyFunc_WithClosures)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe DBusInterfaceGetPropertyFunc_WithClosures)
 -> m (Maybe DBusInterfaceGetPropertyFunc_WithClosures))
-> IO (Maybe DBusInterfaceGetPropertyFunc_WithClosures)
-> m (Maybe DBusInterfaceGetPropertyFunc_WithClosures)
forall a b. (a -> b) -> a -> b
$ DBusInterfaceVTable
-> (Ptr DBusInterfaceVTable
    -> IO (Maybe DBusInterfaceGetPropertyFunc_WithClosures))
-> IO (Maybe DBusInterfaceGetPropertyFunc_WithClosures)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DBusInterfaceVTable
s ((Ptr DBusInterfaceVTable
  -> IO (Maybe DBusInterfaceGetPropertyFunc_WithClosures))
 -> IO (Maybe DBusInterfaceGetPropertyFunc_WithClosures))
-> (Ptr DBusInterfaceVTable
    -> IO (Maybe DBusInterfaceGetPropertyFunc_WithClosures))
-> IO (Maybe DBusInterfaceGetPropertyFunc_WithClosures)
forall a b. (a -> b) -> a -> b
$ \Ptr DBusInterfaceVTable
ptr -> do
    FunPtr C_DBusInterfaceGetPropertyFunc
val <- Ptr (FunPtr C_DBusInterfaceGetPropertyFunc)
-> IO (FunPtr C_DBusInterfaceGetPropertyFunc)
forall a. Storable a => Ptr a -> IO a
peek (Ptr DBusInterfaceVTable
ptr Ptr DBusInterfaceVTable
-> Int -> Ptr (FunPtr C_DBusInterfaceGetPropertyFunc)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) :: IO (FunPtr Gio.Callbacks.C_DBusInterfaceGetPropertyFunc)
    Maybe DBusInterfaceGetPropertyFunc_WithClosures
result <- FunPtr C_DBusInterfaceGetPropertyFunc
-> (FunPtr C_DBusInterfaceGetPropertyFunc
    -> IO DBusInterfaceGetPropertyFunc_WithClosures)
-> IO (Maybe DBusInterfaceGetPropertyFunc_WithClosures)
forall a b. FunPtr a -> (FunPtr a -> IO b) -> IO (Maybe b)
SP.convertFunPtrIfNonNull FunPtr C_DBusInterfaceGetPropertyFunc
val ((FunPtr C_DBusInterfaceGetPropertyFunc
  -> IO DBusInterfaceGetPropertyFunc_WithClosures)
 -> IO (Maybe DBusInterfaceGetPropertyFunc_WithClosures))
-> (FunPtr C_DBusInterfaceGetPropertyFunc
    -> IO DBusInterfaceGetPropertyFunc_WithClosures)
-> IO (Maybe DBusInterfaceGetPropertyFunc_WithClosures)
forall a b. (a -> b) -> a -> b
$ \FunPtr C_DBusInterfaceGetPropertyFunc
val' -> do
        let val'' :: DBusInterfaceGetPropertyFunc_WithClosures
val'' = FunPtr C_DBusInterfaceGetPropertyFunc
-> DBusInterfaceGetPropertyFunc_WithClosures
forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDBusConnection a) =>
FunPtr C_DBusInterfaceGetPropertyFunc
-> a
-> Text
-> Text
-> Text
-> Text
-> GError
-> Ptr ()
-> m GVariant
Gio.Callbacks.dynamic_DBusInterfaceGetPropertyFunc FunPtr C_DBusInterfaceGetPropertyFunc
val'
        DBusInterfaceGetPropertyFunc_WithClosures
-> IO DBusInterfaceGetPropertyFunc_WithClosures
forall (m :: * -> *) a. Monad m => a -> m a
return DBusInterfaceGetPropertyFunc_WithClosures
val''
    Maybe DBusInterfaceGetPropertyFunc_WithClosures
-> IO (Maybe DBusInterfaceGetPropertyFunc_WithClosures)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe DBusInterfaceGetPropertyFunc_WithClosures
result

-- | Set the value of the “@get_property@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' dBusInterfaceVTable [ #getProperty 'Data.GI.Base.Attributes.:=' value ]
-- @
setDBusInterfaceVTableGetProperty :: MonadIO m => DBusInterfaceVTable -> FunPtr Gio.Callbacks.C_DBusInterfaceGetPropertyFunc -> m ()
setDBusInterfaceVTableGetProperty :: forall (m :: * -> *).
MonadIO m =>
DBusInterfaceVTable
-> FunPtr C_DBusInterfaceGetPropertyFunc -> m ()
setDBusInterfaceVTableGetProperty DBusInterfaceVTable
s FunPtr C_DBusInterfaceGetPropertyFunc
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ DBusInterfaceVTable -> (Ptr DBusInterfaceVTable -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DBusInterfaceVTable
s ((Ptr DBusInterfaceVTable -> IO ()) -> IO ())
-> (Ptr DBusInterfaceVTable -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr DBusInterfaceVTable
ptr -> do
    Ptr (FunPtr C_DBusInterfaceGetPropertyFunc)
-> FunPtr C_DBusInterfaceGetPropertyFunc -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr DBusInterfaceVTable
ptr Ptr DBusInterfaceVTable
-> Int -> Ptr (FunPtr C_DBusInterfaceGetPropertyFunc)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) (FunPtr C_DBusInterfaceGetPropertyFunc
val :: FunPtr Gio.Callbacks.C_DBusInterfaceGetPropertyFunc)

-- | Set the value of the “@get_property@” field to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #getProperty
-- @
clearDBusInterfaceVTableGetProperty :: MonadIO m => DBusInterfaceVTable -> m ()
clearDBusInterfaceVTableGetProperty :: forall (m :: * -> *). MonadIO m => DBusInterfaceVTable -> m ()
clearDBusInterfaceVTableGetProperty DBusInterfaceVTable
s = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ DBusInterfaceVTable -> (Ptr DBusInterfaceVTable -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DBusInterfaceVTable
s ((Ptr DBusInterfaceVTable -> IO ()) -> IO ())
-> (Ptr DBusInterfaceVTable -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr DBusInterfaceVTable
ptr -> do
    Ptr (FunPtr C_DBusInterfaceGetPropertyFunc)
-> FunPtr C_DBusInterfaceGetPropertyFunc -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr DBusInterfaceVTable
ptr Ptr DBusInterfaceVTable
-> Int -> Ptr (FunPtr C_DBusInterfaceGetPropertyFunc)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) (FunPtr C_DBusInterfaceGetPropertyFunc
forall a. FunPtr a
FP.nullFunPtr :: FunPtr Gio.Callbacks.C_DBusInterfaceGetPropertyFunc)

#if defined(ENABLE_OVERLOADING)
data DBusInterfaceVTableGetPropertyFieldInfo
instance AttrInfo DBusInterfaceVTableGetPropertyFieldInfo where
    type AttrBaseTypeConstraint DBusInterfaceVTableGetPropertyFieldInfo = (~) DBusInterfaceVTable
    type AttrAllowedOps DBusInterfaceVTableGetPropertyFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DBusInterfaceVTableGetPropertyFieldInfo = (~) (FunPtr Gio.Callbacks.C_DBusInterfaceGetPropertyFunc)
    type AttrTransferTypeConstraint DBusInterfaceVTableGetPropertyFieldInfo = (~)Gio.Callbacks.DBusInterfaceGetPropertyFunc_WithClosures
    type AttrTransferType DBusInterfaceVTableGetPropertyFieldInfo = (FunPtr Gio.Callbacks.C_DBusInterfaceGetPropertyFunc)
    type AttrGetType DBusInterfaceVTableGetPropertyFieldInfo = Maybe Gio.Callbacks.DBusInterfaceGetPropertyFunc_WithClosures
    type AttrLabel DBusInterfaceVTableGetPropertyFieldInfo = "get_property"
    type AttrOrigin DBusInterfaceVTableGetPropertyFieldInfo = DBusInterfaceVTable
    attrGet = getDBusInterfaceVTableGetProperty
    attrSet = setDBusInterfaceVTableGetProperty
    attrConstruct = undefined
    attrClear = clearDBusInterfaceVTableGetProperty
    attrTransfer _ v = do
        Gio.Callbacks.mk_DBusInterfaceGetPropertyFunc (Gio.Callbacks.wrap_DBusInterfaceGetPropertyFunc Nothing v)
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Structs.DBusInterfaceVTable.getProperty"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.29/docs/GI-Gio-Structs-DBusInterfaceVTable.html#g:attr:getProperty"
        })

dBusInterfaceVTable_getProperty :: AttrLabelProxy "getProperty"
dBusInterfaceVTable_getProperty = AttrLabelProxy

#endif


-- | Get the value of the “@set_property@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' dBusInterfaceVTable #setProperty
-- @
getDBusInterfaceVTableSetProperty :: MonadIO m => DBusInterfaceVTable -> m (Maybe Gio.Callbacks.DBusInterfaceSetPropertyFunc_WithClosures)
getDBusInterfaceVTableSetProperty :: forall (m :: * -> *).
MonadIO m =>
DBusInterfaceVTable
-> m (Maybe DBusInterfaceSetPropertyFunc_WithClosures)
getDBusInterfaceVTableSetProperty DBusInterfaceVTable
s = IO (Maybe DBusInterfaceSetPropertyFunc_WithClosures)
-> m (Maybe DBusInterfaceSetPropertyFunc_WithClosures)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe DBusInterfaceSetPropertyFunc_WithClosures)
 -> m (Maybe DBusInterfaceSetPropertyFunc_WithClosures))
-> IO (Maybe DBusInterfaceSetPropertyFunc_WithClosures)
-> m (Maybe DBusInterfaceSetPropertyFunc_WithClosures)
forall a b. (a -> b) -> a -> b
$ DBusInterfaceVTable
-> (Ptr DBusInterfaceVTable
    -> IO (Maybe DBusInterfaceSetPropertyFunc_WithClosures))
-> IO (Maybe DBusInterfaceSetPropertyFunc_WithClosures)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DBusInterfaceVTable
s ((Ptr DBusInterfaceVTable
  -> IO (Maybe DBusInterfaceSetPropertyFunc_WithClosures))
 -> IO (Maybe DBusInterfaceSetPropertyFunc_WithClosures))
-> (Ptr DBusInterfaceVTable
    -> IO (Maybe DBusInterfaceSetPropertyFunc_WithClosures))
-> IO (Maybe DBusInterfaceSetPropertyFunc_WithClosures)
forall a b. (a -> b) -> a -> b
$ \Ptr DBusInterfaceVTable
ptr -> do
    FunPtr C_DBusInterfaceSetPropertyFunc
val <- Ptr (FunPtr C_DBusInterfaceSetPropertyFunc)
-> IO (FunPtr C_DBusInterfaceSetPropertyFunc)
forall a. Storable a => Ptr a -> IO a
peek (Ptr DBusInterfaceVTable
ptr Ptr DBusInterfaceVTable
-> Int -> Ptr (FunPtr C_DBusInterfaceSetPropertyFunc)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16) :: IO (FunPtr Gio.Callbacks.C_DBusInterfaceSetPropertyFunc)
    Maybe DBusInterfaceSetPropertyFunc_WithClosures
result <- FunPtr C_DBusInterfaceSetPropertyFunc
-> (FunPtr C_DBusInterfaceSetPropertyFunc
    -> IO DBusInterfaceSetPropertyFunc_WithClosures)
-> IO (Maybe DBusInterfaceSetPropertyFunc_WithClosures)
forall a b. FunPtr a -> (FunPtr a -> IO b) -> IO (Maybe b)
SP.convertFunPtrIfNonNull FunPtr C_DBusInterfaceSetPropertyFunc
val ((FunPtr C_DBusInterfaceSetPropertyFunc
  -> IO DBusInterfaceSetPropertyFunc_WithClosures)
 -> IO (Maybe DBusInterfaceSetPropertyFunc_WithClosures))
-> (FunPtr C_DBusInterfaceSetPropertyFunc
    -> IO DBusInterfaceSetPropertyFunc_WithClosures)
-> IO (Maybe DBusInterfaceSetPropertyFunc_WithClosures)
forall a b. (a -> b) -> a -> b
$ \FunPtr C_DBusInterfaceSetPropertyFunc
val' -> do
        let val'' :: DBusInterfaceSetPropertyFunc_WithClosures
val'' = FunPtr C_DBusInterfaceSetPropertyFunc
-> DBusInterfaceSetPropertyFunc_WithClosures
forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDBusConnection a) =>
FunPtr C_DBusInterfaceSetPropertyFunc
-> a
-> Text
-> Text
-> Text
-> Text
-> GVariant
-> GError
-> Ptr ()
-> m Bool
Gio.Callbacks.dynamic_DBusInterfaceSetPropertyFunc FunPtr C_DBusInterfaceSetPropertyFunc
val'
        DBusInterfaceSetPropertyFunc_WithClosures
-> IO DBusInterfaceSetPropertyFunc_WithClosures
forall (m :: * -> *) a. Monad m => a -> m a
return DBusInterfaceSetPropertyFunc_WithClosures
val''
    Maybe DBusInterfaceSetPropertyFunc_WithClosures
-> IO (Maybe DBusInterfaceSetPropertyFunc_WithClosures)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe DBusInterfaceSetPropertyFunc_WithClosures
result

-- | Set the value of the “@set_property@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' dBusInterfaceVTable [ #setProperty 'Data.GI.Base.Attributes.:=' value ]
-- @
setDBusInterfaceVTableSetProperty :: MonadIO m => DBusInterfaceVTable -> FunPtr Gio.Callbacks.C_DBusInterfaceSetPropertyFunc -> m ()
setDBusInterfaceVTableSetProperty :: forall (m :: * -> *).
MonadIO m =>
DBusInterfaceVTable
-> FunPtr C_DBusInterfaceSetPropertyFunc -> m ()
setDBusInterfaceVTableSetProperty DBusInterfaceVTable
s FunPtr C_DBusInterfaceSetPropertyFunc
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ DBusInterfaceVTable -> (Ptr DBusInterfaceVTable -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DBusInterfaceVTable
s ((Ptr DBusInterfaceVTable -> IO ()) -> IO ())
-> (Ptr DBusInterfaceVTable -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr DBusInterfaceVTable
ptr -> do
    Ptr (FunPtr C_DBusInterfaceSetPropertyFunc)
-> FunPtr C_DBusInterfaceSetPropertyFunc -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr DBusInterfaceVTable
ptr Ptr DBusInterfaceVTable
-> Int -> Ptr (FunPtr C_DBusInterfaceSetPropertyFunc)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16) (FunPtr C_DBusInterfaceSetPropertyFunc
val :: FunPtr Gio.Callbacks.C_DBusInterfaceSetPropertyFunc)

-- | Set the value of the “@set_property@” field to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #setProperty
-- @
clearDBusInterfaceVTableSetProperty :: MonadIO m => DBusInterfaceVTable -> m ()
clearDBusInterfaceVTableSetProperty :: forall (m :: * -> *). MonadIO m => DBusInterfaceVTable -> m ()
clearDBusInterfaceVTableSetProperty DBusInterfaceVTable
s = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ DBusInterfaceVTable -> (Ptr DBusInterfaceVTable -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DBusInterfaceVTable
s ((Ptr DBusInterfaceVTable -> IO ()) -> IO ())
-> (Ptr DBusInterfaceVTable -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr DBusInterfaceVTable
ptr -> do
    Ptr (FunPtr C_DBusInterfaceSetPropertyFunc)
-> FunPtr C_DBusInterfaceSetPropertyFunc -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr DBusInterfaceVTable
ptr Ptr DBusInterfaceVTable
-> Int -> Ptr (FunPtr C_DBusInterfaceSetPropertyFunc)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16) (FunPtr C_DBusInterfaceSetPropertyFunc
forall a. FunPtr a
FP.nullFunPtr :: FunPtr Gio.Callbacks.C_DBusInterfaceSetPropertyFunc)

#if defined(ENABLE_OVERLOADING)
data DBusInterfaceVTableSetPropertyFieldInfo
instance AttrInfo DBusInterfaceVTableSetPropertyFieldInfo where
    type AttrBaseTypeConstraint DBusInterfaceVTableSetPropertyFieldInfo = (~) DBusInterfaceVTable
    type AttrAllowedOps DBusInterfaceVTableSetPropertyFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DBusInterfaceVTableSetPropertyFieldInfo = (~) (FunPtr Gio.Callbacks.C_DBusInterfaceSetPropertyFunc)
    type AttrTransferTypeConstraint DBusInterfaceVTableSetPropertyFieldInfo = (~)Gio.Callbacks.DBusInterfaceSetPropertyFunc_WithClosures
    type AttrTransferType DBusInterfaceVTableSetPropertyFieldInfo = (FunPtr Gio.Callbacks.C_DBusInterfaceSetPropertyFunc)
    type AttrGetType DBusInterfaceVTableSetPropertyFieldInfo = Maybe Gio.Callbacks.DBusInterfaceSetPropertyFunc_WithClosures
    type AttrLabel DBusInterfaceVTableSetPropertyFieldInfo = "set_property"
    type AttrOrigin DBusInterfaceVTableSetPropertyFieldInfo = DBusInterfaceVTable
    attrGet = getDBusInterfaceVTableSetProperty
    attrSet = setDBusInterfaceVTableSetProperty
    attrConstruct = undefined
    attrClear = clearDBusInterfaceVTableSetProperty
    attrTransfer _ v = do
        Gio.Callbacks.mk_DBusInterfaceSetPropertyFunc (Gio.Callbacks.wrap_DBusInterfaceSetPropertyFunc Nothing v)
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Structs.DBusInterfaceVTable.setProperty"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.29/docs/GI-Gio-Structs-DBusInterfaceVTable.html#g:attr:setProperty"
        })

dBusInterfaceVTable_setProperty :: AttrLabelProxy "setProperty"
dBusInterfaceVTable_setProperty = AttrLabelProxy

#endif



#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList DBusInterfaceVTable
type instance O.AttributeList DBusInterfaceVTable = DBusInterfaceVTableAttributeList
type DBusInterfaceVTableAttributeList = ('[ '("methodCall", DBusInterfaceVTableMethodCallFieldInfo), '("getProperty", DBusInterfaceVTableGetPropertyFieldInfo), '("setProperty", DBusInterfaceVTableSetPropertyFieldInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveDBusInterfaceVTableMethod (t :: Symbol) (o :: *) :: * where
    ResolveDBusInterfaceVTableMethod l o = O.MethodResolutionFailed l o

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

#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveDBusInterfaceVTableMethod t DBusInterfaceVTable, O.OverloadedMethod info DBusInterfaceVTable p, R.HasField t DBusInterfaceVTable p) => R.HasField t DBusInterfaceVTable p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveDBusInterfaceVTableMethod t DBusInterfaceVTable, O.OverloadedMethodInfo info DBusInterfaceVTable) => OL.IsLabel t (O.MethodProxy info DBusInterfaceVTable) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif