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

A 'GI.Gio.Objects.SimpleAction.SimpleAction' is the obvious simple implementation of the 'GI.Gio.Interfaces.Action.Action'
interface. This is the easiest way to create an action for purposes of
adding it to a 'GI.Gio.Objects.SimpleActionGroup.SimpleActionGroup'.

See also @/GtkAction/@.
-}

module GI.Gio.Objects.SimpleAction
    ( 

-- * Exported types
    SimpleAction(..)                        ,
    IsSimpleAction                          ,
    toSimpleAction                          ,
    noSimpleAction                          ,


 -- * Methods
-- ** new #method:new#
    simpleActionNew                         ,


-- ** newStateful #method:newStateful#
    simpleActionNewStateful                 ,


-- ** setEnabled #method:setEnabled#
    SimpleActionSetEnabledMethodInfo        ,
    simpleActionSetEnabled                  ,


-- ** setState #method:setState#
    SimpleActionSetStateMethodInfo          ,
    simpleActionSetState                    ,


-- ** setStateHint #method:setStateHint#
    SimpleActionSetStateHintMethodInfo      ,
    simpleActionSetStateHint                ,




 -- * Properties
-- ** enabled #attr:enabled#
    SimpleActionEnabledPropertyInfo         ,
    constructSimpleActionEnabled            ,
    getSimpleActionEnabled                  ,
    setSimpleActionEnabled                  ,
    simpleActionEnabled                     ,


-- ** name #attr:name#
    SimpleActionNamePropertyInfo            ,
    constructSimpleActionName               ,
    getSimpleActionName                     ,
    simpleActionName                        ,


-- ** parameterType #attr:parameterType#
    SimpleActionParameterTypePropertyInfo   ,
    constructSimpleActionParameterType      ,
    getSimpleActionParameterType            ,
    simpleActionParameterType               ,


-- ** state #attr:state#
    SimpleActionStatePropertyInfo           ,
    constructSimpleActionState              ,
    getSimpleActionState                    ,
    setSimpleActionState                    ,
    simpleActionState                       ,


-- ** stateType #attr:stateType#
    SimpleActionStateTypePropertyInfo       ,
    getSimpleActionStateType                ,
    simpleActionStateType                   ,




 -- * Signals
-- ** activate #signal:activate#
    C_SimpleActionActivateCallback          ,
    SimpleActionActivateCallback            ,
    SimpleActionActivateSignalInfo          ,
    afterSimpleActionActivate               ,
    genClosure_SimpleActionActivate         ,
    mk_SimpleActionActivateCallback         ,
    noSimpleActionActivateCallback          ,
    onSimpleActionActivate                  ,
    wrap_SimpleActionActivateCallback       ,


-- ** changeState #signal:changeState#
    C_SimpleActionChangeStateCallback       ,
    SimpleActionChangeStateCallback         ,
    SimpleActionChangeStateSignalInfo       ,
    afterSimpleActionChangeState            ,
    genClosure_SimpleActionChangeState      ,
    mk_SimpleActionChangeStateCallback      ,
    noSimpleActionChangeStateCallback       ,
    onSimpleActionChangeState               ,
    wrap_SimpleActionChangeStateCallback    ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP

import qualified GI.GLib.Structs.VariantType as GLib.VariantType
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Action as Gio.Action

newtype SimpleAction = SimpleAction (ManagedPtr SimpleAction)
foreign import ccall "g_simple_action_get_type"
    c_g_simple_action_get_type :: IO GType

instance GObject SimpleAction where
    gobjectType _ = c_g_simple_action_get_type
    

class GObject o => IsSimpleAction o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError SimpleAction a) =>
    IsSimpleAction a
#endif
instance IsSimpleAction SimpleAction
instance GObject.Object.IsObject SimpleAction
instance Gio.Action.IsAction SimpleAction

toSimpleAction :: IsSimpleAction o => o -> IO SimpleAction
toSimpleAction = unsafeCastTo SimpleAction

noSimpleAction :: Maybe SimpleAction
noSimpleAction = Nothing

