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

-- * Exported types
    ActionGroup(..)                         ,
    noActionGroup                           ,
    ActionGroupK                            ,
    toActionGroup                           ,


 -- * Methods
-- ** actionGroupActionAdded
    actionGroupActionAdded                  ,


-- ** actionGroupActionEnabledChanged
    actionGroupActionEnabledChanged         ,


-- ** actionGroupActionRemoved
    actionGroupActionRemoved                ,


-- ** actionGroupActionStateChanged
    actionGroupActionStateChanged           ,


-- ** actionGroupActivateAction
    actionGroupActivateAction               ,


-- ** actionGroupChangeActionState
    actionGroupChangeActionState            ,


-- ** actionGroupGetActionEnabled
    actionGroupGetActionEnabled             ,


-- ** actionGroupGetActionParameterType
    actionGroupGetActionParameterType       ,


-- ** actionGroupGetActionState
    actionGroupGetActionState               ,


-- ** actionGroupGetActionStateHint
    actionGroupGetActionStateHint           ,


-- ** actionGroupGetActionStateType
    actionGroupGetActionStateType           ,


-- ** actionGroupHasAction
    actionGroupHasAction                    ,


-- ** actionGroupListActions
    actionGroupListActions                  ,


-- ** actionGroupQueryAction
    actionGroupQueryAction                  ,




 -- * Signals
-- ** ActionAdded
    ActionGroupActionAddedCallback          ,
    ActionGroupActionAddedCallbackC         ,
    ActionGroupActionAddedSignalInfo        ,
    actionGroupActionAddedCallbackWrapper   ,
    actionGroupActionAddedClosure           ,
    afterActionGroupActionAdded             ,
    mkActionGroupActionAddedCallback        ,
    noActionGroupActionAddedCallback        ,
    onActionGroupActionAdded                ,


-- ** ActionEnabledChanged
    ActionGroupActionEnabledChangedCallback ,
    ActionGroupActionEnabledChangedCallbackC,
    ActionGroupActionEnabledChangedSignalInfo,
    actionGroupActionEnabledChangedCallbackWrapper,
    actionGroupActionEnabledChangedClosure  ,
    afterActionGroupActionEnabledChanged    ,
    mkActionGroupActionEnabledChangedCallback,
    noActionGroupActionEnabledChangedCallback,
    onActionGroupActionEnabledChanged       ,


-- ** ActionRemoved
    ActionGroupActionRemovedCallback        ,
    ActionGroupActionRemovedCallbackC       ,
    ActionGroupActionRemovedSignalInfo      ,
    actionGroupActionRemovedCallbackWrapper ,
    actionGroupActionRemovedClosure         ,
    afterActionGroupActionRemoved           ,
    mkActionGroupActionRemovedCallback      ,
    noActionGroupActionRemovedCallback      ,
    onActionGroupActionRemoved              ,


-- ** ActionStateChanged
    ActionGroupActionStateChangedCallback   ,
    ActionGroupActionStateChangedCallbackC  ,
    ActionGroupActionStateChangedSignalInfo ,
    actionGroupActionStateChangedCallbackWrapper,
    actionGroupActionStateChangedClosure    ,
    afterActionGroupActionStateChanged      ,
    mkActionGroupActionStateChangedCallback ,
    noActionGroupActionStateChangedCallback ,
    onActionGroupActionStateChanged         ,




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

-- interface ActionGroup 

newtype ActionGroup = ActionGroup (ForeignPtr ActionGroup)
noActionGroup :: Maybe ActionGroup
noActionGroup = Nothing

-- signal ActionGroup::action-added
type ActionGroupActionAddedCallback =
    T.Text ->
    IO ()

noActionGroupActionAddedCallback :: Maybe ActionGroupActionAddedCallback
noActionGroupActionAddedCallback = Nothing

type ActionGroupActionAddedCallbackC =
    Ptr () ->                               -- object
    CString ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mkActionGroupActionAddedCallback :: ActionGroupActionAddedCallbackC -> IO (FunPtr ActionGroupActionAddedCallbackC)

