Interface

Gio-2.0GioActionGroupInterface

Interface for implementing ActionGroup. Contains only the virtual methods that need to be implemented.

interface Interface {
    vfunc_action_added(action_name: string): void;
    vfunc_action_enabled_changed(action_name: string, enabled: boolean): void;
    vfunc_action_removed(action_name: string): void;
    vfunc_action_state_changed(action_name: string, state: GLib.Variant): void;
    vfunc_activate_action(
        action_name: string,
        parameter?: GLib.Variant<any>,
    ): void;
    vfunc_change_action_state(action_name: string, value: GLib.Variant): void;
    vfunc_get_action_enabled(action_name: string): boolean;
    vfunc_get_action_parameter_type(action_name: string): GLib.VariantType<any>;
    vfunc_get_action_state(action_name: string): GLib.Variant<any>;
    vfunc_get_action_state_hint(action_name: string): GLib.Variant<any>;
    vfunc_get_action_state_type(action_name: string): GLib.VariantType<any>;
    vfunc_has_action(action_name: string): boolean;
    vfunc_list_actions(): string[];
    vfunc_query_action(
        action_name: string,
    ): [
        boolean,
        boolean,
        GLib.VariantType<any>,
        GLib.VariantType<any>,
        GLib.Variant<any>,
        GLib.Variant<any>,
    ];
}

Hierarchy (View Summary)

Index

Methods

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

    This function should only be called by Gio.ActionGroup implementations.

    Parameters

    • action_name: string

      the name of an action in the group

    Returns void

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

    This function should only be called by Gio.ActionGroup implementations.

    Parameters

    • action_name: string

      the name of an action in the group

    • enabled: boolean

      whether the action is now enabled

    Returns void

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

    This function should only be called by Gio.ActionGroup implementations.

    Parameters

    • action_name: string

      the name of an action in the group

    Returns void

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

    This function should only be called by Gio.ActionGroup implementations.

    Parameters

    • action_name: string

      the name of an action in the group

    • state: GLib.Variant

      the new state of the named action

    Returns void

  • Activate the named action within action_group.

    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 NULL. See Gio.ActionGroup.get_action_parameter_type.

    If the Gio.ActionGroup implementation supports asynchronous remote activation over D-Bus, this call may return before the relevant D-Bus traffic has been sent, or any replies have been received. In order to block on such asynchronous activation calls, Gio.DBusConnection.flush should be called prior to the code, which depends on the result of the action activation. Without flushing the D-Bus connection, there is no guarantee that the action would have been activated.

    The following code which runs in a remote app instance, shows an example of a ‘quit’ action being activated on the primary app instance over D-Bus. Here Gio.DBusConnection.flush is called before exit(). Without g_dbus_connection_flush(), the ‘quit’ action may fail to be activated on the primary instance.

    // call ‘quit’ action on primary instance
    g_action_group_activate_action (G_ACTION_GROUP (app), "quit", NULL);

    // make sure the action is activated now
    g_dbus_connection_flush (…);

    g_debug ("Application has been terminated. Exiting.");

    exit (0);

    Parameters

    • action_name: string

      the name of the action to activate

    • Optionalparameter: GLib.Variant<any>

      parameters to the activation

    Returns void

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

    The action must be stateful and value must be of the correct type. See Gio.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 Gio.ActionGroup.get_action_state_hint.

    If the value GVariant is floating, it is consumed.

    Parameters

    • action_name: string

      the name of the action to request the change on

    • value: GLib.Variant

      the new state

    Returns void

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

    An action must be enabled in order to be activated or in order to have its state changed from outside callers.

    Parameters

    • action_name: string

      the name of the action to query

    Returns boolean

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

    When activating the action using Gio.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 NULL, you must not give any GLib.Variant, but NULL 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.

    Parameters

    • action_name: string

      the name of the action to query

    Returns GLib.VariantType<any>

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

    If the action is not stateful then NULL will be returned. If the action is stateful then the type of the return value is the type given by Gio.ActionGroup.get_action_state_type.

    The return value (if non-NULL) should be freed with GLib.Variant.unref when it is no longer required.

    Parameters

    • action_name: string

      the name of the action to query

    Returns GLib.Variant<any>

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

    If NULL 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-NULL) should be freed with GLib.Variant.unref when it is no longer required.

    Parameters

    • action_name: string

      the name of the action to query

    Returns GLib.Variant<any>

  • Checks if the named action exists within action_group.

    Parameters

    • action_name: string

      the name of the action to check for

    Returns boolean

  • Lists the actions contained within action_group.

    The caller is responsible for freeing the list with GLib.strfreev when it is no longer required.

    Returns string[]