ActionGroup

interface ActionGroup : Proxy(source)

GActionGroup represents a group of actions.

Actions can be used to expose functionality in a structured way, either from one part of a program to another, or to the outside world. Action groups are often used together with a type@Gio.MenuModel that provides additional representation data for displaying the actions to the user, e.g. in a menu.

The main way to interact with the actions in a GActionGroup is to activate them with method@Gio.ActionGroup.activate_action. Activating an action may require a type@GLib.Variant parameter. The required type of the parameter can be inquired with method@Gio.ActionGroup.get_action_parameter_type. Actions may be disabled, see method@Gio.ActionGroup.get_action_enabled. Activating a disabled action has no effect.

Actions may optionally have a state in the form of a type@GLib.Variant. The current state of an action can be inquired with method@Gio.ActionGroup.get_action_state. Activating a stateful action may change its state, but it is also possible to set the state by calling method@Gio.ActionGroup.change_action_state.

As typical example, consider a text editing application which has an option to change the current font to ‘bold’. A good way to represent this would be a stateful action, with a boolean state. Activating the action would toggle the state.

Each action in the group has a unique name (which is a string). All method calls, except method@Gio.ActionGroup.list_actions take the name of an action as an argument.

The GActionGroup API is meant to be the ‘public’ API to the action group. The calls here are exactly the interaction that ‘external forces’ (eg: UI, incoming D-Bus messages, etc.) are supposed to have with actions. ‘Internal’ APIs (ie: ones meant only to be accessed by the action group implementation) are found on subclasses. This is why you will find – for example – method@Gio.ActionGroup.get_action_enabled but not an equivalent set_action_enabled() method.

Signals are emitted on the action group in response to state changes on individual actions.

Implementations of GActionGroup should provide implementations for the virtual functions method@Gio.ActionGroup.list_actions and method@Gio.ActionGroup.query_action. The other virtual functions should not be implemented — their ‘wrappers’ are actually implemented with calls to method@Gio.ActionGroup.query_action.

Skipped during bindings generation

  • parameter enabled: enabled: Out parameter is not supported

Inheritors

Types

Link copied to clipboard
class ActionGroupImpl(gioActionGroupPointer: <Error class: unknown class><<Error class: unknown class>>) : ActionGroup

The ActionGroupImpl type represents a native instance of the ActionGroup interface.

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val gioActionGroupPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
abstract val gioProxyPointer: <Error class: unknown class><<Error class: unknown class>>

Functions

Link copied to clipboard
open fun actionAdded(actionName: String)

Emits the signal@Gio.ActionGroup::action-added signal on @action_group.

Link copied to clipboard
open fun actionEnabledChanged(actionName: String, enabled: Boolean)

Emits the signal@Gio.ActionGroup::action-enabled-changed signal on @action_group.

Link copied to clipboard
open fun actionRemoved(actionName: String)

Emits the signal@Gio.ActionGroup::action-removed signal on @action_group.

Link copied to clipboard
open fun actionStateChanged(actionName: String, state: <Error class: unknown class>)

Emits the signal@Gio.ActionGroup::action-state-changed signal on @action_group.

Link copied to clipboard
open fun activateAction(actionName: String, parameter: <Error class: unknown class>? = null)

Activate the named action within @action_group.

Link copied to clipboard
open fun changeActionState(actionName: String, value: <Error class: unknown class>)

Request for the state of the named action within @action_group to be changed to @value.

Link copied to clipboard
open fun connect(connection: IoStream, proxyAddress: ProxyAddress, cancellable: Cancellable? = null): <Error class: unknown class><IoStream>

Given @connection to communicate with a proxy (eg, a #GSocketConnection that is connected to the proxy server), this does the necessary handshake to connect to @proxy_address, and if required, wraps the #GIOStream to handle proxy payload.

Link copied to clipboard
open fun connectAsync(connection: IoStream, proxyAddress: ProxyAddress, cancellable: Cancellable? = null, callback: AsyncReadyCallback?)

Asynchronous version of g_proxy_connect().

Link copied to clipboard
open fun connectFinish(result: AsyncResult): <Error class: unknown class><IoStream>

See g_proxy_connect().

Link copied to clipboard
open fun getActionEnabled(actionName: String): Boolean

Checks if the named action within @action_group is currently enabled.

Link copied to clipboard
open fun getActionParameterType(actionName: String): <Error class: unknown class>?

Queries the type of the parameter that must be given when activating the named action within @action_group.

Link copied to clipboard
open fun getActionState(actionName: String): <Error class: unknown class>?

Queries the current state of the named action within @action_group.

Link copied to clipboard
open fun getActionStateHint(actionName: String): <Error class: unknown class>?

Requests a hint about the valid range of values for the state of the named action within @action_group.

Link copied to clipboard
open fun getActionStateType(actionName: String): <Error class: unknown class>?

Queries the type of the state of the named action within

Link copied to clipboard
open fun hasAction(actionName: String): Boolean

Checks if the named action exists within @action_group.

Link copied to clipboard
open fun listActions(): List<String>

Lists the actions contained within @action_group.

Link copied to clipboard
open fun onActionAdded(    connectFlags: <Error class: unknown class> = ConnectFlags(0u),     detail: String? = null,     handler: (actionName: String) -> Unit): <Error class: unknown class>

Signals that a new action was just added to the group.

Link copied to clipboard
open fun onActionEnabledChanged(    connectFlags: <Error class: unknown class> = ConnectFlags(0u),     detail: String? = null,     handler: (actionName: String, enabled: Boolean) -> Unit): <Error class: unknown class>

Signals that the enabled status of the named action has changed.

Link copied to clipboard
open fun onActionRemoved(    connectFlags: <Error class: unknown class> = ConnectFlags(0u),     detail: String? = null,     handler: (actionName: String) -> Unit): <Error class: unknown class>

Signals that an action is just about to be removed from the group.

Link copied to clipboard
open fun onActionStateChanged(    connectFlags: <Error class: unknown class> = ConnectFlags(0u),     detail: String? = null,     handler: (actionName: String, <Error class: unknown class>) -> Unit): <Error class: unknown class>

Signals that the state of the named action has changed.

Link copied to clipboard

Some proxy protocols expect to be passed a hostname, which they will resolve to an IP address themselves. Others, like SOCKS4, do not allow this. This function will return false if @proxy is implementing such a protocol. When false is returned, the caller should resolve the destination hostname first, and then pass a #GProxyAddress containing the stringified IP address to g_proxy_connect() or g_proxy_connect_async().