actionGroupActionAddedClosure :: ActionGroupActionAddedCallback -> IO Closure
actionGroupActionAddedClosure cb = newCClosure =<< mkActionGroupActionAddedCallback wrapped
    where wrapped = actionGroupActionAddedCallbackWrapper cb

actionGroupActionAddedCallbackWrapper ::
    ActionGroupActionAddedCallback ->
    Ptr () ->
    CString ->
    Ptr () ->
    IO ()
actionGroupActionAddedCallbackWrapper _cb _ action_name _ = do
    action_name' <- cstringToText action_name
    _cb  action_name'

onActionGroupActionAdded :: (GObject a, MonadIO m) => a -> ActionGroupActionAddedCallback -> m SignalHandlerId
onActionGroupActionAdded obj cb = liftIO $ connectActionGroupActionAdded obj cb SignalConnectBefore
afterActionGroupActionAdded :: (GObject a, MonadIO m) => a -> ActionGroupActionAddedCallback -> m SignalHandlerId
afterActionGroupActionAdded obj cb = connectActionGroupActionAdded obj cb SignalConnectAfter

connectActionGroupActionAdded :: (GObject a, MonadIO m) =>
                                 a -> ActionGroupActionAddedCallback -> SignalConnectMode -> m SignalHandlerId
connectActionGroupActionAdded obj cb after = liftIO $ do
    cb' <- mkActionGroupActionAddedCallback (actionGroupActionAddedCallbackWrapper cb)
    connectSignalFunPtr obj "action-added" cb' after

-- signal ActionGroup::action-enabled-changed
type ActionGroupActionEnabledChangedCallback =
    T.Text ->
    Bool ->
    IO ()

noActionGroupActionEnabledChangedCallback :: Maybe ActionGroupActionEnabledChangedCallback
noActionGroupActionEnabledChangedCallback = Nothing

type ActionGroupActionEnabledChangedCallbackC =
    Ptr () ->                               -- object
    CString ->
    CInt ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mkActionGroupActionEnabledChangedCallback :: ActionGroupActionEnabledChangedCallbackC -> IO (FunPtr ActionGroupActionEnabledChangedCallbackC)

actionGroupActionEnabledChangedClosure :: ActionGroupActionEnabledChangedCallback -> IO Closure
actionGroupActionEnabledChangedClosure cb = newCClosure =<< mkActionGroupActionEnabledChangedCallback wrapped
    where wrapped = actionGroupActionEnabledChangedCallbackWrapper cb

actionGroupActionEnabledChangedCallbackWrapper ::
    ActionGroupActionEnabledChangedCallback ->
    Ptr () ->
    CString ->
    CInt ->
    Ptr () ->
    IO ()
actionGroupActionEnabledChangedCallbackWrapper _cb _ action_name enabled _ = do
    action_name' <- cstringToText action_name
    let enabled' = (/= 0) enabled
    _cb  action_name' enabled'

onActionGroupActionEnabledChanged :: (GObject a, MonadIO m) => a -> ActionGroupActionEnabledChangedCallback -> m SignalHandlerId
onActionGroupActionEnabledChanged obj cb = liftIO $ connectActionGroupActionEnabledChanged obj cb SignalConnectBefore
afterActionGroupActionEnabledChanged :: (GObject a, MonadIO m) => a -> ActionGroupActionEnabledChangedCallback -> m SignalHandlerId
afterActionGroupActionEnabledChanged obj cb = connectActionGroupActionEnabledChanged obj cb SignalConnectAfter

connectActionGroupActionEnabledChanged :: (GObject a, MonadIO m) =>
                                          a -> ActionGroupActionEnabledChangedCallback -> SignalConnectMode -> m SignalHandlerId
connectActionGroupActionEnabledChanged obj cb after = liftIO $ do
    cb' <- mkActionGroupActionEnabledChangedCallback (actionGroupActionEnabledChangedCallbackWrapper cb)
    connectSignalFunPtr obj "action-enabled-changed" cb' after

