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, write to the
16 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
17 * Boston, MA 02111-1307, USA.
19 * Authors: Ryan Lortie <desrt@desrt.ca>
24 #include "gsimpleaction.h"
25 #include "gactiongroup.h"
26 #include "gactionmap.h"
30 * SECTION:gremoteactiongroup
31 * @title: GRemoteActionGroup
32 * @short_description: a #GActionGroup that interacts with other processes
34 * The GRemoteActionGroup interface is implemented by #GActionGroup
35 * instances that either transmit action invocations to other processes
36 * or receive action invocations in the local process from other
39 * The interface has <literal>_full</literal> variants of the two
40 * methods on #GActionGroup used to activate actions:
41 * g_action_group_activate_action() and
42 * g_action_group_change_action_state(). These variants allow a
43 * "platform data" #GVariant to be specified: a dictionary providing
44 * context for the action invocation (for example: timestamps, startup
45 * notification IDs, etc).
47 * #GDBusActionGroup implements #GRemoteActionGroup. This provides a
48 * mechanism to send platform data for action invocations over D-Bus.
50 * Additionally, g_dbus_connection_export_action_group() will check if
51 * the exported #GActionGroup implements #GRemoteActionGroup and use the
52 * <literal>_full</literal> variants of the calls if available. This
53 * provides a mechanism by which to receive platform data for action
54 * invocations that arrive by way of D-Bus.
60 * GRemoteActionGroupInterface:
61 * @activate_action_full: the virtual function pointer for g_remote_action_group_activate_action_full()
62 * @change_action_state_full: the virtual function pointer for g_remote_action_group_change_action_state_full()
64 * The virtual function table for #GRemoteActionGroup.
71 #include "gremoteactiongroup.h"
73 G_DEFINE_INTERFACE (GRemoteActionGroup, g_remote_action_group, G_TYPE_ACTION_GROUP)
76 g_remote_action_group_default_init (GRemoteActionGroupInterface *iface)
81 * g_remote_action_group_activate_action_full:
82 * @remote: a #GDBusActionGroup
83 * @action_name: the name of the action to activate
84 * @parameter: (allow-none): the optional parameter to the activation
85 * @platform_data: the platform data to send
87 * Activates the remote action.
89 * This is the same as g_action_group_activate_action() except that it
90 * allows for provision of "platform data" to be sent along with the
91 * activation request. This typically contains details such as the user
92 * interaction timestamp or startup notification information.
94 * @platform_data must be non-%NULL and must have the type
95 * %G_VARIANT_TYPE_VARDICT. If it is floating, it will be consumed.
100 g_remote_action_group_activate_action_full (GRemoteActionGroup *remote,
101 const gchar *action_name,
103 GVariant *platform_data)
105 G_REMOTE_ACTION_GROUP_GET_IFACE (remote)
106 ->activate_action_full (remote, action_name, parameter, platform_data);
110 * g_remote_action_group_change_action_state_full:
111 * @remote: a #GRemoteActionGroup
112 * @action_name: the name of the action to change the state of
113 * @value: the new requested value for the state
114 * @platform_data: the platform data to send
116 * Changes the state of a remote action.
118 * This is the same as g_action_group_change_action_state() except that
119 * it allows for provision of "platform data" to be sent along with the
120 * state change request. This typically contains details such as the
121 * user interaction timestamp or startup notification information.
123 * @platform_data must be non-%NULL and must have the type
124 * %G_VARIANT_TYPE_VARDICT. If it is floating, it will be consumed.
129 g_remote_action_group_change_action_state_full (GRemoteActionGroup *remote,
130 const gchar *action_name,
132 GVariant *platform_data)
134 G_REMOTE_ACTION_GROUP_GET_IFACE (remote)
135 ->change_action_state_full (remote, action_name, value, platform_data);