Merge branch 'gdbus-merge'
[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 #include <gio/giotypes.h>
27
28 G_BEGIN_DECLS
29
30 /**
31  * GBusAcquiredCallback:
32  * @connection: The #GDBusConnection to a message bus.
33  * @name: The name that is requested to be owned.
34  * @user_data: User data passed to g_bus_own_name().
35  *
36  * Invoked when a connection to a message bus has been obtained.
37  *
38  * Since: 2.26
39  */
40 typedef void (*GBusAcquiredCallback) (GDBusConnection *connection,
41                                       const gchar     *name,
42                                       gpointer         user_data);
43
44 /**
45  * GBusNameAcquiredCallback:
46  * @connection: The #GDBusConnection on which to acquired the name.
47  * @name: The name being owned.
48  * @user_data: User data passed to g_bus_own_name() or g_bus_own_name_on_connection().
49  *
50  * Invoked when the name is acquired.
51  *
52  * Since: 2.26
53  */
54 typedef void (*GBusNameAcquiredCallback) (GDBusConnection *connection,
55                                           const gchar     *name,
56                                           gpointer         user_data);
57
58 /**
59  * GBusNameLostCallback:
60  * @connection: The #GDBusConnection on which to acquire the name or %NULL if
61  * the connection was disconnected.
62  * @name: The name being owned.
63  * @user_data: User data passed to g_bus_own_name() or g_bus_own_name_on_connection().
64  *
65  * Invoked when the name is lost or @connection has been closed.
66  *
67  * Since: 2.26
68  */
69 typedef void (*GBusNameLostCallback) (GDBusConnection *connection,
70                                       const gchar     *name,
71                                       gpointer         user_data);
72
73 guint g_bus_own_name                 (GBusType                  bus_type,
74                                       const gchar              *name,
75                                       GBusNameOwnerFlags        flags,
76                                       GBusAcquiredCallback      bus_acquired_handler,
77                                       GBusNameAcquiredCallback  name_acquired_handler,
78                                       GBusNameLostCallback      name_lost_handler,
79                                       gpointer                  user_data,
80                                       GDestroyNotify            user_data_free_func);
81
82 guint g_bus_own_name_on_connection   (GDBusConnection          *connection,
83                                       const gchar              *name,
84                                       GBusNameOwnerFlags        flags,
85                                       GBusNameAcquiredCallback  name_acquired_handler,
86                                       GBusNameLostCallback      name_lost_handler,
87                                       gpointer                  user_data,
88                                       GDestroyNotify            user_data_free_func);
89
90 void  g_bus_unown_name               (guint                     owner_id);
91
92 G_END_DECLS
93
94 #endif /* __G_DBUS_NAME_OWNING_H__ */