{-# LANGUAGE ImplicitParams, RankNTypes, TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- An IBusConfig provides engine configuration methods
-- such as get and set the configure settings to configuration file.
-- 
-- Currently, IBusConfig supports gconf.

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

module GI.IBus.Objects.Config
    ( 

-- * Exported types
    Config(..)                              ,
    IsConfig                                ,
    toConfig                                ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [call]("GI.Gio.Objects.DBusProxy#g:method:call"), [callFinish]("GI.Gio.Objects.DBusProxy#g:method:callFinish"), [callSync]("GI.Gio.Objects.DBusProxy#g:method:callSync"), [callWithUnixFdList]("GI.Gio.Objects.DBusProxy#g:method:callWithUnixFdList"), [callWithUnixFdListFinish]("GI.Gio.Objects.DBusProxy#g:method:callWithUnixFdListFinish"), [callWithUnixFdListSync]("GI.Gio.Objects.DBusProxy#g:method:callWithUnixFdListSync"), [destroy]("GI.IBus.Objects.Proxy#g:method:destroy"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [init]("GI.Gio.Interfaces.Initable#g:method:init"), [initAsync]("GI.Gio.Interfaces.AsyncInitable#g:method:initAsync"), [initFinish]("GI.Gio.Interfaces.AsyncInitable#g:method:initFinish"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [unset]("GI.IBus.Objects.Config#g:method:unset"), [unwatch]("GI.IBus.Objects.Config#g:method:unwatch"), [watch]("GI.IBus.Objects.Config#g:method:watch"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getCachedProperty]("GI.Gio.Objects.DBusProxy#g:method:getCachedProperty"), [getCachedPropertyNames]("GI.Gio.Objects.DBusProxy#g:method:getCachedPropertyNames"), [getConnection]("GI.Gio.Objects.DBusProxy#g:method:getConnection"), [getData]("GI.GObject.Objects.Object#g:method:getData"), [getDefaultTimeout]("GI.Gio.Objects.DBusProxy#g:method:getDefaultTimeout"), [getFlags]("GI.Gio.Objects.DBusProxy#g:method:getFlags"), [getInfo]("GI.Gio.Interfaces.DBusInterface#g:method:getInfo"), [getInterfaceInfo]("GI.Gio.Objects.DBusProxy#g:method:getInterfaceInfo"), [getInterfaceName]("GI.Gio.Objects.DBusProxy#g:method:getInterfaceName"), [getName]("GI.Gio.Objects.DBusProxy#g:method:getName"), [getNameOwner]("GI.Gio.Objects.DBusProxy#g:method:getNameOwner"), [getObject]("GI.Gio.Interfaces.DBusInterface#g:method:getObject"), [getObjectPath]("GI.Gio.Objects.DBusProxy#g:method:getObjectPath"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata"), [getValue]("GI.IBus.Objects.Config#g:method:getValue"), [getValueAsync]("GI.IBus.Objects.Config#g:method:getValueAsync"), [getValueAsyncFinish]("GI.IBus.Objects.Config#g:method:getValueAsyncFinish"), [getValues]("GI.IBus.Objects.Config#g:method:getValues"), [getValuesAsync]("GI.IBus.Objects.Config#g:method:getValuesAsync"), [getValuesAsyncFinish]("GI.IBus.Objects.Config#g:method:getValuesAsyncFinish").
-- 
-- ==== Setters
-- [setCachedProperty]("GI.Gio.Objects.DBusProxy#g:method:setCachedProperty"), [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setDefaultTimeout]("GI.Gio.Objects.DBusProxy#g:method:setDefaultTimeout"), [setInterfaceInfo]("GI.Gio.Objects.DBusProxy#g:method:setInterfaceInfo"), [setObject]("GI.Gio.Interfaces.DBusInterface#g:method:setObject"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty"), [setValue]("GI.IBus.Objects.Config#g:method:setValue"), [setValueAsync]("GI.IBus.Objects.Config#g:method:setValueAsync"), [setValueAsyncFinish]("GI.IBus.Objects.Config#g:method:setValueAsyncFinish").

#if defined(ENABLE_OVERLOADING)
    ResolveConfigMethod                     ,
#endif

-- ** getValue #method:getValue#

#if defined(ENABLE_OVERLOADING)
    ConfigGetValueMethodInfo                ,
#endif
    configGetValue                          ,


-- ** getValueAsync #method:getValueAsync#

#if defined(ENABLE_OVERLOADING)
    ConfigGetValueAsyncMethodInfo           ,
#endif
    configGetValueAsync                     ,


-- ** getValueAsyncFinish #method:getValueAsyncFinish#

#if defined(ENABLE_OVERLOADING)
    ConfigGetValueAsyncFinishMethodInfo     ,
#endif
    configGetValueAsyncFinish               ,


-- ** getValues #method:getValues#

#if defined(ENABLE_OVERLOADING)
    ConfigGetValuesMethodInfo               ,
#endif
    configGetValues                         ,


-- ** getValuesAsync #method:getValuesAsync#

#if defined(ENABLE_OVERLOADING)
    ConfigGetValuesAsyncMethodInfo          ,
#endif
    configGetValuesAsync                    ,


-- ** getValuesAsyncFinish #method:getValuesAsyncFinish#

#if defined(ENABLE_OVERLOADING)
    ConfigGetValuesAsyncFinishMethodInfo    ,
#endif
    configGetValuesAsyncFinish              ,


-- ** new #method:new#

    configNew                               ,


-- ** newAsync #method:newAsync#

    configNewAsync                          ,


-- ** newAsyncFinish #method:newAsyncFinish#

    configNewAsyncFinish                    ,


-- ** setValue #method:setValue#

#if defined(ENABLE_OVERLOADING)
    ConfigSetValueMethodInfo                ,
#endif
    configSetValue                          ,


-- ** setValueAsync #method:setValueAsync#

#if defined(ENABLE_OVERLOADING)
    ConfigSetValueAsyncMethodInfo           ,
#endif
    configSetValueAsync                     ,


-- ** setValueAsyncFinish #method:setValueAsyncFinish#

#if defined(ENABLE_OVERLOADING)
    ConfigSetValueAsyncFinishMethodInfo     ,
#endif
    configSetValueAsyncFinish               ,


-- ** unset #method:unset#

#if defined(ENABLE_OVERLOADING)
    ConfigUnsetMethodInfo                   ,
#endif
    configUnset                             ,


-- ** unwatch #method:unwatch#

#if defined(ENABLE_OVERLOADING)
    ConfigUnwatchMethodInfo                 ,
#endif
    configUnwatch                           ,


-- ** watch #method:watch#

#if defined(ENABLE_OVERLOADING)
    ConfigWatchMethodInfo                   ,
#endif
    configWatch                             ,




 -- * Signals


-- ** valueChanged #signal:valueChanged#

    ConfigValueChangedCallback              ,
#if defined(ENABLE_OVERLOADING)
    ConfigValueChangedSignalInfo            ,
#endif
    afterConfigValueChanged                 ,
    onConfigValueChanged                    ,




    ) 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.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import qualified GI.Gio.Interfaces.AsyncInitable as Gio.AsyncInitable
import qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import qualified GI.Gio.Interfaces.DBusInterface as Gio.DBusInterface
import qualified GI.Gio.Interfaces.Initable as Gio.Initable
import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import qualified GI.Gio.Objects.DBusConnection as Gio.DBusConnection
import qualified GI.Gio.Objects.DBusProxy as Gio.DBusProxy
import {-# SOURCE #-} qualified GI.IBus.Objects.Proxy as IBus.Proxy

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

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

foreign import ccall "ibus_config_get_type"
    c_ibus_config_get_type :: IO B.Types.GType

instance B.Types.TypedObject Config where
    glibType :: IO GType
glibType = IO GType
c_ibus_config_get_type

instance B.Types.GObject Config

-- | Type class for types which can be safely cast to `Config`, for instance with `toConfig`.
class (SP.GObject o, O.IsDescendantOf Config o) => IsConfig o
instance (SP.GObject o, O.IsDescendantOf Config o) => IsConfig o

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

-- | Cast to `Config`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toConfig :: (MIO.MonadIO m, IsConfig o) => o -> m Config
toConfig :: forall (m :: * -> *) o. (MonadIO m, IsConfig o) => o -> m Config
toConfig = IO Config -> m Config
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Config -> m Config) -> (o -> IO Config) -> o -> m Config
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Config -> Config) -> o -> IO Config
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr Config -> Config
Config

-- | Convert 'Config' to and from 'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe Config) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_ibus_config_get_type
    gvalueSet_ :: Ptr GValue -> Maybe Config -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Config
P.Nothing = Ptr GValue -> Ptr Config -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr Config
forall a. Ptr a
FP.nullPtr :: FP.Ptr Config)
    gvalueSet_ Ptr GValue
gv (P.Just Config
obj) = Config -> (Ptr Config -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Config
obj (Ptr GValue -> Ptr Config -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe Config)
gvalueGet_ Ptr GValue
gv = do
        Ptr Config
ptr <- Ptr GValue -> IO (Ptr Config)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr Config)
        if Ptr Config
ptr Ptr Config -> Ptr Config -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr Config
forall a. Ptr a
FP.nullPtr
        then Config -> Maybe Config
forall a. a -> Maybe a
P.Just (Config -> Maybe Config) -> IO Config -> IO (Maybe Config)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr Config -> Config) -> Ptr Config -> IO Config
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr Config -> Config
Config Ptr Config
ptr
        else Maybe Config -> IO (Maybe Config)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Config
forall a. Maybe a
P.Nothing
        
    

#if defined(ENABLE_OVERLOADING)
type family ResolveConfigMethod (t :: Symbol) (o :: *) :: * where
    ResolveConfigMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveConfigMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveConfigMethod "call" o = Gio.DBusProxy.DBusProxyCallMethodInfo
    ResolveConfigMethod "callFinish" o = Gio.DBusProxy.DBusProxyCallFinishMethodInfo
    ResolveConfigMethod "callSync" o = Gio.DBusProxy.DBusProxyCallSyncMethodInfo
    ResolveConfigMethod "callWithUnixFdList" o = Gio.DBusProxy.DBusProxyCallWithUnixFdListMethodInfo
    ResolveConfigMethod "callWithUnixFdListFinish" o = Gio.DBusProxy.DBusProxyCallWithUnixFdListFinishMethodInfo
    ResolveConfigMethod "callWithUnixFdListSync" o = Gio.DBusProxy.DBusProxyCallWithUnixFdListSyncMethodInfo
    ResolveConfigMethod "destroy" o = IBus.Proxy.ProxyDestroyMethodInfo
    ResolveConfigMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveConfigMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveConfigMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveConfigMethod "init" o = Gio.Initable.InitableInitMethodInfo
    ResolveConfigMethod "initAsync" o = Gio.AsyncInitable.AsyncInitableInitAsyncMethodInfo
    ResolveConfigMethod "initFinish" o = Gio.AsyncInitable.AsyncInitableInitFinishMethodInfo
    ResolveConfigMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveConfigMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveConfigMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveConfigMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveConfigMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveConfigMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveConfigMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveConfigMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveConfigMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveConfigMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveConfigMethod "unset" o = ConfigUnsetMethodInfo
    ResolveConfigMethod "unwatch" o = ConfigUnwatchMethodInfo
    ResolveConfigMethod "watch" o = ConfigWatchMethodInfo
    ResolveConfigMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveConfigMethod "getCachedProperty" o = Gio.DBusProxy.DBusProxyGetCachedPropertyMethodInfo
    ResolveConfigMethod "getCachedPropertyNames" o = Gio.DBusProxy.DBusProxyGetCachedPropertyNamesMethodInfo
    ResolveConfigMethod "getConnection" o = Gio.DBusProxy.DBusProxyGetConnectionMethodInfo
    ResolveConfigMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveConfigMethod "getDefaultTimeout" o = Gio.DBusProxy.DBusProxyGetDefaultTimeoutMethodInfo
    ResolveConfigMethod "getFlags" o = Gio.DBusProxy.DBusProxyGetFlagsMethodInfo
    ResolveConfigMethod "getInfo" o = Gio.DBusInterface.DBusInterfaceGetInfoMethodInfo
    ResolveConfigMethod "getInterfaceInfo" o = Gio.DBusProxy.DBusProxyGetInterfaceInfoMethodInfo
    ResolveConfigMethod "getInterfaceName" o = Gio.DBusProxy.DBusProxyGetInterfaceNameMethodInfo
    ResolveConfigMethod "getName" o = Gio.DBusProxy.DBusProxyGetNameMethodInfo
    ResolveConfigMethod "getNameOwner" o = Gio.DBusProxy.DBusProxyGetNameOwnerMethodInfo
    ResolveConfigMethod "getObject" o = Gio.DBusInterface.DBusInterfaceGetObjectMethodInfo
    ResolveConfigMethod "getObjectPath" o = Gio.DBusProxy.DBusProxyGetObjectPathMethodInfo
    ResolveConfigMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveConfigMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveConfigMethod "getValue" o = ConfigGetValueMethodInfo
    ResolveConfigMethod "getValueAsync" o = ConfigGetValueAsyncMethodInfo
    ResolveConfigMethod "getValueAsyncFinish" o = ConfigGetValueAsyncFinishMethodInfo
    ResolveConfigMethod "getValues" o = ConfigGetValuesMethodInfo
    ResolveConfigMethod "getValuesAsync" o = ConfigGetValuesAsyncMethodInfo
    ResolveConfigMethod "getValuesAsyncFinish" o = ConfigGetValuesAsyncFinishMethodInfo
    ResolveConfigMethod "setCachedProperty" o = Gio.DBusProxy.DBusProxySetCachedPropertyMethodInfo
    ResolveConfigMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveConfigMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveConfigMethod "setDefaultTimeout" o = Gio.DBusProxy.DBusProxySetDefaultTimeoutMethodInfo
    ResolveConfigMethod "setInterfaceInfo" o = Gio.DBusProxy.DBusProxySetInterfaceInfoMethodInfo
    ResolveConfigMethod "setObject" o = Gio.DBusInterface.DBusInterfaceSetObjectMethodInfo
    ResolveConfigMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveConfigMethod "setValue" o = ConfigSetValueMethodInfo
    ResolveConfigMethod "setValueAsync" o = ConfigSetValueAsyncMethodInfo
    ResolveConfigMethod "setValueAsyncFinish" o = ConfigSetValueAsyncFinishMethodInfo
    ResolveConfigMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveConfigMethod t Config, O.OverloadedMethod info Config p) => OL.IsLabel t (Config -> 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 ~ ResolveConfigMethod t Config, O.OverloadedMethod info Config p, R.HasField t Config p) => R.HasField t Config p where
    getField = O.overloadedMethod @info

#endif

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

#endif

-- signal Config::value-changed
-- | Emitted when configuration value is changed.
-- \<note>\<para>Argument /@userData@/ is ignored in this function.\<\/para>\<\/note>
type ConfigValueChangedCallback =
    T.Text
    -- ^ /@section@/: Section name.
    -> T.Text
    -- ^ /@name@/: Name of the property.
    -> GVariant
    -- ^ /@value@/: Value.
    -> IO ()

type C_ConfigValueChangedCallback =
    Ptr Config ->                           -- object
    CString ->
    CString ->
    Ptr GVariant ->
    Ptr () ->                               -- user_data
    IO ()

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

wrap_ConfigValueChangedCallback :: 
    GObject a => (a -> ConfigValueChangedCallback) ->
    C_ConfigValueChangedCallback
wrap_ConfigValueChangedCallback :: forall a.
GObject a =>
(a -> ConfigValueChangedCallback) -> C_ConfigValueChangedCallback
wrap_ConfigValueChangedCallback a -> ConfigValueChangedCallback
gi'cb Ptr Config
gi'selfPtr CString
section CString
name Ptr GVariant
value Ptr ()
_ = do
    Text
section' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
section
    Text
name' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
name
    GVariant
value' <- Ptr GVariant -> IO GVariant
B.GVariant.newGVariantFromPtr Ptr GVariant
value
    Ptr Config -> (Config -> IO ()) -> IO ()
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient Ptr Config
gi'selfPtr ((Config -> IO ()) -> IO ()) -> (Config -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Config
gi'self -> a -> ConfigValueChangedCallback
gi'cb (Config -> a
Coerce.coerce Config
gi'self)  Text
section' Text
name' GVariant
value'


-- | Connect a signal handler for the [valueChanged](#signal:valueChanged) 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' config #valueChanged callback
-- @
-- 
-- 
onConfigValueChanged :: (IsConfig a, MonadIO m) => a -> ((?self :: a) => ConfigValueChangedCallback) -> m SignalHandlerId
onConfigValueChanged :: forall a (m :: * -> *).
(IsConfig a, MonadIO m) =>
a
-> ((?self::a) => ConfigValueChangedCallback) -> m SignalHandlerId
onConfigValueChanged a
obj (?self::a) => ConfigValueChangedCallback
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 wrapped :: a -> ConfigValueChangedCallback
wrapped a
self = let ?self = a
?self::a
self in (?self::a) => ConfigValueChangedCallback
ConfigValueChangedCallback
cb
    let wrapped' :: C_ConfigValueChangedCallback
wrapped' = (a -> ConfigValueChangedCallback) -> C_ConfigValueChangedCallback
forall a.
GObject a =>
(a -> ConfigValueChangedCallback) -> C_ConfigValueChangedCallback
wrap_ConfigValueChangedCallback a -> ConfigValueChangedCallback
wrapped
    FunPtr C_ConfigValueChangedCallback
wrapped'' <- C_ConfigValueChangedCallback
-> IO (FunPtr C_ConfigValueChangedCallback)
mk_ConfigValueChangedCallback C_ConfigValueChangedCallback
wrapped'
    a
-> Text
-> FunPtr C_ConfigValueChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"value-changed" FunPtr C_ConfigValueChangedCallback
wrapped'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [valueChanged](#signal:valueChanged) 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' config #valueChanged callback
-- @
-- 
-- 
-- 
-- By default the object invoking the signal is not passed to the callback.
-- If you need to access it, you can use the implit @?self@ parameter.
-- Note that this requires activating the @ImplicitParams@ GHC extension.
-- 
afterConfigValueChanged :: (IsConfig a, MonadIO m) => a -> ((?self :: a) => ConfigValueChangedCallback) -> m SignalHandlerId
afterConfigValueChanged :: forall a (m :: * -> *).
(IsConfig a, MonadIO m) =>
a
-> ((?self::a) => ConfigValueChangedCallback) -> m SignalHandlerId
afterConfigValueChanged a
obj (?self::a) => ConfigValueChangedCallback
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 wrapped :: a -> ConfigValueChangedCallback
wrapped a
self = let ?self = a
?self::a
self in (?self::a) => ConfigValueChangedCallback
ConfigValueChangedCallback
cb
    let wrapped' :: C_ConfigValueChangedCallback
wrapped' = (a -> ConfigValueChangedCallback) -> C_ConfigValueChangedCallback
forall a.
GObject a =>
(a -> ConfigValueChangedCallback) -> C_ConfigValueChangedCallback
wrap_ConfigValueChangedCallback a -> ConfigValueChangedCallback
wrapped
    FunPtr C_ConfigValueChangedCallback
wrapped'' <- C_ConfigValueChangedCallback
-> IO (FunPtr C_ConfigValueChangedCallback)
mk_ConfigValueChangedCallback C_ConfigValueChangedCallback
wrapped'
    a
-> Text
-> FunPtr C_ConfigValueChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"value-changed" FunPtr C_ConfigValueChangedCallback
wrapped'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data ConfigValueChangedSignalInfo
instance SignalInfo ConfigValueChangedSignalInfo where
    type HaskellCallbackType ConfigValueChangedSignalInfo = ConfigValueChangedCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_ConfigValueChangedCallback cb
        cb'' <- mk_ConfigValueChangedCallback cb'
        connectSignalFunPtr obj "value-changed" cb'' connectMode detail
    dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.IBus.Objects.Config::value-changed"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ibus-1.5.4/docs/GI-IBus-Objects-Config.html#g:signal:valueChanged"})