type family ResolveSimpleActionMethod (t :: Symbol) (o :: *) :: * where
    ResolveSimpleActionMethod "activate" o = Gio.Action.ActionActivateMethodInfo
    ResolveSimpleActionMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveSimpleActionMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveSimpleActionMethod "changeState" o = Gio.Action.ActionChangeStateMethodInfo
    ResolveSimpleActionMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveSimpleActionMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveSimpleActionMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveSimpleActionMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveSimpleActionMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveSimpleActionMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveSimpleActionMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveSimpleActionMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveSimpleActionMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveSimpleActionMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveSimpleActionMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveSimpleActionMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveSimpleActionMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveSimpleActionMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveSimpleActionMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveSimpleActionMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveSimpleActionMethod "getEnabled" o = Gio.Action.ActionGetEnabledMethodInfo
    ResolveSimpleActionMethod "getName" o = Gio.Action.ActionGetNameMethodInfo
    ResolveSimpleActionMethod "getParameterType" o = Gio.Action.ActionGetParameterTypeMethodInfo
    ResolveSimpleActionMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveSimpleActionMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveSimpleActionMethod "getState" o = Gio.Action.ActionGetStateMethodInfo
    ResolveSimpleActionMethod "getStateHint" o = Gio.Action.ActionGetStateHintMethodInfo
    ResolveSimpleActionMethod "getStateType" o = Gio.Action.ActionGetStateTypeMethodInfo
    ResolveSimpleActionMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveSimpleActionMethod "setEnabled" o = SimpleActionSetEnabledMethodInfo
    ResolveSimpleActionMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveSimpleActionMethod "setState" o = SimpleActionSetStateMethodInfo
    ResolveSimpleActionMethod "setStateHint" o = SimpleActionSetStateHintMethodInfo
    ResolveSimpleActionMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveSimpleActionMethod t SimpleAction, O.MethodInfo info SimpleAction p) => O.IsLabelProxy t (SimpleAction -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveSimpleActionMethod t SimpleAction, O.MethodInfo info SimpleAction p) => O.IsLabel t (SimpleAction -> p) where
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

-- signal SimpleAction::activate
type SimpleActionActivateCallback =
    Maybe GVariant ->
    IO ()

noSimpleActionActivateCallback :: Maybe SimpleActionActivateCallback
noSimpleActionActivateCallback = Nothing

type C_SimpleActionActivateCallback =
    Ptr () ->                               -- object
    Ptr GVariant ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_SimpleActionActivateCallback :: C_SimpleActionActivateCallback -> IO (FunPtr C_SimpleActionActivateCallback)

genClosure_SimpleActionActivate :: SimpleActionActivateCallback -> IO Closure
genClosure_SimpleActionActivate cb = do
    let cb' = wrap_SimpleActionActivateCallback cb
    mk_SimpleActionActivateCallback cb' >>= newCClosure


wrap_SimpleActionActivateCallback ::
    SimpleActionActivateCallback ->
    Ptr () ->
    Ptr GVariant ->
    Ptr () ->
    IO ()
wrap_SimpleActionActivateCallback _cb _ parameter _ = do
    maybeParameter <-
        if parameter == nullPtr
        then return Nothing
        else do
            parameter' <- newGVariantFromPtr parameter
            return $ Just parameter'
    _cb  maybeParameter


onSimpleActionActivate :: (GObject a, MonadIO m) => a -> SimpleActionActivateCallback -> m SignalHandlerId
onSimpleActionActivate obj cb = liftIO $ connectSimpleActionActivate obj cb SignalConnectBefore
afterSimpleActionActivate :: (GObject a, MonadIO m) => a -> SimpleActionActivateCallback -> m SignalHandlerId
afterSimpleActionActivate obj cb = connectSimpleActionActivate obj cb SignalConnectAfter

connectSimpleActionActivate :: (GObject a, MonadIO m) =>
                               a -> SimpleActionActivateCallback -> SignalConnectMode -> m SignalHandlerId
connectSimpleActionActivate obj cb after = liftIO $ do
    let cb' = wrap_SimpleActionActivateCallback cb
    cb'' <- mk_SimpleActionActivateCallback cb'
    connectSignalFunPtr obj "activate" cb'' after

-- signal SimpleAction::change-state
type SimpleActionChangeStateCallback =
    Maybe GVariant ->
    IO ()

noSimpleActionChangeStateCallback :: Maybe SimpleActionChangeStateCallback
noSimpleActionChangeStateCallback = Nothing

