2 * Copyright © 2010 Codethink Limited
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published
6 * by the Free Software Foundation; either version 2 of the licence or (at
7 * your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General
15 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
17 * Authors: Ryan Lortie <desrt@desrt.ca>
22 #include "gsimpleaction.h"
23 #include "gactiongroup.h"
24 #include "gactionmap.h"
28 * SECTION:gremoteactiongroup
29 * @title: GRemoteActionGroup
30 * @short_description: A GActionGroup that interacts with other processes
33 * The GRemoteActionGroup interface is implemented by #GActionGroup
34 * instances that either transmit action invocations to other processes
35 * or receive action invocations in the local process from other
38 * The interface has `_full` variants of the two
39 * methods on #GActionGroup used to activate actions:
40 * g_action_group_activate_action() and
41 * g_action_group_change_action_state(). These variants allow a
42 * "platform data" #GVariant to be specified: a dictionary providing
43 * context for the action invocation (for example: timestamps, startup
44 * notification IDs, etc).
46 * #GDBusActionGroup implements #GRemoteActionGroup. This provides a
47 * mechanism to send platform data for action invocations over D-Bus.
49 * Additionally, g_dbus_connection_export_action_group() will check if
50 * the exported #GActionGroup implements #GRemoteActionGroup and use the
51 * `_full` variants of the calls if available. This
52 * provides a mechanism by which to receive platform data for action
53 * invocations that arrive by way of D-Bus.
61 * #GRemoteActionGroup is an opaque data structure and can only be accessed
62 * using the following functions.
66 * GRemoteActionGroupInterface:
67 * @activate_action_full: the virtual function pointer for g_remote_action_group_activate_action_full()
68 * @change_action_state_full: the virtual function pointer for g_remote_action_group_change_action_state_full()
70 * The virtual function table for #GRemoteActionGroup.
77 #include "gremoteactiongroup.h"
79 G_DEFINE_INTERFACE (GRemoteActionGroup
, g_remote_action_group
, G_TYPE_ACTION_GROUP
)
82 g_remote_action_group_default_init (GRemoteActionGroupInterface
*iface
)
87 * g_remote_action_group_activate_action_full:
88 * @remote: a #GDBusActionGroup
89 * @action_name: the name of the action to activate
90 * @parameter: (nullable): the optional parameter to the activation
91 * @platform_data: the platform data to send
93 * Activates the remote action.
95 * This is the same as g_action_group_activate_action() except that it
96 * allows for provision of "platform data" to be sent along with the
97 * activation request. This typically contains details such as the user
98 * interaction timestamp or startup notification information.
100 * @platform_data must be non-%NULL and must have the type
101 * %G_VARIANT_TYPE_VARDICT. If it is floating, it will be consumed.
106 g_remote_action_group_activate_action_full (GRemoteActionGroup
*remote
,
107 const gchar
*action_name
,
109 GVariant
*platform_data
)
111 G_REMOTE_ACTION_GROUP_GET_IFACE (remote
)
112 ->activate_action_full (remote
, action_name
, parameter
, platform_data
);
116 * g_remote_action_group_change_action_state_full:
117 * @remote: a #GRemoteActionGroup
118 * @action_name: the name of the action to change the state of
119 * @value: the new requested value for the state
120 * @platform_data: the platform data to send
122 * Changes the state of a remote action.
124 * This is the same as g_action_group_change_action_state() except that
125 * it allows for provision of "platform data" to be sent along with the
126 * state change request. This typically contains details such as the
127 * user interaction timestamp or startup notification information.
129 * @platform_data must be non-%NULL and must have the type
130 * %G_VARIANT_TYPE_VARDICT. If it is floating, it will be consumed.
135 g_remote_action_group_change_action_state_full (GRemoteActionGroup
*remote
,
136 const gchar
*action_name
,
138 GVariant
*platform_data
)
140 G_REMOTE_ACTION_GROUP_GET_IFACE (remote
)
141 ->change_action_state_full (remote
, action_name
, value
, platform_data
);