#endif

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

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Config = ConfigSignalList
type ConfigSignalList = ('[ '("destroy", IBus.Proxy.ProxyDestroySignalInfo), '("gPropertiesChanged", Gio.DBusProxy.DBusProxyGPropertiesChangedSignalInfo), '("gSignal", Gio.DBusProxy.DBusProxyGSignalSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("valueChanged", ConfigValueChangedSignalInfo)] :: [(Symbol, *)])

#endif

-- method Config::new
-- 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 = "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 = "IBus" , name = "Config" })
-- throws : True
-- Skip return : False

foreign import ccall "ibus_config_new" ibus_config_new :: 
    Ptr Gio.DBusConnection.DBusConnection -> -- connection : TInterface (Name {namespace = "Gio", name = "DBusConnection"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Config)

-- | Create a new t'GI.IBus.Objects.Config.Config' from existing t'GI.Gio.Objects.DBusConnection.DBusConnection'.
configNew ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.DBusConnection.IsDBusConnection a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@connection@/: A t'GI.Gio.Objects.DBusConnection.DBusConnection'.
    -> Maybe (b)
    -- ^ /@cancellable@/: A t'GI.Gio.Objects.Cancellable.Cancellable' or 'P.Nothing'.
    -> m Config
    -- ^ __Returns:__ A newly allocated t'GI.IBus.Objects.Config.Config' corresponding to /@connection@/. /(Can throw 'Data.GI.Base.GError.GError')/
configNew :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsDBusConnection a, IsCancellable b) =>
a -> Maybe b -> m Config
configNew a
connection Maybe b
cancellable = IO Config -> m Config
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Config -> m Config) -> IO Config -> m Config
forall a b. (a -> b) -> a -> b
$ do
    Ptr DBusConnection
