{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- An IBusService is a base class for services.

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

module GI.IBus.Objects.Service
    ( 

-- * Exported types
    Service(..)                             ,
    IsService                               ,
    toService                               ,


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

#if defined(ENABLE_OVERLOADING)
    ResolveServiceMethod                    ,
#endif


-- ** emitSignal #method:emitSignal#

#if defined(ENABLE_OVERLOADING)
    ServiceEmitSignalMethodInfo             ,
#endif
    serviceEmitSignal                       ,


-- ** getConnection #method:getConnection#

#if defined(ENABLE_OVERLOADING)
    ServiceGetConnectionMethodInfo          ,
#endif
    serviceGetConnection                    ,


-- ** getObjectPath #method:getObjectPath#

#if defined(ENABLE_OVERLOADING)
    ServiceGetObjectPathMethodInfo          ,
#endif
    serviceGetObjectPath                    ,


-- ** new #method:new#

    serviceNew                              ,


-- ** register #method:register#

#if defined(ENABLE_OVERLOADING)
    ServiceRegisterMethodInfo               ,
#endif
    serviceRegister                         ,


-- ** unregister #method:unregister#

#if defined(ENABLE_OVERLOADING)
    ServiceUnregisterMethodInfo             ,
#endif
    serviceUnregister                       ,




 -- * Properties
-- ** connection #attr:connection#
-- | The connection of service object.

#if defined(ENABLE_OVERLOADING)
    ServiceConnectionPropertyInfo           ,
#endif
    constructServiceConnection              ,
    getServiceConnection                    ,
#if defined(ENABLE_OVERLOADING)
    serviceConnection                       ,
#endif


-- ** objectPath #attr:objectPath#
-- | The path of service object.

#if defined(ENABLE_OVERLOADING)
    ServiceObjectPathPropertyInfo           ,
#endif
    constructServiceObjectPath              ,
    getServiceObjectPath                    ,
#if defined(ENABLE_OVERLOADING)
    serviceObjectPath                       ,
#endif




    ) 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.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 GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Objects.DBusConnection as Gio.DBusConnection
import {-# SOURCE #-} qualified GI.IBus.Objects.Object as IBus.Object

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

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

foreign import ccall "ibus_service_get_type"
    c_ibus_service_get_type :: IO B.Types.GType

instance B.Types.TypedObject Service where
    glibType :: IO GType
glibType = IO GType
c_ibus_service_get_type

instance B.Types.GObject Service

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

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

instance O.HasParentTypes Service
type instance O.ParentTypes Service = '[IBus.Object.Object, GObject.Object.Object]

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

#if defined(ENABLE_OVERLOADING)
type family ResolveServiceMethod (t :: Symbol) (o :: *) :: * where
    ResolveServiceMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveServiceMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveServiceMethod "destroy" o = IBus.Object.ObjectDestroyMethodInfo
    ResolveServiceMethod "emitSignal" o = ServiceEmitSignalMethodInfo
    ResolveServiceMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveServiceMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveServiceMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveServiceMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveServiceMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveServiceMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveServiceMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveServiceMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveServiceMethod "register" o = ServiceRegisterMethodInfo
    ResolveServiceMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveServiceMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveServiceMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveServiceMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveServiceMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveServiceMethod "unregister" o = ServiceUnregisterMethodInfo
    ResolveServiceMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveServiceMethod "getConnection" o = ServiceGetConnectionMethodInfo
    ResolveServiceMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveServiceMethod "getObjectPath" o = ServiceGetObjectPathMethodInfo
    ResolveServiceMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveServiceMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveServiceMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveServiceMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveServiceMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveServiceMethod l o = O.MethodResolutionFailed l o

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

#endif

-- VVV Prop "connection"
   -- Type: TInterface (Name {namespace = "Gio", name = "DBusConnection"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Just False,Nothing)

-- | Get the value of the “@connection@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' service #connection
-- @
getServiceConnection :: (MonadIO m, IsService o) => o -> m Gio.DBusConnection.DBusConnection
getServiceConnection :: o -> m DBusConnection
getServiceConnection o
obj = IO DBusConnection -> m DBusConnection
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DBusConnection -> m DBusConnection)
-> IO DBusConnection -> m DBusConnection
forall a b. (a -> b) -> a -> b
$ Text -> IO (Maybe DBusConnection) -> IO DBusConnection
forall a. HasCallStack => Text -> IO (Maybe a) -> IO a
checkUnexpectedNothing Text
"getServiceConnection" (IO (Maybe DBusConnection) -> IO DBusConnection)
-> IO (Maybe DBusConnection) -> IO DBusConnection
forall a b. (a -> b) -> a -> b
$ o
-> String
-> (ManagedPtr DBusConnection -> DBusConnection)
-> IO (Maybe DBusConnection)
forall a b.
(GObject a, GObject b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
B.Properties.getObjectPropertyObject o
obj String
"connection" ManagedPtr DBusConnection -> DBusConnection
Gio.DBusConnection.DBusConnection

-- | Construct a `GValueConstruct` with valid value for the “@connection@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructServiceConnection :: (IsService o, MIO.MonadIO m, Gio.DBusConnection.IsDBusConnection a) => a -> m (GValueConstruct o)
constructServiceConnection :: a -> m (GValueConstruct o)
constructServiceConnection a
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe a -> IO (GValueConstruct o)
forall a o.
GObject a =>
String -> Maybe a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyObject String
"connection" (a -> Maybe a
forall a. a -> Maybe a
P.Just a
val)

#if defined(ENABLE_OVERLOADING)
data ServiceConnectionPropertyInfo
instance AttrInfo ServiceConnectionPropertyInfo where
    type AttrAllowedOps ServiceConnectionPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint ServiceConnectionPropertyInfo = IsService
    type AttrSetTypeConstraint ServiceConnectionPropertyInfo = Gio.DBusConnection.IsDBusConnection
    type AttrTransferTypeConstraint ServiceConnectionPropertyInfo = Gio.DBusConnection.IsDBusConnection
    type AttrTransferType ServiceConnectionPropertyInfo = Gio.DBusConnection.DBusConnection
    type AttrGetType ServiceConnectionPropertyInfo = Gio.DBusConnection.DBusConnection
    type AttrLabel ServiceConnectionPropertyInfo = "connection"
    type AttrOrigin ServiceConnectionPropertyInfo = Service
    attrGet = getServiceConnection
    attrSet = undefined
    attrTransfer _ v = do
        unsafeCastTo Gio.DBusConnection.DBusConnection v
    attrConstruct = constructServiceConnection
    attrClear = undefined
#endif

-- VVV Prop "object-path"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Just False,Nothing)

-- | Get the value of the “@object-path@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' service #objectPath
-- @
getServiceObjectPath :: (MonadIO m, IsService o) => o -> m T.Text
getServiceObjectPath :: o -> m Text
getServiceObjectPath o
obj = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ Text -> IO (Maybe Text) -> IO Text
forall a. HasCallStack => Text -> IO (Maybe a) -> IO a
checkUnexpectedNothing Text
"getServiceObjectPath" (IO (Maybe Text) -> IO Text) -> IO (Maybe Text) -> IO Text
forall a b. (a -> b) -> a -> b
$ o -> String -> IO (Maybe Text)
forall a. GObject a => a -> String -> IO (Maybe Text)
B.Properties.getObjectPropertyString o
obj String
"object-path"

-- | Construct a `GValueConstruct` with valid value for the “@object-path@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructServiceObjectPath :: (IsService o, MIO.MonadIO m) => T.Text -> m (GValueConstruct o)
constructServiceObjectPath :: Text -> m (GValueConstruct o)
constructServiceObjectPath Text
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe Text -> IO (GValueConstruct o)
forall o. String -> Maybe Text -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyString String
"object-path" (Text -> Maybe Text
forall a. a -> Maybe a
P.Just Text
val)

#if defined(ENABLE_OVERLOADING)
data ServiceObjectPathPropertyInfo
instance AttrInfo ServiceObjectPathPropertyInfo where
    type AttrAllowedOps ServiceObjectPathPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint ServiceObjectPathPropertyInfo = IsService
    type AttrSetTypeConstraint ServiceObjectPathPropertyInfo = (~) T.Text
    type AttrTransferTypeConstraint ServiceObjectPathPropertyInfo = (~) T.Text
    type AttrTransferType ServiceObjectPathPropertyInfo = T.Text
    type AttrGetType ServiceObjectPathPropertyInfo = T.Text
    type AttrLabel ServiceObjectPathPropertyInfo = "object-path"
    type AttrOrigin ServiceObjectPathPropertyInfo = Service
    attrGet = getServiceObjectPath
    attrSet = undefined
    attrTransfer _ v = do
        return v
    attrConstruct = constructServiceObjectPath
    attrClear = undefined
#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Service
type instance O.AttributeList Service = ServiceAttributeList
type ServiceAttributeList = ('[ '("connection", ServiceConnectionPropertyInfo), '("objectPath", ServiceObjectPathPropertyInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
serviceConnection :: AttrLabelProxy "connection"
serviceConnection = AttrLabelProxy

serviceObjectPath :: AttrLabelProxy "objectPath"
serviceObjectPath = AttrLabelProxy

#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Service = ServiceSignalList
type ServiceSignalList = ('[ '("destroy", IBus.Object.ObjectDestroySignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method Service::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 = "path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Object path." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "IBus" , name = "Service" })
-- throws : False
-- Skip return : False

foreign import ccall "ibus_service_new" ibus_service_new :: 
    Ptr Gio.DBusConnection.DBusConnection -> -- connection : TInterface (Name {namespace = "Gio", name = "DBusConnection"})
    CString ->                              -- path : TBasicType TUTF8
    IO (Ptr Service)

-- | Creantes a new t'GI.IBus.Objects.Service.Service'.
serviceNew ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.DBusConnection.IsDBusConnection a) =>
    a
    -- ^ /@connection@/: A GDBusConnection.
    -> T.Text
    -- ^ /@path@/: Object path.
    -> m Service
    -- ^ __Returns:__ A newly allocated t'GI.IBus.Objects.Service.Service'
serviceNew :: a -> Text -> m Service
serviceNew a
connection Text
path = IO Service -> m Service
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Service -> m Service) -> IO Service -> m Service
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
    CString
path' <- Text -> IO CString
textToCString Text
path
    Ptr Service
result <- Ptr DBusConnection -> CString -> IO (Ptr Service)
ibus_service_new Ptr DBusConnection
connection' CString
path'
    Text -> Ptr Service -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"serviceNew" Ptr Service
result
    Service
result' <- ((ManagedPtr Service -> Service) -> Ptr Service -> IO Service
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Service -> Service
Service) Ptr Service
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
connection
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
    Service -> IO Service
