Add includes to all gio docs
[platform/upstream/glib.git] / gio / gremoteactiongroup.c
1 /*
2  * Copyright © 2010 Codethink Limited
3  *
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.
8  *
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.
13  *
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.
18  *
19  * Authors: Ryan Lortie <desrt@desrt.ca>
20  */
21
22 #include "config.h"
23
24 #include "gsimpleaction.h"
25 #include "gactiongroup.h"
26 #include "gactionmap.h"
27 #include "gaction.h"
28
29 /**
30  * SECTION:gremoteactiongroup
31  * @title: GRemoteActionGroup
32  * @short_description: A GActionGroup that interacts with other processes
33  * @include: gio/gio.h
34  *
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
38  * processes.
39  *
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).
47  *
48  * #GDBusActionGroup implements #GRemoteActionGroup.  This provides a
49  * mechanism to send platform data for action invocations over D-Bus.
50  *
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.
56  *
57  * Since: 2.32
58  **/
59
60 /**
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()
64  *
65  * The virtual function table for #GRemoteActionGroup.
66  *
67  * Since: 2.32
68  **/
69
70 #include "config.h"
71
72 #include "gremoteactiongroup.h"
73
74 G_DEFINE_INTERFACE (GRemoteActionGroup, g_remote_action_group, G_TYPE_ACTION_GROUP)
75
76 static void
77 g_remote_action_group_default_init (GRemoteActionGroupInterface *iface)
78 {
79 }
80
81 /**
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
87  *
88  * Activates the remote action.
89  *
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.
94  *
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.
97  *
98  * Since: 2.32
99  **/
100 void
101 g_remote_action_group_activate_action_full (GRemoteActionGroup *remote,
102                                             const gchar        *action_name,
103                                             GVariant           *parameter,
104                                             GVariant           *platform_data)
105 {
106   G_REMOTE_ACTION_GROUP_GET_IFACE (remote)
107     ->activate_action_full (remote, action_name, parameter, platform_data);
108 }
109
110 /**
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
116  *
117  * Changes the state of a remote action.
118  *
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.
123  *
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.
126  *
127  * Since: 2.32
128  **/
129 void
130 g_remote_action_group_change_action_state_full (GRemoteActionGroup *remote,
131                                                 const gchar        *action_name,
132                                                 GVariant           *value,
133                                                 GVariant           *platform_data)
134 {
135   G_REMOTE_ACTION_GROUP_GET_IFACE (remote)
136     ->change_action_state_full (remote, action_name, value, platform_data);
137 }