Class: Gio::SimpleAction
- Inherits:
-
Object
- Object
- Gio::SimpleAction
- Defined in:
- lib/gio2/simple-action.rb
Overview
A GSimpleAction is the obvious simple implementation of the
[ifaceGio.Action] interface. This is the easiest way to create an action for
purposes of adding it to a [classGio.SimpleActionGroup].
Instance Method Summary collapse
-
#enabled=(enabled) ⇒ Boolean
If action is currently enabled.
-
#enabled? ⇒ Boolean
If action is currently enabled.
-
#initialize(name, parameter_type = nil, state = nil) ⇒ Gio::SimpleAction
constructor
Creates a new stateful action.
-
#initialize_raw ⇒ Gio::SimpleAction
Creates a new stateful action.
-
#name ⇒ String
The name of the action.
-
#name=(name) ⇒ String
The name of the action.
-
#parameter_type ⇒ GLib::VariantType
The type of the parameter that must be given when activating the action.
-
#parameter_type=(parameter_type) ⇒ GLib::VariantType
The type of the parameter that must be given when activating the action.
-
#state ⇒ GLib::Variant
The state of the action, or nil if the action is stateless.
-
#state=(state) ⇒ GLib::Variant
The state of the action, or nil if the action is stateless.
-
#state_hint=(state_hint) ⇒ nil
Sets the state hint for the action.
-
#state_type ⇒ GLib::VariantType
The GVariant::Type of the state that the action has, or nil if the action is stateless.
-
#state_type=(state_type) ⇒ GLib::VariantType
The GVariant::Type of the state that the action has, or nil if the action is stateless.
Constructor Details
#initialize(name, parameter_type = nil, state = nil) ⇒ Gio::SimpleAction
Creates a new stateful action.
All future state values must have the same GVariant::Type as the initial state.
If the state #GVariant is floating, it is consumed.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/gio2/simple-action.rb', line 20 def initialize(name, parameter_type=nil, state=nil) if parameter_type.is_a?(String) parameter_type = GLib::VariantType.new(parameter_type) end if state initialize_raw(name, parameter_type, state) else initialize_raw(name, parameter_type) end end |
Instance Method Details
#enabled=(enabled) ⇒ Boolean
If action is currently enabled.
If the action is disabled then calls to g_action_activate() and g_action_change_state() have no effect.
#enabled? ⇒ Boolean
If action is currently enabled.
If the action is disabled then calls to g_action_activate() and g_action_change_state() have no effect.
#initialize_raw ⇒ Gio::SimpleAction
Creates a new stateful action.
All future state values must have the same GVariant::Type as the initial state.
If the state #GVariant is floating, it is consumed.
|
|
# File 'lib/gio2/simple-action.rb', line 19
|
#name ⇒ String
The name of the action. This is mostly meaningful for identifying the action once it has been added to a GSimple::ActionGroup.
#name=(name) ⇒ String
The name of the action. This is mostly meaningful for identifying the action once it has been added to a GSimple::ActionGroup.
#parameter_type ⇒ GLib::VariantType
The type of the parameter that must be given when activating the action.
#parameter_type=(parameter_type) ⇒ GLib::VariantType
The type of the parameter that must be given when activating the action.
#state ⇒ GLib::Variant
The state of the action, or nil if the action is stateless.
#state=(state) ⇒ GLib::Variant
The state of the action, or nil if the action is stateless.
#state_hint=(state_hint) ⇒ nil
Sets the state hint for the action.
See g_action_get_state_hint() for more information about action state hints.
#state_type ⇒ GLib::VariantType
The GVariant::Type of the state that the action has, or nil if the action is stateless.
#state_type=(state_type) ⇒ GLib::VariantType
The GVariant::Type of the state that the action has, or nil if the action is stateless.