forall (m :: * -> *) a. Monad m => a -> m a
return Service
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method Service::emit_signal
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "service"
--           , argType =
--               TInterface Name { namespace = "IBus" , name = "Service" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "dest_bus_name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "interface_name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "signal_name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "parameters"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , 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_service_emit_signal" ibus_service_emit_signal :: 
    Ptr Service ->                          -- service : TInterface (Name {namespace = "IBus", name = "Service"})
    CString ->                              -- dest_bus_name : TBasicType TUTF8
    CString ->                              -- interface_name : TBasicType TUTF8
    CString ->                              -- signal_name : TBasicType TUTF8
    Ptr GVariant ->                         -- parameters : TVariant
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | /No description available in the introspection data./
serviceEmitSignal ::
    (B.CallStack.HasCallStack, MonadIO m, IsService a) =>
    a
    -> T.Text
    -> T.Text
    -> T.Text
    -> GVariant
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
serviceEmitSignal :: a -> Text -> Text -> Text -> GVariant -> m ()
serviceEmitSignal a
service Text
destBusName Text
interfaceName Text
signalName GVariant
parameters = 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 Service
service' <- a -> IO (Ptr Service)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
service
    CString
destBusName' <- Text -> IO CString
textToCString Text
destBusName
    CString
interfaceName' <- Text -> IO CString
textToCString Text
interfaceName
    CString
signalName' <- Text -> IO CString
textToCString Text
signalName
    Ptr GVariant
parameters' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
parameters
    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 Service
-> CString
-> CString
-> CString
-> Ptr GVariant
-> Ptr (Ptr GError)
-> IO CInt
ibus_service_emit_signal Ptr Service
service' CString
destBusName' CString
interfaceName' CString
signalName' Ptr GVariant
parameters'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
service
        GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
parameters
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
destBusName'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
interfaceName'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
signalName'
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
destBusName'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
interfaceName'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
signalName'
     )

