Gio.ActionGroup.prototype.query_action

function query_action(action_name: String): [ok: Boolean, enabled: Boolean, parameter_type: GLib.VariantType, state_type: GLib.VariantType, state_hint: GLib.Variant, state: GLib.Variant] {
    // Gjs wrapper for g_action_group_query_action()
}
  

Queries all aspects of the named action within an action_group.

This function acquires the information available from Gio.ActionGroup.prototype.has_action, Gio.ActionGroup.prototype.get_action_enabled, Gio.ActionGroup.prototype.get_action_parameter_type, Gio.ActionGroup.prototype.get_action_state_type, Gio.ActionGroup.prototype.get_action_state_hint and Gio.ActionGroup.prototype.get_action_state with a single function call.

This provides two main benefits.

The first is the improvement in efficiency that comes with not having to perform repeated lookups of the action in order to discover different things about it. The second is that implementing Gio.ActionGroup can now be done by only overriding this one virtual function.

The interface provides a default implementation of this function that calls the individual functions, as required, to fetch the information. The interface also provides default implementations of those functions that call this function. All implementations, therefore, must override either this function or all of the others.

If the action exists, true is returned and any of the requested fields (as indicated by having a non-null reference passed in) are filled. If the action doesn't exist, false is returned and the fields may or may not have been modified.

Since 2.32

action_name

the name of an action in the group

ok

true if the action exists, else false

enabled

if the action is presently enabled

parameter_type

the parameter type, or null if none needed

state_type

the state type, or null if stateless

state_hint

the state hint, or null if none

state

the current state, or null if stateless