-- signal ActionGroup::action-removed
type ActionGroupActionRemovedCallback =
    T.Text ->
    IO ()

noActionGroupActionRemovedCallback :: Maybe ActionGroupActionRemovedCallback
noActionGroupActionRemovedCallback = Nothing

type ActionGroupActionRemovedCallbackC =
    Ptr () ->                               -- object
    CString ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mkActionGroupActionRemovedCallback :: ActionGroupActionRemovedCallbackC -> IO (FunPtr ActionGroupActionRemovedCallbackC)

actionGroupActionRemovedClosure :: ActionGroupActionRemovedCallback -> IO Closure
actionGroupActionRemovedClosure cb = newCClosure =<< mkActionGroupActionRemovedCallback wrapped
    where wrapped = actionGroupActionRemovedCallbackWrapper cb

actionGroupActionRemovedCallbackWrapper ::
    ActionGroupActionRemovedCallback ->
    Ptr () ->
    CString ->
    Ptr () ->
    IO ()
actionGroupActionRemovedCallbackWrapper _cb _ action_name _ = do
    action_name' <- cstringToText action_name
    _cb  action_name'

onActionGroupActionRemoved :: (GObject a, MonadIO m) => a -> ActionGroupActionRemovedCallback -> m SignalHandlerId
onActionGroupActionRemoved obj cb = liftIO $ connectActionGroupActionRemoved obj cb SignalConnectBefore
afterActionGroupActionRemoved :: (GObject a, MonadIO m) => a -> ActionGroupActionRemovedCallback -> m SignalHandlerId
afterActionGroupActionRemoved obj cb = connectActionGroupActionRemoved obj cb SignalConnectAfter

connectActionGroupActionRemoved :: (GObject a, MonadIO m) =>
                                   a -> ActionGroupActionRemovedCallback -> SignalConnectMode -> m SignalHandlerId
connectActionGroupActionRemoved obj cb after = liftIO $ do
    cb' <- mkActionGroupActionRemovedCallback (actionGroupActionRemovedCallbackWrapper cb)
    connectSignalFunPtr obj "action-removed" cb' after

-- signal ActionGroup::action-state-changed
type ActionGroupActionStateChangedCallback =
    T.Text ->
    GVariant ->
    IO ()

noActionGroupActionStateChangedCallback :: Maybe ActionGroupActionStateChangedCallback
noActionGroupActionStateChangedCallback = Nothing

type ActionGroupActionStateChangedCallbackC =
    Ptr () ->                               -- object
    CString ->
    Ptr GVariant ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mkActionGroupActionStateChangedCallback :: ActionGroupActionStateChangedCallbackC -> IO (FunPtr ActionGroupActionStateChangedCallbackC)

actionGroupActionStateChangedClosure :: ActionGroupActionStateChangedCallback -> IO Closure
actionGroupActionStateChangedClosure cb = newCClosure =<< mkActionGroupActionStateChangedCallback wrapped
    where wrapped = actionGroupActionStateChangedCallbackWrapper cb

actionGroupActionStateChangedCallbackWrapper ::
    ActionGroupActionStateChangedCallback ->
    Ptr () ->
    CString ->
    Ptr GVariant ->
    Ptr () ->
    IO ()
actionGroupActionStateChangedCallbackWrapper _cb _ action_name value _ = do
    action_name' <- cstringToText action_name
    value' <- newGVariantFromPtr value
    _cb  action_name' value'

onActionGroupActionStateChanged :: (GObject a, MonadIO m) => a -> ActionGroupActionStateChangedCallback -> m SignalHandlerId
onActionGroupActionStateChanged obj cb = liftIO $ connectActionGroupActionStateChanged obj cb SignalConnectBefore
afterActionGroupActionStateChanged :: (GObject a, MonadIO m) => a -> ActionGroupActionStateChangedCallback -> m SignalHandlerId
afterActionGroupActionStateChanged obj cb = connectActionGroupActionStateChanged obj cb SignalConnectAfter

connectActionGroupActionStateChanged :: (GObject a, MonadIO m) =>
                                        a -> ActionGroupActionStateChangedCallback -> SignalConnectMode -> m SignalHandlerId
connectActionGroupActionStateChanged obj cb after = liftIO $ do
    cb' <- mkActionGroupActionStateChangedCallback (actionGroupActionStateChangedCallbackWrapper cb)
    connectSignalFunPtr obj "action-state-changed" cb' after

type instance AttributeList ActionGroup = ActionGroupAttributeList
type ActionGroupAttributeList = ('[ ] :: [(Symbol, *)])

data ActionGroupActionAddedSignalInfo
instance SignalInfo ActionGroupActionAddedSignalInfo where
    type HaskellCallbackType ActionGroupActionAddedSignalInfo = ActionGroupActionAddedCallback
    connectSignal _ = connectActionGroupActionAdded

data ActionGroupActionEnabledChangedSignalInfo
instance SignalInfo ActionGroupActionEnabledChangedSignalInfo where
    type HaskellCallbackType ActionGroupActionEnabledChangedSignalInfo = ActionGroupActionEnabledChangedCallback
    connectSignal _ = connectActionGroupActionEnabledChanged

data ActionGroupActionRemovedSignalInfo
instance SignalInfo ActionGroupActionRemovedSignalInfo where
    type HaskellCallbackType ActionGroupActionRemovedSignalInfo = ActionGroupActionRemovedCallback
    connectSignal _ = connectActionGroupActionRemoved

data ActionGroupActionStateChangedSignalInfo
instance SignalInfo ActionGroupActionStateChangedSignalInfo where
    type HaskellCallbackType ActionGroupActionStateChangedSignalInfo = ActionGroupActionStateChangedCallback
    connectSignal _ = connectActionGroupActionStateChanged

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

foreign import ccall "g_action_group_get_type"
    c_g_action_group_get_type :: IO GType

type instance ParentTypes ActionGroup = ActionGroupParentTypes
type ActionGroupParentTypes = '[GObject.Object]

instance GObject ActionGroup where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_g_action_group_get_type
    

class GObject o => ActionGroupK o
instance (GObject o, IsDescendantOf ActionGroup o) => ActionGroupK o

toActionGroup :: ActionGroupK o => o -> IO ActionGroup
toActionGroup = unsafeCastTo ActionGroup

-- method ActionGroup::action_added
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "ActionGroup", 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" "ActionGroup", 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_action_group_action_added" g_action_group_action_added :: 
    Ptr ActionGroup ->                      -- _obj : TInterface "Gio" "ActionGroup"
    CString ->                              -- action_name : TBasicType TUTF8
    IO ()


actionGroupActionAdded ::
    (MonadIO m, ActionGroupK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- action_name
    m ()
actionGroupActionAdded _obj action_name = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    action_name' <- textToCString action_name
    g_action_group_action_added _obj' action_name'
    touchManagedPtr _obj
    freeMem action_name'
    return ()

-- method ActionGroup::action_enabled_changed
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "ActionGroup", 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},Arg {argName = "enabled", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "ActionGroup", 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},Arg {argName = "enabled", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_action_group_action_enabled_changed" g_action_group_action_enabled_changed :: 
    Ptr ActionGroup ->                      -- _obj : TInterface "Gio" "ActionGroup"
    CString ->                              -- action_name : TBasicType TUTF8
    CInt ->                                 -- enabled : TBasicType TBoolean
    IO ()


actionGroupActionEnabledChanged ::
    (MonadIO m, ActionGroupK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- action_name
    Bool ->                                 -- enabled
    m ()
actionGroupActionEnabledChanged _obj action_name enabled = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    action_name' <- textToCString action_name
    let enabled' = (fromIntegral . fromEnum) enabled
    g_action_group_action_enabled_changed _obj' action_name' enabled'
    touchManagedPtr _obj
    freeMem action_name'
    return ()

-- method ActionGroup::action_removed
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "ActionGroup", 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" "ActionGroup", 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_action_group_action_removed" g_action_group_action_removed :: 
    Ptr ActionGroup ->                      -- _obj : TInterface "Gio" "ActionGroup"
    CString ->                              -- action_name : TBasicType TUTF8
    IO ()


actionGroupActionRemoved ::
    (MonadIO m, ActionGroupK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- action_name
    m ()
actionGroupActionRemoved _obj action_name = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    action_name' <- textToCString action_name
    g_action_group_action_removed _obj' action_name'
    touchManagedPtr _obj
    freeMem action_name'
    return ()

-- method ActionGroup::action_state_changed
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "ActionGroup", 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},Arg {argName = "state", argType = TVariant, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "ActionGroup", 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},Arg {argName = "state", argType = TVariant, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_action_group_action_state_changed" g_action_group_action_state_changed :: 
    Ptr ActionGroup ->                      -- _obj : TInterface "Gio" "ActionGroup"
    CString ->                              -- action_name : TBasicType TUTF8
    Ptr GVariant ->                         -- state : TVariant
    IO ()


actionGroupActionStateChanged ::
    (MonadIO m, ActionGroupK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- action_name
    GVariant ->                             -- state
    m ()
actionGroupActionStateChanged _obj action_name state = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    action_name' <- textToCString action_name
    let state' = unsafeManagedPtrGetPtr state
    g_action_group_action_state_changed _obj' action_name' state'
    touchManagedPtr _obj
    freeMem action_name'
    return ()

-- method ActionGroup::activate_action
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "ActionGroup", 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},Arg {argName = "parameter", argType = TVariant, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "ActionGroup", 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},Arg {argName = "parameter", argType = TVariant, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_action_group_activate_action" g_action_group_activate_action :: 
    Ptr ActionGroup ->                      -- _obj : TInterface "Gio" "ActionGroup"
    CString ->                              -- action_name : TBasicType TUTF8
    Ptr GVariant ->                         -- parameter : TVariant
    IO ()


actionGroupActivateAction ::
    (MonadIO m, ActionGroupK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- action_name
    Maybe (GVariant) ->                     -- parameter
    m ()
actionGroupActivateAction _obj action_name parameter = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    action_name' <- textToCString action_name
    maybeParameter <- case parameter of
        Nothing -> return nullPtr
        Just jParameter -> do
            let jParameter' = unsafeManagedPtrGetPtr jParameter
            return jParameter'
    g_action_group_activate_action _obj' action_name' maybeParameter
    touchManagedPtr _obj
    freeMem action_name'
    return ()

-- method ActionGroup::change_action_state
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "ActionGroup", 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},Arg {argName = "value", argType = TVariant, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "ActionGroup", 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},Arg {argName = "value", argType = TVariant, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_action_group_change_action_state" g_action_group_change_action_state :: 
    Ptr ActionGroup ->                      -- _obj : TInterface "Gio" "ActionGroup"
    CString ->                              -- action_name : TBasicType TUTF8
    Ptr GVariant ->                         -- value : TVariant
    IO ()


actionGroupChangeActionState ::
    (MonadIO m, ActionGroupK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- action_name
    GVariant ->                             -- value
    m ()
actionGroupChangeActionState _obj action_name value = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    action_name' <- textToCString action_name
    let value' = unsafeManagedPtrGetPtr value
    g_action_group_change_action_state _obj' action_name' value'
    touchManagedPtr _obj
    freeMem action_name'
    return ()

-- method ActionGroup::get_action_enabled
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "ActionGroup", 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" "ActionGroup", 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 TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "g_action_group_get_action_enabled" g_action_group_get_action_enabled :: 
    Ptr ActionGroup ->                      -- _obj : TInterface "Gio" "ActionGroup"
    CString ->                              -- action_name : TBasicType TUTF8
    IO CInt


actionGroupGetActionEnabled ::
    (MonadIO m, ActionGroupK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- action_name
    m Bool
actionGroupGetActionEnabled _obj action_name = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    action_name' <- textToCString action_name
    result <- g_action_group_get_action_enabled _obj' action_name'
    let result' = (/= 0) result
    touchManagedPtr _obj
    freeMem action_name'
    return result'

-- method ActionGroup::get_action_parameter_type
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "ActionGroup", 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" "ActionGroup", 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 "GLib" "VariantType"
-- throws : False
-- Skip return : False

foreign import ccall "g_action_group_get_action_parameter_type" g_action_group_get_action_parameter_type :: 
    Ptr ActionGroup ->                      -- _obj : TInterface "Gio" "ActionGroup"
    CString ->                              -- action_name : TBasicType TUTF8
    IO (Ptr GLib.VariantType)


actionGroupGetActionParameterType ::
    (MonadIO m, ActionGroupK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- action_name
    m GLib.VariantType
actionGroupGetActionParameterType _obj action_name = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    action_name' <- textToCString action_name
    result <- g_action_group_get_action_parameter_type _obj' action_name'
    checkUnexpectedReturnNULL "g_action_group_get_action_parameter_type" result
    result' <- (newBoxed GLib.VariantType) result
    touchManagedPtr _obj
    freeMem action_name'
    return result'

-- method ActionGroup::get_action_state
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "ActionGroup", 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" "ActionGroup", 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 : TVariant
-- throws : False
-- Skip return : False

foreign import ccall "g_action_group_get_action_state" g_action_group_get_action_state :: 
    Ptr ActionGroup ->                      -- _obj : TInterface "Gio" "ActionGroup"
    CString ->                              -- action_name : TBasicType TUTF8
    IO (Ptr GVariant)


actionGroupGetActionState ::
    (MonadIO m, ActionGroupK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- action_name
    m GVariant
actionGroupGetActionState _obj action_name = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    action_name' <- textToCString action_name
    result <- g_action_group_get_action_state _obj' action_name'
    checkUnexpectedReturnNULL "g_action_group_get_action_state" result
    result' <- wrapGVariantPtr result
    touchManagedPtr _obj
    freeMem action_name'
    return result'

-- method ActionGroup::get_action_state_hint
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "ActionGroup", 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" "ActionGroup", 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 : TVariant
-- throws : False
-- Skip return : False

foreign import ccall "g_action_group_get_action_state_hint" g_action_group_get_action_state_hint :: 
    Ptr ActionGroup ->                      -- _obj : TInterface "Gio" "ActionGroup"
    CString ->                              -- action_name : TBasicType TUTF8
    IO (Ptr GVariant)


actionGroupGetActionStateHint ::
    (MonadIO m, ActionGroupK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- action_name
    m GVariant
actionGroupGetActionStateHint _obj action_name = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    action_name' <- textToCString action_name
    result <- g_action_group_get_action_state_hint _obj' action_name'
    checkUnexpectedReturnNULL "g_action_group_get_action_state_hint" result
    result' <- wrapGVariantPtr result
    touchManagedPtr _obj
    freeMem action_name'
    return result'

-- method ActionGroup::get_action_state_type
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "ActionGroup", 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" "ActionGroup", 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 "GLib" "VariantType"
-- throws : False
-- Skip return : False

foreign import ccall "g_action_group_get_action_state_type" g_action_group_get_action_state_type :: 
    Ptr ActionGroup ->                      -- _obj : TInterface "Gio" "ActionGroup"
    CString ->                              -- action_name : TBasicType TUTF8
    IO (Ptr GLib.VariantType)


actionGroupGetActionStateType ::
    (MonadIO m, ActionGroupK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- action_name
    m GLib.VariantType
actionGroupGetActionStateType _obj action_name = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    action_name' <- textToCString action_name
    result <- g_action_group_get_action_state_type _obj' action_name'
    checkUnexpectedReturnNULL "g_action_group_get_action_state_type" result
    result' <- (newBoxed GLib.VariantType) result
    touchManagedPtr _obj
    freeMem action_name'
    return result'

-- method ActionGroup::has_action
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "ActionGroup", 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" "ActionGroup", 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 TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "g_action_group_has_action" g_action_group_has_action :: 
    Ptr ActionGroup ->                      -- _obj : TInterface "Gio" "ActionGroup"
    CString ->                              -- action_name : TBasicType TUTF8
    IO CInt


actionGroupHasAction ::
    (MonadIO m, ActionGroupK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- action_name
    m Bool
actionGroupHasAction _obj action_name = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    action_name' <- textToCString action_name
    result <- g_action_group_has_action _obj' action_name'
    let result' = (/= 0) result
    touchManagedPtr _obj
    freeMem action_name'
    return result'

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

foreign import ccall "g_action_group_list_actions" g_action_group_list_actions :: 
    Ptr ActionGroup ->                      -- _obj : TInterface "Gio" "ActionGroup"
    IO (Ptr CString)


actionGroupListActions ::
    (MonadIO m, ActionGroupK a) =>
    a ->                                    -- _obj
    m [T.Text]
actionGroupListActions _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_action_group_list_actions _obj'
    checkUnexpectedReturnNULL "g_action_group_list_actions" result
    result' <- unpackZeroTerminatedUTF8CArray result
    mapZeroTerminatedCArray freeMem result
    freeMem result
    touchManagedPtr _obj
    return result'

-- method ActionGroup::query_action
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "ActionGroup", 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},Arg {argName = "enabled", argType = TBasicType TBoolean, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "parameter_type", argType = TInterface "GLib" "VariantType", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "state_type", argType = TInterface "GLib" "VariantType", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "state_hint", argType = TVariant, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "state", argType = TVariant, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "ActionGroup", 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 TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "g_action_group_query_action" g_action_group_query_action :: 
    Ptr ActionGroup ->                      -- _obj : TInterface "Gio" "ActionGroup"
    CString ->                              -- action_name : TBasicType TUTF8
    Ptr CInt ->                             -- enabled : TBasicType TBoolean
    Ptr (Ptr GLib.VariantType) ->           -- parameter_type : TInterface "GLib" "VariantType"
    Ptr (Ptr GLib.VariantType) ->           -- state_type : TInterface "GLib" "VariantType"
    Ptr (Ptr GVariant) ->                   -- state_hint : TVariant
    Ptr (Ptr GVariant) ->                   -- state : TVariant
    IO CInt


actionGroupQueryAction ::
    (MonadIO m, ActionGroupK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- action_name
    m (Bool,Bool,GLib.VariantType,GLib.VariantType,GVariant,GVariant)
actionGroupQueryAction _obj action_name = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    action_name' <- textToCString action_name
    enabled <- allocMem :: IO (Ptr CInt)
    parameter_type <- allocMem :: IO (Ptr (Ptr GLib.VariantType))
    state_type <- allocMem :: IO (Ptr (Ptr GLib.VariantType))
    state_hint <- allocMem :: IO (Ptr (Ptr GVariant))
    state <- allocMem :: IO (Ptr (Ptr GVariant))
    result <- g_action_group_query_action _obj' action_name' enabled parameter_type state_type state_hint state
    let result' = (/= 0) result
    enabled' <- peek enabled
    let enabled'' = (/= 0) enabled'
    parameter_type' <- peek parameter_type
    parameter_type'' <- (wrapBoxed GLib.VariantType) parameter_type'
    state_type' <- peek state_type
    state_type'' <- (wrapBoxed GLib.VariantType) state_type'
    state_hint' <- peek state_hint
    state_hint'' <- wrapGVariantPtr state_hint'
    state' <- peek state
    state'' <- wrapGVariantPtr state'
    touchManagedPtr _obj
    freeMem action_name'
    freeMem enabled
    freeMem parameter_type
    freeMem state_type
    freeMem state_hint
    freeMem state
    return (result', enabled'', parameter_type'', state_type'', state_hint'', state'')