#if defined(ENABLE_OVERLOADING)
data ServiceEmitSignalMethodInfo
instance (signature ~ (T.Text -> T.Text -> T.Text -> GVariant -> m ()), MonadIO m, IsService a) => O.MethodInfo ServiceEmitSignalMethodInfo a signature where
    overloadedMethod = serviceEmitSignal

#endif

-- method Service::get_connection
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "service"
--           , argType =
--               TInterface Name { namespace = "IBus" , name = "Service" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An IBusService." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Gio" , name = "DBusConnection" })
-- throws : False
-- Skip return : False

foreign import ccall "ibus_service_get_connection" ibus_service_get_connection :: 
    Ptr Service ->                          -- service : TInterface (Name {namespace = "IBus", name = "Service"})
    IO (Ptr Gio.DBusConnection.DBusConnection)

-- | Gets a connections.
serviceGetConnection ::
    (B.CallStack.HasCallStack, MonadIO m, IsService a) =>
    a
    -- ^ /@service@/: An IBusService.
    -> m Gio.DBusConnection.DBusConnection
    -- ^ __Returns:__ A t'GI.Gio.Objects.DBusConnection.DBusConnection' of an t'GI.IBus.Objects.Service.Service' instance.
serviceGetConnection :: a -> m DBusConnection
serviceGetConnection a
service = IO DBusConnection -> m DBusConnection
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DBusConnection -> m DBusConnection)
-> IO DBusConnection -> m DBusConnection
forall a b. (a -> b) -> a -> b
$ do
    Ptr Service
service' <- a -> IO (Ptr Service)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
service
    Ptr DBusConnection
result <- Ptr Service -> IO (Ptr DBusConnection)
ibus_service_get_connection Ptr Service
service'
    Text -> Ptr DBusConnection -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"serviceGetConnection" Ptr DBusConnection
result
    DBusConnection
result' <- ((ManagedPtr DBusConnection -> DBusConnection)
-> Ptr DBusConnection -> IO DBusConnection
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr DBusConnection -> DBusConnection
Gio.DBusConnection.DBusConnection) Ptr DBusConnection
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
service
    DBusConnection -> IO DBusConnection
forall (m :: * -> *) a. Monad m => a -> m a
return DBusConnection
result'

#if defined(ENABLE_OVERLOADING)
data ServiceGetConnectionMethodInfo
instance (signature ~ (m Gio.DBusConnection.DBusConnection), MonadIO m, IsService a) => O.MethodInfo ServiceGetConnectionMethodInfo a signature where
    overloadedMethod = serviceGetConnection

#endif

-- method Service::get_object_path
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "service"
--           , argType =
--               TInterface Name { namespace = "IBus" , name = "Service" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An IBusService." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "ibus_service_get_object_path" ibus_service_get_object_path :: 
    Ptr Service ->                          -- service : TInterface (Name {namespace = "IBus", name = "Service"})
    IO CString

-- | Gets the object path of an IBusService.
serviceGetObjectPath ::
    (B.CallStack.HasCallStack, MonadIO m, IsService a) =>
    a
    -- ^ /@service@/: An IBusService.
    -> m T.Text
    -- ^ __Returns:__ The object path of /@service@/
serviceGetObjectPath :: a -> m Text
serviceGetObjectPath a
service = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr Service
service' <- a -> IO (Ptr Service)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
service
    CString
result <- Ptr Service -> IO CString
ibus_service_get_object_path Ptr Service
service'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"serviceGetObjectPath" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
service
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

#if defined(ENABLE_OVERLOADING)
data ServiceGetObjectPathMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsService a) => O.MethodInfo ServiceGetObjectPathMethodInfo a signature where
    overloadedMethod = serviceGetObjectPath