type C_SimpleActionChangeStateCallback =
    Ptr () ->                               -- object
    Ptr GVariant ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_SimpleActionChangeStateCallback :: C_SimpleActionChangeStateCallback -> IO (FunPtr C_SimpleActionChangeStateCallback)

genClosure_SimpleActionChangeState :: SimpleActionChangeStateCallback -> IO Closure
genClosure_SimpleActionChangeState cb = do
    let cb' = wrap_SimpleActionChangeStateCallback cb
    mk_SimpleActionChangeStateCallback cb' >>= newCClosure


wrap_SimpleActionChangeStateCallback ::
    SimpleActionChangeStateCallback ->
    Ptr () ->
    Ptr GVariant ->
    Ptr () ->
    IO ()
wrap_SimpleActionChangeStateCallback _cb _ value _ = do
    maybeValue <-
        if value == nullPtr
        then return Nothing
        else do
            value' <- newGVariantFromPtr value
            return $ Just value'
    _cb  maybeValue


onSimpleActionChangeState :: (GObject a, MonadIO m) => a -> SimpleActionChangeStateCallback -> m SignalHandlerId
onSimpleActionChangeState obj cb = liftIO $ connectSimpleActionChangeState obj cb SignalConnectBefore
afterSimpleActionChangeState :: (GObject a, MonadIO m) => a -> SimpleActionChangeStateCallback -> m SignalHandlerId
afterSimpleActionChangeState obj cb = connectSimpleActionChangeState obj cb SignalConnectAfter

connectSimpleActionChangeState :: (GObject a, MonadIO m) =>
                                  a -> SimpleActionChangeStateCallback -> SignalConnectMode -> m SignalHandlerId
connectSimpleActionChangeState obj cb after = liftIO $ do
    let cb' = wrap_SimpleActionChangeStateCallback cb
    cb'' <- mk_SimpleActionChangeStateCallback cb'
    connectSignalFunPtr obj "change-state" cb'' after

--- XXX Duplicated object with different types:
  --- Name {namespace = "Gio", name = "SimpleAction"} -> Property {propName = "enabled", propType = TBasicType TBoolean, propFlags = [PropertyReadable,PropertyWritable], propReadNullable = Nothing, propWriteNullable = Nothing, propTransfer = TransferNothing, propDeprecated = Nothing}
  --- Name {namespace = "Gio", name = "Action"} -> Property {propName = "enabled", propType = TBasicType TBoolean, propFlags = [PropertyReadable], propReadNullable = Nothing, propWriteNullable = Nothing, propTransfer = TransferNothing, propDeprecated = Nothing}
--- XXX Duplicated object with different types:
  --- Name {namespace = "Gio", name = "SimpleAction"} -> Property {propName = "name", propType = TBasicType TUTF8, propFlags = [PropertyReadable,PropertyWritable,PropertyConstructOnly], propReadNullable = Nothing, propWriteNullable = Nothing, propTransfer = TransferNothing, propDeprecated = Nothing}
  --- Name {namespace = "Gio", name = "Action"} -> Property {propName = "name", propType = TBasicType TUTF8, propFlags = [PropertyReadable], propReadNullable = Nothing, propWriteNullable = Nothing, propTransfer = TransferNothing, propDeprecated = Nothing}
--- XXX Duplicated object with different types:
  --- Name {namespace = "Gio", name = "SimpleAction"} -> Property {propName = "parameter-type", propType = TInterface (Name {namespace = "GLib", name = "VariantType"}), propFlags = [PropertyReadable,PropertyWritable,PropertyConstructOnly], propReadNullable = Nothing, propWriteNullable = Nothing, propTransfer = TransferNothing, propDeprecated = Nothing}
  --- Name {namespace = "Gio", name = "Action"} -> Property {propName = "parameter-type", propType = TInterface (Name {namespace = "GLib", name = "VariantType"}), propFlags = [PropertyReadable], propReadNullable = Nothing, propWriteNullable = Nothing, propTransfer = TransferNothing, propDeprecated = Nothing}
