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
35 * The GRemoteActionGroup interface is implemented by #GActionGroup
36 * instances that either transmit action invocations to other processes
37 * or receive action invocations in the local process from other
40 * The interface has <literal>_full</literal> variants of the two
41 * methods on #GActionGroup used to activate actions:
42 * g_action_group_activate_action() and
43 * g_action_group_change_action_state(). These variants allow a
44 * "platform data" #GVariant to be specified: a dictionary providing
45 * context for the action invocation (for example: timestamps, startup
46 * notification IDs, etc).
48 * #GDBusActionGroup implements #GRemoteActionGroup. This provides a
49 * mechanism to send platform data for action invocations over D-Bus.
51 * Additionally, g_dbus_connection_export_action_group() will check if
52 * the exported #GActionGroup implements #GRemoteActionGroup and use the
53 * <literal>_full</literal> variants of the calls if available. This
54 * provides a mechanism by which to receive platform data for action
55 * invocations that arrive by way of D-Bus.
61 * GRemoteActionGroupInterface:
62 * @activate_action_full: the virtual function pointer for g_remote_action_group_activate_action_full()
63 * @change_action_state_full: the virtual function pointer for g_remote_action_group_change_action_state_full()
65 * The virtual function table for #GRemoteActionGroup.
72 #include "gremoteactiongroup.h"
74 G_DEFINE_INTERFACE (GRemoteActionGroup, g_remote_action_group, G_TYPE_ACTION_GROUP)
77 g_remote_action_group_default_init (GRemoteActionGroupInterface *iface)
82 * g_remote_action_group_activate_action_full:
83 * @remote: a #GDBusActionGroup
84 * @action_name: the name of the action to activate
85 * @parameter: (allow-none): the optional parameter to the activation
86 * @platform_data: the platform data to send
88 * Activates the remote action.
90 * This is the same as g_action_group_activate_action() except that it
91 * allows for provision of "platform data" to be sent along with the
92 * activation request. This typically contains details such as the user
93 * interaction timestamp or startup notification information.
95 * @platform_data must be non-%NULL and must have the type
96 * %G_VARIANT_TYPE_VARDICT. If it is floating, it will be consumed.
101 g_remote_action_group_activate_action_full (GRemoteActionGroup *remote,
102 const gchar *action_name,
104 GVariant *platform_data)
106 G_REMOTE_ACTION_GROUP_GET_IFACE (remote)
107 ->activate_action_full (remote, action_name, parameter, platform_data);
111 * g_remote_action_group_change_action_state_full:
112 * @remote: a #GRemoteActionGroup
113 * @action_name: the name of the action to change the state of
114 * @value: the new requested value for the state
115 * @platform_data: the platform data to send
117 * Changes the state of a remote action.
119 * This is the same as g_action_group_change_action_state() except that
120 * it allows for provision of "platform data" to be sent along with the
121 * state change request. This typically contains details such as the
122 * user interaction timestamp or startup notification information.
124 * @platform_data must be non-%NULL and must have the type
125 * %G_VARIANT_TYPE_VARDICT. If it is floating, it will be consumed.
130 g_remote_action_group_change_action_state_full (GRemoteActionGroup *remote,
131 const gchar *action_name,
133 GVariant *platform_data)
135 G_REMOTE_ACTION_GROUP_GET_IFACE (remote)
136 ->change_action_state_full (remote, action_name, value, platform_data);