{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}

module GI.Gio.Objects.TestDBus
    ( 

-- * Exported types
    TestDBus(..)                            ,
    TestDBusK                               ,
    toTestDBus                              ,
    noTestDBus                              ,


 -- * Methods
-- ** testDBusAddServiceDir
    testDBusAddServiceDir                   ,


-- ** testDBusDown
    testDBusDown                            ,


-- ** testDBusGetBusAddress
    testDBusGetBusAddress                   ,


-- ** testDBusGetFlags
    testDBusGetFlags                        ,


-- ** testDBusNew
    testDBusNew                             ,


-- ** testDBusStop
    testDBusStop                            ,


-- ** testDBusUnset
    testDBusUnset                           ,


-- ** testDBusUp
    testDBusUp                              ,




 -- * Properties
-- ** Flags
    TestDBusFlagsPropertyInfo               ,
    constructTestDBusFlags                  ,
    getTestDBusFlags                        ,




    ) where

import Prelude ()
import Data.GI.Base.ShortPrelude

import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map

import GI.Gio.Types
import GI.Gio.Callbacks
import qualified GI.GObject as GObject

newtype TestDBus = TestDBus (ForeignPtr TestDBus)
foreign import ccall "g_test_dbus_get_type"
    c_g_test_dbus_get_type :: IO GType

type instance ParentTypes TestDBus = TestDBusParentTypes
type TestDBusParentTypes = '[GObject.Object]

instance GObject TestDBus where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_g_test_dbus_get_type
    

class GObject o => TestDBusK o
instance (GObject o, IsDescendantOf TestDBus o) => TestDBusK o

toTestDBus :: TestDBusK o => o -> IO TestDBus
toTestDBus = unsafeCastTo TestDBus

noTestDBus :: Maybe TestDBus
noTestDBus = Nothing

-- VVV Prop "flags"
   -- Type: TInterface "Gio" "TestDBusFlags"
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]

getTestDBusFlags :: (MonadIO m, TestDBusK o) => o -> m [TestDBusFlags]
getTestDBusFlags obj = liftIO $ getObjectPropertyFlags obj "flags"

constructTestDBusFlags :: [TestDBusFlags] -> IO ([Char], GValue)
constructTestDBusFlags val = constructObjectPropertyFlags "flags" val

data TestDBusFlagsPropertyInfo
instance AttrInfo TestDBusFlagsPropertyInfo where
    type AttrAllowedOps TestDBusFlagsPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint TestDBusFlagsPropertyInfo = (~) [TestDBusFlags]
    type AttrBaseTypeConstraint TestDBusFlagsPropertyInfo = TestDBusK
    type AttrGetType TestDBusFlagsPropertyInfo = [TestDBusFlags]
    type AttrLabel TestDBusFlagsPropertyInfo = "TestDBus::flags"
    attrGet _ = getTestDBusFlags
    attrSet _ = undefined
    attrConstruct _ = constructTestDBusFlags

type instance AttributeList TestDBus = TestDBusAttributeList
type TestDBusAttributeList = ('[ '("flags", TestDBusFlagsPropertyInfo)] :: [(Symbol, *)])

type instance SignalList TestDBus = TestDBusSignalList
type TestDBusSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method TestDBus::new
-- method type : Constructor
-- Args : [Arg {argName = "flags", argType = TInterface "Gio" "TestDBusFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "flags", argType = TInterface "Gio" "TestDBusFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "TestDBus"
-- throws : False
-- Skip return : False

foreign import ccall "g_test_dbus_new" g_test_dbus_new :: 
    CUInt ->                                -- flags : TInterface "Gio" "TestDBusFlags"
    IO (Ptr TestDBus)


testDBusNew ::
    (MonadIO m) =>
    [TestDBusFlags] ->                      -- flags
    m TestDBus
testDBusNew flags = liftIO $ do
    let flags' = gflagsToWord flags
    result <- g_test_dbus_new flags'
    checkUnexpectedReturnNULL "g_test_dbus_new" result
    result' <- (wrapObject TestDBus) result
    return result'

-- method TestDBus::add_service_dir
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "TestDBus", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "TestDBus", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_test_dbus_add_service_dir" g_test_dbus_add_service_dir :: 
    Ptr TestDBus ->                         -- _obj : TInterface "Gio" "TestDBus"
    CString ->                              -- path : TBasicType TUTF8
    IO ()


testDBusAddServiceDir ::
    (MonadIO m, TestDBusK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- path
    m ()
testDBusAddServiceDir _obj path = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    path' <- textToCString path
    g_test_dbus_add_service_dir _obj' path'
    touchManagedPtr _obj
    freeMem path'
    return ()

-- method TestDBus::down
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "TestDBus", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "TestDBus", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_test_dbus_down" g_test_dbus_down :: 
    Ptr TestDBus ->                         -- _obj : TInterface "Gio" "TestDBus"
    IO ()


testDBusDown ::
    (MonadIO m, TestDBusK a) =>
    a ->                                    -- _obj
    m ()
testDBusDown _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    g_test_dbus_down _obj'
    touchManagedPtr _obj
    return ()

-- method TestDBus::get_bus_address
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "TestDBus", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "TestDBus", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "g_test_dbus_get_bus_address" g_test_dbus_get_bus_address :: 
    Ptr TestDBus ->                         -- _obj : TInterface "Gio" "TestDBus"
    IO CString


testDBusGetBusAddress ::
    (MonadIO m, TestDBusK a) =>
    a ->                                    -- _obj
    m T.Text
testDBusGetBusAddress _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_test_dbus_get_bus_address _obj'
    checkUnexpectedReturnNULL "g_test_dbus_get_bus_address" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

-- method TestDBus::get_flags
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "TestDBus", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "TestDBus", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "TestDBusFlags"
-- throws : False
-- Skip return : False

foreign import ccall "g_test_dbus_get_flags" g_test_dbus_get_flags :: 
    Ptr TestDBus ->                         -- _obj : TInterface "Gio" "TestDBus"
    IO CUInt


testDBusGetFlags ::
    (MonadIO m, TestDBusK a) =>
    a ->                                    -- _obj
    m [TestDBusFlags]
testDBusGetFlags _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_test_dbus_get_flags _obj'
    let result' = wordToGFlags result
    touchManagedPtr _obj
    return result'

-- method TestDBus::stop
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "TestDBus", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "TestDBus", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_test_dbus_stop" g_test_dbus_stop :: 
    Ptr TestDBus ->                         -- _obj : TInterface "Gio" "TestDBus"
    IO ()


testDBusStop ::
    (MonadIO m, TestDBusK a) =>
    a ->                                    -- _obj
    m ()
testDBusStop _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    g_test_dbus_stop _obj'
    touchManagedPtr _obj
    return ()

-- method TestDBus::up
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "TestDBus", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "TestDBus", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_test_dbus_up" g_test_dbus_up :: 
    Ptr TestDBus ->                         -- _obj : TInterface "Gio" "TestDBus"
    IO ()


testDBusUp ::
    (MonadIO m, TestDBusK a) =>
    a ->                                    -- _obj
    m ()
testDBusUp _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    g_test_dbus_up _obj'
    touchManagedPtr _obj
    return ()

-- method TestDBus::unset
-- method type : MemberFunction
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_test_dbus_unset" g_test_dbus_unset :: 
    IO ()


testDBusUnset ::
    (MonadIO m) =>
    m ()
testDBusUnset  = liftIO $ do
    g_test_dbus_unset
    return ()