[−][src]Trait gio::ActionGroupExt
Trait containing all ActionGroup
methods.
Implementors
ActionGroup
, Application
, RemoteActionGroup
, SimpleActionGroup
Required methods
fn action_added(&self, action_name: &str)
Emits the ActionGroup::action-added
signal on self
.
This function should only be called by ActionGroup
implementations.
action_name
the name of an action in the group
fn action_enabled_changed(&self, action_name: &str, enabled: bool)
Emits the ActionGroup::action-enabled-changed
signal on self
.
This function should only be called by ActionGroup
implementations.
action_name
the name of an action in the group
enabled
whether or not the action is now enabled
fn action_removed(&self, action_name: &str)
Emits the ActionGroup::action-removed
signal on self
.
This function should only be called by ActionGroup
implementations.
action_name
the name of an action in the group
fn action_state_changed(&self, action_name: &str, state: &Variant)
Emits the ActionGroup::action-state-changed
signal on self
.
This function should only be called by ActionGroup
implementations.
action_name
the name of an action in the group
state
the new state of the named action
fn activate_action(&self, action_name: &str, parameter: Option<&Variant>)
Activate the named action within self
.
If the action is expecting a parameter, then the correct type of
parameter must be given as parameter
. If the action is expecting no
parameters then parameter
must be None
. See
ActionGroup::get_action_parameter_type
.
action_name
the name of the action to activate
parameter
parameters to the activation
fn change_action_state(&self, action_name: &str, value: &Variant)
Request for the state of the named action within self
to be
changed to value
.
The action must be stateful and value
must be of the correct type.
See ActionGroup::get_action_state_type
.
This call merely requests a change. The action may refuse to change
its state or may change its state to something other than value
.
See ActionGroup::get_action_state_hint
.
If the value
GVariant is floating, it is consumed.
action_name
the name of the action to request the change on
value
the new state
fn get_action_enabled(&self, action_name: &str) -> bool
Checks if the named action within self
is currently enabled.
An action must be enabled in order to be activated or in order to have its state changed from outside callers.
action_name
the name of the action to query
Returns
whether or not the action is currently enabled
fn get_action_parameter_type(&self, action_name: &str) -> Option<VariantType>
Queries the type of the parameter that must be given when activating
the named action within self
.
When activating the action using ActionGroup::activate_action
,
the glib::Variant
given to that function must be of the type returned
by this function.
In the case that this function returns None
, you must not give any
glib::Variant
, but None
instead.
The parameter type of a particular action will never change but it is possible for an action to be removed and for a new action to be added with the same name but a different parameter type.
action_name
the name of the action to query
Returns
the parameter type
fn get_action_state(&self, action_name: &str) -> Option<Variant>
Queries the current state of the named action within self
.
If the action is not stateful then None
will be returned. If the
action is stateful then the type of the return value is the type
given by ActionGroup::get_action_state_type
.
The return value (if non-None
) should be freed with
glib::Variant::unref
when it is no longer required.
action_name
the name of the action to query
Returns
the current state of the action
fn get_action_state_hint(&self, action_name: &str) -> Option<Variant>
Requests a hint about the valid range of values for the state of the
named action within self
.
If None
is returned it either means that the action is not stateful
or that there is no hint about the valid range of values for the
state of the action.
If a glib::Variant
array is returned then each item in the array is a
possible value for the state. If a glib::Variant
pair (ie: two-tuple) is
returned then the tuple specifies the inclusive lower and upper bound
of valid values for the state.
In any case, the information is merely a hint. It may be possible to have a state value outside of the hinted range and setting a value within the range may fail.
The return value (if non-None
) should be freed with
glib::Variant::unref
when it is no longer required.
action_name
the name of the action to query
Returns
the state range hint
fn get_action_state_type(&self, action_name: &str) -> Option<VariantType>
Queries the type of the state of the named action within
self
.
If the action is stateful then this function returns the
glib::VariantType
of the state. All calls to
ActionGroup::change_action_state
must give a glib::Variant
of this
type and ActionGroup::get_action_state
will return a glib::Variant
of the same type.
If the action is not stateful then this function will return None
.
In that case, ActionGroup::get_action_state
will return None
and you must not call ActionGroup::change_action_state
.
The state type of a particular action will never change but it is possible for an action to be removed and for a new action to be added with the same name but a different state type.
action_name
the name of the action to query
Returns
the state type, if the action is stateful
fn has_action(&self, action_name: &str) -> bool
Checks if the named action exists within self
.
action_name
the name of the action to check for
Returns
whether the named action exists
fn list_actions(&self) -> Vec<GString>
Lists the actions contained within self
.
The caller is responsible for freeing the list with g_strfreev
when
it is no longer required.
Returns
a None
-terminated array of the names of the
actions in the group
fn connect_action_added<F: Fn(&Self, &str) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
Signals that a new action was just added to the group. This signal is emitted after the action has been added and is now visible.
action_name
the name of the action in action_group
fn connect_action_enabled_changed<F: Fn(&Self, &str, bool) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
Signals that the enabled status of the named action has changed.
action_name
the name of the action in action_group
enabled
whether the action is enabled or not
fn connect_action_removed<F: Fn(&Self, &str) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
Signals that an action is just about to be removed from the group. This signal is emitted before the action is removed, so the action is still visible and can be queried from the signal handler.
action_name
the name of the action in action_group
fn connect_action_state_changed<F: Fn(&Self, &str, &Variant) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
Signals that the state of the named action has changed.
action_name
the name of the action in action_group
value
the new value of the state
Implementors
impl<O: IsA<ActionGroup>> ActionGroupExt for O
[src]
fn action_added(&self, action_name: &str)
[src]
fn action_enabled_changed(&self, action_name: &str, enabled: bool)
[src]
fn action_removed(&self, action_name: &str)
[src]
fn action_state_changed(&self, action_name: &str, state: &Variant)
[src]
fn activate_action(&self, action_name: &str, parameter: Option<&Variant>)
[src]
fn change_action_state(&self, action_name: &str, value: &Variant)
[src]
fn get_action_enabled(&self, action_name: &str) -> bool
[src]
fn get_action_parameter_type(&self, action_name: &str) -> Option<VariantType>
[src]
fn get_action_state(&self, action_name: &str) -> Option<Variant>
[src]
fn get_action_state_hint(&self, action_name: &str) -> Option<Variant>
[src]
fn get_action_state_type(&self, action_name: &str) -> Option<VariantType>
[src]
fn has_action(&self, action_name: &str) -> bool
[src]
fn list_actions(&self) -> Vec<GString>
[src]
fn connect_action_added<F: Fn(&Self, &str) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_action_enabled_changed<F: Fn(&Self, &str, bool) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_action_removed<F: Fn(&Self, &str) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_action_state_changed<F: Fn(&Self, &str, &Variant) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId