source: appstream-generator/build/girepo/gio/DBusNames.d @ 4841

Last change on this file since 4841 was 4841, checked in by Juanma, 2 years ago

Initial release

File size: 14.0 KB
Line 
1/*
2 * Licensed under the GNU Lesser General Public License Version 3
3 *
4 * This library is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the license, or
7 * (at your option) any later version.
8 *
9 * This software is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18// generated automatically - do not change
19
20
21module gio.DBusNames;
22
23private import gi.gio;
24public  import gi.giotypes;
25private import gio.DBusConnection;
26private import glib.Str;
27private import gobject.Closure;
28
29
30/** */
31public struct DBusNames
32{
33
34        /**
35         * Starts acquiring @name on the bus specified by @bus_type and calls
36         * @name_acquired_handler and @name_lost_handler when the name is
37         * acquired respectively lost. Callbacks will be invoked in the
38         * [thread-default main context][g-main-context-push-thread-default]
39         * of the thread you are calling this function from.
40         *
41         * You are guaranteed that one of the @name_acquired_handler and @name_lost_handler
42         * callbacks will be invoked after calling this function - there are three
43         * possible cases:
44         *
45         * - @name_lost_handler with a %NULL connection (if a connection to the bus
46         * can't be made).
47         *
48         * - @bus_acquired_handler then @name_lost_handler (if the name can't be
49         * obtained)
50         *
51         * - @bus_acquired_handler then @name_acquired_handler (if the name was
52         * obtained).
53         *
54         * When you are done owning the name, just call g_bus_unown_name()
55         * with the owner id this function returns.
56         *
57         * If the name is acquired or lost (for example another application
58         * could acquire the name if you allow replacement or the application
59         * currently owning the name exits), the handlers are also invoked.
60         * If the #GDBusConnection that is used for attempting to own the name
61         * closes, then @name_lost_handler is invoked since it is no longer
62         * possible for other processes to access the process.
63         *
64         * You cannot use g_bus_own_name() several times for the same name (unless
65         * interleaved with calls to g_bus_unown_name()) - only the first call
66         * will work.
67         *
68         * Another guarantee is that invocations of @name_acquired_handler
69         * and @name_lost_handler are guaranteed to alternate; that
70         * is, if @name_acquired_handler is invoked then you are
71         * guaranteed that the next time one of the handlers is invoked, it
72         * will be @name_lost_handler. The reverse is also true.
73         *
74         * If you plan on exporting objects (using e.g.
75         * g_dbus_connection_register_object()), note that it is generally too late
76         * to export the objects in @name_acquired_handler. Instead, you can do this
77         * in @bus_acquired_handler since you are guaranteed that this will run
78         * before @name is requested from the bus.
79         *
80         * This behavior makes it very simple to write applications that wants
81         * to [own names][gdbus-owning-names] and export objects.
82         * Simply register objects to be exported in @bus_acquired_handler and
83         * unregister the objects (if any) in @name_lost_handler.
84         *
85         * Params:
86         *     busType = the type of bus to own a name on
87         *     name = the well-known name to own
88         *     flags = a set of flags from the #GBusNameOwnerFlags enumeration
89         *     busAcquiredHandler = handler to invoke when connected to the bus of type @bus_type or %NULL
90         *     nameAcquiredHandler = handler to invoke when @name is acquired or %NULL
91         *     nameLostHandler = handler to invoke when @name is lost or %NULL
92         *     userData = user data to pass to handlers
93         *     userDataFreeFunc = function for freeing @user_data or %NULL
94         *
95         * Returns: an identifier (never 0) that an be used with
96         *     g_bus_unown_name() to stop owning the name.
97         *
98         * Since: 2.26
99         */
100        public static uint ownName(GBusType busType, string name, GBusNameOwnerFlags flags, GBusAcquiredCallback busAcquiredHandler, GBusNameAcquiredCallback nameAcquiredHandler, GBusNameLostCallback nameLostHandler, void* userData, GDestroyNotify userDataFreeFunc)
101        {
102                return g_bus_own_name(busType, Str.toStringz(name), flags, busAcquiredHandler, nameAcquiredHandler, nameLostHandler, userData, userDataFreeFunc);
103        }
104
105        /**
106         * Like g_bus_own_name() but takes a #GDBusConnection instead of a
107         * #GBusType.
108         *
109         * Params:
110         *     connection = a #GDBusConnection
111         *     name = the well-known name to own
112         *     flags = a set of flags from the #GBusNameOwnerFlags enumeration
113         *     nameAcquiredHandler = handler to invoke when @name is acquired or %NULL
114         *     nameLostHandler = handler to invoke when @name is lost or %NULL
115         *     userData = user data to pass to handlers
116         *     userDataFreeFunc = function for freeing @user_data or %NULL
117         *
118         * Returns: an identifier (never 0) that an be used with
119         *     g_bus_unown_name() to stop owning the name
120         *
121         * Since: 2.26
122         */
123        public static uint ownNameOnConnection(DBusConnection connection, string name, GBusNameOwnerFlags flags, GBusNameAcquiredCallback nameAcquiredHandler, GBusNameLostCallback nameLostHandler, void* userData, GDestroyNotify userDataFreeFunc)
124        {
125                return g_bus_own_name_on_connection((connection is null) ? null : connection.getDBusConnectionStruct(), Str.toStringz(name), flags, nameAcquiredHandler, nameLostHandler, userData, userDataFreeFunc);
126        }
127
128        /**
129         * Version of g_bus_own_name_on_connection() using closures instead of
130         * callbacks for easier binding in other languages.
131         *
132         * Params:
133         *     connection = a #GDBusConnection
134         *     name = the well-known name to own
135         *     flags = a set of flags from the #GBusNameOwnerFlags enumeration
136         *     nameAcquiredClosure = #GClosure to invoke when @name is
137         *         acquired or %NULL
138         *     nameLostClosure = #GClosure to invoke when @name is lost
139         *         or %NULL
140         *
141         * Returns: an identifier (never 0) that an be used with
142         *     g_bus_unown_name() to stop owning the name.
143         *
144         * Since: 2.26
145         */
146        public static uint ownNameOnConnectionWithClosures(DBusConnection connection, string name, GBusNameOwnerFlags flags, Closure nameAcquiredClosure, Closure nameLostClosure)
147        {
148                return g_bus_own_name_on_connection_with_closures((connection is null) ? null : connection.getDBusConnectionStruct(), Str.toStringz(name), flags, (nameAcquiredClosure is null) ? null : nameAcquiredClosure.getClosureStruct(), (nameLostClosure is null) ? null : nameLostClosure.getClosureStruct());
149        }
150
151        /**
152         * Version of g_bus_own_name() using closures instead of callbacks for
153         * easier binding in other languages.
154         *
155         * Params:
156         *     busType = the type of bus to own a name on
157         *     name = the well-known name to own
158         *     flags = a set of flags from the #GBusNameOwnerFlags enumeration
159         *     busAcquiredClosure = #GClosure to invoke when connected to
160         *         the bus of type @bus_type or %NULL
161         *     nameAcquiredClosure = #GClosure to invoke when @name is
162         *         acquired or %NULL
163         *     nameLostClosure = #GClosure to invoke when @name is lost or
164         *         %NULL
165         *
166         * Returns: an identifier (never 0) that an be used with
167         *     g_bus_unown_name() to stop owning the name.
168         *
169         * Since: 2.26
170         */
171        public static uint ownNameWithClosures(GBusType busType, string name, GBusNameOwnerFlags flags, Closure busAcquiredClosure, Closure nameAcquiredClosure, Closure nameLostClosure)
172        {
173                return g_bus_own_name_with_closures(busType, Str.toStringz(name), flags, (busAcquiredClosure is null) ? null : busAcquiredClosure.getClosureStruct(), (nameAcquiredClosure is null) ? null : nameAcquiredClosure.getClosureStruct(), (nameLostClosure is null) ? null : nameLostClosure.getClosureStruct());
174        }
175
176        /**
177         * Stops owning a name.
178         *
179         * Params:
180         *     ownerId = an identifier obtained from g_bus_own_name()
181         *
182         * Since: 2.26
183         */
184        public static void unownName(uint ownerId)
185        {
186                g_bus_unown_name(ownerId);
187        }
188
189        /**
190         * Stops watching a name.
191         *
192         * Params:
193         *     watcherId = An identifier obtained from g_bus_watch_name()
194         *
195         * Since: 2.26
196         */
197        public static void unwatchName(uint watcherId)
198        {
199                g_bus_unwatch_name(watcherId);
200        }
201
202        /**
203         * Starts watching @name on the bus specified by @bus_type and calls
204         * @name_appeared_handler and @name_vanished_handler when the name is
205         * known to have a owner respectively known to lose its
206         * owner. Callbacks will be invoked in the
207         * [thread-default main context][g-main-context-push-thread-default]
208         * of the thread you are calling this function from.
209         *
210         * You are guaranteed that one of the handlers will be invoked after
211         * calling this function. When you are done watching the name, just
212         * call g_bus_unwatch_name() with the watcher id this function
213         * returns.
214         *
215         * If the name vanishes or appears (for example the application owning
216         * the name could restart), the handlers are also invoked. If the
217         * #GDBusConnection that is used for watching the name disconnects, then
218         * @name_vanished_handler is invoked since it is no longer
219         * possible to access the name.
220         *
221         * Another guarantee is that invocations of @name_appeared_handler
222         * and @name_vanished_handler are guaranteed to alternate; that
223         * is, if @name_appeared_handler is invoked then you are
224         * guaranteed that the next time one of the handlers is invoked, it
225         * will be @name_vanished_handler. The reverse is also true.
226         *
227         * This behavior makes it very simple to write applications that want
228         * to take action when a certain [name exists][gdbus-watching-names].
229         * Basically, the application should create object proxies in
230         * @name_appeared_handler and destroy them again (if any) in
231         * @name_vanished_handler.
232         *
233         * Params:
234         *     busType = The type of bus to watch a name on.
235         *     name = The name (well-known or unique) to watch.
236         *     flags = Flags from the #GBusNameWatcherFlags enumeration.
237         *     nameAppearedHandler = Handler to invoke when @name is known to exist or %NULL.
238         *     nameVanishedHandler = Handler to invoke when @name is known to not exist or %NULL.
239         *     userData = User data to pass to handlers.
240         *     userDataFreeFunc = Function for freeing @user_data or %NULL.
241         *
242         * Returns: An identifier (never 0) that an be used with
243         *     g_bus_unwatch_name() to stop watching the name.
244         *
245         * Since: 2.26
246         */
247        public static uint watchName(GBusType busType, string name, GBusNameWatcherFlags flags, GBusNameAppearedCallback nameAppearedHandler, GBusNameVanishedCallback nameVanishedHandler, void* userData, GDestroyNotify userDataFreeFunc)
248        {
249                return g_bus_watch_name(busType, Str.toStringz(name), flags, nameAppearedHandler, nameVanishedHandler, userData, userDataFreeFunc);
250        }
251
252        /**
253         * Like g_bus_watch_name() but takes a #GDBusConnection instead of a
254         * #GBusType.
255         *
256         * Params:
257         *     connection = A #GDBusConnection.
258         *     name = The name (well-known or unique) to watch.
259         *     flags = Flags from the #GBusNameWatcherFlags enumeration.
260         *     nameAppearedHandler = Handler to invoke when @name is known to exist or %NULL.
261         *     nameVanishedHandler = Handler to invoke when @name is known to not exist or %NULL.
262         *     userData = User data to pass to handlers.
263         *     userDataFreeFunc = Function for freeing @user_data or %NULL.
264         *
265         * Returns: An identifier (never 0) that an be used with
266         *     g_bus_unwatch_name() to stop watching the name.
267         *
268         * Since: 2.26
269         */
270        public static uint watchNameOnConnection(DBusConnection connection, string name, GBusNameWatcherFlags flags, GBusNameAppearedCallback nameAppearedHandler, GBusNameVanishedCallback nameVanishedHandler, void* userData, GDestroyNotify userDataFreeFunc)
271        {
272                return g_bus_watch_name_on_connection((connection is null) ? null : connection.getDBusConnectionStruct(), Str.toStringz(name), flags, nameAppearedHandler, nameVanishedHandler, userData, userDataFreeFunc);
273        }
274
275        /**
276         * Version of g_bus_watch_name_on_connection() using closures instead of callbacks for
277         * easier binding in other languages.
278         *
279         * Params:
280         *     connection = A #GDBusConnection.
281         *     name = The name (well-known or unique) to watch.
282         *     flags = Flags from the #GBusNameWatcherFlags enumeration.
283         *     nameAppearedClosure = #GClosure to invoke when @name is known
284         *         to exist or %NULL.
285         *     nameVanishedClosure = #GClosure to invoke when @name is known
286         *         to not exist or %NULL.
287         *
288         * Returns: An identifier (never 0) that an be used with
289         *     g_bus_unwatch_name() to stop watching the name.
290         *
291         * Since: 2.26
292         */
293        public static uint watchNameOnConnectionWithClosures(DBusConnection connection, string name, GBusNameWatcherFlags flags, Closure nameAppearedClosure, Closure nameVanishedClosure)
294        {
295                return g_bus_watch_name_on_connection_with_closures((connection is null) ? null : connection.getDBusConnectionStruct(), Str.toStringz(name), flags, (nameAppearedClosure is null) ? null : nameAppearedClosure.getClosureStruct(), (nameVanishedClosure is null) ? null : nameVanishedClosure.getClosureStruct());
296        }
297
298        /**
299         * Version of g_bus_watch_name() using closures instead of callbacks for
300         * easier binding in other languages.
301         *
302         * Params:
303         *     busType = The type of bus to watch a name on.
304         *     name = The name (well-known or unique) to watch.
305         *     flags = Flags from the #GBusNameWatcherFlags enumeration.
306         *     nameAppearedClosure = #GClosure to invoke when @name is known
307         *         to exist or %NULL.
308         *     nameVanishedClosure = #GClosure to invoke when @name is known
309         *         to not exist or %NULL.
310         *
311         * Returns: An identifier (never 0) that an be used with
312         *     g_bus_unwatch_name() to stop watching the name.
313         *
314         * Since: 2.26
315         */
316        public static uint watchNameWithClosures(GBusType busType, string name, GBusNameWatcherFlags flags, Closure nameAppearedClosure, Closure nameVanishedClosure)
317        {
318                return g_bus_watch_name_with_closures(busType, Str.toStringz(name), flags, (nameAppearedClosure is null) ? null : nameAppearedClosure.getClosureStruct(), (nameVanishedClosure is null) ? null : nameVanishedClosure.getClosureStruct());
319        }
320}
Note: See TracBrowser for help on using the repository browser.