1 /* ide-worker.c
2 *
3 * Copyright 2015-2019 Christian Hergert <chergert@redhat.com>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * SPDX-License-Identifier: GPL-3.0-or-later
19 */
20
21 #define G_LOG_DOMAIN "ide-worker"
22
23 #include "config.h"
24
25 #include <libide-core.h>
26
27 #include "ide-worker.h"
28
G_DEFINE_INTERFACE(IdeWorker,ide_worker,G_TYPE_OBJECT)29 G_DEFINE_INTERFACE (IdeWorker, ide_worker, G_TYPE_OBJECT)
30
31 static void
32 ide_worker_default_init (IdeWorkerInterface *iface)
33 {
34 }
35
36 void
ide_worker_register_service(IdeWorker * self,GDBusConnection * connection)37 ide_worker_register_service (IdeWorker *self,
38 GDBusConnection *connection)
39 {
40 g_return_if_fail (IDE_IS_WORKER (self));
41 g_return_if_fail (G_IS_DBUS_CONNECTION (connection));
42
43 IDE_WORKER_GET_IFACE (self)->register_service (self, connection);
44 }
45
46 /**
47 * ide_worker_create_proxy:
48 * @self: An #IdeWorker.
49 * @connection: a #GDBusConnection connected to the worker process.
50 * @error: (allow-none): a location for a #GError, or %NULL.
51 *
52 * Creates a new proxy to be connected to the subprocess peer on the other
53 * end of @connection.
54 *
55 * Returns: (transfer full): a #GDBusProxy or %NULL.
56 *
57 * Since: 3.32
58 */
59 GDBusProxy *
ide_worker_create_proxy(IdeWorker * self,GDBusConnection * connection,GError ** error)60 ide_worker_create_proxy (IdeWorker *self,
61 GDBusConnection *connection,
62 GError **error)
63 {
64 g_return_val_if_fail (IDE_IS_WORKER (self), NULL);
65 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
66
67 return IDE_WORKER_GET_IFACE (self)->create_proxy (self, connection, error);
68 }
69