--- XXX Duplicated object with different types:
  --- Name {namespace = "Gio", name = "SimpleAction"} -> Property {propName = "state", propType = TVariant, propFlags = [PropertyReadable,PropertyWritable,PropertyConstruct], propReadNullable = Nothing, propWriteNullable = Nothing, propTransfer = TransferNothing, propDeprecated = Nothing}
  --- Name {namespace = "Gio", name = "Action"} -> Property {propName = "state", propType = TVariant, propFlags = [PropertyReadable], propReadNullable = Nothing, propWriteNullable = Nothing, propTransfer = TransferNothing, propDeprecated = Nothing}
-- VVV Prop "enabled"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Just False)

getSimpleActionEnabled :: (MonadIO m, IsSimpleAction o) => o -> m Bool
getSimpleActionEnabled obj = liftIO $ getObjectPropertyBool obj "enabled"

setSimpleActionEnabled :: (MonadIO m, IsSimpleAction o) => o -> Bool -> m ()
setSimpleActionEnabled obj val = liftIO $ setObjectPropertyBool obj "enabled" val

constructSimpleActionEnabled :: (IsSimpleAction o) => Bool -> IO (GValueConstruct o)
constructSimpleActionEnabled val = constructObjectPropertyBool "enabled" val

data SimpleActionEnabledPropertyInfo
instance AttrInfo SimpleActionEnabledPropertyInfo where
    type AttrAllowedOps SimpleActionEnabledPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint SimpleActionEnabledPropertyInfo = (~) Bool
    type AttrBaseTypeConstraint SimpleActionEnabledPropertyInfo = IsSimpleAction
    type AttrGetType SimpleActionEnabledPropertyInfo = Bool
    type AttrLabel SimpleActionEnabledPropertyInfo = "enabled"
    type AttrOrigin SimpleActionEnabledPropertyInfo = SimpleAction
    attrGet _ = getSimpleActionEnabled
    attrSet _ = setSimpleActionEnabled
    attrConstruct _ = constructSimpleActionEnabled
    attrClear _ = undefined

-- VVV Prop "name"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

getSimpleActionName :: (MonadIO m, IsSimpleAction o) => o -> m (Maybe T.Text)
getSimpleActionName obj = liftIO $ getObjectPropertyString obj "name"

constructSimpleActionName :: (IsSimpleAction o) => T.Text -> IO (GValueConstruct o)
constructSimpleActionName val = constructObjectPropertyString "name" (Just val)

data SimpleActionNamePropertyInfo
instance AttrInfo SimpleActionNamePropertyInfo where
    type AttrAllowedOps SimpleActionNamePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint SimpleActionNamePropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint SimpleActionNamePropertyInfo = IsSimpleAction
    type AttrGetType SimpleActionNamePropertyInfo = (Maybe T.Text)
    type AttrLabel SimpleActionNamePropertyInfo = "name"
    type AttrOrigin SimpleActionNamePropertyInfo = SimpleAction
    attrGet _ = getSimpleActionName
    attrSet _ = undefined
    attrConstruct _ = constructSimpleActionName
    attrClear _ = undefined

