2011-12-17 06:17:08 +01:00
|
|
|
|
/*
|
|
|
|
|
* Copyright © 2010 Codethink Limited
|
|
|
|
|
*
|
2022-05-18 10:12:45 +02:00
|
|
|
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
|
*
|
2017-05-27 18:21:30 +02:00
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2011-12-17 06:17:08 +01:00
|
|
|
|
*
|
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Lesser General
|
2014-01-23 12:58:29 +01:00
|
|
|
|
* Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
2011-12-17 06:17:08 +01:00
|
|
|
|
*
|
|
|
|
|
* Authors: Ryan Lortie <desrt@desrt.ca>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
|
|
#include "gsimpleaction.h"
|
|
|
|
|
#include "gactiongroup.h"
|
|
|
|
|
#include "gactionmap.h"
|
|
|
|
|
#include "gaction.h"
|
|
|
|
|
|
|
|
|
|
/**
|
2023-11-02 17:21:51 +01:00
|
|
|
|
* GRemoteActionGroup:
|
2011-12-17 06:17:08 +01:00
|
|
|
|
*
|
2023-11-02 17:21:51 +01:00
|
|
|
|
* The `GRemoteActionGroup` interface is implemented by [iface@Gio.ActionGroup]
|
2011-12-17 06:17:08 +01:00
|
|
|
|
* instances that either transmit action invocations to other processes
|
|
|
|
|
* or receive action invocations in the local process from other
|
|
|
|
|
* processes.
|
|
|
|
|
*
|
2014-02-06 14:04:52 +01:00
|
|
|
|
* The interface has `_full` variants of the two
|
2023-11-02 17:21:51 +01:00
|
|
|
|
* methods on [iface@Gio.ActionGroup] used to activate actions:
|
|
|
|
|
* [method@Gio.ActionGroup.activate_action] and
|
|
|
|
|
* [method@Gio.ActionGroup.change_action_state]. These variants allow a
|
|
|
|
|
* ‘platform data’ [struct@GLib.Variant] to be specified: a dictionary providing
|
2011-12-17 06:17:08 +01:00
|
|
|
|
* context for the action invocation (for example: timestamps, startup
|
|
|
|
|
* notification IDs, etc).
|
|
|
|
|
*
|
2023-11-02 17:21:51 +01:00
|
|
|
|
* [class@Gio.DBusActionGroup] implements `GRemoteActionGroup`. This provides a
|
2011-12-17 06:17:08 +01:00
|
|
|
|
* mechanism to send platform data for action invocations over D-Bus.
|
|
|
|
|
*
|
2023-11-02 17:21:51 +01:00
|
|
|
|
* Additionally, [method@Gio.DBusConnection.export_action_group] will check if
|
|
|
|
|
* the exported [iface@Gio.ActionGroup] implements `GRemoteActionGroup` and use
|
|
|
|
|
* the `_full` variants of the calls if available. This
|
2011-12-17 06:17:08 +01:00
|
|
|
|
* provides a mechanism by which to receive platform data for action
|
|
|
|
|
* invocations that arrive by way of D-Bus.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.32
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GRemoteActionGroupInterface:
|
|
|
|
|
* @activate_action_full: the virtual function pointer for g_remote_action_group_activate_action_full()
|
|
|
|
|
* @change_action_state_full: the virtual function pointer for g_remote_action_group_change_action_state_full()
|
|
|
|
|
*
|
|
|
|
|
* The virtual function table for #GRemoteActionGroup.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.32
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
|
|
#include "gremoteactiongroup.h"
|
|
|
|
|
|
|
|
|
|
G_DEFINE_INTERFACE (GRemoteActionGroup, g_remote_action_group, G_TYPE_ACTION_GROUP)
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
g_remote_action_group_default_init (GRemoteActionGroupInterface *iface)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* g_remote_action_group_activate_action_full:
|
2012-01-30 21:59:38 +01:00
|
|
|
|
* @remote: a #GDBusActionGroup
|
2011-12-17 06:17:08 +01:00
|
|
|
|
* @action_name: the name of the action to activate
|
2016-10-29 03:29:02 +02:00
|
|
|
|
* @parameter: (nullable): the optional parameter to the activation
|
2011-12-17 06:17:08 +01:00
|
|
|
|
* @platform_data: the platform data to send
|
|
|
|
|
*
|
|
|
|
|
* Activates the remote action.
|
|
|
|
|
*
|
|
|
|
|
* This is the same as g_action_group_activate_action() except that it
|
|
|
|
|
* allows for provision of "platform data" to be sent along with the
|
|
|
|
|
* activation request. This typically contains details such as the user
|
|
|
|
|
* interaction timestamp or startup notification information.
|
|
|
|
|
*
|
|
|
|
|
* @platform_data must be non-%NULL and must have the type
|
|
|
|
|
* %G_VARIANT_TYPE_VARDICT. If it is floating, it will be consumed.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.32
|
|
|
|
|
**/
|
|
|
|
|
void
|
|
|
|
|
g_remote_action_group_activate_action_full (GRemoteActionGroup *remote,
|
|
|
|
|
const gchar *action_name,
|
|
|
|
|
GVariant *parameter,
|
|
|
|
|
GVariant *platform_data)
|
|
|
|
|
{
|
|
|
|
|
G_REMOTE_ACTION_GROUP_GET_IFACE (remote)
|
|
|
|
|
->activate_action_full (remote, action_name, parameter, platform_data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2012-01-30 21:59:38 +01:00
|
|
|
|
* g_remote_action_group_change_action_state_full:
|
2011-12-17 06:17:08 +01:00
|
|
|
|
* @remote: a #GRemoteActionGroup
|
|
|
|
|
* @action_name: the name of the action to change the state of
|
|
|
|
|
* @value: the new requested value for the state
|
|
|
|
|
* @platform_data: the platform data to send
|
|
|
|
|
*
|
|
|
|
|
* Changes the state of a remote action.
|
|
|
|
|
*
|
|
|
|
|
* This is the same as g_action_group_change_action_state() except that
|
|
|
|
|
* it allows for provision of "platform data" to be sent along with the
|
|
|
|
|
* state change request. This typically contains details such as the
|
|
|
|
|
* user interaction timestamp or startup notification information.
|
|
|
|
|
*
|
|
|
|
|
* @platform_data must be non-%NULL and must have the type
|
|
|
|
|
* %G_VARIANT_TYPE_VARDICT. If it is floating, it will be consumed.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.32
|
|
|
|
|
**/
|
|
|
|
|
void
|
|
|
|
|
g_remote_action_group_change_action_state_full (GRemoteActionGroup *remote,
|
|
|
|
|
const gchar *action_name,
|
|
|
|
|
GVariant *value,
|
|
|
|
|
GVariant *platform_data)
|
|
|
|
|
{
|
|
|
|
|
G_REMOTE_ACTION_GROUP_GET_IFACE (remote)
|
|
|
|
|
->change_action_state_full (remote, action_name, value, platform_data);
|
|
|
|
|
}
|