Merge branch '976-disable-assert-checks' into 'master'
[glib.git] / gio / gdbusnameowning.h
blob89c011a2fb8489411dfc91d1b6e429aa096e78ad
1 /* GDBus - GLib D-Bus Library
3 * Copyright (C) 2008-2010 Red Hat, Inc.
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.
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.
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/>.
18 * Author: David Zeuthen <davidz@redhat.com>
21 #ifndef __G_DBUS_NAME_OWNING_H__
22 #define __G_DBUS_NAME_OWNING_H__
24 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
25 #error "Only <gio/gio.h> can be included directly."
26 #endif
28 #include <gio/giotypes.h>
30 G_BEGIN_DECLS
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().
38 * Invoked when a connection to a message bus has been obtained.
40 * Since: 2.26
42 typedef void (*GBusAcquiredCallback) (GDBusConnection *connection,
43 const gchar *name,
44 gpointer user_data);
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().
52 * Invoked when the name is acquired.
54 * Since: 2.26
56 typedef void (*GBusNameAcquiredCallback) (GDBusConnection *connection,
57 const gchar *name,
58 gpointer user_data);
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().
67 * Invoked when the name is lost or @connection has been closed.
69 * Since: 2.26
71 typedef void (*GBusNameLostCallback) (GDBusConnection *connection,
72 const gchar *name,
73 gpointer user_data);
75 GLIB_AVAILABLE_IN_ALL
76 guint 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);
85 GLIB_AVAILABLE_IN_ALL
86 guint 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);
94 GLIB_AVAILABLE_IN_ALL
95 guint 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);
102 GLIB_AVAILABLE_IN_ALL
103 guint 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);
110 GLIB_AVAILABLE_IN_ALL
111 void g_bus_unown_name (guint owner_id);
113 G_END_DECLS
115 #endif /* __G_DBUS_NAME_OWNING_H__ */