-- VVV Prop "parameter-type"
   -- Type: TInterface (Name {namespace = "GLib", name = "VariantType"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

getSimpleActionParameterType :: (MonadIO m, IsSimpleAction o) => o -> m (Maybe GLib.VariantType.VariantType)
getSimpleActionParameterType obj = liftIO $ getObjectPropertyBoxed obj "parameter-type" GLib.VariantType.VariantType

constructSimpleActionParameterType :: (IsSimpleAction o) => GLib.VariantType.VariantType -> IO (GValueConstruct o)
constructSimpleActionParameterType val = constructObjectPropertyBoxed "parameter-type" (Just val)

data SimpleActionParameterTypePropertyInfo
instance AttrInfo SimpleActionParameterTypePropertyInfo where
    type AttrAllowedOps SimpleActionParameterTypePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint SimpleActionParameterTypePropertyInfo = (~) GLib.VariantType.VariantType
    type AttrBaseTypeConstraint SimpleActionParameterTypePropertyInfo = IsSimpleAction
    type AttrGetType SimpleActionParameterTypePropertyInfo = (Maybe GLib.VariantType.VariantType)
    type AttrLabel SimpleActionParameterTypePropertyInfo = "parameter-type"
    type AttrOrigin SimpleActionParameterTypePropertyInfo = SimpleAction
    attrGet _ = getSimpleActionParameterType
    attrSet _ = undefined
    attrConstruct _ = constructSimpleActionParameterType
    attrClear _ = undefined

-- VVV Prop "state"
   -- Type: TVariant
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
   -- Nullable: (Nothing,Just False)

getSimpleActionState :: (MonadIO m, IsSimpleAction o) => o -> m (Maybe GVariant)
getSimpleActionState obj = liftIO $ getObjectPropertyVariant obj "state"

setSimpleActionState :: (MonadIO m, IsSimpleAction o) => o -> GVariant -> m ()
setSimpleActionState obj val = liftIO $ setObjectPropertyVariant obj "state" (Just val)

constructSimpleActionState :: (IsSimpleAction o) => GVariant -> IO (GValueConstruct o)
constructSimpleActionState val = constructObjectPropertyVariant "state" (Just val)

data SimpleActionStatePropertyInfo
instance AttrInfo SimpleActionStatePropertyInfo where
    type AttrAllowedOps SimpleActionStatePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint SimpleActionStatePropertyInfo = (~) GVariant
    type AttrBaseTypeConstraint SimpleActionStatePropertyInfo = IsSimpleAction
    type AttrGetType SimpleActionStatePropertyInfo = (Maybe GVariant)
    type AttrLabel SimpleActionStatePropertyInfo = "state"
    type AttrOrigin SimpleActionStatePropertyInfo = SimpleAction
    attrGet _ = getSimpleActionState
    attrSet _ = setSimpleActionState
    attrConstruct _ = constructSimpleActionState
    attrClear _ = undefined

-- VVV Prop "state-type"
   -- Type: TInterface (Name {namespace = "GLib", name = "VariantType"})
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

getSimpleActionStateType :: (MonadIO m, IsSimpleAction o) => o -> m (Maybe GLib.VariantType.VariantType)
getSimpleActionStateType obj = liftIO $ getObjectPropertyBoxed obj "state-type" GLib.VariantType.VariantType

data SimpleActionStateTypePropertyInfo
instance AttrInfo SimpleActionStateTypePropertyInfo where
    type AttrAllowedOps SimpleActionStateTypePropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint SimpleActionStateTypePropertyInfo = (~) ()
    type AttrBaseTypeConstraint SimpleActionStateTypePropertyInfo = IsSimpleAction
    type AttrGetType SimpleActionStateTypePropertyInfo = (Maybe GLib.VariantType.VariantType)
    type AttrLabel SimpleActionStateTypePropertyInfo = "state-type"
    type AttrOrigin SimpleActionStateTypePropertyInfo = SimpleAction
    attrGet _ = getSimpleActionStateType
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

instance O.HasAttributeList SimpleAction
type instance O.AttributeList SimpleAction = SimpleActionAttributeList
type SimpleActionAttributeList = ('[ '("enabled", SimpleActionEnabledPropertyInfo), '("name", SimpleActionNamePropertyInfo), '("parameterType", SimpleActionParameterTypePropertyInfo), '("state", SimpleActionStatePropertyInfo), '("stateType", SimpleActionStateTypePropertyInfo)] :: [(Symbol, *)])

simpleActionEnabled :: AttrLabelProxy "enabled"
simpleActionEnabled = AttrLabelProxy

simpleActionName :: AttrLabelProxy "name"
simpleActionName = AttrLabelProxy

simpleActionParameterType :: AttrLabelProxy "parameterType"
simpleActionParameterType = AttrLabelProxy

simpleActionState :: AttrLabelProxy "state"
simpleActionState = AttrLabelProxy

simpleActionStateType :: AttrLabelProxy "stateType"
simpleActionStateType = AttrLabelProxy

data SimpleActionActivateSignalInfo
instance SignalInfo SimpleActionActivateSignalInfo where
    type HaskellCallbackType SimpleActionActivateSignalInfo = SimpleActionActivateCallback
    connectSignal _ = connectSimpleActionActivate

data SimpleActionChangeStateSignalInfo
instance SignalInfo SimpleActionChangeStateSignalInfo where
    type HaskellCallbackType SimpleActionChangeStateSignalInfo = SimpleActionChangeStateCallback
    connectSignal _ = connectSimpleActionChangeState

type instance O.SignalList SimpleAction = SimpleActionSignalList
type SimpleActionSignalList = ('[ '("activate", SimpleActionActivateSignalInfo), '("changeState", SimpleActionChangeStateSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method SimpleAction::new
-- method type : Constructor
-- Args : [Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the action", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parameter_type", argType = TInterface (Name {namespace = "GLib", name = "VariantType"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the type of parameter to the activate function", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "SimpleAction"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_simple_action_new" g_simple_action_new :: 
    CString ->                              -- name : TBasicType TUTF8
    Ptr GLib.VariantType.VariantType ->     -- parameter_type : TInterface (Name {namespace = "GLib", name = "VariantType"})
    IO (Ptr SimpleAction)

{- |
Creates a new action.

The created action is stateless.  See 'GI.Gio.Objects.SimpleAction.simpleActionNewStateful'.

@since 2.28
-}
simpleActionNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@name@/: the name of the action -}
    -> Maybe (GLib.VariantType.VariantType)
    {- ^ /@parameterType@/: the type of parameter to the activate function -}
    -> m SimpleAction
    {- ^ __Returns:__ a new 'GI.Gio.Objects.SimpleAction.SimpleAction' -}
simpleActionNew name parameterType = liftIO $ do
    name' <- textToCString name
    maybeParameterType <- case parameterType of
        Nothing -> return nullPtr
        Just jParameterType -> do
            jParameterType' <- unsafeManagedPtrGetPtr jParameterType
            return jParameterType'
    result <- g_simple_action_new name' maybeParameterType
    checkUnexpectedReturnNULL "simpleActionNew" result
    result' <- (wrapObject SimpleAction) result
    whenJust parameterType touchManagedPtr
    freeMem name'
    return result'

-- method SimpleAction::new_stateful
-- method type : Constructor
-- Args : [Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the action", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parameter_type", argType = TInterface (Name {namespace = "GLib", name = "VariantType"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the type of the parameter to the activate function", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "state", argType = TVariant, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the initial state of the action", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "SimpleAction"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_simple_action_new_stateful" g_simple_action_new_stateful :: 
    CString ->                              -- name : TBasicType TUTF8
    Ptr GLib.VariantType.VariantType ->     -- parameter_type : TInterface (Name {namespace = "GLib", name = "VariantType"})
    Ptr GVariant ->                         -- state : TVariant
    IO (Ptr SimpleAction)

{- |
Creates a new stateful action.

/@state@/ is the initial state of the action.  All future state values
must have the same 'GI.GLib.Structs.VariantType.VariantType' as the initial state.

If the /@state@/ GVariant is floating, it is consumed.

@since 2.28
-}
simpleActionNewStateful ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@name@/: the name of the action -}
    -> Maybe (GLib.VariantType.VariantType)
    {- ^ /@parameterType@/: the type of the parameter to the activate function -}
    -> GVariant
    {- ^ /@state@/: the initial state of the action -}
    -> m SimpleAction
    {- ^ __Returns:__ a new 'GI.Gio.Objects.SimpleAction.SimpleAction' -}
simpleActionNewStateful name parameterType state = liftIO $ do
    name' <- textToCString name
    maybeParameterType <- case parameterType of
        Nothing -> return nullPtr
        Just jParameterType -> do
            jParameterType' <- unsafeManagedPtrGetPtr jParameterType
            return jParameterType'
    state' <- unsafeManagedPtrGetPtr state
    result <- g_simple_action_new_stateful name' maybeParameterType state'
    checkUnexpectedReturnNULL "simpleActionNewStateful" result
    result' <- (wrapObject SimpleAction) result
    whenJust parameterType touchManagedPtr
    touchManagedPtr state
    freeMem name'
    return result'

-- method SimpleAction::set_enabled
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "simple", argType = TInterface (Name {namespace = "Gio", name = "SimpleAction"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GSimpleAction", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "enabled", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "whether the action is enabled", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_simple_action_set_enabled" g_simple_action_set_enabled :: 
    Ptr SimpleAction ->                     -- simple : TInterface (Name {namespace = "Gio", name = "SimpleAction"})
    CInt ->                                 -- enabled : TBasicType TBoolean
    IO ()

{- |
Sets the action as enabled or not.

An action must be enabled in order to be activated or in order to
have its state changed from outside callers.

This should only be called by the implementor of the action.  Users
of the action should not attempt to modify its enabled flag.

@since 2.28
-}
simpleActionSetEnabled ::
    (B.CallStack.HasCallStack, MonadIO m, IsSimpleAction a) =>
    a
    {- ^ /@simple@/: a 'GI.Gio.Objects.SimpleAction.SimpleAction' -}
    -> Bool
    {- ^ /@enabled@/: whether the action is enabled -}
    -> m ()
simpleActionSetEnabled simple enabled = liftIO $ do
    simple' <- unsafeManagedPtrCastPtr simple
    let enabled' = (fromIntegral . fromEnum) enabled
    g_simple_action_set_enabled simple' enabled'
    touchManagedPtr simple
    return ()

data SimpleActionSetEnabledMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsSimpleAction a) => O.MethodInfo SimpleActionSetEnabledMethodInfo a signature where
    overloadedMethod _ = simpleActionSetEnabled

-- method SimpleAction::set_state
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "simple", argType = TInterface (Name {namespace = "Gio", name = "SimpleAction"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GSimpleAction", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TVariant, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new #GVariant for the state", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_simple_action_set_state" g_simple_action_set_state :: 
    Ptr SimpleAction ->                     -- simple : TInterface (Name {namespace = "Gio", name = "SimpleAction"})
    Ptr GVariant ->                         -- value : TVariant
    IO ()

{- |
Sets the state of the action.

This directly updates the \'state\' property to the given value.

This should only be called by the implementor of the action.  Users
of the action should not attempt to directly modify the \'state\'
property.  Instead, they should call 'GI.Gio.Interfaces.Action.actionChangeState' to
request the change.

If the /@value@/ GVariant is floating, it is consumed.

@since 2.30
-}
simpleActionSetState ::
    (B.CallStack.HasCallStack, MonadIO m, IsSimpleAction a) =>
    a
    {- ^ /@simple@/: a 'GI.Gio.Objects.SimpleAction.SimpleAction' -}
    -> GVariant
    {- ^ /@value@/: the new 'GVariant' for the state -}
    -> m ()
simpleActionSetState simple value = liftIO $ do
    simple' <- unsafeManagedPtrCastPtr simple
    value' <- unsafeManagedPtrGetPtr value
    g_simple_action_set_state simple' value'
    touchManagedPtr simple
    touchManagedPtr value
    return ()

data SimpleActionSetStateMethodInfo
instance (signature ~ (GVariant -> m ()), MonadIO m, IsSimpleAction a) => O.MethodInfo SimpleActionSetStateMethodInfo a signature where
    overloadedMethod _ = simpleActionSetState

-- method SimpleAction::set_state_hint
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "simple", argType = TInterface (Name {namespace = "Gio", name = "SimpleAction"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GSimpleAction", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "state_hint", argType = TVariant, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GVariant representing the state hint", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_simple_action_set_state_hint" g_simple_action_set_state_hint :: 
    Ptr SimpleAction ->                     -- simple : TInterface (Name {namespace = "Gio", name = "SimpleAction"})
    Ptr GVariant ->                         -- state_hint : TVariant
    IO ()

{- |
Sets the state hint for the action.

See 'GI.Gio.Interfaces.Action.actionGetStateHint' for more information about
action state hints.

@since 2.44
-}
simpleActionSetStateHint ::
    (B.CallStack.HasCallStack, MonadIO m, IsSimpleAction a) =>
    a
    {- ^ /@simple@/: a 'GI.Gio.Objects.SimpleAction.SimpleAction' -}
    -> Maybe (GVariant)
    {- ^ /@stateHint@/: a 'GVariant' representing the state hint -}
    -> m ()
simpleActionSetStateHint simple stateHint = liftIO $ do
    simple' <- unsafeManagedPtrCastPtr simple
    maybeStateHint <- case stateHint of
        Nothing -> return nullPtr
        Just jStateHint -> do
            jStateHint' <- unsafeManagedPtrGetPtr jStateHint
            return jStateHint'
    g_simple_action_set_state_hint simple' maybeStateHint
    touchManagedPtr simple
    whenJust stateHint touchManagedPtr
    return ()

data SimpleActionSetStateHintMethodInfo
instance (signature ~ (Maybe (GVariant) -> m ()), MonadIO m, IsSimpleAction a) => O.MethodInfo SimpleActionSetStateHintMethodInfo a signature where
    overloadedMethod _ = simpleActionSetStateHint