{- |
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.Soup.Interfaces.SessionFeature
    ( 

-- * Exported types
    SessionFeature(..)                      ,
    noSessionFeature                        ,
    SessionFeatureK                         ,
    toSessionFeature                        ,


 -- * Methods
-- ** sessionFeatureAddFeature
    sessionFeatureAddFeature                ,


-- ** sessionFeatureAttach
    sessionFeatureAttach                    ,


-- ** sessionFeatureDetach
    sessionFeatureDetach                    ,


-- ** sessionFeatureHasFeature
    sessionFeatureHasFeature                ,


-- ** sessionFeatureRemoveFeature
    sessionFeatureRemoveFeature             ,




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

-- interface SessionFeature 

newtype SessionFeature = SessionFeature (ForeignPtr SessionFeature)
noSessionFeature :: Maybe SessionFeature
noSessionFeature = Nothing

type instance AttributeList SessionFeature = SessionFeatureAttributeList
type SessionFeatureAttributeList = ('[ ] :: [(Symbol, *)])

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

foreign import ccall "soup_session_feature_get_type"
    c_soup_session_feature_get_type :: IO GType

type instance ParentTypes SessionFeature = SessionFeatureParentTypes
type SessionFeatureParentTypes = '[GObject.Object]

instance GObject SessionFeature where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_soup_session_feature_get_type
    

class GObject o => SessionFeatureK o
instance (GObject o, IsDescendantOf SessionFeature o) => SessionFeatureK o

toSessionFeature :: SessionFeatureK o => o -> IO SessionFeature
toSessionFeature = unsafeCastTo SessionFeature

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

foreign import ccall "soup_session_feature_add_feature" soup_session_feature_add_feature :: 
    Ptr SessionFeature ->                   -- _obj : TInterface "Soup" "SessionFeature"
    CGType ->                               -- type : TBasicType TGType
    IO CInt


sessionFeatureAddFeature ::
    (MonadIO m, SessionFeatureK a) =>
    a ->                                    -- _obj
    GType ->                                -- type
    m Bool
sessionFeatureAddFeature _obj type_ = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let type_' = gtypeToCGType type_
    result <- soup_session_feature_add_feature _obj' type_'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "soup_session_feature_attach" soup_session_feature_attach :: 
    Ptr SessionFeature ->                   -- _obj : TInterface "Soup" "SessionFeature"
    Ptr Session ->                          -- session : TInterface "Soup" "Session"
    IO ()


sessionFeatureAttach ::
    (MonadIO m, SessionFeatureK a, SessionK b) =>
    a ->                                    -- _obj
    b ->                                    -- session
    m ()
sessionFeatureAttach _obj session = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let session' = unsafeManagedPtrCastPtr session
    soup_session_feature_attach _obj' session'
    touchManagedPtr _obj
    touchManagedPtr session
    return ()

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

foreign import ccall "soup_session_feature_detach" soup_session_feature_detach :: 
    Ptr SessionFeature ->                   -- _obj : TInterface "Soup" "SessionFeature"
    Ptr Session ->                          -- session : TInterface "Soup" "Session"
    IO ()


sessionFeatureDetach ::
    (MonadIO m, SessionFeatureK a, SessionK b) =>
    a ->                                    -- _obj
    b ->                                    -- session
    m ()
sessionFeatureDetach _obj session = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let session' = unsafeManagedPtrCastPtr session
    soup_session_feature_detach _obj' session'
    touchManagedPtr _obj
    touchManagedPtr session
    return ()

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

foreign import ccall "soup_session_feature_has_feature" soup_session_feature_has_feature :: 
    Ptr SessionFeature ->                   -- _obj : TInterface "Soup" "SessionFeature"
    CGType ->                               -- type : TBasicType TGType
    IO CInt


sessionFeatureHasFeature ::
    (MonadIO m, SessionFeatureK a) =>
    a ->                                    -- _obj
    GType ->                                -- type
    m Bool
sessionFeatureHasFeature _obj type_ = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let type_' = gtypeToCGType type_
    result <- soup_session_feature_has_feature _obj' type_'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "soup_session_feature_remove_feature" soup_session_feature_remove_feature :: 
    Ptr SessionFeature ->                   -- _obj : TInterface "Soup" "SessionFeature"
    CGType ->                               -- type : TBasicType TGType
    IO CInt


sessionFeatureRemoveFeature ::
    (MonadIO m, SessionFeatureK a) =>
    a ->                                    -- _obj
    GType ->                                -- type
    m Bool
sessionFeatureRemoveFeature _obj type_ = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let type_' = gtypeToCGType type_
    result <- soup_session_feature_remove_feature _obj' type_'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'