{- |
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.SimpleActionGroup
    ( 

-- * Exported types
    SimpleActionGroup(..)                   ,
    SimpleActionGroupK                      ,
    toSimpleActionGroup                     ,
    noSimpleActionGroup                     ,


 -- * Methods
-- ** simpleActionGroupAddEntries
    simpleActionGroupAddEntries             ,


-- ** simpleActionGroupInsert
    simpleActionGroupInsert                 ,


-- ** simpleActionGroupLookup
    simpleActionGroupLookup                 ,


-- ** simpleActionGroupNew
    simpleActionGroupNew                    ,


-- ** simpleActionGroupRemove
    simpleActionGroupRemove                 ,




    ) 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 SimpleActionGroup = SimpleActionGroup (ForeignPtr SimpleActionGroup)
foreign import ccall "g_simple_action_group_get_type"
    c_g_simple_action_group_get_type :: IO GType

type instance ParentTypes SimpleActionGroup = SimpleActionGroupParentTypes
type SimpleActionGroupParentTypes = '[GObject.Object, ActionGroup, ActionMap]

instance GObject SimpleActionGroup where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_g_simple_action_group_get_type
    

class GObject o => SimpleActionGroupK o
instance (GObject o, IsDescendantOf SimpleActionGroup o) => SimpleActionGroupK o

toSimpleActionGroup :: SimpleActionGroupK o => o -> IO SimpleActionGroup
toSimpleActionGroup = unsafeCastTo SimpleActionGroup

noSimpleActionGroup :: Maybe SimpleActionGroup
noSimpleActionGroup = Nothing

type instance AttributeList SimpleActionGroup = SimpleActionGroupAttributeList
type SimpleActionGroupAttributeList = ('[ ] :: [(Symbol, *)])

type instance SignalList SimpleActionGroup = SimpleActionGroupSignalList
type SimpleActionGroupSignalList = ('[ '("action-added", ActionGroupActionAddedSignalInfo), '("action-enabled-changed", ActionGroupActionEnabledChangedSignalInfo), '("action-removed", ActionGroupActionRemovedSignalInfo), '("action-state-changed", ActionGroupActionStateChangedSignalInfo), '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method SimpleActionGroup::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TInterface "Gio" "SimpleActionGroup"
-- throws : False
-- Skip return : False

foreign import ccall "g_simple_action_group_new" g_simple_action_group_new :: 
    IO (Ptr SimpleActionGroup)


simpleActionGroupNew ::
    (MonadIO m) =>
    m SimpleActionGroup
simpleActionGroupNew  = liftIO $ do
    result <- g_simple_action_group_new
    checkUnexpectedReturnNULL "g_simple_action_group_new" result
    result' <- (wrapObject SimpleActionGroup) result
    return result'

-- method SimpleActionGroup::add_entries
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "SimpleActionGroup", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "entries", argType = TCArray False (-1) 2 (TInterface "Gio" "ActionEntry"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_entries", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : [Arg {argName = "n_entries", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "SimpleActionGroup", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "entries", argType = TCArray False (-1) 2 (TInterface "Gio" "ActionEntry"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_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_simple_action_group_add_entries" g_simple_action_group_add_entries :: 
    Ptr SimpleActionGroup ->                -- _obj : TInterface "Gio" "SimpleActionGroup"
    Ptr ActionEntry ->                      -- entries : TCArray False (-1) 2 (TInterface "Gio" "ActionEntry")
    Int32 ->                                -- n_entries : TBasicType TInt32
    Ptr () ->                               -- user_data : TBasicType TVoid
    IO ()

{-# DEPRECATED simpleActionGroupAddEntries ["(Since version 2.38)","Use g_action_map_add_action_entries()"]#-}
simpleActionGroupAddEntries ::
    (MonadIO m, SimpleActionGroupK a) =>
    a ->                                    -- _obj
    [ActionEntry] ->                        -- entries
    Ptr () ->                               -- user_data
    m ()
simpleActionGroupAddEntries _obj entries user_data = liftIO $ do
    let n_entries = fromIntegral $ length entries
    let _obj' = unsafeManagedPtrCastPtr _obj
    let entries' = map unsafeManagedPtrGetPtr entries
    entries'' <- packBlockArray 64 entries'
    g_simple_action_group_add_entries _obj' entries'' n_entries user_data
    touchManagedPtr _obj
    mapM_ touchManagedPtr entries
    freeMem entries''
    return ()

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

foreign import ccall "g_simple_action_group_insert" g_simple_action_group_insert :: 
    Ptr SimpleActionGroup ->                -- _obj : TInterface "Gio" "SimpleActionGroup"
    Ptr Action ->                           -- action : TInterface "Gio" "Action"
    IO ()

{-# DEPRECATED simpleActionGroupInsert ["(Since version 2.38)","Use g_action_map_add_action()"]#-}
simpleActionGroupInsert ::
    (MonadIO m, SimpleActionGroupK a, ActionK b) =>
    a ->                                    -- _obj
    b ->                                    -- action
    m ()
simpleActionGroupInsert _obj action = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let action' = unsafeManagedPtrCastPtr action
    g_simple_action_group_insert _obj' action'
    touchManagedPtr _obj
    touchManagedPtr action
    return ()

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

foreign import ccall "g_simple_action_group_lookup" g_simple_action_group_lookup :: 
    Ptr SimpleActionGroup ->                -- _obj : TInterface "Gio" "SimpleActionGroup"
    CString ->                              -- action_name : TBasicType TUTF8
    IO (Ptr Action)

{-# DEPRECATED simpleActionGroupLookup ["(Since version 2.38)","Use g_action_map_lookup_action()"]#-}
simpleActionGroupLookup ::
    (MonadIO m, SimpleActionGroupK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- action_name
    m Action
simpleActionGroupLookup _obj action_name = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    action_name' <- textToCString action_name
    result <- g_simple_action_group_lookup _obj' action_name'
    checkUnexpectedReturnNULL "g_simple_action_group_lookup" result
    result' <- (newObject Action) result
    touchManagedPtr _obj
    freeMem action_name'
    return result'

-- method SimpleActionGroup::remove
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "SimpleActionGroup", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "action_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "SimpleActionGroup", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "action_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_simple_action_group_remove" g_simple_action_group_remove :: 
    Ptr SimpleActionGroup ->                -- _obj : TInterface "Gio" "SimpleActionGroup"
    CString ->                              -- action_name : TBasicType TUTF8
    IO ()

{-# DEPRECATED simpleActionGroupRemove ["(Since version 2.38)","Use g_action_map_remove_action()"]#-}
simpleActionGroupRemove ::
    (MonadIO m, SimpleActionGroupK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- action_name
    m ()
simpleActionGroupRemove _obj action_name = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    action_name' <- textToCString action_name
    g_simple_action_group_remove _obj' action_name'
    touchManagedPtr _obj
    freeMem action_name'
    return ()