1/* GDBus - GLib D-Bus Library
2 *
3 * Copyright (C) 2008-2010 Red Hat, Inc.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library 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 GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
17 *
18 * Author: David Zeuthen <davidz@redhat.com>
19 */
20
21#ifndef __G_DBUS_NAME_OWNING_H__
22#define __G_DBUS_NAME_OWNING_H__
23
24#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
25#error "Only <gio/gio.h> can be included directly."
26#endif
27
28#include <gio/giotypes.h>
29
30G_BEGIN_DECLS
31
32/**
33 * GBusAcquiredCallback:
34 * @connection: The #GDBusConnection to a message bus.
35 * @name: The name that is requested to be owned.
36 * @user_data: User data passed to g_bus_own_name().
37 *
38 * Invoked when a connection to a message bus has been obtained.
39 *
40 * Since: 2.26
41 */
42typedef void (*GBusAcquiredCallback) (GDBusConnection *connection,
43 const gchar *name,
44 gpointer user_data);
45
46/**
47 * GBusNameAcquiredCallback:
48 * @connection: The #GDBusConnection on which to acquired the name.
49 * @name: The name being owned.
50 * @user_data: User data passed to g_bus_own_name() or g_bus_own_name_on_connection().
51 *
52 * Invoked when the name is acquired.
53 *
54 * Since: 2.26
55 */
56typedef void (*GBusNameAcquiredCallback) (GDBusConnection *connection,
57 const gchar *name,
58 gpointer user_data);
59
60/**
61 * GBusNameLostCallback:
62 * @connection: The #GDBusConnection on which to acquire the name or %NULL if
63 * the connection was disconnected.
64 * @name: The name being owned.
65 * @user_data: User data passed to g_bus_own_name() or g_bus_own_name_on_connection().
66 *
67 * Invoked when the name is lost or @connection has been closed.
68 *
69 * Since: 2.26
70 */
71typedef void (*GBusNameLostCallback) (GDBusConnection *connection,
72 const gchar *name,
73 gpointer user_data);
74
75GLIB_AVAILABLE_IN_ALL
76guint g_bus_own_name (GBusType bus_type,
77 const gchar *name,
78 GBusNameOwnerFlags flags,
79 GBusAcquiredCallback bus_acquired_handler,
80 GBusNameAcquiredCallback name_acquired_handler,
81 GBusNameLostCallback name_lost_handler,
82 gpointer user_data,
83 GDestroyNotify user_data_free_func);
84
85GLIB_AVAILABLE_IN_ALL
86guint g_bus_own_name_on_connection (GDBusConnection *connection,
87 const gchar *name,
88 GBusNameOwnerFlags flags,
89 GBusNameAcquiredCallback name_acquired_handler,
90 GBusNameLostCallback name_lost_handler,
91 gpointer user_data,
92 GDestroyNotify user_data_free_func);
93
94GLIB_AVAILABLE_IN_ALL
95guint g_bus_own_name_with_closures (GBusType bus_type,
96 const gchar *name,
97 GBusNameOwnerFlags flags,
98 GClosure *bus_acquired_closure,
99 GClosure *name_acquired_closure,
100 GClosure *name_lost_closure);
101
102GLIB_AVAILABLE_IN_ALL
103guint g_bus_own_name_on_connection_with_closures (
104 GDBusConnection *connection,
105 const gchar *name,
106 GBusNameOwnerFlags flags,
107 GClosure *name_acquired_closure,
108 GClosure *name_lost_closure);
109
110GLIB_AVAILABLE_IN_ALL
111void g_bus_unown_name (guint owner_id);
112
113G_END_DECLS
114
115#endif /* __G_DBUS_NAME_OWNING_H__ */
116

source code of include/glib-2.0/gio/gdbusnameowning.h