connection' <- a -> IO (Ptr DBusConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    IO Config -> IO () -> IO Config
forall a b. IO a -> IO b -> IO a
onException (do
        Ptr Config
result <- (Ptr (Ptr GError) -> IO (Ptr Config)) -> IO (Ptr Config)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr Config)) -> IO (Ptr Config))
-> (Ptr (Ptr GError) -> IO (Ptr Config)) -> IO (Ptr Config)
forall a b. (a -> b) -> a -> b
$ Ptr DBusConnection
-> Ptr Cancellable -> Ptr (Ptr GError) -> IO (Ptr Config)
ibus_config_new Ptr DBusConnection
connection' Ptr Cancellable
maybeCancellable
        Text -> Ptr Config -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"configNew" Ptr Config
result
        Config
result' <- ((ManagedPtr Config -> Config) -> Ptr Config -> IO Config
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Config -> Config
Config) Ptr Config
result
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
connection
        Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        Config -> IO Config
forall (m :: * -> *) a. Monad m => a -> m a
return Config
result'
     ) (do
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
#endif

-- method Config::new_async_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 pass to\n     ibus_config_new_async()."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "IBus" , name = "Config" })
-- throws : True
-- Skip return : False

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

-- | Finishes an operation started with 'GI.IBus.Objects.Config.configNewAsync'.
configNewAsyncFinish ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.AsyncResult.IsAsyncResult a) =>
    a
    -- ^ /@res@/: A t'GI.Gio.Interfaces.AsyncResult.AsyncResult' obtained from the t'GI.Gio.Callbacks.AsyncReadyCallback' pass to
    --      'GI.IBus.Objects.Config.configNewAsync'.
    -> m Config
    -- ^ __Returns:__ A newly allocated t'GI.IBus.Objects.Config.Config'. /(Can throw 'Data.GI.Base.GError.GError')/