#endif

-- method Service::register
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "service"
--           , argType =
--               TInterface Name { namespace = "IBus" , name = "Service" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An IBusService." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "connection"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "DBusConnection" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "A GDBusConnection the service will be registered to."
--                 , 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_service_register" ibus_service_register :: 
    Ptr Service ->                          -- service : TInterface (Name {namespace = "IBus", name = "Service"})
    Ptr Gio.DBusConnection.DBusConnection -> -- connection : TInterface (Name {namespace = "Gio", name = "DBusConnection"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Registers service to a connection.
serviceRegister ::
    (B.CallStack.HasCallStack, MonadIO m, IsService a, Gio.DBusConnection.IsDBusConnection b) =>
    a
    -- ^ /@service@/: An IBusService.
    -> b
    -- ^ /@connection@/: A GDBusConnection the service will be registered to.
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
serviceRegister :: a -> b -> m ()
serviceRegister a
service b
connection = 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 Service
service' <- a -> IO (Ptr Service)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
service
    Ptr DBusConnection
connection' <- b -> IO (Ptr DBusConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
connection
    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 Service -> Ptr DBusConnection -> Ptr (Ptr GError) -> IO CInt
ibus_service_register Ptr Service
service' Ptr DBusConnection
connection'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
service
        b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
connection
        () -> 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 ServiceRegisterMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsService a, Gio.DBusConnection.IsDBusConnection b) => O.MethodInfo ServiceRegisterMethodInfo a signature where
    overloadedMethod = serviceRegister

#endif

-- method Service::unregister
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "service"
--           , argType =
--               TInterface Name { namespace = "IBus" , name = "Service" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An IBusService." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "connection"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "DBusConnection" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "A GDBusConnection the service was registered with."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "ibus_service_unregister" ibus_service_unregister :: 
    Ptr Service ->                          -- service : TInterface (Name {namespace = "IBus", name = "Service"})
    Ptr Gio.DBusConnection.DBusConnection -> -- connection : TInterface (Name {namespace = "Gio", name = "DBusConnection"})
    IO ()

-- | Unregisters service from a connection.
serviceUnregister ::
    (B.CallStack.HasCallStack, MonadIO m, IsService a, Gio.DBusConnection.IsDBusConnection b) =>
    a
    -- ^ /@service@/: An IBusService.
    -> b
    -- ^ /@connection@/: A GDBusConnection the service was registered with.
    -> m ()
serviceUnregister :: a -> b -> m ()
serviceUnregister a
service b
connection = 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 Service
service' <- a -> IO (Ptr Service)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
service
    Ptr DBusConnection
connection' <- b -> IO (Ptr DBusConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
connection
    Ptr Service -> Ptr DBusConnection -> IO ()
ibus_service_unregister Ptr Service
service' Ptr DBusConnection
connection'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
service
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
connection
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ServiceUnregisterMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsService a, Gio.DBusConnection.IsDBusConnection b) => O.MethodInfo ServiceUnregisterMethodInfo a signature where
    overloadedMethod = serviceUnregister

#endif