Coverage Report

Created: 2025-06-13 06:20

/src/glib/gio/gremoteactiongroup.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright © 2010 Codethink Limited
3
 *
4
 * SPDX-License-Identifier: LGPL-2.1-or-later
5
 *
6
 * This library is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Lesser General Public
8
 * License as published by the Free Software Foundation; either
9
 * version 2.1 of the License, or (at your option) any later version.
10
 *
11
 * This library is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 * Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General
17
 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
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
 * GRemoteActionGroup:
31
 *
32
 * The `GRemoteActionGroup` interface is implemented by [iface@Gio.ActionGroup]
33
 * instances that either transmit action invocations to other processes
34
 * or receive action invocations in the local process from other
35
 * processes.
36
 *
37
 * The interface has `_full` variants of the two
38
 * methods on [iface@Gio.ActionGroup] used to activate actions:
39
 * [method@Gio.ActionGroup.activate_action] and
40
 * [method@Gio.ActionGroup.change_action_state]. These variants allow a
41
 * ‘platform data’ [struct@GLib.Variant] to be specified: a dictionary providing
42
 * context for the action invocation (for example: timestamps, startup
43
 * notification IDs, etc).
44
 *
45
 * [class@Gio.DBusActionGroup] implements `GRemoteActionGroup`.  This provides a
46
 * mechanism to send platform data for action invocations over D-Bus.
47
 *
48
 * Additionally, [method@Gio.DBusConnection.export_action_group] will check if
49
 * the exported [iface@Gio.ActionGroup] implements `GRemoteActionGroup` and use
50
 * the `_full` variants of the calls if available.  This
51
 * provides a mechanism by which to receive platform data for action
52
 * invocations that arrive by way of D-Bus.
53
 *
54
 * Since: 2.32
55
 **/
56
57
/**
58
 * GRemoteActionGroupInterface:
59
 * @activate_action_full: the virtual function pointer for g_remote_action_group_activate_action_full()
60
 * @change_action_state_full: the virtual function pointer for g_remote_action_group_change_action_state_full()
61
 *
62
 * The virtual function table for #GRemoteActionGroup.
63
 *
64
 * Since: 2.32
65
 **/
66
67
#include "config.h"
68
69
#include "gremoteactiongroup.h"
70
71
G_DEFINE_INTERFACE (GRemoteActionGroup, g_remote_action_group, G_TYPE_ACTION_GROUP)
72
73
static void
74
g_remote_action_group_default_init (GRemoteActionGroupInterface *iface)
75
0
{
76
0
}
77
78
/**
79
 * g_remote_action_group_activate_action_full:
80
 * @remote: a #GDBusActionGroup
81
 * @action_name: the name of the action to activate
82
 * @parameter: (nullable): the optional parameter to the activation
83
 * @platform_data: the platform data to send
84
 *
85
 * Activates the remote action.
86
 *
87
 * This is the same as g_action_group_activate_action() except that it
88
 * allows for provision of "platform data" to be sent along with the
89
 * activation request.  This typically contains details such as the user
90
 * interaction timestamp or startup notification information.
91
 *
92
 * @platform_data must be non-%NULL and must have the type
93
 * %G_VARIANT_TYPE_VARDICT.  If it is floating, it will be consumed.
94
 *
95
 * Since: 2.32
96
 **/
97
void
98
g_remote_action_group_activate_action_full (GRemoteActionGroup *remote,
99
                                            const gchar        *action_name,
100
                                            GVariant           *parameter,
101
                                            GVariant           *platform_data)
102
0
{
103
0
  G_REMOTE_ACTION_GROUP_GET_IFACE (remote)
104
0
    ->activate_action_full (remote, action_name, parameter, platform_data);
105
0
}
106
107
/**
108
 * g_remote_action_group_change_action_state_full:
109
 * @remote: a #GRemoteActionGroup
110
 * @action_name: the name of the action to change the state of
111
 * @value: the new requested value for the state
112
 * @platform_data: the platform data to send
113
 *
114
 * Changes the state of a remote action.
115
 *
116
 * This is the same as g_action_group_change_action_state() except that
117
 * it allows for provision of "platform data" to be sent along with the
118
 * state change request.  This typically contains details such as the
119
 * user interaction timestamp or startup notification information.
120
 *
121
 * @platform_data must be non-%NULL and must have the type
122
 * %G_VARIANT_TYPE_VARDICT.  If it is floating, it will be consumed.
123
 *
124
 * Since: 2.32
125
 **/
126
void
127
g_remote_action_group_change_action_state_full (GRemoteActionGroup *remote,
128
                                                const gchar        *action_name,
129
                                                GVariant           *value,
130
                                                GVariant           *platform_data)
131
0
{
132
0
  G_REMOTE_ACTION_GROUP_GET_IFACE (remote)
133
0
    ->change_action_state_full (remote, action_name, value, platform_data);
134
0
}