configNewAsyncFinish :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAsyncResult a) =>
a -> m Config
configNewAsyncFinish a
res = IO Config -> m Config
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Config -> m Config) -> IO Config -> m Config
forall a b. (a -> b) -> a -> b
$ do
    Ptr AsyncResult
res' <- a -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
res
    IO Config -> IO () -> IO Config
forall a b. IO a -> IO b -> IO a
onException (do
        Ptr Config
result <- (Ptr (Ptr GError) -> IO (Ptr Config)) -> IO (Ptr Config)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr Config)) -> IO (Ptr Config))
-> (Ptr (Ptr GError) -> IO (Ptr Config)) -> IO (Ptr Config)
forall a b. (a -> b) -> a -> b
$ Ptr AsyncResult -> Ptr (Ptr GError) -> IO (Ptr Config)
ibus_config_new_async_finish Ptr AsyncResult
res'
        Text -> Ptr Config -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"configNewAsyncFinish" Ptr Config
result
        Config
result' <- ((ManagedPtr Config -> Config) -> Ptr Config -> IO Config
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Config -> Config
Config) Ptr Config
result
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
res
        Config -> IO Config
forall (m :: * -> *) a. Monad m => a -> m a
return Config
result'
     ) (do
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
#endif

-- method Config::get_value
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "config"
--           , argType =
--               TInterface Name { namespace = "IBus" , name = "Config" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #IBusConfig" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "section"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Section name of the configuration option."
--                 , 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 "Name of the configure option."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just TVariant
-- throws : False
-- Skip return : False

foreign import ccall "ibus_config_get_value" ibus_config_get_value :: 
    Ptr Config ->                           -- config : TInterface (Name {namespace = "IBus", name = "Config"})
    CString ->                              -- section : TBasicType TUTF8
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr GVariant)

-- | Get the value of a configuration option synchronously.
-- 
-- GConf stores configure options in a tree-like structure,
-- and the IBus related setting is at \/desktop\/ibus,
-- thus, /@section@/ here is a path from there,
-- while /@name@/ is the key of that configuration option.
-- 
-- ibus-chewing, for example, stores its setting in \/desktop\/ibus\/engine\/Chewing,
-- so the section name for it is \"engine\/Chewing\".
-- See also: 'GI.IBus.Objects.Config.configSetValue'.
configGetValue ::
    (B.CallStack.HasCallStack, MonadIO m, IsConfig a) =>
    a
    -- ^ /@config@/: An t'GI.IBus.Objects.Config.Config'
    -> T.Text
    -- ^ /@section@/: Section name of the configuration option.
    -> T.Text
    -- ^ /@name@/: Name of the configure option.
    -> m GVariant
    -- ^ __Returns:__ A t'GVariant' or 'P.Nothing'. Free with 'GI.GLib.Structs.Variant.variantUnref'.
configGetValue :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsConfig a) =>
a -> Text -> Text -> m GVariant
configGetValue a
config Text
section Text
name = IO GVariant -> m GVariant
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GVariant -> m GVariant) -> IO GVariant -> m GVariant
forall a b. (a -> b) -> a -> b
$ do
    Ptr Config
config' <- a -> IO (Ptr Config)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
config
    CString
section' <- Text -> IO CString
textToCString Text
section
    CString
name' <- Text -> IO CString
textToCString Text
name
    Ptr GVariant
result <- Ptr Config -> CString -> CString -> IO (Ptr GVariant)
ibus_config_get_value Ptr Config
config' CString
section' CString
name'
    Text -> Ptr GVariant -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"configGetValue" Ptr GVariant
result
    GVariant
result' <- Ptr GVariant -> IO GVariant
B.GVariant.wrapGVariantPtr Ptr GVariant
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
config
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
section'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
    GVariant -> IO GVariant
forall (m :: * -> *) a. Monad m => a -> m a
return GVariant
result'

#if defined(ENABLE_OVERLOADING)
data ConfigGetValueMethodInfo
instance (signature ~ (T.Text -> T.Text -> m GVariant), MonadIO m, IsConfig a) => O.OverloadedMethod ConfigGetValueMethodInfo a signature where
    overloadedMethod = configGetValue

instance O.OverloadedMethodInfo ConfigGetValueMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.IBus.Objects.Config.configGetValue",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ibus-1.5.4/docs/GI-IBus-Objects-Config.html#v:configGetValue"
        })


#endif

