{- |
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.GObject.Objects.Object
    ( 

-- * Exported types
    Object(..)                              ,
    ObjectK                                 ,
    toObject                                ,
    noObject                                ,


 -- * Methods
-- ** objectBindProperty
    objectBindProperty                      ,


-- ** objectBindPropertyFull
    objectBindPropertyFull                  ,


-- ** objectCompatControl
    objectCompatControl                     ,


-- ** objectForceFloating
    objectForceFloating                     ,


-- ** objectFreezeNotify
    objectFreezeNotify                      ,


-- ** objectGetData
    objectGetData                           ,


-- ** objectGetProperty
    objectGetProperty                       ,


-- ** objectGetQdata
    objectGetQdata                          ,


-- ** objectInterfaceFindProperty
    objectInterfaceFindProperty             ,


-- ** objectInterfaceInstallProperty
    objectInterfaceInstallProperty          ,


-- ** objectIsFloating
    objectIsFloating                        ,


-- ** objectNew
    objectNew                               ,


-- ** objectNotify
    objectNotify                            ,


-- ** objectNotifyByPspec
    objectNotifyByPspec                     ,


-- ** objectRef
    objectRef                               ,


-- ** objectRefSink
    objectRefSink                           ,


-- ** objectReplaceData
    objectReplaceData                       ,


-- ** objectReplaceQdata
    objectReplaceQdata                      ,


-- ** objectRunDispose
    objectRunDispose                        ,


-- ** objectSetData
    objectSetData                           ,


-- ** objectSetProperty
    objectSetProperty                       ,


-- ** objectStealData
    objectStealData                         ,


-- ** objectStealQdata
    objectStealQdata                        ,


-- ** objectThawNotify
    objectThawNotify                        ,


-- ** objectUnref
    objectUnref                             ,


-- ** objectWatchClosure
    objectWatchClosure                      ,




 -- * Signals
-- ** Notify
    ObjectNotifyCallback                    ,
    ObjectNotifyCallbackC                   ,
    ObjectNotifySignalInfo                  ,
    afterObjectNotify                       ,
    mkObjectNotifyCallback                  ,
    noObjectNotifyCallback                  ,
    objectNotifyCallbackWrapper             ,
    objectNotifyClosure                     ,
    onObjectNotify                          ,




    ) 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.GObject.Types
import GI.GObject.Callbacks
import qualified GI.GLib as GLib

newtype Object = Object (ForeignPtr Object)
foreign import ccall "g_object_get_type"
    c_g_object_get_type :: IO GType

type instance ParentTypes Object = ObjectParentTypes
type ObjectParentTypes = '[]

instance GObject Object where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_g_object_get_type
    

class GObject o => ObjectK o
instance (GObject o, IsDescendantOf Object o) => ObjectK o

toObject :: ObjectK o => o -> IO Object
toObject = unsafeCastTo Object

noObject :: Maybe Object
noObject = Nothing

-- signal Object::notify
type ObjectNotifyCallback =
    GParamSpec ->
    IO ()

noObjectNotifyCallback :: Maybe ObjectNotifyCallback
noObjectNotifyCallback = Nothing

type ObjectNotifyCallbackC =
    Ptr () ->                               -- object
    Ptr GParamSpec ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mkObjectNotifyCallback :: ObjectNotifyCallbackC -> IO (FunPtr ObjectNotifyCallbackC)

objectNotifyClosure :: ObjectNotifyCallback -> IO Closure
objectNotifyClosure cb = newCClosure =<< mkObjectNotifyCallback wrapped
    where wrapped = objectNotifyCallbackWrapper cb

objectNotifyCallbackWrapper ::
    ObjectNotifyCallback ->
    Ptr () ->
    Ptr GParamSpec ->
    Ptr () ->
    IO ()
objectNotifyCallbackWrapper _cb _ pspec _ = do
    pspec' <- newGParamSpecFromPtr pspec
    _cb  pspec'

onObjectNotify :: (GObject a, MonadIO m) => a -> ObjectNotifyCallback -> m SignalHandlerId
onObjectNotify obj cb = liftIO $ connectObjectNotify obj cb SignalConnectBefore
afterObjectNotify :: (GObject a, MonadIO m) => a -> ObjectNotifyCallback -> m SignalHandlerId
afterObjectNotify obj cb = connectObjectNotify obj cb SignalConnectAfter

connectObjectNotify :: (GObject a, MonadIO m) =>
                       a -> ObjectNotifyCallback -> SignalConnectMode -> m SignalHandlerId
connectObjectNotify obj cb after = liftIO $ do
    cb' <- mkObjectNotifyCallback (objectNotifyCallbackWrapper cb)
    connectSignalFunPtr obj "notify" cb' after

type instance AttributeList Object = ObjectAttributeList
type ObjectAttributeList = ('[ ] :: [(Symbol, *)])

data ObjectNotifySignalInfo
instance SignalInfo ObjectNotifySignalInfo where
    type HaskellCallbackType ObjectNotifySignalInfo = ObjectNotifyCallback
    connectSignal _ = connectObjectNotify

type instance SignalList Object = ObjectSignalList
type ObjectSignalList = ('[ '("notify", ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method Object::new
-- method type : Constructor
-- Args : [Arg {argName = "object_type", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_parameters", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "parameters", argType = TCArray False (-1) 1 (TInterface "GObject" "Parameter"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : [Arg {argName = "n_parameters", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- hInArgs : [Arg {argName = "object_type", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "parameters", argType = TCArray False (-1) 1 (TInterface "GObject" "Parameter"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "GObject" "Object"
-- throws : False
-- Skip return : False

foreign import ccall "g_object_newv" g_object_newv :: 
    CGType ->                               -- object_type : TBasicType TGType
    Word32 ->                               -- n_parameters : TBasicType TUInt32
    Ptr Parameter ->                        -- parameters : TCArray False (-1) 1 (TInterface "GObject" "Parameter")
    IO (Ptr Object)


objectNew ::
    (MonadIO m) =>
    GType ->                                -- object_type
    [Parameter] ->                          -- parameters
    m Object
objectNew object_type parameters = liftIO $ do
    let n_parameters = fromIntegral $ length parameters
    let object_type' = gtypeToCGType object_type
    let parameters' = map unsafeManagedPtrGetPtr parameters
    parameters'' <- packBlockArray 32 parameters'
    result <- g_object_newv object_type' n_parameters parameters''
    checkUnexpectedReturnNULL "g_object_newv" result
    result' <- (wrapObject Object) result
    mapM_ touchManagedPtr parameters
    freeMem parameters''
    return result'

-- method Object::bind_property
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "source_property", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "target", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "target_property", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "GObject" "BindingFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "source_property", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "target", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "target_property", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "GObject" "BindingFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "GObject" "Binding"
-- throws : False
-- Skip return : False

foreign import ccall "g_object_bind_property" g_object_bind_property :: 
    Ptr Object ->                           -- _obj : TInterface "GObject" "Object"
    CString ->                              -- source_property : TBasicType TUTF8
    Ptr Object ->                           -- target : TInterface "GObject" "Object"
    CString ->                              -- target_property : TBasicType TUTF8
    CUInt ->                                -- flags : TInterface "GObject" "BindingFlags"
    IO (Ptr Binding)


objectBindProperty ::
    (MonadIO m, ObjectK a, ObjectK b) =>
    a ->                                    -- _obj
    T.Text ->                               -- source_property
    b ->                                    -- target
    T.Text ->                               -- target_property
    [BindingFlags] ->                       -- flags
    m Binding
objectBindProperty _obj source_property target target_property flags = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    source_property' <- textToCString source_property
    let target' = unsafeManagedPtrCastPtr target
    target_property' <- textToCString target_property
    let flags' = gflagsToWord flags
    result <- g_object_bind_property _obj' source_property' target' target_property' flags'
    checkUnexpectedReturnNULL "g_object_bind_property" result
    result' <- (newObject Binding) result
    touchManagedPtr _obj
    touchManagedPtr target
    freeMem source_property'
    freeMem target_property'
    return result'

-- method Object::bind_property_full
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "source_property", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "target", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "target_property", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "GObject" "BindingFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "transform_to", argType = TInterface "GObject" "Closure", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "transform_from", argType = TInterface "GObject" "Closure", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "source_property", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "target", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "target_property", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "GObject" "BindingFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "transform_to", argType = TInterface "GObject" "Closure", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "transform_from", argType = TInterface "GObject" "Closure", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "GObject" "Binding"
-- throws : False
-- Skip return : False

foreign import ccall "g_object_bind_property_with_closures" g_object_bind_property_with_closures :: 
    Ptr Object ->                           -- _obj : TInterface "GObject" "Object"
    CString ->                              -- source_property : TBasicType TUTF8
    Ptr Object ->                           -- target : TInterface "GObject" "Object"
    CString ->                              -- target_property : TBasicType TUTF8
    CUInt ->                                -- flags : TInterface "GObject" "BindingFlags"
    Ptr Closure ->                          -- transform_to : TInterface "GObject" "Closure"
    Ptr Closure ->                          -- transform_from : TInterface "GObject" "Closure"
    IO (Ptr Binding)


objectBindPropertyFull ::
    (MonadIO m, ObjectK a, ObjectK b) =>
    a ->                                    -- _obj
    T.Text ->                               -- source_property
    b ->                                    -- target
    T.Text ->                               -- target_property
    [BindingFlags] ->                       -- flags
    Closure ->                              -- transform_to
    Closure ->                              -- transform_from
    m Binding
objectBindPropertyFull _obj source_property target target_property flags transform_to transform_from = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    source_property' <- textToCString source_property
    let target' = unsafeManagedPtrCastPtr target
    target_property' <- textToCString target_property
    let flags' = gflagsToWord flags
    let transform_to' = unsafeManagedPtrGetPtr transform_to
    let transform_from' = unsafeManagedPtrGetPtr transform_from
    result <- g_object_bind_property_with_closures _obj' source_property' target' target_property' flags' transform_to' transform_from'
    checkUnexpectedReturnNULL "g_object_bind_property_with_closures" result
    result' <- (newObject Binding) result
    touchManagedPtr _obj
    touchManagedPtr target
    touchManagedPtr transform_to
    touchManagedPtr transform_from
    freeMem source_property'
    freeMem target_property'
    return result'

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

foreign import ccall "g_object_force_floating" g_object_force_floating :: 
    Ptr Object ->                           -- _obj : TInterface "GObject" "Object"
    IO ()


objectForceFloating ::
    (MonadIO m, ObjectK a) =>
    a ->                                    -- _obj
    m ()
objectForceFloating _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    g_object_force_floating _obj'
    touchManagedPtr _obj
    return ()

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

foreign import ccall "g_object_freeze_notify" g_object_freeze_notify :: 
    Ptr Object ->                           -- _obj : TInterface "GObject" "Object"
    IO ()


objectFreezeNotify ::
    (MonadIO m, ObjectK a) =>
    a ->                                    -- _obj
    m ()
objectFreezeNotify _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    g_object_freeze_notify _obj'
    touchManagedPtr _obj
    return ()

-- method Object::get_data
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "key", 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_object_get_data" g_object_get_data :: 
    Ptr Object ->                           -- _obj : TInterface "GObject" "Object"
    CString ->                              -- key : TBasicType TUTF8
    IO ()


objectGetData ::
    (MonadIO m, ObjectK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- key
    m ()
objectGetData _obj key = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    key' <- textToCString key
    g_object_get_data _obj' key'
    touchManagedPtr _obj
    freeMem key'
    return ()

-- method Object::get_property
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "property_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TInterface "GObject" "Value", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "property_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TInterface "GObject" "Value", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_object_get_property" g_object_get_property :: 
    Ptr Object ->                           -- _obj : TInterface "GObject" "Object"
    CString ->                              -- property_name : TBasicType TUTF8
    Ptr GValue ->                           -- value : TInterface "GObject" "Value"
    IO ()


objectGetProperty ::
    (MonadIO m, ObjectK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- property_name
    GValue ->                               -- value
    m ()
objectGetProperty _obj property_name value = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    property_name' <- textToCString property_name
    let value' = unsafeManagedPtrGetPtr value
    g_object_get_property _obj' property_name' value'
    touchManagedPtr _obj
    touchManagedPtr value
    freeMem property_name'
    return ()

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

foreign import ccall "g_object_get_qdata" g_object_get_qdata :: 
    Ptr Object ->                           -- _obj : TInterface "GObject" "Object"
    Word32 ->                               -- quark : TBasicType TUInt32
    IO ()


objectGetQdata ::
    (MonadIO m, ObjectK a) =>
    a ->                                    -- _obj
    Word32 ->                               -- quark
    m ()
objectGetQdata _obj quark = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    g_object_get_qdata _obj' quark
    touchManagedPtr _obj
    return ()

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

foreign import ccall "g_object_is_floating" g_object_is_floating :: 
    Ptr Object ->                           -- _obj : TInterface "GObject" "Object"
    IO CInt


objectIsFloating ::
    (MonadIO m, ObjectK a) =>
    a ->                                    -- _obj
    m Bool
objectIsFloating _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_object_is_floating _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method Object::notify
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "property_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "property_name", 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_object_notify" g_object_notify :: 
    Ptr Object ->                           -- _obj : TInterface "GObject" "Object"
    CString ->                              -- property_name : TBasicType TUTF8
    IO ()


objectNotify ::
    (MonadIO m, ObjectK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- property_name
    m ()
objectNotify _obj property_name = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    property_name' <- textToCString property_name
    g_object_notify _obj' property_name'
    touchManagedPtr _obj
    freeMem property_name'
    return ()

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

foreign import ccall "g_object_notify_by_pspec" g_object_notify_by_pspec :: 
    Ptr Object ->                           -- _obj : TInterface "GObject" "Object"
    Ptr GParamSpec ->                       -- pspec : TParamSpec
    IO ()


objectNotifyByPspec ::
    (MonadIO m, ObjectK a) =>
    a ->                                    -- _obj
    GParamSpec ->                           -- pspec
    m ()
objectNotifyByPspec _obj pspec = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let pspec' = unsafeManagedPtrGetPtr pspec
    g_object_notify_by_pspec _obj' pspec'
    touchManagedPtr _obj
    return ()

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

foreign import ccall "g_object_ref" g_object_ref :: 
    Ptr Object ->                           -- _obj : TInterface "GObject" "Object"
    IO (Ptr Object)


objectRef ::
    (MonadIO m, ObjectK a) =>
    a ->                                    -- _obj
    m Object
objectRef _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_object_ref _obj'
    checkUnexpectedReturnNULL "g_object_ref" result
    result' <- (newObject Object) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "g_object_ref_sink" g_object_ref_sink :: 
    Ptr Object ->                           -- _obj : TInterface "GObject" "Object"
    IO (Ptr Object)


objectRefSink ::
    (MonadIO m, ObjectK a) =>
    a ->                                    -- _obj
    m Object
objectRefSink _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_object_ref_sink _obj'
    checkUnexpectedReturnNULL "g_object_ref_sink" result
    result' <- (newObject Object) result
    touchManagedPtr _obj
    return result'

-- method Object::replace_data
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "oldval", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "newval", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "destroy", argType = TInterface "GLib" "DestroyNotify", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "old_destroy", argType = TInterface "GLib" "DestroyNotify", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "oldval", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "newval", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "destroy", argType = TInterface "GLib" "DestroyNotify", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "old_destroy", argType = TInterface "GLib" "DestroyNotify", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "g_object_replace_data" g_object_replace_data :: 
    Ptr Object ->                           -- _obj : TInterface "GObject" "Object"
    CString ->                              -- key : TBasicType TUTF8
    Ptr () ->                               -- oldval : TBasicType TVoid
    Ptr () ->                               -- newval : TBasicType TVoid
    FunPtr GLib.DestroyNotifyC ->           -- destroy : TInterface "GLib" "DestroyNotify"
    FunPtr GLib.DestroyNotifyC ->           -- old_destroy : TInterface "GLib" "DestroyNotify"
    IO CInt


objectReplaceData ::
    (MonadIO m, ObjectK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- key
    Maybe (Ptr ()) ->                       -- oldval
    Maybe (Ptr ()) ->                       -- newval
    Maybe (GLib.DestroyNotify) ->           -- destroy
    Maybe (GLib.DestroyNotify) ->           -- old_destroy
    m Bool
objectReplaceData _obj key oldval newval destroy old_destroy = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    key' <- textToCString key
    maybeOldval <- case oldval of
        Nothing -> return nullPtr
        Just jOldval -> do
            return jOldval
    maybeNewval <- case newval of
        Nothing -> return nullPtr
        Just jNewval -> do
            return jNewval
    ptrdestroy <- callocMem :: IO (Ptr (FunPtr GLib.DestroyNotifyC))
    maybeDestroy <- case destroy of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jDestroy -> do
            jDestroy' <- GLib.mkDestroyNotify (GLib.destroyNotifyWrapper (Just ptrdestroy) jDestroy)
            poke ptrdestroy jDestroy'
            return jDestroy'
    ptrold_destroy <- callocMem :: IO (Ptr (FunPtr GLib.DestroyNotifyC))
    maybeOld_destroy <- case old_destroy of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jOld_destroy -> do
            jOld_destroy' <- GLib.mkDestroyNotify (GLib.destroyNotifyWrapper (Just ptrold_destroy) jOld_destroy)
            poke ptrold_destroy jOld_destroy'
            return jOld_destroy'
    result <- g_object_replace_data _obj' key' maybeOldval maybeNewval maybeDestroy maybeOld_destroy
    let result' = (/= 0) result
    touchManagedPtr _obj
    freeMem key'
    return result'

-- method Object::replace_qdata
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "quark", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "oldval", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "newval", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "destroy", argType = TInterface "GLib" "DestroyNotify", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "old_destroy", argType = TInterface "GLib" "DestroyNotify", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "quark", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "oldval", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "newval", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "destroy", argType = TInterface "GLib" "DestroyNotify", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "old_destroy", argType = TInterface "GLib" "DestroyNotify", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "g_object_replace_qdata" g_object_replace_qdata :: 
    Ptr Object ->                           -- _obj : TInterface "GObject" "Object"
    Word32 ->                               -- quark : TBasicType TUInt32
    Ptr () ->                               -- oldval : TBasicType TVoid
    Ptr () ->                               -- newval : TBasicType TVoid
    FunPtr GLib.DestroyNotifyC ->           -- destroy : TInterface "GLib" "DestroyNotify"
    FunPtr GLib.DestroyNotifyC ->           -- old_destroy : TInterface "GLib" "DestroyNotify"
    IO CInt


objectReplaceQdata ::
    (MonadIO m, ObjectK a) =>
    a ->                                    -- _obj
    Word32 ->                               -- quark
    Maybe (Ptr ()) ->                       -- oldval
    Maybe (Ptr ()) ->                       -- newval
    Maybe (GLib.DestroyNotify) ->           -- destroy
    Maybe (GLib.DestroyNotify) ->           -- old_destroy
    m Bool
objectReplaceQdata _obj quark oldval newval destroy old_destroy = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeOldval <- case oldval of
        Nothing -> return nullPtr
        Just jOldval -> do
            return jOldval
    maybeNewval <- case newval of
        Nothing -> return nullPtr
        Just jNewval -> do
            return jNewval
    ptrdestroy <- callocMem :: IO (Ptr (FunPtr GLib.DestroyNotifyC))
    maybeDestroy <- case destroy of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jDestroy -> do
            jDestroy' <- GLib.mkDestroyNotify (GLib.destroyNotifyWrapper (Just ptrdestroy) jDestroy)
            poke ptrdestroy jDestroy'
            return jDestroy'
    ptrold_destroy <- callocMem :: IO (Ptr (FunPtr GLib.DestroyNotifyC))
    maybeOld_destroy <- case old_destroy of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jOld_destroy -> do
            jOld_destroy' <- GLib.mkDestroyNotify (GLib.destroyNotifyWrapper (Just ptrold_destroy) jOld_destroy)
            poke ptrold_destroy jOld_destroy'
            return jOld_destroy'
    result <- g_object_replace_qdata _obj' quark maybeOldval maybeNewval maybeDestroy maybeOld_destroy
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "g_object_run_dispose" g_object_run_dispose :: 
    Ptr Object ->                           -- _obj : TInterface "GObject" "Object"
    IO ()


objectRunDispose ::
    (MonadIO m, ObjectK a) =>
    a ->                                    -- _obj
    m ()
objectRunDispose _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    g_object_run_dispose _obj'
    touchManagedPtr _obj
    return ()

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

foreign import ccall "g_object_set_data" g_object_set_data :: 
    Ptr Object ->                           -- _obj : TInterface "GObject" "Object"
    CString ->                              -- key : TBasicType TUTF8
    Ptr () ->                               -- data : TBasicType TVoid
    IO ()


objectSetData ::
    (MonadIO m, ObjectK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- key
    Ptr () ->                               -- data
    m ()
objectSetData _obj key data_ = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    key' <- textToCString key
    g_object_set_data _obj' key' data_
    touchManagedPtr _obj
    freeMem key'
    return ()

-- method Object::set_property
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "property_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TInterface "GObject" "Value", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "property_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TInterface "GObject" "Value", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_object_set_property" g_object_set_property :: 
    Ptr Object ->                           -- _obj : TInterface "GObject" "Object"
    CString ->                              -- property_name : TBasicType TUTF8
    Ptr GValue ->                           -- value : TInterface "GObject" "Value"
    IO ()


objectSetProperty ::
    (MonadIO m, ObjectK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- property_name
    GValue ->                               -- value
    m ()
objectSetProperty _obj property_name value = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    property_name' <- textToCString property_name
    let value' = unsafeManagedPtrGetPtr value
    g_object_set_property _obj' property_name' value'
    touchManagedPtr _obj
    touchManagedPtr value
    freeMem property_name'
    return ()

-- method Object::steal_data
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "key", 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_object_steal_data" g_object_steal_data :: 
    Ptr Object ->                           -- _obj : TInterface "GObject" "Object"
    CString ->                              -- key : TBasicType TUTF8
    IO ()


objectStealData ::
    (MonadIO m, ObjectK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- key
    m ()
objectStealData _obj key = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    key' <- textToCString key
    g_object_steal_data _obj' key'
    touchManagedPtr _obj
    freeMem key'
    return ()

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

foreign import ccall "g_object_steal_qdata" g_object_steal_qdata :: 
    Ptr Object ->                           -- _obj : TInterface "GObject" "Object"
    Word32 ->                               -- quark : TBasicType TUInt32
    IO ()


objectStealQdata ::
    (MonadIO m, ObjectK a) =>
    a ->                                    -- _obj
    Word32 ->                               -- quark
    m ()
objectStealQdata _obj quark = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    g_object_steal_qdata _obj' quark
    touchManagedPtr _obj
    return ()

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

foreign import ccall "g_object_thaw_notify" g_object_thaw_notify :: 
    Ptr Object ->                           -- _obj : TInterface "GObject" "Object"
    IO ()


objectThawNotify ::
    (MonadIO m, ObjectK a) =>
    a ->                                    -- _obj
    m ()
objectThawNotify _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    g_object_thaw_notify _obj'
    touchManagedPtr _obj
    return ()

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

foreign import ccall "g_object_unref" g_object_unref :: 
    Ptr Object ->                           -- _obj : TInterface "GObject" "Object"
    IO ()


objectUnref ::
    (MonadIO m, ObjectK a) =>
    a ->                                    -- _obj
    m ()
objectUnref _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    g_object_unref _obj'
    touchManagedPtr _obj
    return ()

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

foreign import ccall "g_object_watch_closure" g_object_watch_closure :: 
    Ptr Object ->                           -- _obj : TInterface "GObject" "Object"
    Ptr Closure ->                          -- closure : TInterface "GObject" "Closure"
    IO ()


objectWatchClosure ::
    (MonadIO m, ObjectK a) =>
    a ->                                    -- _obj
    Closure ->                              -- closure
    m ()
objectWatchClosure _obj closure = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let closure' = unsafeManagedPtrGetPtr closure
    g_object_watch_closure _obj' closure'
    touchManagedPtr _obj
    touchManagedPtr closure
    return ()

-- method Object::compat_control
-- method type : MemberFunction
-- Args : [Arg {argName = "what", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "what", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt64
-- throws : False
-- Skip return : False

foreign import ccall "g_object_compat_control" g_object_compat_control :: 
    Word64 ->                               -- what : TBasicType TUInt64
    Ptr () ->                               -- data : TBasicType TVoid
    IO Word64


objectCompatControl ::
    (MonadIO m) =>
    Word64 ->                               -- what
    Ptr () ->                               -- data
    m Word64
objectCompatControl what data_ = liftIO $ do
    result <- g_object_compat_control what data_
    return result

-- method Object::interface_find_property
-- method type : MemberFunction
-- Args : [Arg {argName = "g_iface", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "property_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "g_iface", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "property_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TParamSpec
-- throws : False
-- Skip return : False

foreign import ccall "g_object_interface_find_property" g_object_interface_find_property :: 
    Ptr () ->                               -- g_iface : TBasicType TVoid
    CString ->                              -- property_name : TBasicType TUTF8
    IO (Ptr GParamSpec)


objectInterfaceFindProperty ::
    (MonadIO m) =>
    Ptr () ->                               -- g_iface
    T.Text ->                               -- property_name
    m GParamSpec
objectInterfaceFindProperty g_iface property_name = liftIO $ do
    property_name' <- textToCString property_name
    result <- g_object_interface_find_property g_iface property_name'
    checkUnexpectedReturnNULL "g_object_interface_find_property" result
    result' <- newGParamSpecFromPtr result
    freeMem property_name'
    return result'

-- method Object::interface_install_property
-- method type : MemberFunction
-- Args : [Arg {argName = "g_iface", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "pspec", argType = TParamSpec, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "g_iface", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "pspec", argType = TParamSpec, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_object_interface_install_property" g_object_interface_install_property :: 
    Ptr () ->                               -- g_iface : TBasicType TVoid
    Ptr GParamSpec ->                       -- pspec : TParamSpec
    IO ()


objectInterfaceInstallProperty ::
    (MonadIO m) =>
    Ptr () ->                               -- g_iface
    GParamSpec ->                           -- pspec
    m ()
objectInterfaceInstallProperty g_iface pspec = liftIO $ do
    let pspec' = unsafeManagedPtrGetPtr pspec
    g_object_interface_install_property g_iface pspec'
    return ()

-- XXX Could not generate method Object::interface_list_properties
-- Error was : Not implemented: "unpackCArray : Don't know how to unpack C Array of type TParamSpec"