6e69bff5f4316f17139d3c489820107dfc65aa1b
[platform/upstream/glib.git] / gio / gdbusnameowning.h
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 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, write to the
17  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18  * Boston, MA 02111-1307, USA.
19  *
20  * Author: David Zeuthen <davidz@redhat.com>
21  */
22
23 #ifndef __G_DBUS_NAME_OWNING_H__
24 #define __G_DBUS_NAME_OWNING_H__
25
26 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
27 #error "Only <gio/gio.h> can be included directly."
28 #endif
29
30 #include <gio/giotypes.h>
31
32 G_BEGIN_DECLS
33
34 /**
35  * GBusAcquiredCallback:
36  * @connection: The #GDBusConnection to a message bus.
37  * @name: The name that is requested to be owned.
38  * @user_data: User data passed to g_bus_own_name().
39  *
40  * Invoked when a connection to a message bus has been obtained.
41  *
42  * Since: 2.26
43  */
44 typedef void (*GBusAcquiredCallback) (GDBusConnection *connection,
45                                       const gchar     *name,
46                                       gpointer         user_data);
47
48 /**
49  * GBusNameAcquiredCallback:
50  * @connection: The #GDBusConnection on which to acquired the name.
51  * @name: The name being owned.
52  * @user_data: User data passed to g_bus_own_name() or g_bus_own_name_on_connection().
53  *
54  * Invoked when the name is acquired.
55  *
56  * Since: 2.26
57  */
58 typedef void (*GBusNameAcquiredCallback) (GDBusConnection *connection,
59                                           const gchar     *name,
60                                           gpointer         user_data);
61
62 /**
63  * GBusNameLostCallback:
64  * @connection: The #GDBusConnection on which to acquire the name or %NULL if
65  * the connection was disconnected.
66  * @name: The name being owned.
67  * @user_data: User data passed to g_bus_own_name() or g_bus_own_name_on_connection().
68  *
69  * Invoked when the name is lost or @connection has been closed.
70  *
71  * Since: 2.26
72  */
73 typedef void (*GBusNameLostCallback) (GDBusConnection *connection,
74                                       const gchar     *name,
75                                       gpointer         user_data);
76
77 GLIB_AVAILABLE_IN_ALL
78 guint g_bus_own_name                 (GBusType                  bus_type,
79                                       const gchar              *name,
80                                       GBusNameOwnerFlags        flags,
81                                       GBusAcquiredCallback      bus_acquired_handler,
82                                       GBusNameAcquiredCallback  name_acquired_handler,
83                                       GBusNameLostCallback      name_lost_handler,
84                                       gpointer                  user_data,
85                                       GDestroyNotify            user_data_free_func);
86
87 GLIB_AVAILABLE_IN_ALL
88 guint g_bus_own_name_on_connection   (GDBusConnection          *connection,
89                                       const gchar              *name,
90                                       GBusNameOwnerFlags        flags,
91                                       GBusNameAcquiredCallback  name_acquired_handler,
92                                       GBusNameLostCallback      name_lost_handler,
93                                       gpointer                  user_data,
94                                       GDestroyNotify            user_data_free_func);
95
96 GLIB_AVAILABLE_IN_ALL
97 guint g_bus_own_name_with_closures   (GBusType                  bus_type,
98                                       const gchar              *name,
99                                       GBusNameOwnerFlags        flags,
100                                       GClosure                 *bus_acquired_closure,
101                                       GClosure                 *name_acquired_closure,
102                                       GClosure                 *name_lost_closure);
103
104 GLIB_AVAILABLE_IN_ALL
105 guint g_bus_own_name_on_connection_with_closures (
106                                       GDBusConnection          *connection,
107                                       const gchar              *name,
108                                       GBusNameOwnerFlags        flags,
109                                       GClosure                 *name_acquired_closure,
110                                       GClosure                 *name_lost_closure);
111
112 GLIB_AVAILABLE_IN_ALL
113 void  g_bus_unown_name               (guint                     owner_id);
114
115 G_END_DECLS
116
117 #endif /* __G_DBUS_NAME_OWNING_H__ */