Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
GI.Gio.Objects.SimpleAction
Description
A GSimpleAction
is the obvious simple implementation of the
Action
interface. This is the easiest way to create an action for
purposes of adding it to a SimpleActionGroup
.
Synopsis
- newtype SimpleAction = SimpleAction (ManagedPtr SimpleAction)
- class (GObject o, IsDescendantOf SimpleAction o) => IsSimpleAction o
- toSimpleAction :: (MonadIO m, IsSimpleAction o) => o -> m SimpleAction
- type family ResolveSimpleActionMethod (t :: Symbol) o where ...
- simpleActionNew :: (HasCallStack, MonadIO m) => Text -> Maybe VariantType -> m SimpleAction
- simpleActionNewStateful :: (HasCallStack, MonadIO m) => Text -> Maybe VariantType -> GVariant -> m SimpleAction
- data SimpleActionSetEnabledMethodInfo
- simpleActionSetEnabled :: (HasCallStack, MonadIO m, IsSimpleAction a) => a -> Bool -> m ()
- data SimpleActionSetStateMethodInfo
- simpleActionSetState :: (HasCallStack, MonadIO m, IsSimpleAction a) => a -> GVariant -> m ()
- data SimpleActionSetStateHintMethodInfo
- simpleActionSetStateHint :: (HasCallStack, MonadIO m, IsSimpleAction a) => a -> Maybe GVariant -> m ()
- data SimpleActionEnabledPropertyInfo
- constructSimpleActionEnabled :: (IsSimpleAction o, MonadIO m) => Bool -> m (GValueConstruct o)
- getSimpleActionEnabled :: (MonadIO m, IsSimpleAction o) => o -> m Bool
- setSimpleActionEnabled :: (MonadIO m, IsSimpleAction o) => o -> Bool -> m ()
- simpleActionEnabled :: AttrLabelProxy "enabled"
- data SimpleActionNamePropertyInfo
- constructSimpleActionName :: (IsSimpleAction o, MonadIO m) => Text -> m (GValueConstruct o)
- getSimpleActionName :: (MonadIO m, IsSimpleAction o) => o -> m (Maybe Text)
- simpleActionName :: AttrLabelProxy "name"
- data SimpleActionParameterTypePropertyInfo
- constructSimpleActionParameterType :: (IsSimpleAction o, MonadIO m) => VariantType -> m (GValueConstruct o)
- getSimpleActionParameterType :: (MonadIO m, IsSimpleAction o) => o -> m (Maybe VariantType)
- simpleActionParameterType :: AttrLabelProxy "parameterType"
- data SimpleActionStatePropertyInfo
- constructSimpleActionState :: (IsSimpleAction o, MonadIO m) => GVariant -> m (GValueConstruct o)
- getSimpleActionState :: (MonadIO m, IsSimpleAction o) => o -> m (Maybe GVariant)
- setSimpleActionState :: (MonadIO m, IsSimpleAction o) => o -> GVariant -> m ()
- simpleActionState :: AttrLabelProxy "state"
- data SimpleActionStateTypePropertyInfo
- getSimpleActionStateType :: (MonadIO m, IsSimpleAction o) => o -> m (Maybe VariantType)
- simpleActionStateType :: AttrLabelProxy "stateType"
- type SimpleActionActivateCallback = Maybe GVariant -> IO ()
- data SimpleActionActivateSignalInfo
- afterSimpleActionActivate :: (IsSimpleAction a, MonadIO m) => a -> ((?self :: a) => SimpleActionActivateCallback) -> m SignalHandlerId
- onSimpleActionActivate :: (IsSimpleAction a, MonadIO m) => a -> ((?self :: a) => SimpleActionActivateCallback) -> m SignalHandlerId
- type SimpleActionChangeStateCallback = Maybe GVariant -> IO ()
- data SimpleActionChangeStateSignalInfo
- afterSimpleActionChangeState :: (IsSimpleAction a, MonadIO m) => a -> ((?self :: a) => SimpleActionChangeStateCallback) -> m SignalHandlerId
- onSimpleActionChangeState :: (IsSimpleAction a, MonadIO m) => a -> ((?self :: a) => SimpleActionChangeStateCallback) -> m SignalHandlerId
Exported types
newtype SimpleAction Source #
Memory-managed wrapper type.
Constructors
SimpleAction (ManagedPtr SimpleAction) |
Instances
class (GObject o, IsDescendantOf SimpleAction o) => IsSimpleAction o Source #
Type class for types which can be safely cast to SimpleAction
, for instance with toSimpleAction
.
Instances
(GObject o, IsDescendantOf SimpleAction o) => IsSimpleAction o Source # | |
Defined in GI.Gio.Objects.SimpleAction |
toSimpleAction :: (MonadIO m, IsSimpleAction o) => o -> m SimpleAction Source #
Cast to SimpleAction
, for types for which this is known to be safe. For general casts, use castTo
.
Methods
Click to display all available methods, including inherited ones
Methods
activate, bindProperty, bindPropertyFull, changeState, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getData, getEnabled, getName, getParameterType, getProperty, getQdata, getState, getStateHint, getStateType.
Setters
setData, setDataFull, setEnabled, setProperty, setState, setStateHint.
type family ResolveSimpleActionMethod (t :: Symbol) o where ... Source #
Equations
new
Arguments
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Maybe VariantType |
|
-> m SimpleAction | Returns: a new |
Creates a new action.
The created action is stateless. See simpleActionNewStateful
to create
an action that has state.
Since: 2.28
newStateful
simpleActionNewStateful Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Maybe VariantType |
|
-> GVariant |
|
-> m SimpleAction | Returns: a new |
Creates a new stateful action.
All future state values must have the same VariantType
as the initial
state
.
If the state
GVariant
is floating, it is consumed.
Since: 2.28
setEnabled
data SimpleActionSetEnabledMethodInfo Source #
Instances
(signature ~ (Bool -> m ()), MonadIO m, IsSimpleAction a) => OverloadedMethod SimpleActionSetEnabledMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.SimpleAction Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SimpleActionSetEnabledMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.SimpleAction Methods |
simpleActionSetEnabled Source #
Arguments
:: (HasCallStack, MonadIO m, IsSimpleAction a) | |
=> a |
|
-> Bool |
|
-> m () |
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
setState
data SimpleActionSetStateMethodInfo Source #
Instances
(signature ~ (GVariant -> m ()), MonadIO m, IsSimpleAction a) => OverloadedMethod SimpleActionSetStateMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.SimpleAction Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SimpleActionSetStateMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.SimpleAction Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSimpleAction a) | |
=> a |
|
-> GVariant |
|
-> m () |
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 actionChangeState
to
request the change.
If the value
GVariant is floating, it is consumed.
Since: 2.30
setStateHint
data SimpleActionSetStateHintMethodInfo Source #
Instances
(signature ~ (Maybe GVariant -> m ()), MonadIO m, IsSimpleAction a) => OverloadedMethod SimpleActionSetStateHintMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.SimpleAction Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SimpleActionSetStateHintMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.SimpleAction Methods |
simpleActionSetStateHint Source #
Arguments
:: (HasCallStack, MonadIO m, IsSimpleAction a) | |
=> a |
|
-> Maybe GVariant |
|
-> m () |
Sets the state hint for the action.
See actionGetStateHint
for more information about
action state hints.
Since: 2.44
Properties
enabled
If action
is currently enabled.
If the action is disabled then calls to actionActivate
and
actionChangeState
have no effect.
Since: 2.28
data SimpleActionEnabledPropertyInfo Source #
Instances
constructSimpleActionEnabled :: (IsSimpleAction o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “enabled
” property. This is rarely needed directly, but it is used by new
.
getSimpleActionEnabled :: (MonadIO m, IsSimpleAction o) => o -> m Bool Source #
Get the value of the “enabled
” property.
When overloading is enabled, this is equivalent to
get
simpleAction #enabled
setSimpleActionEnabled :: (MonadIO m, IsSimpleAction o) => o -> Bool -> m () Source #
Set the value of the “enabled
” property.
When overloading is enabled, this is equivalent to
set
simpleAction [ #enabled:=
value ]
simpleActionEnabled :: AttrLabelProxy "enabled" Source #
name
The name of the action. This is mostly meaningful for identifying
the action once it has been added to a SimpleActionGroup
.
Since: 2.28
data SimpleActionNamePropertyInfo Source #
Instances
AttrInfo SimpleActionNamePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.SimpleAction Associated Types
Methods attrGet :: AttrBaseTypeConstraint SimpleActionNamePropertyInfo o => o -> IO (AttrGetType SimpleActionNamePropertyInfo) # attrSet :: (AttrBaseTypeConstraint SimpleActionNamePropertyInfo o, AttrSetTypeConstraint SimpleActionNamePropertyInfo b) => o -> b -> IO () # attrClear :: AttrBaseTypeConstraint SimpleActionNamePropertyInfo o => o -> IO () # attrConstruct :: (AttrBaseTypeConstraint SimpleActionNamePropertyInfo o, AttrSetTypeConstraint SimpleActionNamePropertyInfo b) => b -> IO (GValueConstruct o) # attrTransfer :: (AttrBaseTypeConstraint SimpleActionNamePropertyInfo o, AttrTransferTypeConstraint SimpleActionNamePropertyInfo b) => Proxy o -> b -> IO (AttrTransferType SimpleActionNamePropertyInfo) # | |||||||||||||||||||||||||||||||||
type AttrAllowedOps SimpleActionNamePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.SimpleAction | |||||||||||||||||||||||||||||||||
type AttrBaseTypeConstraint SimpleActionNamePropertyInfo Source # | |||||||||||||||||||||||||||||||||
type AttrGetType SimpleActionNamePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.SimpleAction | |||||||||||||||||||||||||||||||||
type AttrLabel SimpleActionNamePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.SimpleAction | |||||||||||||||||||||||||||||||||
type AttrOrigin SimpleActionNamePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.SimpleAction | |||||||||||||||||||||||||||||||||
type AttrSetTypeConstraint SimpleActionNamePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.SimpleAction | |||||||||||||||||||||||||||||||||
type AttrTransferType SimpleActionNamePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.SimpleAction | |||||||||||||||||||||||||||||||||
type AttrTransferTypeConstraint SimpleActionNamePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.SimpleAction |
constructSimpleActionName :: (IsSimpleAction o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “name
” property. This is rarely needed directly, but it is used by new
.
getSimpleActionName :: (MonadIO m, IsSimpleAction o) => o -> m (Maybe Text) Source #
Get the value of the “name
” property.
When overloading is enabled, this is equivalent to
get
simpleAction #name
simpleActionName :: AttrLabelProxy "name" Source #
parameterType
The type of the parameter that must be given when activating the action.
Since: 2.28
data SimpleActionParameterTypePropertyInfo Source #
Instances
AttrInfo SimpleActionParameterTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.SimpleAction Associated Types
Methods attrGet :: AttrBaseTypeConstraint SimpleActionParameterTypePropertyInfo o => o -> IO (AttrGetType SimpleActionParameterTypePropertyInfo) # attrSet :: (AttrBaseTypeConstraint SimpleActionParameterTypePropertyInfo o, AttrSetTypeConstraint SimpleActionParameterTypePropertyInfo b) => o -> b -> IO () # attrClear :: AttrBaseTypeConstraint SimpleActionParameterTypePropertyInfo o => o -> IO () # attrConstruct :: (AttrBaseTypeConstraint SimpleActionParameterTypePropertyInfo o, AttrSetTypeConstraint SimpleActionParameterTypePropertyInfo b) => b -> IO (GValueConstruct o) # attrTransfer :: (AttrBaseTypeConstraint SimpleActionParameterTypePropertyInfo o, AttrTransferTypeConstraint SimpleActionParameterTypePropertyInfo b) => Proxy o -> b -> IO (AttrTransferType SimpleActionParameterTypePropertyInfo) # | |||||||||||||||||||||||||||||||||
type AttrAllowedOps SimpleActionParameterTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.SimpleAction | |||||||||||||||||||||||||||||||||
type AttrBaseTypeConstraint SimpleActionParameterTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
type AttrGetType SimpleActionParameterTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
type AttrLabel SimpleActionParameterTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.SimpleAction | |||||||||||||||||||||||||||||||||
type AttrOrigin SimpleActionParameterTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
type AttrSetTypeConstraint SimpleActionParameterTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
type AttrTransferType SimpleActionParameterTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
type AttrTransferTypeConstraint SimpleActionParameterTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
constructSimpleActionParameterType :: (IsSimpleAction o, MonadIO m) => VariantType -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “parameter-type
” property. This is rarely needed directly, but it is used by new
.
getSimpleActionParameterType :: (MonadIO m, IsSimpleAction o) => o -> m (Maybe VariantType) Source #
Get the value of the “parameter-type
” property.
When overloading is enabled, this is equivalent to
get
simpleAction #parameterType
simpleActionParameterType :: AttrLabelProxy "parameterType" Source #
state
The state of the action, or Nothing
if the action is stateless.
Since: 2.28
data SimpleActionStatePropertyInfo Source #
Instances
AttrInfo SimpleActionStatePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.SimpleAction Associated Types
Methods attrGet :: AttrBaseTypeConstraint SimpleActionStatePropertyInfo o => o -> IO (AttrGetType SimpleActionStatePropertyInfo) # attrSet :: (AttrBaseTypeConstraint SimpleActionStatePropertyInfo o, AttrSetTypeConstraint SimpleActionStatePropertyInfo b) => o -> b -> IO () # attrClear :: AttrBaseTypeConstraint SimpleActionStatePropertyInfo o => o -> IO () # attrConstruct :: (AttrBaseTypeConstraint SimpleActionStatePropertyInfo o, AttrSetTypeConstraint SimpleActionStatePropertyInfo b) => b -> IO (GValueConstruct o) # attrTransfer :: (AttrBaseTypeConstraint SimpleActionStatePropertyInfo o, AttrTransferTypeConstraint SimpleActionStatePropertyInfo b) => Proxy o -> b -> IO (AttrTransferType SimpleActionStatePropertyInfo) # | |||||||||||||||||||||||||||||||||
type AttrAllowedOps SimpleActionStatePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.SimpleAction | |||||||||||||||||||||||||||||||||
type AttrBaseTypeConstraint SimpleActionStatePropertyInfo Source # | |||||||||||||||||||||||||||||||||
type AttrGetType SimpleActionStatePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.SimpleAction | |||||||||||||||||||||||||||||||||
type AttrLabel SimpleActionStatePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.SimpleAction | |||||||||||||||||||||||||||||||||
type AttrOrigin SimpleActionStatePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.SimpleAction | |||||||||||||||||||||||||||||||||
type AttrSetTypeConstraint SimpleActionStatePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.SimpleAction | |||||||||||||||||||||||||||||||||
type AttrTransferType SimpleActionStatePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.SimpleAction | |||||||||||||||||||||||||||||||||
type AttrTransferTypeConstraint SimpleActionStatePropertyInfo Source # | |||||||||||||||||||||||||||||||||
constructSimpleActionState :: (IsSimpleAction o, MonadIO m) => GVariant -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “state
” property. This is rarely needed directly, but it is used by new
.
getSimpleActionState :: (MonadIO m, IsSimpleAction o) => o -> m (Maybe GVariant) Source #
Get the value of the “state
” property.
When overloading is enabled, this is equivalent to
get
simpleAction #state
setSimpleActionState :: (MonadIO m, IsSimpleAction o) => o -> GVariant -> m () Source #
Set the value of the “state
” property.
When overloading is enabled, this is equivalent to
set
simpleAction [ #state:=
value ]
simpleActionState :: AttrLabelProxy "state" Source #
stateType
The VariantType
of the state that the action has, or Nothing
if the
action is stateless.
Since: 2.28
data SimpleActionStateTypePropertyInfo Source #
Instances
AttrInfo SimpleActionStateTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.SimpleAction Associated Types
Methods attrGet :: AttrBaseTypeConstraint SimpleActionStateTypePropertyInfo o => o -> IO (AttrGetType SimpleActionStateTypePropertyInfo) # attrSet :: (AttrBaseTypeConstraint SimpleActionStateTypePropertyInfo o, AttrSetTypeConstraint SimpleActionStateTypePropertyInfo b) => o -> b -> IO () # attrClear :: AttrBaseTypeConstraint SimpleActionStateTypePropertyInfo o => o -> IO () # attrConstruct :: (AttrBaseTypeConstraint SimpleActionStateTypePropertyInfo o, AttrSetTypeConstraint SimpleActionStateTypePropertyInfo b) => b -> IO (GValueConstruct o) # attrTransfer :: (AttrBaseTypeConstraint SimpleActionStateTypePropertyInfo o, AttrTransferTypeConstraint SimpleActionStateTypePropertyInfo b) => Proxy o -> b -> IO (AttrTransferType SimpleActionStateTypePropertyInfo) # | |||||||||||||||||||||||||||||||||
type AttrAllowedOps SimpleActionStateTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.SimpleAction | |||||||||||||||||||||||||||||||||
type AttrBaseTypeConstraint SimpleActionStateTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
type AttrGetType SimpleActionStateTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.SimpleAction | |||||||||||||||||||||||||||||||||
type AttrLabel SimpleActionStateTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.SimpleAction | |||||||||||||||||||||||||||||||||
type AttrOrigin SimpleActionStateTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.SimpleAction | |||||||||||||||||||||||||||||||||
type AttrSetTypeConstraint SimpleActionStateTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.SimpleAction | |||||||||||||||||||||||||||||||||
type AttrTransferType SimpleActionStateTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.SimpleAction | |||||||||||||||||||||||||||||||||
type AttrTransferTypeConstraint SimpleActionStateTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.SimpleAction |
getSimpleActionStateType :: (MonadIO m, IsSimpleAction o) => o -> m (Maybe VariantType) Source #
Get the value of the “state-type
” property.
When overloading is enabled, this is equivalent to
get
simpleAction #stateType
simpleActionStateType :: AttrLabelProxy "stateType" Source #
Signals
activate
type SimpleActionActivateCallback Source #
Arguments
= Maybe GVariant |
|
-> IO () |
Indicates that the action was just activated.
parameter
will always be of the expected type, i.e. the parameter type
specified when the action was created. If an incorrect type is given when
activating the action, this signal is not emitted.
Since GLib 2.40, if no handler is connected to this signal then the
default behaviour for boolean-stated actions with a Nothing
parameter
type is to toggle them via the SimpleAction::changeState signal.
For stateful actions where the state type is equal to the parameter
type, the default is to forward them directly to
SimpleAction::changeState. This should allow almost all users
of SimpleAction
to connect only one handler or the other.
Since: 2.28
data SimpleActionActivateSignalInfo Source #
Instances
SignalInfo SimpleActionActivateSignalInfo Source # | |||||
Defined in GI.Gio.Objects.SimpleAction Associated Types
Methods connectSignal :: GObject o => o -> (o -> HaskellCallbackType SimpleActionActivateSignalInfo) -> SignalConnectMode -> Maybe Text -> IO SignalHandlerId # | |||||
type HaskellCallbackType SimpleActionActivateSignalInfo Source # | |||||
afterSimpleActionActivate :: (IsSimpleAction a, MonadIO m) => a -> ((?self :: a) => SimpleActionActivateCallback) -> m SignalHandlerId Source #
Connect a signal handler for the activate signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
simpleAction #activate callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onSimpleActionActivate :: (IsSimpleAction a, MonadIO m) => a -> ((?self :: a) => SimpleActionActivateCallback) -> m SignalHandlerId Source #
Connect a signal handler for the activate signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
simpleAction #activate callback
changeState
type SimpleActionChangeStateCallback Source #
Indicates that the action just received a request to change its state.
value
will always be of the correct state type, i.e. the type of the
initial state passed to simpleActionNewStateful
. If an incorrect
type is given when requesting to change the state, this signal is not
emitted.
If no handler is connected to this signal then the default
behaviour is to call simpleActionSetState
to set the state
to the requested value. If you connect a signal handler then no
default action is taken. If the state should change then you must
call simpleActionSetState
from the handler.
An example of a 'change-state' handler:
C code
static void change_volume_state (GSimpleAction *action, GVariant *value, gpointer user_data) { gint requested; requested = g_variant_get_int32 (value); // Volume only goes from 0 to 10 if (0 <= requested && requested <= 10) g_simple_action_set_state (action, value); }
The handler need not set the state to the requested value. It could set it to any value at all, or take some other action.
Since: 2.30
data SimpleActionChangeStateSignalInfo Source #
Instances
SignalInfo SimpleActionChangeStateSignalInfo Source # | |||||
Defined in GI.Gio.Objects.SimpleAction Associated Types
Methods connectSignal :: GObject o => o -> (o -> HaskellCallbackType SimpleActionChangeStateSignalInfo) -> SignalConnectMode -> Maybe Text -> IO SignalHandlerId # | |||||
type HaskellCallbackType SimpleActionChangeStateSignalInfo Source # | |||||
afterSimpleActionChangeState :: (IsSimpleAction a, MonadIO m) => a -> ((?self :: a) => SimpleActionChangeStateCallback) -> m SignalHandlerId Source #
Connect a signal handler for the changeState signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
simpleAction #changeState callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onSimpleActionChangeState :: (IsSimpleAction a, MonadIO m) => a -> ((?self :: a) => SimpleActionChangeStateCallback) -> m SignalHandlerId Source #
Connect a signal handler for the changeState signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
simpleAction #changeState callback