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 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."
28 #include <gio/giotypes.h>
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.
42 typedef void (*GBusAcquiredCallback
) (GDBusConnection
*connection
,
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.
56 typedef void (*GBusNameAcquiredCallback
) (GDBusConnection
*connection
,
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.
71 typedef void (*GBusNameLostCallback
) (GDBusConnection
*connection
,
76 guint
g_bus_own_name (GBusType bus_type
,
78 GBusNameOwnerFlags flags
,
79 GBusAcquiredCallback bus_acquired_handler
,
80 GBusNameAcquiredCallback name_acquired_handler
,
81 GBusNameLostCallback name_lost_handler
,
83 GDestroyNotify user_data_free_func
);
86 guint
g_bus_own_name_on_connection (GDBusConnection
*connection
,
88 GBusNameOwnerFlags flags
,
89 GBusNameAcquiredCallback name_acquired_handler
,
90 GBusNameLostCallback name_lost_handler
,
92 GDestroyNotify user_data_free_func
);
95 guint
g_bus_own_name_with_closures (GBusType bus_type
,
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
,
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
);
115 #endif /* __G_DBUS_NAME_OWNING_H__ */