gi-gio
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

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

Exported types

newtype SimpleAction Source #

Memory-managed wrapper type.

Instances

Instances details
Eq SimpleAction Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

GObject SimpleAction Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

ManagedPtrNewtype SimpleAction Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

TypedObject SimpleAction Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

Methods

glibType :: IO GType #

HasParentTypes SimpleAction Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

HasAttributeList SimpleAction Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

(info ~ ResolveSimpleActionMethod t SimpleAction, OverloadedMethod info SimpleAction p, HasField t SimpleAction p) => HasField (t :: Symbol) SimpleAction (p :: Type) Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

Methods

getField :: SimpleAction -> p #

(info ~ ResolveSimpleActionMethod t SimpleAction, OverloadedMethodInfo info SimpleAction) => IsLabel t (MethodProxy info SimpleAction) Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

(info ~ ResolveSimpleActionMethod t SimpleAction, OverloadedMethod info SimpleAction p) => IsLabel t (SimpleAction -> p) Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

Methods

fromLabel :: SimpleAction -> p #

IsGValue (Maybe SimpleAction) Source #

Convert SimpleAction to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttributeList SimpleAction Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type ParentTypes SimpleAction Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type SignalList SimpleAction Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

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

Instances details
(GObject o, IsDescendantOf SimpleAction o) => IsSimpleAction o Source # 
Instance details

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

type family ResolveSimpleActionMethod (t :: Symbol) o where ... Source #

Equations

ResolveSimpleActionMethod "activate" o = ActionActivateMethodInfo 
ResolveSimpleActionMethod "bindProperty" o = ObjectBindPropertyMethodInfo 
ResolveSimpleActionMethod "bindPropertyFull" o = ObjectBindPropertyFullMethodInfo 
ResolveSimpleActionMethod "changeState" o = ActionChangeStateMethodInfo 
ResolveSimpleActionMethod "forceFloating" o = ObjectForceFloatingMethodInfo 
ResolveSimpleActionMethod "freezeNotify" o = ObjectFreezeNotifyMethodInfo 
ResolveSimpleActionMethod "getv" o = ObjectGetvMethodInfo 
ResolveSimpleActionMethod "isFloating" o = ObjectIsFloatingMethodInfo 
ResolveSimpleActionMethod "notify" o = ObjectNotifyMethodInfo 
ResolveSimpleActionMethod "notifyByPspec" o = ObjectNotifyByPspecMethodInfo 
ResolveSimpleActionMethod "ref" o = ObjectRefMethodInfo 
ResolveSimpleActionMethod "refSink" o = ObjectRefSinkMethodInfo 
ResolveSimpleActionMethod "runDispose" o = ObjectRunDisposeMethodInfo 
ResolveSimpleActionMethod "stealData" o = ObjectStealDataMethodInfo 
ResolveSimpleActionMethod "stealQdata" o = ObjectStealQdataMethodInfo 
ResolveSimpleActionMethod "thawNotify" o = ObjectThawNotifyMethodInfo 
ResolveSimpleActionMethod "unref" o = ObjectUnrefMethodInfo 
ResolveSimpleActionMethod "watchClosure" o = ObjectWatchClosureMethodInfo 
ResolveSimpleActionMethod "getData" o = ObjectGetDataMethodInfo 
ResolveSimpleActionMethod "getEnabled" o = ActionGetEnabledMethodInfo 
ResolveSimpleActionMethod "getName" o = ActionGetNameMethodInfo 
ResolveSimpleActionMethod "getParameterType" o = ActionGetParameterTypeMethodInfo 
ResolveSimpleActionMethod "getProperty" o = ObjectGetPropertyMethodInfo 
ResolveSimpleActionMethod "getQdata" o = ObjectGetQdataMethodInfo 
ResolveSimpleActionMethod "getState" o = ActionGetStateMethodInfo 
ResolveSimpleActionMethod "getStateHint" o = ActionGetStateHintMethodInfo 
ResolveSimpleActionMethod "getStateType" o = ActionGetStateTypeMethodInfo 
ResolveSimpleActionMethod "setData" o = ObjectSetDataMethodInfo 
ResolveSimpleActionMethod "setDataFull" o = ObjectSetDataFullMethodInfo 
ResolveSimpleActionMethod "setEnabled" o = SimpleActionSetEnabledMethodInfo 
ResolveSimpleActionMethod "setProperty" o = ObjectSetPropertyMethodInfo 
ResolveSimpleActionMethod "setState" o = SimpleActionSetStateMethodInfo 
ResolveSimpleActionMethod "setStateHint" o = SimpleActionSetStateHintMethodInfo 
ResolveSimpleActionMethod l o = MethodResolutionFailed l o :: Type 

new

simpleActionNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

name: the name of the action

-> Maybe VariantType

parameterType: the type of parameter that will be passed to handlers for the SimpleAction::activate signal, or Nothing for no parameter

-> m SimpleAction

Returns: a new SimpleAction

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

name: the name of the action

-> Maybe VariantType

parameterType: the type of the parameter that will be passed to handlers for the SimpleAction::activate signal, or Nothing for no parameter

-> GVariant

state: the initial state of the action

-> m SimpleAction

Returns: a new SimpleAction

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

simpleActionSetEnabled Source #

Arguments

:: (HasCallStack, MonadIO m, IsSimpleAction a) 
=> a

simple: a SimpleAction

-> Bool

enabled: whether the action is enabled

-> 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

simpleActionSetState Source #

Arguments

:: (HasCallStack, MonadIO m, IsSimpleAction a) 
=> a

simple: a SimpleAction

-> GVariant

value: the new GVariant for the state

-> 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

simpleActionSetStateHint Source #

Arguments

:: (HasCallStack, MonadIO m, IsSimpleAction a) 
=> a

simple: a SimpleAction

-> Maybe GVariant

stateHint: a GVariant representing the state hint

-> 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

Instances details
AttrInfo SimpleActionEnabledPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrAllowedOps SimpleActionEnabledPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrBaseTypeConstraint SimpleActionEnabledPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrGetType SimpleActionEnabledPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrLabel SimpleActionEnabledPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrOrigin SimpleActionEnabledPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrSetTypeConstraint SimpleActionEnabledPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrTransferType SimpleActionEnabledPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrTransferTypeConstraint SimpleActionEnabledPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

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 ]

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

Instances details
AttrInfo SimpleActionNamePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrAllowedOps SimpleActionNamePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrBaseTypeConstraint SimpleActionNamePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrGetType SimpleActionNamePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrLabel SimpleActionNamePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrOrigin SimpleActionNamePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrSetTypeConstraint SimpleActionNamePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrTransferType SimpleActionNamePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrTransferTypeConstraint SimpleActionNamePropertyInfo Source # 
Instance details

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

parameterType

The type of the parameter that must be given when activating the action.

Since: 2.28

data SimpleActionParameterTypePropertyInfo Source #

Instances

Instances details
AttrInfo SimpleActionParameterTypePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

Associated Types

type AttrAllowedOps SimpleActionParameterTypePropertyInfo 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrBaseTypeConstraint SimpleActionParameterTypePropertyInfo 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrGetType SimpleActionParameterTypePropertyInfo 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrSetTypeConstraint SimpleActionParameterTypePropertyInfo 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrTransferTypeConstraint SimpleActionParameterTypePropertyInfo 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrTransferType SimpleActionParameterTypePropertyInfo 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrLabel SimpleActionParameterTypePropertyInfo 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrOrigin SimpleActionParameterTypePropertyInfo 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrAllowedOps SimpleActionParameterTypePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrBaseTypeConstraint SimpleActionParameterTypePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrGetType SimpleActionParameterTypePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrLabel SimpleActionParameterTypePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrOrigin SimpleActionParameterTypePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrSetTypeConstraint SimpleActionParameterTypePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrTransferType SimpleActionParameterTypePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrTransferTypeConstraint SimpleActionParameterTypePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

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

state

The state of the action, or Nothing if the action is stateless.

Since: 2.28

data SimpleActionStatePropertyInfo Source #

Instances

Instances details
AttrInfo SimpleActionStatePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrAllowedOps SimpleActionStatePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrBaseTypeConstraint SimpleActionStatePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrGetType SimpleActionStatePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrLabel SimpleActionStatePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrOrigin SimpleActionStatePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrSetTypeConstraint SimpleActionStatePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrTransferType SimpleActionStatePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrTransferTypeConstraint SimpleActionStatePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

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 ]

stateType

The VariantType of the state that the action has, or Nothing if the action is stateless.

Since: 2.28

data SimpleActionStateTypePropertyInfo Source #

Instances

Instances details
AttrInfo SimpleActionStateTypePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrAllowedOps SimpleActionStateTypePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrBaseTypeConstraint SimpleActionStateTypePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrGetType SimpleActionStateTypePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrLabel SimpleActionStateTypePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrOrigin SimpleActionStateTypePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrSetTypeConstraint SimpleActionStateTypePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrTransferType SimpleActionStateTypePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SimpleAction

type AttrTransferTypeConstraint SimpleActionStateTypePropertyInfo Source # 
Instance details

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

Signals

activate

type SimpleActionActivateCallback Source #

Arguments

 = Maybe GVariant

parameter: the parameter to the activation, or Nothing if it has no parameter

-> 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

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 #

Arguments

 = Maybe GVariant

value: the requested value for the state

-> IO () 

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

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