-- method Config::get_value_async
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "config"
--           , argType =
--               TInterface Name { namespace = "IBus" , name = "Config" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #IBusConfig" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "section"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Section name of the configuration option."
--                 , 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 "Name of the configure option."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "timeout_ms"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "The timeout in milliseconds or -1 to use the 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 "Callback function to invoke when the return value is ready."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 6
--           , 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 "ibus_config_get_value_async" ibus_config_get_value_async :: 
    Ptr Config ->                           -- config : TInterface (Name {namespace = "IBus", name = "Config"})
    CString ->                              -- section : TBasicType TUTF8
    CString ->                              -- name : TBasicType TUTF8
    Int32 ->                                -- timeout_ms : 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 ()

-- | Get the value of a configuration option asynchronously.
-- 
-- See also: 'GI.IBus.Objects.Config.configGetValue'.
configGetValueAsync ::
    (B.CallStack.HasCallStack, MonadIO m, IsConfig a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@config@/: An t'GI.IBus.Objects.Config.Config'
    -> T.Text
    -- ^ /@section@/: Section name of the configuration option.
    -> T.Text
    -- ^ /@name@/: Name of the configure option.
    -> Int32
    -- ^ /@timeoutMs@/: The timeout in milliseconds or -1 to use the default timeout.
    -> Maybe (b)
    -- ^ /@cancellable@/: A t'GI.Gio.Objects.Cancellable.Cancellable' or 'P.Nothing'.
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    -- ^ /@callback@/: Callback function to invoke when the return value is ready.
    -> m ()
configGetValueAsync :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsConfig a, IsCancellable b) =>
a
-> Text
-> Text
-> Int32
-> Maybe b
-> Maybe AsyncReadyCallback
-> m ()
configGetValueAsync a
config Text
section Text
name Int32
timeoutMs Maybe b
cancellable Maybe AsyncReadyCallback
callback = 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 Config
config' <- a -> IO (Ptr Config)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
config
    CString
section' <- Text -> IO CString
textToCString Text
section
    CString
name' <- Text -> IO CString
textToCString Text
name
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
        Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
        Just AsyncReadyCallback
jCallback -> do
            Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
            Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
            FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
    let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
    Ptr Config
-> CString
-> CString
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
ibus_config_get_value_async Ptr Config
config' CString
section' CString
name' Int32
timeoutMs Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
config
    Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
section'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ConfigGetValueAsyncMethodInfo
instance (signature ~ (T.Text -> T.Text -> Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsConfig a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod ConfigGetValueAsyncMethodInfo a signature where
    overloadedMethod = configGetValueAsync

instance O.OverloadedMethodInfo ConfigGetValueAsyncMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.IBus.Objects.Config.configGetValueAsync",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ibus-1.5.4/docs/GI-IBus-Objects-Config.html#v:configGetValueAsync"
        })


#endif

-- method Config::get_value_async_finish
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "config"
--           , argType =
--               TInterface Name { namespace = "IBus" , name = "Config" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #IBusConfig." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "result"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncResult" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GAsyncResult." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just TVariant
-- throws : True
-- Skip return : False

foreign import ccall "ibus_config_get_value_async_finish" ibus_config_get_value_async_finish :: 
    Ptr Config ->                           -- config : TInterface (Name {namespace = "IBus", name = "Config"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr GVariant)

-- | Finish get value of a configuration option.
configGetValueAsyncFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsConfig a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    -- ^ /@config@/: A t'GI.IBus.Objects.Config.Config'.
    -> b
    -- ^ /@result@/: A t'GI.Gio.Interfaces.AsyncResult.AsyncResult'.
    -> m GVariant
    -- ^ __Returns:__ A t'GVariant' or 'P.Nothing' if error is set. Free with 'GI.GLib.Structs.Variant.variantUnref'.
    -- 
    -- See also: 'GI.IBus.Objects.Config.configGetValueAsync'. /(Can throw 'Data.GI.Base.GError.GError')/
configGetValueAsyncFinish :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsConfig a, IsAsyncResult b) =>
a -> b -> m GVariant
configGetValueAsyncFinish a
config b
result_ = IO GVariant -> m GVariant
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GVariant -> m GVariant) -> IO GVariant -> m GVariant
forall a b. (a -> b) -> a -> b
$ do
    Ptr Config
config' <- a -> IO (Ptr Config)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
config
    Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
    IO GVariant -> IO () -> IO GVariant
forall a b. IO a -> IO b -> IO a
onException (do
        Ptr GVariant
result <- (Ptr (Ptr GError) -> IO (Ptr GVariant)) -> IO (Ptr GVariant)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr GVariant)) -> IO (Ptr GVariant))
-> (Ptr (Ptr GError) -> IO (Ptr GVariant)) -> IO (Ptr GVariant)
forall a b. (a -> b) -> a -> b
$ Ptr Config
-> Ptr AsyncResult -> Ptr (Ptr GError) -> IO (Ptr GVariant)
ibus_config_get_value_async_finish Ptr Config
config' Ptr AsyncResult
result_'
        Text -> Ptr GVariant -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"configGetValueAsyncFinish" Ptr GVariant
result
        GVariant
result' <- Ptr GVariant -> IO GVariant
B.GVariant.wrapGVariantPtr Ptr GVariant
result
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
config
        b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
        GVariant -> IO GVariant
forall (m :: * -> *) a. Monad m => a -> m a
return GVariant
result'
     ) (do
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data ConfigGetValueAsyncFinishMethodInfo
instance (signature ~ (b -> m GVariant), MonadIO m, IsConfig a, Gio.AsyncResult.IsAsyncResult b) => O.OverloadedMethod ConfigGetValueAsyncFinishMethodInfo a signature where
    overloadedMethod = configGetValueAsyncFinish

instance O.OverloadedMethodInfo ConfigGetValueAsyncFinishMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.IBus.Objects.Config.configGetValueAsyncFinish",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ibus-1.5.4/docs/GI-IBus-Objects-Config.html#v:configGetValueAsyncFinish"
        })


#endif

-- method Config::get_values
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "config"
--           , argType =
--               TInterface Name { namespace = "IBus" , name = "Config" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #IBusConfig" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "section"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Section name of the configuration option."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just TVariant
-- throws : False
-- Skip return : False

foreign import ccall "ibus_config_get_values" ibus_config_get_values :: 
    Ptr Config ->                           -- config : TInterface (Name {namespace = "IBus", name = "Config"})
    CString ->                              -- section : TBasicType TUTF8
    IO (Ptr GVariant)

-- | Get all values in a section synchronously.
configGetValues ::
    (B.CallStack.HasCallStack, MonadIO m, IsConfig a) =>
    a
    -- ^ /@config@/: An t'GI.IBus.Objects.Config.Config'
    -> T.Text
    -- ^ /@section@/: Section name of the configuration option.
    -> m GVariant
    -- ^ __Returns:__ A t'GVariant' or 'P.Nothing'. Free with 'GI.GLib.Structs.Variant.variantUnref'.
    -- 
    -- See also: 'GI.IBus.Objects.Config.configSetValue'.
configGetValues :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsConfig a) =>
a -> Text -> m GVariant
configGetValues a
config Text
section = IO GVariant -> m GVariant
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GVariant -> m GVariant) -> IO GVariant -> m GVariant
forall a b. (a -> b) -> a -> b
$ do
    Ptr Config
config' <- a -> IO (Ptr Config)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
config
    CString
section' <- Text -> IO CString
textToCString Text
section
    Ptr GVariant
result <- Ptr Config -> CString -> IO (Ptr GVariant)
ibus_config_get_values Ptr Config
config' CString
section'
    Text -> Ptr GVariant -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"configGetValues" Ptr GVariant
result
    GVariant
result' <- Ptr GVariant -> IO GVariant
B.GVariant.wrapGVariantPtr Ptr GVariant
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
config
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
section'
    GVariant -> IO GVariant
forall (m :: * -> *) a. Monad m => a -> m a
return GVariant
result'

#if defined(ENABLE_OVERLOADING)
data ConfigGetValuesMethodInfo
instance (signature ~ (T.Text -> m GVariant), MonadIO m, IsConfig a) => O.OverloadedMethod ConfigGetValuesMethodInfo a signature where
    overloadedMethod = configGetValues

