{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.IBus.Objects.Config
(
Config(..) ,
IsConfig ,
toConfig ,
#if defined(ENABLE_OVERLOADING)
ResolveConfigMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
ConfigGetValueMethodInfo ,
#endif
configGetValue ,
#if defined(ENABLE_OVERLOADING)
ConfigGetValueAsyncMethodInfo ,
#endif
configGetValueAsync ,
#if defined(ENABLE_OVERLOADING)
ConfigGetValueAsyncFinishMethodInfo ,
#endif
configGetValueAsyncFinish ,
#if defined(ENABLE_OVERLOADING)
ConfigGetValuesMethodInfo ,
#endif
configGetValues ,
#if defined(ENABLE_OVERLOADING)
ConfigGetValuesAsyncMethodInfo ,
#endif
configGetValuesAsync ,
#if defined(ENABLE_OVERLOADING)
ConfigGetValuesAsyncFinishMethodInfo ,
#endif
configGetValuesAsyncFinish ,
configNew ,
configNewAsync ,
configNewAsyncFinish ,
#if defined(ENABLE_OVERLOADING)
ConfigSetValueMethodInfo ,
#endif
configSetValue ,
#if defined(ENABLE_OVERLOADING)
ConfigSetValueAsyncMethodInfo ,
#endif
configSetValueAsync ,
#if defined(ENABLE_OVERLOADING)
ConfigSetValueAsyncFinishMethodInfo ,
#endif
configSetValueAsyncFinish ,
#if defined(ENABLE_OVERLOADING)
ConfigUnsetMethodInfo ,
#endif
configUnset ,
#if defined(ENABLE_OVERLOADING)
ConfigUnwatchMethodInfo ,
#endif
configUnwatch ,
#if defined(ENABLE_OVERLOADING)
ConfigWatchMethodInfo ,
#endif
configWatch ,
C_ConfigValueChangedCallback ,
ConfigValueChangedCallback ,
#if defined(ENABLE_OVERLOADING)
ConfigValueChangedSignalInfo ,
#endif
afterConfigValueChanged ,
genClosure_ConfigValueChanged ,
mk_ConfigValueChangedCallback ,
noConfigValueChangedCallback ,
onConfigValueChanged ,
wrap_ConfigValueChangedCallback ,
) 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.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
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
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]
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
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
type ConfigValueChangedCallback =
T.Text
-> T.Text
-> GVariant
-> IO ()
noConfigValueChangedCallback :: Maybe ConfigValueChangedCallback
noConfigValueChangedCallback :: Maybe ConfigValueChangedCallback
noConfigValueChangedCallback = Maybe ConfigValueChangedCallback
forall a. Maybe a
Nothing
type C_ConfigValueChangedCallback =
Ptr () ->
CString ->
CString ->
Ptr GVariant ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mk_ConfigValueChangedCallback :: C_ConfigValueChangedCallback -> IO (FunPtr C_ConfigValueChangedCallback)
genClosure_ConfigValueChanged :: MonadIO m => ConfigValueChangedCallback -> m (GClosure C_ConfigValueChangedCallback)
genClosure_ConfigValueChanged :: forall (m :: * -> *).
MonadIO m =>
ConfigValueChangedCallback
-> m (GClosure C_ConfigValueChangedCallback)
genClosure_ConfigValueChanged ConfigValueChangedCallback
cb = IO (GClosure C_ConfigValueChangedCallback)
-> m (GClosure C_ConfigValueChangedCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_ConfigValueChangedCallback)
-> m (GClosure C_ConfigValueChangedCallback))
-> IO (GClosure C_ConfigValueChangedCallback)
-> m (GClosure C_ConfigValueChangedCallback)
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_ConfigValueChangedCallback
cb' = ConfigValueChangedCallback -> C_ConfigValueChangedCallback
wrap_ConfigValueChangedCallback ConfigValueChangedCallback
cb
C_ConfigValueChangedCallback
-> IO (FunPtr C_ConfigValueChangedCallback)
mk_ConfigValueChangedCallback C_ConfigValueChangedCallback
cb' IO (FunPtr C_ConfigValueChangedCallback)
-> (FunPtr C_ConfigValueChangedCallback
-> IO (GClosure C_ConfigValueChangedCallback))
-> IO (GClosure C_ConfigValueChangedCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ConfigValueChangedCallback
-> IO (GClosure C_ConfigValueChangedCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure
wrap_ConfigValueChangedCallback ::
ConfigValueChangedCallback ->
C_ConfigValueChangedCallback
wrap_ConfigValueChangedCallback :: ConfigValueChangedCallback -> C_ConfigValueChangedCallback
wrap_ConfigValueChangedCallback ConfigValueChangedCallback
_cb Ptr ()
_ 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
ConfigValueChangedCallback
_cb Text
section' Text
name' GVariant
value'
onConfigValueChanged :: (IsConfig a, MonadIO m) => a -> ConfigValueChangedCallback -> m SignalHandlerId
onConfigValueChanged :: forall a (m :: * -> *).
(IsConfig a, MonadIO m) =>
a -> ConfigValueChangedCallback -> m SignalHandlerId
onConfigValueChanged a
obj 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 cb' :: C_ConfigValueChangedCallback
cb' = ConfigValueChangedCallback -> C_ConfigValueChangedCallback
wrap_ConfigValueChangedCallback ConfigValueChangedCallback
cb
FunPtr C_ConfigValueChangedCallback
cb'' <- C_ConfigValueChangedCallback
-> IO (FunPtr C_ConfigValueChangedCallback)
mk_ConfigValueChangedCallback C_ConfigValueChangedCallback
cb'
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
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing
afterConfigValueChanged :: (IsConfig a, MonadIO m) => a -> ConfigValueChangedCallback -> m SignalHandlerId
afterConfigValueChanged :: forall a (m :: * -> *).
(IsConfig a, MonadIO m) =>
a -> ConfigValueChangedCallback -> m SignalHandlerId
afterConfigValueChanged a
obj 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 cb' :: C_ConfigValueChangedCallback
cb' = ConfigValueChangedCallback -> C_ConfigValueChangedCallback
wrap_ConfigValueChangedCallback ConfigValueChangedCallback
cb
FunPtr C_ConfigValueChangedCallback
cb'' <- C_ConfigValueChangedCallback
-> IO (FunPtr C_ConfigValueChangedCallback)
mk_ConfigValueChangedCallback C_ConfigValueChangedCallback
cb'
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
cb'' 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
#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
foreign import ccall "ibus_config_new" ibus_config_new ::
Ptr Gio.DBusConnection.DBusConnection ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Config)
configNew ::
(B.CallStack.HasCallStack, MonadIO m, Gio.DBusConnection.IsDBusConnection a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m Config
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
foreign import ccall "ibus_config_new_async_finish" ibus_config_new_async_finish ::
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO (Ptr Config)
configNewAsyncFinish ::
(B.CallStack.HasCallStack, MonadIO m, Gio.AsyncResult.IsAsyncResult a) =>
a
-> m Config
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
foreign import ccall "ibus_config_get_value" ibus_config_get_value ::
Ptr Config ->
CString ->
CString ->
IO (Ptr GVariant)
configGetValue ::
(B.CallStack.HasCallStack, MonadIO m, IsConfig a) =>
a
-> T.Text
-> T.Text
-> m GVariant
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 = O.MethodInfo {
O.overloadedMethodName = "GI.IBus.Objects.Config.configGetValue",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-ibus-1.5.3/docs/GI-IBus-Objects-Config.html#v:configGetValue"
}
#endif
foreign import ccall "ibus_config_get_value_async" ibus_config_get_value_async ::
Ptr Config ->
CString ->
CString ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
configGetValueAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsConfig a, Gio.Cancellable.IsCancellable b) =>
a
-> T.Text
-> T.Text
-> Int32
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> 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 = O.MethodInfo {
O.overloadedMethodName = "GI.IBus.Objects.Config.configGetValueAsync",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-ibus-1.5.3/docs/GI-IBus-Objects-Config.html#v:configGetValueAsync"
}
#endif
foreign import ccall "ibus_config_get_value_async_finish" ibus_config_get_value_async_finish ::
Ptr Config ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO (Ptr GVariant)
configGetValueAsyncFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsConfig a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m GVariant
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 = O.MethodInfo {
O.overloadedMethodName = "GI.IBus.Objects.Config.configGetValueAsyncFinish",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-ibus-1.5.3/docs/GI-IBus-Objects-Config.html#v:configGetValueAsyncFinish"
}
#endif
foreign import ccall "ibus_config_get_values" ibus_config_get_values ::
Ptr Config ->
CString ->
IO (Ptr GVariant)
configGetValues ::
(B.CallStack.HasCallStack, MonadIO m, IsConfig a) =>
a
-> T.Text
-> m GVariant
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 = O.MethodInfo {
O.overloadedMethodName = "GI.IBus.Objects.Config.configGetValues",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-ibus-1.5.3/docs/GI-IBus-Objects-Config.html#v:configGetValues"
}
#endif
foreign import ccall "ibus_config_get_values_async" ibus_config_get_values_async ::
Ptr Config ->
CString ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
configGetValuesAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsConfig a, Gio.Cancellable.IsCancellable b) =>
a
-> T.Text
-> Int32
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> 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 = O.MethodInfo {
O.overloadedMethodName = "GI.IBus.Objects.Config.configGetValuesAsync",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-ibus-1.5.3/docs/GI-IBus-Objects-Config.html#v:configGetValuesAsync"
}
#endif
foreign import ccall "ibus_config_get_values_async_finish" ibus_config_get_values_async_finish ::
Ptr Config ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO (Ptr GVariant)
configGetValuesAsyncFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsConfig a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m GVariant
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 = O.MethodInfo {
O.overloadedMethodName = "GI.IBus.Objects.Config.configGetValuesAsyncFinish",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-ibus-1.5.3/docs/GI-IBus-Objects-Config.html#v:configGetValuesAsyncFinish"
}
#endif
foreign import ccall "ibus_config_set_value" ibus_config_set_value ::
Ptr Config ->
CString ->
CString ->
Ptr GVariant ->
IO CInt
configSetValue ::
(B.CallStack.HasCallStack, MonadIO m, IsConfig a) =>
a
-> T.Text
-> T.Text
-> GVariant
-> m Bool
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 = O.MethodInfo {
O.overloadedMethodName = "GI.IBus.Objects.Config.configSetValue",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-ibus-1.5.3/docs/GI-IBus-Objects-Config.html#v:configSetValue"
}
#endif
foreign import ccall "ibus_config_set_value_async" ibus_config_set_value_async ::
Ptr Config ->
CString ->
CString ->
Ptr GVariant ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
configSetValueAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsConfig a, Gio.Cancellable.IsCancellable b) =>
a
-> T.Text
-> T.Text
-> GVariant
-> Int32
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> 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 = O.MethodInfo {
O.overloadedMethodName = "GI.IBus.Objects.Config.configSetValueAsync",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-ibus-1.5.3/docs/GI-IBus-Objects-Config.html#v:configSetValueAsync"
}
#endif
foreign import ccall "ibus_config_set_value_async_finish" ibus_config_set_value_async_finish ::
Ptr Config ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO CInt
configSetValueAsyncFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsConfig a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ()
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 = O.MethodInfo {
O.overloadedMethodName = "GI.IBus.Objects.Config.configSetValueAsyncFinish",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-ibus-1.5.3/docs/GI-IBus-Objects-Config.html#v:configSetValueAsyncFinish"
}
#endif
foreign import ccall "ibus_config_unset" ibus_config_unset ::
Ptr Config ->
CString ->
CString ->
IO CInt
configUnset ::
(B.CallStack.HasCallStack, MonadIO m, IsConfig a) =>
a
-> T.Text
-> T.Text
-> m Bool
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 = O.MethodInfo {
O.overloadedMethodName = "GI.IBus.Objects.Config.configUnset",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-ibus-1.5.3/docs/GI-IBus-Objects-Config.html#v:configUnset"
}
#endif
foreign import ccall "ibus_config_unwatch" ibus_config_unwatch ::
Ptr Config ->
CString ->
CString ->
IO CInt
configUnwatch ::
(B.CallStack.HasCallStack, MonadIO m, IsConfig a) =>
a
-> Maybe (T.Text)
-> Maybe (T.Text)
-> m Bool
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 = O.MethodInfo {
O.overloadedMethodName = "GI.IBus.Objects.Config.configUnwatch",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-ibus-1.5.3/docs/GI-IBus-Objects-Config.html#v:configUnwatch"
}
#endif
foreign import ccall "ibus_config_watch" ibus_config_watch ::
Ptr Config ->
CString ->
CString ->
IO CInt
configWatch ::
(B.CallStack.HasCallStack, MonadIO m, IsConfig a) =>
a
-> Maybe (T.Text)
-> Maybe (T.Text)
-> m Bool
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 = O.MethodInfo {
O.overloadedMethodName = "GI.IBus.Objects.Config.configWatch",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-ibus-1.5.3/docs/GI-IBus-Objects-Config.html#v:configWatch"
}
#endif
foreign import ccall "ibus_config_new_async" ibus_config_new_async ::
Ptr Gio.DBusConnection.DBusConnection ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
configNewAsync ::
(B.CallStack.HasCallStack, MonadIO m, Gio.DBusConnection.IsDBusConnection a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> 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