ActionGroup.activateAction

void activateAction(string actionName, glib.variant.Variant parameter = null)

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.action_group.ActionGroup.getActionParameterType].

If the #GActionGroup 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.dbus_connection.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.dbus_connection.DBusConnection.flush] is called before exit(). Without [gio.dbus_connection.DBusConnection.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

actionNamethe name of the action to activate
parameterparameters to the activation