instance O.OverloadedMethodInfo ConfigGetValuesMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.IBus.Objects.Config.configGetValues",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ibus-1.5.4/docs/GI-IBus-Objects-Config.html#v:configGetValues"
        })


#endif

-- method Config::get_values_async
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "config"
--           , argType =
--               TInterface Name { namespace = "IBus" , name = "Config" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #IBusConfig" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "section"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Section name of the configuration option."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "timeout_ms"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "The timeout in milliseconds or -1 to use the 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 "Callback function to invoke when the return value is ready."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 5
--           , 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 "ibus_config_get_values_async" ibus_config_get_values_async :: 
    Ptr Config ->                           -- config : TInterface (Name {namespace = "IBus", name = "Config"})
    CString ->                              -- section : TBasicType TUTF8
    Int32 ->                                -- timeout_ms : 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 ()

-- | Get all values in a section asynchronously.
-- 
-- See also: 'GI.IBus.Objects.Config.configGetValues'.
configGetValuesAsync ::
    (B.CallStack.HasCallStack, MonadIO m, IsConfig a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@config@/: An t'GI.IBus.Objects.Config.Config'
    -> T.Text
    -- ^ /@section@/: Section name of the configuration option.
    -> Int32
    -- ^ /@timeoutMs@/: The timeout in milliseconds or -1 to use the default timeout.
    -> Maybe (b)
    -- ^ /@cancellable@/: A t'GI.Gio.Objects.Cancellable.Cancellable' or 'P.Nothing'.
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    -- ^ /@callback@/: Callback function to invoke when the return value is ready.
    -> m ()
configGetValuesAsync :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsConfig a, IsCancellable b) =>
a -> Text -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
configGetValuesAsync a
config Text
section Int32
timeoutMs Maybe b
cancellable Maybe AsyncReadyCallback
callback = 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 Config
config' <- a -> IO (Ptr Config)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
config
    CString
section' <- Text -> IO CString
textToCString Text
section
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
        Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
        Just AsyncReadyCallback
jCallback -> do
            Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
            Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
            FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
    let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
    Ptr Config
-> CString
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
ibus_config_get_values_async Ptr Config
config' CString
section' Int32
timeoutMs Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
config
    Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
section'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ConfigGetValuesAsyncMethodInfo
instance (signature ~ (T.Text -> Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsConfig a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod ConfigGetValuesAsyncMethodInfo a signature where
    overloadedMethod = configGetValuesAsync

instance O.OverloadedMethodInfo ConfigGetValuesAsyncMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.IBus.Objects.Config.configGetValuesAsync",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ibus-1.5.4/docs/GI-IBus-Objects-Config.html#v:configGetValuesAsync"
        })


#endif

-- method Config::get_values_async_finish
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "config"
--           , argType =
--               TInterface Name { namespace = "IBus" , name = "Config" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #IBusConfig." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "result"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncResult" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GAsyncResult." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just TVariant
-- throws : True
-- Skip return : False

foreign import ccall "ibus_config_get_values_async_finish" ibus_config_get_values_async_finish :: 
    Ptr Config ->                           -- config : TInterface (Name {namespace = "IBus", name = "Config"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr GVariant)

-- | Finish get values in a section.
configGetValuesAsyncFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsConfig a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    -- ^ /@config@/: A t'GI.IBus.Objects.Config.Config'.
    -> b
    -- ^ /@result@/: A t'GI.Gio.Interfaces.AsyncResult.AsyncResult'.
    -> m GVariant
    -- ^ __Returns:__ A t'GVariant' or 'P.Nothing' if error is set. Free with 'GI.GLib.Structs.Variant.variantUnref'.
    -- 
    -- See also: 'GI.IBus.Objects.Config.configGetValuesAsync'. /(Can throw 'Data.GI.Base.GError.GError')/
configGetValuesAsyncFinish :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsConfig a, IsAsyncResult b) =>
a -> b -> m GVariant
configGetValuesAsyncFinish a
config b
result_ = IO GVariant -> m GVariant
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GVariant -> m GVariant) -> IO GVariant -> m GVariant
forall a b. (a -> b) -> a -> b
$ do
    Ptr Config
config' <- a -> IO (Ptr Config)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
config
    Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
    IO GVariant -> IO () -> IO GVariant
forall a b. IO a -> IO b -> IO a
onException (do
        Ptr GVariant
result <- (Ptr (Ptr GError) -> IO (Ptr GVariant)) -> IO (Ptr GVariant)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr GVariant)) -> IO (Ptr GVariant))
-> (Ptr (Ptr GError) -> IO (Ptr GVariant)) -> IO (Ptr GVariant)
forall a b. (a -> b) -> a -> b
$ Ptr Config
-> Ptr AsyncResult -> Ptr (Ptr GError) -> IO (Ptr GVariant)
ibus_config_get_values_async_finish Ptr Config
config' Ptr AsyncResult
result_'
        Text -> Ptr GVariant -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"configGetValuesAsyncFinish" Ptr GVariant
result
        GVariant
result' <- Ptr GVariant -> IO GVariant
B.GVariant.wrapGVariantPtr Ptr GVariant
result
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
config
        b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
        GVariant -> IO GVariant
forall (m :: * -> *) a. Monad m => a -> m a
return GVariant
result'
     ) (do
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data ConfigGetValuesAsyncFinishMethodInfo
instance (signature ~ (b -> m GVariant), MonadIO m, IsConfig a, Gio.AsyncResult.IsAsyncResult b) => O.OverloadedMethod ConfigGetValuesAsyncFinishMethodInfo a signature where
    overloadedMethod = configGetValuesAsyncFinish

instance O.OverloadedMethodInfo ConfigGetValuesAsyncFinishMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.IBus.Objects.Config.configGetValuesAsyncFinish",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ibus-1.5.4/docs/GI-IBus-Objects-Config.html#v:configGetValuesAsyncFinish"
        })


#endif

-- method Config::set_value
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "config"
--           , argType =
--               TInterface Name { namespace = "IBus" , name = "Config" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #IBusConfig" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "section"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Section name of the configuration option."
--                 , 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 "Name of the configure option its self."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "value"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "A #GVariant that holds the value. If the value is floating, the\nfunction takes ownership of it."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "ibus_config_set_value" ibus_config_set_value :: 
    Ptr Config ->                           -- config : TInterface (Name {namespace = "IBus", name = "Config"})
    CString ->                              -- section : TBasicType TUTF8
    CString ->                              -- name : TBasicType TUTF8
    Ptr GVariant ->                         -- value : TVariant
    IO CInt

-- | Set the value of a configuration option synchronously.
configSetValue ::
    (B.CallStack.HasCallStack, MonadIO m, IsConfig a) =>
    a
    -- ^ /@config@/: An t'GI.IBus.Objects.Config.Config'
    -> T.Text
    -- ^ /@section@/: Section name of the configuration option.
    -> T.Text
    -- ^ /@name@/: Name of the configure option its self.
    -> GVariant
    -- ^ /@value@/: A t'GVariant' that holds the value. If the value is floating, the
    -- function takes ownership of it.
    -> m Bool
    -- ^ __Returns:__ 'P.True' if succeed; 'P.False' otherwise.
    -- 
    -- See also: 'GI.IBus.Objects.Config.configGetValue'.
configSetValue :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsConfig a) =>
a -> Text -> Text -> GVariant -> m Bool
configSetValue a
config Text
section Text
name GVariant
value = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr Config
config' <- a -> IO (Ptr Config)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
config
    CString
section' <- Text -> IO CString
textToCString Text
section
    CString
name' <- Text -> IO CString
textToCString Text
name
    Ptr GVariant
value' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
value
    CInt
result <- Ptr Config -> CString -> CString -> Ptr GVariant -> IO CInt
ibus_config_set_value Ptr Config
config' CString
section' CString
name' Ptr GVariant
value'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
config
    GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
value
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
section'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data ConfigSetValueMethodInfo
instance (signature ~ (T.Text -> T.Text -> GVariant -> m Bool), MonadIO m, IsConfig a) => O.OverloadedMethod ConfigSetValueMethodInfo a signature where
    overloadedMethod = configSetValue

instance O.OverloadedMethodInfo ConfigSetValueMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.IBus.Objects.Config.configSetValue",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ibus-1.5.4/docs/GI-IBus-Objects-Config.html#v:configSetValue"
        })


#endif

-- method Config::set_value_async
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "config"
--           , argType =
--               TInterface Name { namespace = "IBus" , name = "Config" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #IBusConfig" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "section"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Section name of the configuration option."
--                 , 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 "Name of the configure option."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "value"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "A #GVariant that holds the value. If the value is floating, the\nfunction takes ownership of it."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "timeout_ms"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "The timeout in milliseconds or -1 to use the 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 "Callback function to invoke when the return value is ready."
--                 , 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 "ibus_config_set_value_async" ibus_config_set_value_async :: 
    Ptr Config ->                           -- config : TInterface (Name {namespace = "IBus", name = "Config"})
    CString ->                              -- section : TBasicType TUTF8
    CString ->                              -- name : TBasicType TUTF8
    Ptr GVariant ->                         -- value : TVariant
    Int32 ->                                -- timeout_ms : 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 ()

-- | Set the value of a configuration option asynchronously.
-- 
-- See also: 'GI.IBus.Objects.Config.configSetValue'.
configSetValueAsync ::
    (B.CallStack.HasCallStack, MonadIO m, IsConfig a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@config@/: An t'GI.IBus.Objects.Config.Config'
    -> T.Text
    -- ^ /@section@/: Section name of the configuration option.
    -> T.Text
    -- ^ /@name@/: Name of the configure option.
    -> GVariant
    -- ^ /@value@/: A t'GVariant' that holds the value. If the value is floating, the
    -- function takes ownership of it.
    -> Int32
    -- ^ /@timeoutMs@/: The timeout in milliseconds or -1 to use the default timeout.
    -> Maybe (b)
    -- ^ /@cancellable@/: A t'GI.Gio.Objects.Cancellable.Cancellable' or 'P.Nothing'.
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    -- ^ /@callback@/: Callback function to invoke when the return value is ready.
    -> m ()
configSetValueAsync :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsConfig a, IsCancellable b) =>
a
-> Text
-> Text
-> GVariant
-> Int32
-> Maybe b
-> Maybe AsyncReadyCallback
-> m ()
configSetValueAsync a
config Text
section Text
name GVariant
value Int32
timeoutMs Maybe b
cancellable Maybe AsyncReadyCallback
callback = 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 Config
config' <- a -> IO (Ptr Config)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
config
    CString
section' <- Text -> IO CString
textToCString Text
section
    CString
name' <- Text -> IO CString
textToCString Text
name
    Ptr GVariant
value' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
value
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
        Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
        Just AsyncReadyCallback
jCallback -> do
            Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
            Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
            FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
    let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
    Ptr Config
-> CString
-> CString
-> Ptr GVariant
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
ibus_config_set_value_async Ptr Config
config' CString
section' CString
name' Ptr GVariant
value' Int32
timeoutMs Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
config
    GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
value
    Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
section'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ConfigSetValueAsyncMethodInfo
instance (signature ~ (T.Text -> T.Text -> GVariant -> Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsConfig a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod ConfigSetValueAsyncMethodInfo a signature where
    overloadedMethod = configSetValueAsync

instance O.OverloadedMethodInfo ConfigSetValueAsyncMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.IBus.Objects.Config.configSetValueAsync",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ibus-1.5.4/docs/GI-IBus-Objects-Config.html#v:configSetValueAsync"
        })


#endif

-- method Config::set_value_async_finish
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "config"
--           , argType =
--               TInterface Name { namespace = "IBus" , name = "Config" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #IBusConfig." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "result"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncResult" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GAsyncResult." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ibus_config_set_value_async_finish" ibus_config_set_value_async_finish :: 
    Ptr Config ->                           -- config : TInterface (Name {namespace = "IBus", name = "Config"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Finish set value of a configuration option.
configSetValueAsyncFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsConfig a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    -- ^ /@config@/: A t'GI.IBus.Objects.Config.Config'.
    -> b
    -- ^ /@result@/: A t'GI.Gio.Interfaces.AsyncResult.AsyncResult'.
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
configSetValueAsyncFinish :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsConfig a, IsAsyncResult b) =>
a -> b -> m ()
configSetValueAsyncFinish a
config b
result_ = 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 Config
config' <- a -> IO (Ptr Config)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
config
    Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Config -> Ptr AsyncResult -> Ptr (Ptr GError) -> IO CInt
ibus_config_set_value_async_finish Ptr Config
config' Ptr AsyncResult
result_'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
config
        b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data ConfigSetValueAsyncFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsConfig a, Gio.AsyncResult.IsAsyncResult b) => O.OverloadedMethod ConfigSetValueAsyncFinishMethodInfo a signature where
    overloadedMethod = configSetValueAsyncFinish

instance O.OverloadedMethodInfo ConfigSetValueAsyncFinishMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.IBus.Objects.Config.configSetValueAsyncFinish",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ibus-1.5.4/docs/GI-IBus-Objects-Config.html#v:configSetValueAsyncFinish"
        })


#endif

-- method Config::unset
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "config"
--           , argType =
--               TInterface Name { namespace = "IBus" , name = "Config" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #IBusConfig" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "section"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Section name of the configuration option."
--                 , 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 "Name of the configure option its self."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "ibus_config_unset" ibus_config_unset :: 
    Ptr Config ->                           -- config : TInterface (Name {namespace = "IBus", name = "Config"})
    CString ->                              -- section : TBasicType TUTF8
    CString ->                              -- name : TBasicType TUTF8
    IO CInt

-- | Remove an entry of a configuration option.
configUnset ::
    (B.CallStack.HasCallStack, MonadIO m, IsConfig a) =>
    a
    -- ^ /@config@/: An t'GI.IBus.Objects.Config.Config'
    -> T.Text
    -- ^ /@section@/: Section name of the configuration option.
    -> T.Text
    -- ^ /@name@/: Name of the configure option its self.
    -> m Bool
    -- ^ __Returns:__ 'P.True' if succeed; 'P.False' otherwise.
    -- 
    -- See also: 'GI.IBus.Objects.Config.configGetValue'.
configUnset :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsConfig a) =>
a -> Text -> Text -> m Bool
configUnset a
config Text
section Text
name = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr Config
config' <- a -> IO (Ptr Config)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
config
    CString
section' <- Text -> IO CString
textToCString Text
section
    CString
name' <- Text -> IO CString
textToCString Text
name
    CInt
result <- Ptr Config -> CString -> CString -> IO CInt
ibus_config_unset Ptr Config
config' CString
section' CString
name'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
config
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
section'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data ConfigUnsetMethodInfo
instance (signature ~ (T.Text -> T.Text -> m Bool), MonadIO m, IsConfig a) => O.OverloadedMethod ConfigUnsetMethodInfo a signature where
    overloadedMethod = configUnset

instance O.OverloadedMethodInfo ConfigUnsetMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.IBus.Objects.Config.configUnset",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ibus-1.5.4/docs/GI-IBus-Objects-Config.html#v:configUnset"
        })


#endif

-- method Config::unwatch
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "config"
--           , argType =
--               TInterface Name { namespace = "IBus" , name = "Config" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #IBusConfig" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "section"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Section name of the configuration option."
--                 , 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 "Name of the configure option its self."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "ibus_config_unwatch" ibus_config_unwatch :: 
    Ptr Config ->                           -- config : TInterface (Name {namespace = "IBus", name = "Config"})
    CString ->                              -- section : TBasicType TUTF8
    CString ->                              -- name : TBasicType TUTF8
    IO CInt

-- | Unsubscribe from the configuration option change notification.
configUnwatch ::
    (B.CallStack.HasCallStack, MonadIO m, IsConfig a) =>
    a
    -- ^ /@config@/: An t'GI.IBus.Objects.Config.Config'
    -> Maybe (T.Text)
    -- ^ /@section@/: Section name of the configuration option.
    -> Maybe (T.Text)
    -- ^ /@name@/: Name of the configure option its self.
    -> m Bool
    -- ^ __Returns:__ 'P.True' if succeed; 'P.False' otherwise.
    -- 
    -- See also: ibus_config_watch.
configUnwatch :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsConfig a) =>
a -> Maybe Text -> Maybe Text -> m Bool
configUnwatch a
config Maybe Text
section Maybe Text
name = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr Config
config' <- a -> IO (Ptr Config)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
config
    CString
maybeSection <- case Maybe Text
section of
        Maybe Text
Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just Text
jSection -> do
            CString
jSection' <- Text -> IO CString
textToCString Text
jSection
            CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jSection'
    CString
maybeName <- case Maybe Text
name of
        Maybe Text
Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just Text
jName -> do
            CString
jName' <- Text -> IO CString
textToCString Text
jName
            CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jName'
    CInt
result <- Ptr Config -> CString -> CString -> IO CInt
ibus_config_unwatch Ptr Config
config' CString
maybeSection CString
maybeName
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
config
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeSection
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeName
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data ConfigUnwatchMethodInfo
instance (signature ~ (Maybe (T.Text) -> Maybe (T.Text) -> m Bool), MonadIO m, IsConfig a) => O.OverloadedMethod ConfigUnwatchMethodInfo a signature where
    overloadedMethod = configUnwatch

instance O.OverloadedMethodInfo ConfigUnwatchMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.IBus.Objects.Config.configUnwatch",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ibus-1.5.4/docs/GI-IBus-Objects-Config.html#v:configUnwatch"
        })


#endif

-- method Config::watch
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "config"
--           , argType =
--               TInterface Name { namespace = "IBus" , name = "Config" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #IBusConfig" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "section"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Section name of the configuration option."
--                 , 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 "Name of the configure option its self."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "ibus_config_watch" ibus_config_watch :: 
    Ptr Config ->                           -- config : TInterface (Name {namespace = "IBus", name = "Config"})
    CString ->                              -- section : TBasicType TUTF8
    CString ->                              -- name : TBasicType TUTF8
    IO CInt

-- | Subscribe to the configuration option change notification.
-- 
-- Until this function is called, every change will be notified to the
-- client through [valueChanged]("GI.IBus.Objects.Config#g:signal:valueChanged") signal.  Clients should
-- call 'GI.IBus.Objects.Config.configWatch' with the sections they are interested in,
-- to reduce the number of D-Bus messages.
configWatch ::
    (B.CallStack.HasCallStack, MonadIO m, IsConfig a) =>
    a
    -- ^ /@config@/: An t'GI.IBus.Objects.Config.Config'
    -> Maybe (T.Text)
    -- ^ /@section@/: Section name of the configuration option.
    -> Maybe (T.Text)
    -- ^ /@name@/: Name of the configure option its self.
    -> m Bool
    -- ^ __Returns:__ 'P.True' if succeed; 'P.False' otherwise.
    -- 
    -- See also: 'GI.IBus.Objects.Config.configUnwatch'.
configWatch :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsConfig a) =>
a -> Maybe Text -> Maybe Text -> m Bool
configWatch a
config Maybe Text
section Maybe Text
name = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr Config
config' <- a -> IO (Ptr Config)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
config
    CString
maybeSection <- case Maybe Text
section of
        Maybe Text
Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just Text
jSection -> do
            CString
jSection' <- Text -> IO CString
textToCString Text
jSection
            CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jSection'
    CString
maybeName <- case Maybe Text
name of
        Maybe Text
Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just Text
jName -> do
            CString
jName' <- Text -> IO CString
textToCString Text
jName
            CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jName'
    CInt
result <- Ptr Config -> CString -> CString -> IO CInt
ibus_config_watch Ptr Config
config' CString
maybeSection CString
maybeName
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
config
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeSection
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeName
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data ConfigWatchMethodInfo
instance (signature ~ (Maybe (T.Text) -> Maybe (T.Text) -> m Bool), MonadIO m, IsConfig a) => O.OverloadedMethod ConfigWatchMethodInfo a signature where
    overloadedMethod = configWatch

instance O.OverloadedMethodInfo ConfigWatchMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.IBus.Objects.Config.configWatch",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ibus-1.5.4/docs/GI-IBus-Objects-Config.html#v:configWatch"
        })


#endif

-- method Config::new_async
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "connection"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "DBusConnection" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #GDBusConnection."
--                 , 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.\n     The callback should not be %NULL."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 3
--           , 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 "ibus_config_new_async" ibus_config_new_async :: 
    Ptr Gio.DBusConnection.DBusConnection -> -- connection : TInterface (Name {namespace = "Gio", name = "DBusConnection"})
    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 ()

-- | New an t'GI.IBus.Objects.Config.Config' asynchronously.
configNewAsync ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.DBusConnection.IsDBusConnection a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@connection@/: An t'GI.Gio.Objects.DBusConnection.DBusConnection'.
    -> Maybe (b)
    -- ^ /@cancellable@/: A t'GI.Gio.Objects.Cancellable.Cancellable' or 'P.Nothing'.
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    -- ^ /@callback@/: A t'GI.Gio.Callbacks.AsyncReadyCallback' to call when the request is satisfied.
    --      The callback should not be 'P.Nothing'.
    -> m ()
configNewAsync :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsDBusConnection a, IsCancellable b) =>
a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
configNewAsync a
connection Maybe b
cancellable Maybe AsyncReadyCallback
callback = 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 DBusConnection
connection' <- a -> IO (Ptr DBusConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
        Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
        Just AsyncReadyCallback
jCallback -> do
            Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
            Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
            FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
    let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
    Ptr DBusConnection
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
ibus_config_new_async Ptr DBusConnection
connection' Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
connection
    Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
#endif