1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD 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
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gio.DBusConnection;
26 
27 private import gio.ActionGroupIF;
28 private import gio.AsyncInitableIF;
29 private import gio.AsyncInitableT;
30 private import gio.AsyncResultIF;
31 private import gio.Cancellable;
32 private import gio.Credentials;
33 private import gio.DBusAuthObserver;
34 private import gio.DBusInterfaceInfo;
35 private import gio.DBusMessage;
36 private import gio.IOStream;
37 private import gio.InitableIF;
38 private import gio.InitableT;
39 private import gio.MenuModel;
40 private import gio.UnixFDList;
41 private import gio.c.functions;
42 public  import gio.c.types;
43 private import glib.ConstructionException;
44 private import glib.ErrorG;
45 private import glib.GException;
46 private import glib.Str;
47 private import glib.Variant;
48 private import glib.VariantType;
49 private import gobject.Closure;
50 private import gobject.ObjectG;
51 private import gobject.Signals;
52 public  import gtkc.giotypes;
53 private import std.algorithm;
54 
55 
56 /**
57  * The #GDBusConnection type is used for D-Bus connections to remote
58  * peers such as a message buses. It is a low-level API that offers a
59  * lot of flexibility. For instance, it lets you establish a connection
60  * over any transport that can by represented as an #GIOStream.
61  * 
62  * This class is rarely used directly in D-Bus clients. If you are writing
63  * a D-Bus client, it is often easier to use the g_bus_own_name(),
64  * g_bus_watch_name() or g_dbus_proxy_new_for_bus() APIs.
65  * 
66  * As an exception to the usual GLib rule that a particular object must not
67  * be used by two threads at the same time, #GDBusConnection's methods may be
68  * called from any thread. This is so that g_bus_get() and g_bus_get_sync()
69  * can safely return the same #GDBusConnection when called from any thread.
70  * 
71  * Most of the ways to obtain a #GDBusConnection automatically initialize it
72  * (i.e. connect to D-Bus): for instance, g_dbus_connection_new() and
73  * g_bus_get(), and the synchronous versions of those methods, give you an
74  * initialized connection. Language bindings for GIO should use
75  * g_initable_new() or g_async_initable_new_async(), which also initialize the
76  * connection.
77  * 
78  * If you construct an uninitialized #GDBusConnection, such as via
79  * g_object_new(), you must initialize it via g_initable_init() or
80  * g_async_initable_init_async() before using its methods or properties.
81  * Calling methods or accessing properties on a #GDBusConnection that has not
82  * completed initialization successfully is considered to be invalid, and leads
83  * to undefined behaviour. In particular, if initialization fails with a
84  * #GError, the only valid thing you can do with that #GDBusConnection is to
85  * free it with g_object_unref().
86  * 
87  * ## An example D-Bus server # {#gdbus-server}
88  * 
89  * Here is an example for a D-Bus server:
90  * [gdbus-example-server.c](https://git.gnome.org/browse/glib/tree/gio/tests/gdbus-example-server.c)
91  * 
92  * ## An example for exporting a subtree # {#gdbus-subtree-server}
93  * 
94  * Here is an example for exporting a subtree:
95  * [gdbus-example-subtree.c](https://git.gnome.org/browse/glib/tree/gio/tests/gdbus-example-subtree.c)
96  * 
97  * ## An example for file descriptor passing # {#gdbus-unix-fd-client}
98  * 
99  * Here is an example for passing UNIX file descriptors:
100  * [gdbus-unix-fd-client.c](https://git.gnome.org/browse/glib/tree/gio/tests/gdbus-unix-fd-client.c)
101  * 
102  * ## An example for exporting a GObject # {#gdbus-export}
103  * 
104  * Here is an example for exporting a #GObject:
105  * [gdbus-example-export.c](https://git.gnome.org/browse/glib/tree/gio/tests/gdbus-example-export.c)
106  *
107  * Since: 2.26
108  */
109 public class DBusConnection : ObjectG, AsyncInitableIF, InitableIF
110 {
111 	/** the main Gtk struct */
112 	protected GDBusConnection* gDBusConnection;
113 
114 	/** Get the main Gtk struct */
115 	public GDBusConnection* getDBusConnectionStruct(bool transferOwnership = false)
116 	{
117 		if (transferOwnership)
118 			ownedRef = false;
119 		return gDBusConnection;
120 	}
121 
122 	/** the main Gtk struct as a void* */
123 	protected override void* getStruct()
124 	{
125 		return cast(void*)gDBusConnection;
126 	}
127 
128 	protected override void setStruct(GObject* obj)
129 	{
130 		gDBusConnection = cast(GDBusConnection*)obj;
131 		super.setStruct(obj);
132 	}
133 
134 	/**
135 	 * Sets our main struct and passes it to the parent class.
136 	 */
137 	public this (GDBusConnection* gDBusConnection, bool ownedRef = false)
138 	{
139 		this.gDBusConnection = gDBusConnection;
140 		super(cast(GObject*)gDBusConnection, ownedRef);
141 	}
142 
143 	// add the AsyncInitable capabilities
144 	mixin AsyncInitableT!(GDBusConnection);
145 
146 	// add the Initable capabilities
147 	mixin InitableT!(GDBusConnection);
148 
149 	/**
150 	 * Finishes an operation started with g_dbus_connection_new().
151 	 *
152 	 * Params:
153 	 *     res    = A GAsyncResult obtained from the GAsyncReadyCallback
154 	 *               passed to g_dbus_connection_new().
155 	 *     address = If true finish an address.
156 	 *
157 	 * Throws: GException on failure.
158 	 * Throws: ConstructionException GTK+ fails to create the object.
159 	 *
160 	 * Since: 2.26
161 	 */
162 	public this (AsyncResultIF res, bool address = false)
163 	{
164 		GError* err = null;
165 		GDBusConnection* p;
166 
167 		if ( address )
168 		{
169 			p = g_dbus_connection_new_for_address_finish((res is null) ? null : res.getAsyncResultStruct(), &err);
170 		}
171 		else
172 		{
173 			p = g_dbus_connection_new_finish((res is null) ? null : res.getAsyncResultStruct(), &err);
174 		}
175 
176 		if (err !is null)
177 		{
178 			throw new GException( new ErrorG(err) );
179 		}
180 
181 		if(p is null)
182 		{
183 			throw new ConstructionException("null returned by g_dbus_connection_new_finish((res is null) ? null : res.getAsyncResultStruct(), &err)");
184 		}
185 		this(p, true);
186 	}
187 
188 	/**
189 	 */
190 
191 	/** */
192 	public static GType getType()
193 	{
194 		return g_dbus_connection_get_type();
195 	}
196 
197 	/**
198 	 * Synchronously connects and sets up a D-Bus client connection for
199 	 * exchanging D-Bus messages with an endpoint specified by @address
200 	 * which must be in the
201 	 * [D-Bus address format](https://dbus.freedesktop.org/doc/dbus-specification.html#addresses).
202 	 *
203 	 * This constructor can only be used to initiate client-side
204 	 * connections - use g_dbus_connection_new_sync() if you need to act
205 	 * as the server. In particular, @flags cannot contain the
206 	 * %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER or
207 	 * %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS flags.
208 	 *
209 	 * This is a synchronous failable constructor. See
210 	 * g_dbus_connection_new_for_address() for the asynchronous version.
211 	 *
212 	 * If @observer is not %NULL it may be used to control the
213 	 * authentication process.
214 	 *
215 	 * Params:
216 	 *     address = a D-Bus address
217 	 *     flags = flags describing how to make the connection
218 	 *     observer = a #GDBusAuthObserver or %NULL
219 	 *     cancellable = a #GCancellable or %NULL
220 	 *
221 	 * Returns: a #GDBusConnection or %NULL if @error is set. Free with
222 	 *     g_object_unref().
223 	 *
224 	 * Since: 2.26
225 	 *
226 	 * Throws: GException on failure.
227 	 * Throws: ConstructionException GTK+ fails to create the object.
228 	 */
229 	public this(string address, GDBusConnectionFlags flags, DBusAuthObserver observer, Cancellable cancellable)
230 	{
231 		GError* err = null;
232 
233 		auto p = g_dbus_connection_new_for_address_sync(Str.toStringz(address), flags, (observer is null) ? null : observer.getDBusAuthObserverStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
234 
235 		if (err !is null)
236 		{
237 			throw new GException( new ErrorG(err) );
238 		}
239 
240 		if(p is null)
241 		{
242 			throw new ConstructionException("null returned by new_for_address_sync");
243 		}
244 
245 		this(cast(GDBusConnection*) p, true);
246 	}
247 
248 	/**
249 	 * Synchronously sets up a D-Bus connection for exchanging D-Bus messages
250 	 * with the end represented by @stream.
251 	 *
252 	 * If @stream is a #GSocketConnection, then the corresponding #GSocket
253 	 * will be put into non-blocking mode.
254 	 *
255 	 * The D-Bus connection will interact with @stream from a worker thread.
256 	 * As a result, the caller should not interact with @stream after this
257 	 * method has been called, except by calling g_object_unref() on it.
258 	 *
259 	 * If @observer is not %NULL it may be used to control the
260 	 * authentication process.
261 	 *
262 	 * This is a synchronous failable constructor. See
263 	 * g_dbus_connection_new() for the asynchronous version.
264 	 *
265 	 * Params:
266 	 *     stream = a #GIOStream
267 	 *     guid = the GUID to use if a authenticating as a server or %NULL
268 	 *     flags = flags describing how to make the connection
269 	 *     observer = a #GDBusAuthObserver or %NULL
270 	 *     cancellable = a #GCancellable or %NULL
271 	 *
272 	 * Returns: a #GDBusConnection or %NULL if @error is set. Free with g_object_unref().
273 	 *
274 	 * Since: 2.26
275 	 *
276 	 * Throws: GException on failure.
277 	 * Throws: ConstructionException GTK+ fails to create the object.
278 	 */
279 	public this(IOStream stream, string guid, GDBusConnectionFlags flags, DBusAuthObserver observer, Cancellable cancellable)
280 	{
281 		GError* err = null;
282 
283 		auto p = g_dbus_connection_new_sync((stream is null) ? null : stream.getIOStreamStruct(), Str.toStringz(guid), flags, (observer is null) ? null : observer.getDBusAuthObserverStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
284 
285 		if (err !is null)
286 		{
287 			throw new GException( new ErrorG(err) );
288 		}
289 
290 		if(p is null)
291 		{
292 			throw new ConstructionException("null returned by new_sync");
293 		}
294 
295 		this(cast(GDBusConnection*) p, true);
296 	}
297 
298 	/**
299 	 * Asynchronously sets up a D-Bus connection for exchanging D-Bus messages
300 	 * with the end represented by @stream.
301 	 *
302 	 * If @stream is a #GSocketConnection, then the corresponding #GSocket
303 	 * will be put into non-blocking mode.
304 	 *
305 	 * The D-Bus connection will interact with @stream from a worker thread.
306 	 * As a result, the caller should not interact with @stream after this
307 	 * method has been called, except by calling g_object_unref() on it.
308 	 *
309 	 * If @observer is not %NULL it may be used to control the
310 	 * authentication process.
311 	 *
312 	 * When the operation is finished, @callback will be invoked. You can
313 	 * then call g_dbus_connection_new_finish() to get the result of the
314 	 * operation.
315 	 *
316 	 * This is a asynchronous failable constructor. See
317 	 * g_dbus_connection_new_sync() for the synchronous
318 	 * version.
319 	 *
320 	 * Params:
321 	 *     stream = a #GIOStream
322 	 *     guid = the GUID to use if a authenticating as a server or %NULL
323 	 *     flags = flags describing how to make the connection
324 	 *     observer = a #GDBusAuthObserver or %NULL
325 	 *     cancellable = a #GCancellable or %NULL
326 	 *     callback = a #GAsyncReadyCallback to call when the request is satisfied
327 	 *     userData = the data to pass to @callback
328 	 *
329 	 * Since: 2.26
330 	 */
331 	public static void newConnection(IOStream stream, string guid, GDBusConnectionFlags flags, DBusAuthObserver observer, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
332 	{
333 		g_dbus_connection_new((stream is null) ? null : stream.getIOStreamStruct(), Str.toStringz(guid), flags, (observer is null) ? null : observer.getDBusAuthObserverStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
334 	}
335 
336 	/**
337 	 * Asynchronously connects and sets up a D-Bus client connection for
338 	 * exchanging D-Bus messages with an endpoint specified by @address
339 	 * which must be in the
340 	 * [D-Bus address format](https://dbus.freedesktop.org/doc/dbus-specification.html#addresses).
341 	 *
342 	 * This constructor can only be used to initiate client-side
343 	 * connections - use g_dbus_connection_new() if you need to act as the
344 	 * server. In particular, @flags cannot contain the
345 	 * %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER or
346 	 * %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS flags.
347 	 *
348 	 * When the operation is finished, @callback will be invoked. You can
349 	 * then call g_dbus_connection_new_finish() to get the result of the
350 	 * operation.
351 	 *
352 	 * If @observer is not %NULL it may be used to control the
353 	 * authentication process.
354 	 *
355 	 * This is a asynchronous failable constructor. See
356 	 * g_dbus_connection_new_for_address_sync() for the synchronous
357 	 * version.
358 	 *
359 	 * Params:
360 	 *     address = a D-Bus address
361 	 *     flags = flags describing how to make the connection
362 	 *     observer = a #GDBusAuthObserver or %NULL
363 	 *     cancellable = a #GCancellable or %NULL
364 	 *     callback = a #GAsyncReadyCallback to call when the request is satisfied
365 	 *     userData = the data to pass to @callback
366 	 *
367 	 * Since: 2.26
368 	 */
369 	public static void newForAddress(string address, GDBusConnectionFlags flags, DBusAuthObserver observer, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
370 	{
371 		g_dbus_connection_new_for_address(Str.toStringz(address), flags, (observer is null) ? null : observer.getDBusAuthObserverStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
372 	}
373 
374 	/**
375 	 * Adds a message filter. Filters are handlers that are run on all
376 	 * incoming and outgoing messages, prior to standard dispatch. Filters
377 	 * are run in the order that they were added.  The same handler can be
378 	 * added as a filter more than once, in which case it will be run more
379 	 * than once.  Filters added during a filter callback won't be run on
380 	 * the message being processed. Filter functions are allowed to modify
381 	 * and even drop messages.
382 	 *
383 	 * Note that filters are run in a dedicated message handling thread so
384 	 * they can't block and, generally, can't do anything but signal a
385 	 * worker thread. Also note that filters are rarely needed - use API
386 	 * such as g_dbus_connection_send_message_with_reply(),
387 	 * g_dbus_connection_signal_subscribe() or g_dbus_connection_call() instead.
388 	 *
389 	 * If a filter consumes an incoming message the message is not
390 	 * dispatched anywhere else - not even the standard dispatch machinery
391 	 * (that API such as g_dbus_connection_signal_subscribe() and
392 	 * g_dbus_connection_send_message_with_reply() relies on) will see the
393 	 * message. Similary, if a filter consumes an outgoing message, the
394 	 * message will not be sent to the other peer.
395 	 *
396 	 * If @user_data_free_func is non-%NULL, it will be called (in the
397 	 * thread-default main context of the thread you are calling this
398 	 * method from) at some point after @user_data is no longer
399 	 * needed. (It is not guaranteed to be called synchronously when the
400 	 * filter is removed, and may be called after @connection has been
401 	 * destroyed.)
402 	 *
403 	 * Params:
404 	 *     filterFunction = a filter function
405 	 *     userData = user data to pass to @filter_function
406 	 *     userDataFreeFunc = function to free @user_data with when filter
407 	 *         is removed or %NULL
408 	 *
409 	 * Returns: a filter identifier that can be used with
410 	 *     g_dbus_connection_remove_filter()
411 	 *
412 	 * Since: 2.26
413 	 */
414 	public uint addFilter(GDBusMessageFilterFunction filterFunction, void* userData, GDestroyNotify userDataFreeFunc)
415 	{
416 		return g_dbus_connection_add_filter(gDBusConnection, filterFunction, userData, userDataFreeFunc);
417 	}
418 
419 	/**
420 	 * Asynchronously invokes the @method_name method on the
421 	 * @interface_name D-Bus interface on the remote object at
422 	 * @object_path owned by @bus_name.
423 	 *
424 	 * If @connection is closed then the operation will fail with
425 	 * %G_IO_ERROR_CLOSED. If @cancellable is canceled, the operation will
426 	 * fail with %G_IO_ERROR_CANCELLED. If @parameters contains a value
427 	 * not compatible with the D-Bus protocol, the operation fails with
428 	 * %G_IO_ERROR_INVALID_ARGUMENT.
429 	 *
430 	 * If @reply_type is non-%NULL then the reply will be checked for having this type and an
431 	 * error will be raised if it does not match.  Said another way, if you give a @reply_type
432 	 * then any non-%NULL return value will be of this type.
433 	 *
434 	 * If the @parameters #GVariant is floating, it is consumed. This allows
435 	 * convenient 'inline' use of g_variant_new(), e.g.:
436 	 * |[<!-- language="C" -->
437 	 * g_dbus_connection_call (connection,
438 	 * "org.freedesktop.StringThings",
439 	 * "/org/freedesktop/StringThings",
440 	 * "org.freedesktop.StringThings",
441 	 * "TwoStrings",
442 	 * g_variant_new ("(ss)",
443 	 * "Thing One",
444 	 * "Thing Two"),
445 	 * NULL,
446 	 * G_DBUS_CALL_FLAGS_NONE,
447 	 * -1,
448 	 * NULL,
449 	 * (GAsyncReadyCallback) two_strings_done,
450 	 * NULL);
451 	 * ]|
452 	 *
453 	 * This is an asynchronous method. When the operation is finished,
454 	 * @callback will be invoked in the
455 	 * [thread-default main context][g-main-context-push-thread-default]
456 	 * of the thread you are calling this method from. You can then call
457 	 * g_dbus_connection_call_finish() to get the result of the operation.
458 	 * See g_dbus_connection_call_sync() for the synchronous version of this
459 	 * function.
460 	 *
461 	 * If @callback is %NULL then the D-Bus method call message will be sent with
462 	 * the %G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED flag set.
463 	 *
464 	 * Params:
465 	 *     busName = a unique or well-known bus name or %NULL if
466 	 *         @connection is not a message bus connection
467 	 *     objectPath = path of remote object
468 	 *     interfaceName = D-Bus interface to invoke method on
469 	 *     methodName = the name of the method to invoke
470 	 *     parameters = a #GVariant tuple with parameters for the method
471 	 *         or %NULL if not passing parameters
472 	 *     replyType = the expected type of the reply, or %NULL
473 	 *     flags = flags from the #GDBusCallFlags enumeration
474 	 *     timeoutMsec = the timeout in milliseconds, -1 to use the default
475 	 *         timeout or %G_MAXINT for no timeout
476 	 *     cancellable = a #GCancellable or %NULL
477 	 *     callback = a #GAsyncReadyCallback to call when the request
478 	 *         is satisfied or %NULL if you don't care about the result of the
479 	 *         method invocation
480 	 *     userData = the data to pass to @callback
481 	 *
482 	 * Since: 2.26
483 	 */
484 	public void call(string busName, string objectPath, string interfaceName, string methodName, Variant parameters, VariantType replyType, GDBusCallFlags flags, int timeoutMsec, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
485 	{
486 		g_dbus_connection_call(gDBusConnection, Str.toStringz(busName), Str.toStringz(objectPath), Str.toStringz(interfaceName), Str.toStringz(methodName), (parameters is null) ? null : parameters.getVariantStruct(), (replyType is null) ? null : replyType.getVariantTypeStruct(), flags, timeoutMsec, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
487 	}
488 
489 	/**
490 	 * Finishes an operation started with g_dbus_connection_call().
491 	 *
492 	 * Params:
493 	 *     res = a #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_connection_call()
494 	 *
495 	 * Returns: %NULL if @error is set. Otherwise a #GVariant tuple with
496 	 *     return values. Free with g_variant_unref().
497 	 *
498 	 * Since: 2.26
499 	 *
500 	 * Throws: GException on failure.
501 	 */
502 	public Variant callFinish(AsyncResultIF res)
503 	{
504 		GError* err = null;
505 
506 		auto p = g_dbus_connection_call_finish(gDBusConnection, (res is null) ? null : res.getAsyncResultStruct(), &err);
507 
508 		if (err !is null)
509 		{
510 			throw new GException( new ErrorG(err) );
511 		}
512 
513 		if(p is null)
514 		{
515 			return null;
516 		}
517 
518 		return new Variant(cast(GVariant*) p, true);
519 	}
520 
521 	/**
522 	 * Synchronously invokes the @method_name method on the
523 	 * @interface_name D-Bus interface on the remote object at
524 	 * @object_path owned by @bus_name.
525 	 *
526 	 * If @connection is closed then the operation will fail with
527 	 * %G_IO_ERROR_CLOSED. If @cancellable is canceled, the
528 	 * operation will fail with %G_IO_ERROR_CANCELLED. If @parameters
529 	 * contains a value not compatible with the D-Bus protocol, the operation
530 	 * fails with %G_IO_ERROR_INVALID_ARGUMENT.
531 	 *
532 	 * If @reply_type is non-%NULL then the reply will be checked for having
533 	 * this type and an error will be raised if it does not match.  Said
534 	 * another way, if you give a @reply_type then any non-%NULL return
535 	 * value will be of this type.
536 	 *
537 	 * If the @parameters #GVariant is floating, it is consumed.
538 	 * This allows convenient 'inline' use of g_variant_new(), e.g.:
539 	 * |[<!-- language="C" -->
540 	 * g_dbus_connection_call_sync (connection,
541 	 * "org.freedesktop.StringThings",
542 	 * "/org/freedesktop/StringThings",
543 	 * "org.freedesktop.StringThings",
544 	 * "TwoStrings",
545 	 * g_variant_new ("(ss)",
546 	 * "Thing One",
547 	 * "Thing Two"),
548 	 * NULL,
549 	 * G_DBUS_CALL_FLAGS_NONE,
550 	 * -1,
551 	 * NULL,
552 	 * &error);
553 	 * ]|
554 	 *
555 	 * The calling thread is blocked until a reply is received. See
556 	 * g_dbus_connection_call() for the asynchronous version of
557 	 * this method.
558 	 *
559 	 * Params:
560 	 *     busName = a unique or well-known bus name or %NULL if
561 	 *         @connection is not a message bus connection
562 	 *     objectPath = path of remote object
563 	 *     interfaceName = D-Bus interface to invoke method on
564 	 *     methodName = the name of the method to invoke
565 	 *     parameters = a #GVariant tuple with parameters for the method
566 	 *         or %NULL if not passing parameters
567 	 *     replyType = the expected type of the reply, or %NULL
568 	 *     flags = flags from the #GDBusCallFlags enumeration
569 	 *     timeoutMsec = the timeout in milliseconds, -1 to use the default
570 	 *         timeout or %G_MAXINT for no timeout
571 	 *     cancellable = a #GCancellable or %NULL
572 	 *
573 	 * Returns: %NULL if @error is set. Otherwise a #GVariant tuple with
574 	 *     return values. Free with g_variant_unref().
575 	 *
576 	 * Since: 2.26
577 	 *
578 	 * Throws: GException on failure.
579 	 */
580 	public Variant callSync(string busName, string objectPath, string interfaceName, string methodName, Variant parameters, VariantType replyType, GDBusCallFlags flags, int timeoutMsec, Cancellable cancellable)
581 	{
582 		GError* err = null;
583 
584 		auto p = g_dbus_connection_call_sync(gDBusConnection, Str.toStringz(busName), Str.toStringz(objectPath), Str.toStringz(interfaceName), Str.toStringz(methodName), (parameters is null) ? null : parameters.getVariantStruct(), (replyType is null) ? null : replyType.getVariantTypeStruct(), flags, timeoutMsec, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
585 
586 		if (err !is null)
587 		{
588 			throw new GException( new ErrorG(err) );
589 		}
590 
591 		if(p is null)
592 		{
593 			return null;
594 		}
595 
596 		return new Variant(cast(GVariant*) p, true);
597 	}
598 
599 	/**
600 	 * Like g_dbus_connection_call() but also takes a #GUnixFDList object.
601 	 *
602 	 * This method is only available on UNIX.
603 	 *
604 	 * Params:
605 	 *     busName = a unique or well-known bus name or %NULL if
606 	 *         @connection is not a message bus connection
607 	 *     objectPath = path of remote object
608 	 *     interfaceName = D-Bus interface to invoke method on
609 	 *     methodName = the name of the method to invoke
610 	 *     parameters = a #GVariant tuple with parameters for the method
611 	 *         or %NULL if not passing parameters
612 	 *     replyType = the expected type of the reply, or %NULL
613 	 *     flags = flags from the #GDBusCallFlags enumeration
614 	 *     timeoutMsec = the timeout in milliseconds, -1 to use the default
615 	 *         timeout or %G_MAXINT for no timeout
616 	 *     fdList = a #GUnixFDList or %NULL
617 	 *     cancellable = a #GCancellable or %NULL
618 	 *     callback = a #GAsyncReadyCallback to call when the request is
619 	 *         satisfied or %NULL if you don't * care about the result of the
620 	 *         method invocation
621 	 *     userData = The data to pass to @callback.
622 	 *
623 	 * Since: 2.30
624 	 */
625 	public void callWithUnixFdList(string busName, string objectPath, string interfaceName, string methodName, Variant parameters, VariantType replyType, GDBusCallFlags flags, int timeoutMsec, UnixFDList fdList, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
626 	{
627 		g_dbus_connection_call_with_unix_fd_list(gDBusConnection, Str.toStringz(busName), Str.toStringz(objectPath), Str.toStringz(interfaceName), Str.toStringz(methodName), (parameters is null) ? null : parameters.getVariantStruct(), (replyType is null) ? null : replyType.getVariantTypeStruct(), flags, timeoutMsec, (fdList is null) ? null : fdList.getUnixFDListStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
628 	}
629 
630 	/**
631 	 * Finishes an operation started with g_dbus_connection_call_with_unix_fd_list().
632 	 *
633 	 * Params:
634 	 *     outFdList = return location for a #GUnixFDList or %NULL
635 	 *     res = a #GAsyncResult obtained from the #GAsyncReadyCallback passed to
636 	 *         g_dbus_connection_call_with_unix_fd_list()
637 	 *
638 	 * Returns: %NULL if @error is set. Otherwise a #GVariant tuple with
639 	 *     return values. Free with g_variant_unref().
640 	 *
641 	 * Since: 2.30
642 	 *
643 	 * Throws: GException on failure.
644 	 */
645 	public Variant callWithUnixFdListFinish(out UnixFDList outFdList, AsyncResultIF res)
646 	{
647 		GUnixFDList* outoutFdList = null;
648 		GError* err = null;
649 
650 		auto p = g_dbus_connection_call_with_unix_fd_list_finish(gDBusConnection, &outoutFdList, (res is null) ? null : res.getAsyncResultStruct(), &err);
651 
652 		if (err !is null)
653 		{
654 			throw new GException( new ErrorG(err) );
655 		}
656 
657 		outFdList = ObjectG.getDObject!(UnixFDList)(outoutFdList);
658 
659 		if(p is null)
660 		{
661 			return null;
662 		}
663 
664 		return new Variant(cast(GVariant*) p, true);
665 	}
666 
667 	/**
668 	 * Like g_dbus_connection_call_sync() but also takes and returns #GUnixFDList objects.
669 	 *
670 	 * This method is only available on UNIX.
671 	 *
672 	 * Params:
673 	 *     busName = a unique or well-known bus name or %NULL
674 	 *         if @connection is not a message bus connection
675 	 *     objectPath = path of remote object
676 	 *     interfaceName = D-Bus interface to invoke method on
677 	 *     methodName = the name of the method to invoke
678 	 *     parameters = a #GVariant tuple with parameters for
679 	 *         the method or %NULL if not passing parameters
680 	 *     replyType = the expected type of the reply, or %NULL
681 	 *     flags = flags from the #GDBusCallFlags enumeration
682 	 *     timeoutMsec = the timeout in milliseconds, -1 to use the default
683 	 *         timeout or %G_MAXINT for no timeout
684 	 *     fdList = a #GUnixFDList or %NULL
685 	 *     outFdList = return location for a #GUnixFDList or %NULL
686 	 *     cancellable = a #GCancellable or %NULL
687 	 *
688 	 * Returns: %NULL if @error is set. Otherwise a #GVariant tuple with
689 	 *     return values. Free with g_variant_unref().
690 	 *
691 	 * Since: 2.30
692 	 *
693 	 * Throws: GException on failure.
694 	 */
695 	public Variant callWithUnixFdListSync(string busName, string objectPath, string interfaceName, string methodName, Variant parameters, VariantType replyType, GDBusCallFlags flags, int timeoutMsec, UnixFDList fdList, out UnixFDList outFdList, Cancellable cancellable)
696 	{
697 		GUnixFDList* outoutFdList = null;
698 		GError* err = null;
699 
700 		auto p = g_dbus_connection_call_with_unix_fd_list_sync(gDBusConnection, Str.toStringz(busName), Str.toStringz(objectPath), Str.toStringz(interfaceName), Str.toStringz(methodName), (parameters is null) ? null : parameters.getVariantStruct(), (replyType is null) ? null : replyType.getVariantTypeStruct(), flags, timeoutMsec, (fdList is null) ? null : fdList.getUnixFDListStruct(), &outoutFdList, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
701 
702 		if (err !is null)
703 		{
704 			throw new GException( new ErrorG(err) );
705 		}
706 
707 		outFdList = ObjectG.getDObject!(UnixFDList)(outoutFdList);
708 
709 		if(p is null)
710 		{
711 			return null;
712 		}
713 
714 		return new Variant(cast(GVariant*) p, true);
715 	}
716 
717 	/**
718 	 * Closes @connection. Note that this never causes the process to
719 	 * exit (this might only happen if the other end of a shared message
720 	 * bus connection disconnects, see #GDBusConnection:exit-on-close).
721 	 *
722 	 * Once the connection is closed, operations such as sending a message
723 	 * will return with the error %G_IO_ERROR_CLOSED. Closing a connection
724 	 * will not automatically flush the connection so queued messages may
725 	 * be lost. Use g_dbus_connection_flush() if you need such guarantees.
726 	 *
727 	 * If @connection is already closed, this method fails with
728 	 * %G_IO_ERROR_CLOSED.
729 	 *
730 	 * When @connection has been closed, the #GDBusConnection::closed
731 	 * signal is emitted in the
732 	 * [thread-default main context][g-main-context-push-thread-default]
733 	 * of the thread that @connection was constructed in.
734 	 *
735 	 * This is an asynchronous method. When the operation is finished,
736 	 * @callback will be invoked in the
737 	 * [thread-default main context][g-main-context-push-thread-default]
738 	 * of the thread you are calling this method from. You can
739 	 * then call g_dbus_connection_close_finish() to get the result of the
740 	 * operation. See g_dbus_connection_close_sync() for the synchronous
741 	 * version.
742 	 *
743 	 * Params:
744 	 *     cancellable = a #GCancellable or %NULL
745 	 *     callback = a #GAsyncReadyCallback to call when the request is
746 	 *         satisfied or %NULL if you don't care about the result
747 	 *     userData = The data to pass to @callback
748 	 *
749 	 * Since: 2.26
750 	 */
751 	public void close(Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
752 	{
753 		g_dbus_connection_close(gDBusConnection, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
754 	}
755 
756 	/**
757 	 * Finishes an operation started with g_dbus_connection_close().
758 	 *
759 	 * Params:
760 	 *     res = a #GAsyncResult obtained from the #GAsyncReadyCallback passed
761 	 *         to g_dbus_connection_close()
762 	 *
763 	 * Returns: %TRUE if the operation succeeded, %FALSE if @error is set
764 	 *
765 	 * Since: 2.26
766 	 *
767 	 * Throws: GException on failure.
768 	 */
769 	public bool closeFinish(AsyncResultIF res)
770 	{
771 		GError* err = null;
772 
773 		auto p = g_dbus_connection_close_finish(gDBusConnection, (res is null) ? null : res.getAsyncResultStruct(), &err) != 0;
774 
775 		if (err !is null)
776 		{
777 			throw new GException( new ErrorG(err) );
778 		}
779 
780 		return p;
781 	}
782 
783 	/**
784 	 * Synchronously closees @connection. The calling thread is blocked
785 	 * until this is done. See g_dbus_connection_close() for the
786 	 * asynchronous version of this method and more details about what it
787 	 * does.
788 	 *
789 	 * Params:
790 	 *     cancellable = a #GCancellable or %NULL
791 	 *
792 	 * Returns: %TRUE if the operation succeeded, %FALSE if @error is set
793 	 *
794 	 * Since: 2.26
795 	 *
796 	 * Throws: GException on failure.
797 	 */
798 	public bool closeSync(Cancellable cancellable)
799 	{
800 		GError* err = null;
801 
802 		auto p = g_dbus_connection_close_sync(gDBusConnection, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0;
803 
804 		if (err !is null)
805 		{
806 			throw new GException( new ErrorG(err) );
807 		}
808 
809 		return p;
810 	}
811 
812 	/**
813 	 * Emits a signal.
814 	 *
815 	 * If the parameters GVariant is floating, it is consumed.
816 	 *
817 	 * This can only fail if @parameters is not compatible with the D-Bus protocol.
818 	 *
819 	 * Params:
820 	 *     destinationBusName = the unique bus name for the destination
821 	 *         for the signal or %NULL to emit to all listeners
822 	 *     objectPath = path of remote object
823 	 *     interfaceName = D-Bus interface to emit a signal on
824 	 *     signalName = the name of the signal to emit
825 	 *     parameters = a #GVariant tuple with parameters for the signal
826 	 *         or %NULL if not passing parameters
827 	 *
828 	 * Returns: %TRUE unless @error is set
829 	 *
830 	 * Since: 2.26
831 	 *
832 	 * Throws: GException on failure.
833 	 */
834 	public bool emitSignal(string destinationBusName, string objectPath, string interfaceName, string signalName, Variant parameters)
835 	{
836 		GError* err = null;
837 
838 		auto p = g_dbus_connection_emit_signal(gDBusConnection, Str.toStringz(destinationBusName), Str.toStringz(objectPath), Str.toStringz(interfaceName), Str.toStringz(signalName), (parameters is null) ? null : parameters.getVariantStruct(), &err) != 0;
839 
840 		if (err !is null)
841 		{
842 			throw new GException( new ErrorG(err) );
843 		}
844 
845 		return p;
846 	}
847 
848 	/**
849 	 * Exports @action_group on @connection at @object_path.
850 	 *
851 	 * The implemented D-Bus API should be considered private.  It is
852 	 * subject to change in the future.
853 	 *
854 	 * A given object path can only have one action group exported on it.
855 	 * If this constraint is violated, the export will fail and 0 will be
856 	 * returned (with @error set accordingly).
857 	 *
858 	 * You can unexport the action group using
859 	 * g_dbus_connection_unexport_action_group() with the return value of
860 	 * this function.
861 	 *
862 	 * The thread default main context is taken at the time of this call.
863 	 * All incoming action activations and state change requests are
864 	 * reported from this context.  Any changes on the action group that
865 	 * cause it to emit signals must also come from this same context.
866 	 * Since incoming action activations and state change requests are
867 	 * rather likely to cause changes on the action group, this effectively
868 	 * limits a given action group to being exported from only one main
869 	 * context.
870 	 *
871 	 * Params:
872 	 *     objectPath = a D-Bus object path
873 	 *     actionGroup = a #GActionGroup
874 	 *
875 	 * Returns: the ID of the export (never zero), or 0 in case of failure
876 	 *
877 	 * Since: 2.32
878 	 *
879 	 * Throws: GException on failure.
880 	 */
881 	public uint exportActionGroup(string objectPath, ActionGroupIF actionGroup)
882 	{
883 		GError* err = null;
884 
885 		auto p = g_dbus_connection_export_action_group(gDBusConnection, Str.toStringz(objectPath), (actionGroup is null) ? null : actionGroup.getActionGroupStruct(), &err);
886 
887 		if (err !is null)
888 		{
889 			throw new GException( new ErrorG(err) );
890 		}
891 
892 		return p;
893 	}
894 
895 	/**
896 	 * Exports @menu on @connection at @object_path.
897 	 *
898 	 * The implemented D-Bus API should be considered private.
899 	 * It is subject to change in the future.
900 	 *
901 	 * An object path can only have one menu model exported on it. If this
902 	 * constraint is violated, the export will fail and 0 will be
903 	 * returned (with @error set accordingly).
904 	 *
905 	 * You can unexport the menu model using
906 	 * g_dbus_connection_unexport_menu_model() with the return value of
907 	 * this function.
908 	 *
909 	 * Params:
910 	 *     objectPath = a D-Bus object path
911 	 *     menu = a #GMenuModel
912 	 *
913 	 * Returns: the ID of the export (never zero), or 0 in case of failure
914 	 *
915 	 * Since: 2.32
916 	 *
917 	 * Throws: GException on failure.
918 	 */
919 	public uint exportMenuModel(string objectPath, MenuModel menu)
920 	{
921 		GError* err = null;
922 
923 		auto p = g_dbus_connection_export_menu_model(gDBusConnection, Str.toStringz(objectPath), (menu is null) ? null : menu.getMenuModelStruct(), &err);
924 
925 		if (err !is null)
926 		{
927 			throw new GException( new ErrorG(err) );
928 		}
929 
930 		return p;
931 	}
932 
933 	/**
934 	 * Asynchronously flushes @connection, that is, writes all queued
935 	 * outgoing message to the transport and then flushes the transport
936 	 * (using g_output_stream_flush_async()). This is useful in programs
937 	 * that wants to emit a D-Bus signal and then exit immediately. Without
938 	 * flushing the connection, there is no guaranteed that the message has
939 	 * been sent to the networking buffers in the OS kernel.
940 	 *
941 	 * This is an asynchronous method. When the operation is finished,
942 	 * @callback will be invoked in the
943 	 * [thread-default main context][g-main-context-push-thread-default]
944 	 * of the thread you are calling this method from. You can
945 	 * then call g_dbus_connection_flush_finish() to get the result of the
946 	 * operation. See g_dbus_connection_flush_sync() for the synchronous
947 	 * version.
948 	 *
949 	 * Params:
950 	 *     cancellable = a #GCancellable or %NULL
951 	 *     callback = a #GAsyncReadyCallback to call when the
952 	 *         request is satisfied or %NULL if you don't care about the result
953 	 *     userData = The data to pass to @callback
954 	 *
955 	 * Since: 2.26
956 	 */
957 	public void flush(Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
958 	{
959 		g_dbus_connection_flush(gDBusConnection, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
960 	}
961 
962 	/**
963 	 * Finishes an operation started with g_dbus_connection_flush().
964 	 *
965 	 * Params:
966 	 *     res = a #GAsyncResult obtained from the #GAsyncReadyCallback passed
967 	 *         to g_dbus_connection_flush()
968 	 *
969 	 * Returns: %TRUE if the operation succeeded, %FALSE if @error is set
970 	 *
971 	 * Since: 2.26
972 	 *
973 	 * Throws: GException on failure.
974 	 */
975 	public bool flushFinish(AsyncResultIF res)
976 	{
977 		GError* err = null;
978 
979 		auto p = g_dbus_connection_flush_finish(gDBusConnection, (res is null) ? null : res.getAsyncResultStruct(), &err) != 0;
980 
981 		if (err !is null)
982 		{
983 			throw new GException( new ErrorG(err) );
984 		}
985 
986 		return p;
987 	}
988 
989 	/**
990 	 * Synchronously flushes @connection. The calling thread is blocked
991 	 * until this is done. See g_dbus_connection_flush() for the
992 	 * asynchronous version of this method and more details about what it
993 	 * does.
994 	 *
995 	 * Params:
996 	 *     cancellable = a #GCancellable or %NULL
997 	 *
998 	 * Returns: %TRUE if the operation succeeded, %FALSE if @error is set
999 	 *
1000 	 * Since: 2.26
1001 	 *
1002 	 * Throws: GException on failure.
1003 	 */
1004 	public bool flushSync(Cancellable cancellable)
1005 	{
1006 		GError* err = null;
1007 
1008 		auto p = g_dbus_connection_flush_sync(gDBusConnection, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0;
1009 
1010 		if (err !is null)
1011 		{
1012 			throw new GException( new ErrorG(err) );
1013 		}
1014 
1015 		return p;
1016 	}
1017 
1018 	/**
1019 	 * Gets the capabilities negotiated with the remote peer
1020 	 *
1021 	 * Returns: zero or more flags from the #GDBusCapabilityFlags enumeration
1022 	 *
1023 	 * Since: 2.26
1024 	 */
1025 	public GDBusCapabilityFlags getCapabilities()
1026 	{
1027 		return g_dbus_connection_get_capabilities(gDBusConnection);
1028 	}
1029 
1030 	/**
1031 	 * Gets whether the process is terminated when @connection is
1032 	 * closed by the remote peer. See
1033 	 * #GDBusConnection:exit-on-close for more details.
1034 	 *
1035 	 * Returns: whether the process is terminated when @connection is
1036 	 *     closed by the remote peer
1037 	 *
1038 	 * Since: 2.26
1039 	 */
1040 	public bool getExitOnClose()
1041 	{
1042 		return g_dbus_connection_get_exit_on_close(gDBusConnection) != 0;
1043 	}
1044 
1045 	/**
1046 	 * The GUID of the peer performing the role of server when
1047 	 * authenticating. See #GDBusConnection:guid for more details.
1048 	 *
1049 	 * Returns: The GUID. Do not free this string, it is owned by
1050 	 *     @connection.
1051 	 *
1052 	 * Since: 2.26
1053 	 */
1054 	public string getGuid()
1055 	{
1056 		return Str.toString(g_dbus_connection_get_guid(gDBusConnection));
1057 	}
1058 
1059 	/**
1060 	 * Retrieves the last serial number assigned to a #GDBusMessage on
1061 	 * the current thread. This includes messages sent via both low-level
1062 	 * API such as g_dbus_connection_send_message() as well as
1063 	 * high-level API such as g_dbus_connection_emit_signal(),
1064 	 * g_dbus_connection_call() or g_dbus_proxy_call().
1065 	 *
1066 	 * Returns: the last used serial or zero when no message has been sent
1067 	 *     within the current thread
1068 	 *
1069 	 * Since: 2.34
1070 	 */
1071 	public uint getLastSerial()
1072 	{
1073 		return g_dbus_connection_get_last_serial(gDBusConnection);
1074 	}
1075 
1076 	/**
1077 	 * Gets the credentials of the authenticated peer. This will always
1078 	 * return %NULL unless @connection acted as a server
1079 	 * (e.g. %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER was passed)
1080 	 * when set up and the client passed credentials as part of the
1081 	 * authentication process.
1082 	 *
1083 	 * In a message bus setup, the message bus is always the server and
1084 	 * each application is a client. So this method will always return
1085 	 * %NULL for message bus clients.
1086 	 *
1087 	 * Returns: a #GCredentials or %NULL if not
1088 	 *     available. Do not free this object, it is owned by @connection.
1089 	 *
1090 	 * Since: 2.26
1091 	 */
1092 	public Credentials getPeerCredentials()
1093 	{
1094 		auto p = g_dbus_connection_get_peer_credentials(gDBusConnection);
1095 
1096 		if(p is null)
1097 		{
1098 			return null;
1099 		}
1100 
1101 		return ObjectG.getDObject!(Credentials)(cast(GCredentials*) p);
1102 	}
1103 
1104 	/**
1105 	 * Gets the underlying stream used for IO.
1106 	 *
1107 	 * While the #GDBusConnection is active, it will interact with this
1108 	 * stream from a worker thread, so it is not safe to interact with
1109 	 * the stream directly.
1110 	 *
1111 	 * Returns: the stream used for IO
1112 	 *
1113 	 * Since: 2.26
1114 	 */
1115 	public IOStream getStream()
1116 	{
1117 		auto p = g_dbus_connection_get_stream(gDBusConnection);
1118 
1119 		if(p is null)
1120 		{
1121 			return null;
1122 		}
1123 
1124 		return ObjectG.getDObject!(IOStream)(cast(GIOStream*) p);
1125 	}
1126 
1127 	/**
1128 	 * Gets the unique name of @connection as assigned by the message
1129 	 * bus. This can also be used to figure out if @connection is a
1130 	 * message bus connection.
1131 	 *
1132 	 * Returns: the unique name or %NULL if @connection is not a message
1133 	 *     bus connection. Do not free this string, it is owned by
1134 	 *     @connection.
1135 	 *
1136 	 * Since: 2.26
1137 	 */
1138 	public string getUniqueName()
1139 	{
1140 		return Str.toString(g_dbus_connection_get_unique_name(gDBusConnection));
1141 	}
1142 
1143 	/**
1144 	 * Gets whether @connection is closed.
1145 	 *
1146 	 * Returns: %TRUE if the connection is closed, %FALSE otherwise
1147 	 *
1148 	 * Since: 2.26
1149 	 */
1150 	public bool isClosed()
1151 	{
1152 		return g_dbus_connection_is_closed(gDBusConnection) != 0;
1153 	}
1154 
1155 	/**
1156 	 * Registers callbacks for exported objects at @object_path with the
1157 	 * D-Bus interface that is described in @interface_info.
1158 	 *
1159 	 * Calls to functions in @vtable (and @user_data_free_func) will happen
1160 	 * in the
1161 	 * [thread-default main context][g-main-context-push-thread-default]
1162 	 * of the thread you are calling this method from.
1163 	 *
1164 	 * Note that all #GVariant values passed to functions in @vtable will match
1165 	 * the signature given in @interface_info - if a remote caller passes
1166 	 * incorrect values, the `org.freedesktop.DBus.Error.InvalidArgs`
1167 	 * is returned to the remote caller.
1168 	 *
1169 	 * Additionally, if the remote caller attempts to invoke methods or
1170 	 * access properties not mentioned in @interface_info the
1171 	 * `org.freedesktop.DBus.Error.UnknownMethod` resp.
1172 	 * `org.freedesktop.DBus.Error.InvalidArgs` errors
1173 	 * are returned to the caller.
1174 	 *
1175 	 * It is considered a programming error if the
1176 	 * #GDBusInterfaceGetPropertyFunc function in @vtable returns a
1177 	 * #GVariant of incorrect type.
1178 	 *
1179 	 * If an existing callback is already registered at @object_path and
1180 	 * @interface_name, then @error is set to #G_IO_ERROR_EXISTS.
1181 	 *
1182 	 * GDBus automatically implements the standard D-Bus interfaces
1183 	 * org.freedesktop.DBus.Properties, org.freedesktop.DBus.Introspectable
1184 	 * and org.freedesktop.Peer, so you don't have to implement those for the
1185 	 * objects you export. You can implement org.freedesktop.DBus.Properties
1186 	 * yourself, e.g. to handle getting and setting of properties asynchronously.
1187 	 *
1188 	 * Note that the reference count on @interface_info will be
1189 	 * incremented by 1 (unless allocated statically, e.g. if the
1190 	 * reference count is -1, see g_dbus_interface_info_ref()) for as long
1191 	 * as the object is exported. Also note that @vtable will be copied.
1192 	 *
1193 	 * See this [server][gdbus-server] for an example of how to use this method.
1194 	 *
1195 	 * Params:
1196 	 *     objectPath = the object path to register at
1197 	 *     interfaceInfo = introspection data for the interface
1198 	 *     vtable = a #GDBusInterfaceVTable to call into or %NULL
1199 	 *     userData = data to pass to functions in @vtable
1200 	 *     userDataFreeFunc = function to call when the object path is unregistered
1201 	 *
1202 	 * Returns: 0 if @error is set, otherwise a registration id (never 0)
1203 	 *     that can be used with g_dbus_connection_unregister_object()
1204 	 *
1205 	 * Since: 2.26
1206 	 *
1207 	 * Throws: GException on failure.
1208 	 */
1209 	public uint registerObject(string objectPath, DBusInterfaceInfo interfaceInfo, GDBusInterfaceVTable* vtable, void* userData, GDestroyNotify userDataFreeFunc)
1210 	{
1211 		GError* err = null;
1212 
1213 		auto p = g_dbus_connection_register_object(gDBusConnection, Str.toStringz(objectPath), (interfaceInfo is null) ? null : interfaceInfo.getDBusInterfaceInfoStruct(), vtable, userData, userDataFreeFunc, &err);
1214 
1215 		if (err !is null)
1216 		{
1217 			throw new GException( new ErrorG(err) );
1218 		}
1219 
1220 		return p;
1221 	}
1222 
1223 	/**
1224 	 * Version of g_dbus_connection_register_object() using closures instead of a
1225 	 * #GDBusInterfaceVTable for easier binding in other languages.
1226 	 *
1227 	 * Params:
1228 	 *     objectPath = The object path to register at.
1229 	 *     interfaceInfo = Introspection data for the interface.
1230 	 *     methodCallClosure = #GClosure for handling incoming method calls.
1231 	 *     getPropertyClosure = #GClosure for getting a property.
1232 	 *     setPropertyClosure = #GClosure for setting a property.
1233 	 *
1234 	 * Returns: 0 if @error is set, otherwise a registration id (never 0)
1235 	 *     that can be used with g_dbus_connection_unregister_object() .
1236 	 *
1237 	 * Since: 2.46
1238 	 *
1239 	 * Throws: GException on failure.
1240 	 */
1241 	public uint registerObjectWithClosures(string objectPath, DBusInterfaceInfo interfaceInfo, Closure methodCallClosure, Closure getPropertyClosure, Closure setPropertyClosure)
1242 	{
1243 		GError* err = null;
1244 
1245 		auto p = g_dbus_connection_register_object_with_closures(gDBusConnection, Str.toStringz(objectPath), (interfaceInfo is null) ? null : interfaceInfo.getDBusInterfaceInfoStruct(), (methodCallClosure is null) ? null : methodCallClosure.getClosureStruct(), (getPropertyClosure is null) ? null : getPropertyClosure.getClosureStruct(), (setPropertyClosure is null) ? null : setPropertyClosure.getClosureStruct(), &err);
1246 
1247 		if (err !is null)
1248 		{
1249 			throw new GException( new ErrorG(err) );
1250 		}
1251 
1252 		return p;
1253 	}
1254 
1255 	/**
1256 	 * Registers a whole subtree of dynamic objects.
1257 	 *
1258 	 * The @enumerate and @introspection functions in @vtable are used to
1259 	 * convey, to remote callers, what nodes exist in the subtree rooted
1260 	 * by @object_path.
1261 	 *
1262 	 * When handling remote calls into any node in the subtree, first the
1263 	 * @enumerate function is used to check if the node exists. If the node exists
1264 	 * or the #G_DBUS_SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES flag is set
1265 	 * the @introspection function is used to check if the node supports the
1266 	 * requested method. If so, the @dispatch function is used to determine
1267 	 * where to dispatch the call. The collected #GDBusInterfaceVTable and
1268 	 * #gpointer will be used to call into the interface vtable for processing
1269 	 * the request.
1270 	 *
1271 	 * All calls into user-provided code will be invoked in the
1272 	 * [thread-default main context][g-main-context-push-thread-default]
1273 	 * of the thread you are calling this method from.
1274 	 *
1275 	 * If an existing subtree is already registered at @object_path or
1276 	 * then @error is set to #G_IO_ERROR_EXISTS.
1277 	 *
1278 	 * Note that it is valid to register regular objects (using
1279 	 * g_dbus_connection_register_object()) in a subtree registered with
1280 	 * g_dbus_connection_register_subtree() - if so, the subtree handler
1281 	 * is tried as the last resort. One way to think about a subtree
1282 	 * handler is to consider it a fallback handler for object paths not
1283 	 * registered via g_dbus_connection_register_object() or other bindings.
1284 	 *
1285 	 * Note that @vtable will be copied so you cannot change it after
1286 	 * registration.
1287 	 *
1288 	 * See this [server][gdbus-subtree-server] for an example of how to use
1289 	 * this method.
1290 	 *
1291 	 * Params:
1292 	 *     objectPath = the object path to register the subtree at
1293 	 *     vtable = a #GDBusSubtreeVTable to enumerate, introspect and
1294 	 *         dispatch nodes in the subtree
1295 	 *     flags = flags used to fine tune the behavior of the subtree
1296 	 *     userData = data to pass to functions in @vtable
1297 	 *     userDataFreeFunc = function to call when the subtree is unregistered
1298 	 *
1299 	 * Returns: 0 if @error is set, otherwise a subtree registration id (never 0)
1300 	 *     that can be used with g_dbus_connection_unregister_subtree() .
1301 	 *
1302 	 * Since: 2.26
1303 	 *
1304 	 * Throws: GException on failure.
1305 	 */
1306 	public uint registerSubtree(string objectPath, GDBusSubtreeVTable* vtable, GDBusSubtreeFlags flags, void* userData, GDestroyNotify userDataFreeFunc)
1307 	{
1308 		GError* err = null;
1309 
1310 		auto p = g_dbus_connection_register_subtree(gDBusConnection, Str.toStringz(objectPath), vtable, flags, userData, userDataFreeFunc, &err);
1311 
1312 		if (err !is null)
1313 		{
1314 			throw new GException( new ErrorG(err) );
1315 		}
1316 
1317 		return p;
1318 	}
1319 
1320 	/**
1321 	 * Removes a filter.
1322 	 *
1323 	 * Note that since filters run in a different thread, there is a race
1324 	 * condition where it is possible that the filter will be running even
1325 	 * after calling g_dbus_connection_remove_filter(), so you cannot just
1326 	 * free data that the filter might be using. Instead, you should pass
1327 	 * a #GDestroyNotify to g_dbus_connection_add_filter(), which will be
1328 	 * called when it is guaranteed that the data is no longer needed.
1329 	 *
1330 	 * Params:
1331 	 *     filterId = an identifier obtained from g_dbus_connection_add_filter()
1332 	 *
1333 	 * Since: 2.26
1334 	 */
1335 	public void removeFilter(uint filterId)
1336 	{
1337 		g_dbus_connection_remove_filter(gDBusConnection, filterId);
1338 	}
1339 
1340 	/**
1341 	 * Asynchronously sends @message to the peer represented by @connection.
1342 	 *
1343 	 * Unless @flags contain the
1344 	 * %G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag, the serial number
1345 	 * will be assigned by @connection and set on @message via
1346 	 * g_dbus_message_set_serial(). If @out_serial is not %NULL, then the
1347 	 * serial number used will be written to this location prior to
1348 	 * submitting the message to the underlying transport.
1349 	 *
1350 	 * If @connection is closed then the operation will fail with
1351 	 * %G_IO_ERROR_CLOSED. If @message is not well-formed,
1352 	 * the operation fails with %G_IO_ERROR_INVALID_ARGUMENT.
1353 	 *
1354 	 * See this [server][gdbus-server] and [client][gdbus-unix-fd-client]
1355 	 * for an example of how to use this low-level API to send and receive
1356 	 * UNIX file descriptors.
1357 	 *
1358 	 * Note that @message must be unlocked, unless @flags contain the
1359 	 * %G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag.
1360 	 *
1361 	 * Params:
1362 	 *     message = a #GDBusMessage
1363 	 *     flags = flags affecting how the message is sent
1364 	 *     outSerial = return location for serial number assigned
1365 	 *         to @message when sending it or %NULL
1366 	 *
1367 	 * Returns: %TRUE if the message was well-formed and queued for
1368 	 *     transmission, %FALSE if @error is set
1369 	 *
1370 	 * Since: 2.26
1371 	 *
1372 	 * Throws: GException on failure.
1373 	 */
1374 	public bool sendMessage(DBusMessage message, GDBusSendMessageFlags flags, out uint outSerial)
1375 	{
1376 		GError* err = null;
1377 
1378 		auto p = g_dbus_connection_send_message(gDBusConnection, (message is null) ? null : message.getDBusMessageStruct(), flags, &outSerial, &err) != 0;
1379 
1380 		if (err !is null)
1381 		{
1382 			throw new GException( new ErrorG(err) );
1383 		}
1384 
1385 		return p;
1386 	}
1387 
1388 	/**
1389 	 * Asynchronously sends @message to the peer represented by @connection.
1390 	 *
1391 	 * Unless @flags contain the
1392 	 * %G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag, the serial number
1393 	 * will be assigned by @connection and set on @message via
1394 	 * g_dbus_message_set_serial(). If @out_serial is not %NULL, then the
1395 	 * serial number used will be written to this location prior to
1396 	 * submitting the message to the underlying transport.
1397 	 *
1398 	 * If @connection is closed then the operation will fail with
1399 	 * %G_IO_ERROR_CLOSED. If @cancellable is canceled, the operation will
1400 	 * fail with %G_IO_ERROR_CANCELLED. If @message is not well-formed,
1401 	 * the operation fails with %G_IO_ERROR_INVALID_ARGUMENT.
1402 	 *
1403 	 * This is an asynchronous method. When the operation is finished, @callback
1404 	 * will be invoked in the
1405 	 * [thread-default main context][g-main-context-push-thread-default]
1406 	 * of the thread you are calling this method from. You can then call
1407 	 * g_dbus_connection_send_message_with_reply_finish() to get the result of the operation.
1408 	 * See g_dbus_connection_send_message_with_reply_sync() for the synchronous version.
1409 	 *
1410 	 * Note that @message must be unlocked, unless @flags contain the
1411 	 * %G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag.
1412 	 *
1413 	 * See this [server][gdbus-server] and [client][gdbus-unix-fd-client]
1414 	 * for an example of how to use this low-level API to send and receive
1415 	 * UNIX file descriptors.
1416 	 *
1417 	 * Params:
1418 	 *     message = a #GDBusMessage
1419 	 *     flags = flags affecting how the message is sent
1420 	 *     timeoutMsec = the timeout in milliseconds, -1 to use the default
1421 	 *         timeout or %G_MAXINT for no timeout
1422 	 *     outSerial = return location for serial number assigned
1423 	 *         to @message when sending it or %NULL
1424 	 *     cancellable = a #GCancellable or %NULL
1425 	 *     callback = a #GAsyncReadyCallback to call when the request
1426 	 *         is satisfied or %NULL if you don't care about the result
1427 	 *     userData = The data to pass to @callback
1428 	 *
1429 	 * Since: 2.26
1430 	 */
1431 	public void sendMessageWithReply(DBusMessage message, GDBusSendMessageFlags flags, int timeoutMsec, out uint outSerial, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
1432 	{
1433 		g_dbus_connection_send_message_with_reply(gDBusConnection, (message is null) ? null : message.getDBusMessageStruct(), flags, timeoutMsec, &outSerial, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
1434 	}
1435 
1436 	/**
1437 	 * Finishes an operation started with g_dbus_connection_send_message_with_reply().
1438 	 *
1439 	 * Note that @error is only set if a local in-process error
1440 	 * occurred. That is to say that the returned #GDBusMessage object may
1441 	 * be of type %G_DBUS_MESSAGE_TYPE_ERROR. Use
1442 	 * g_dbus_message_to_gerror() to transcode this to a #GError.
1443 	 *
1444 	 * See this [server][gdbus-server] and [client][gdbus-unix-fd-client]
1445 	 * for an example of how to use this low-level API to send and receive
1446 	 * UNIX file descriptors.
1447 	 *
1448 	 * Params:
1449 	 *     res = a #GAsyncResult obtained from the #GAsyncReadyCallback passed to
1450 	 *         g_dbus_connection_send_message_with_reply()
1451 	 *
1452 	 * Returns: a locked #GDBusMessage or %NULL if @error is set
1453 	 *
1454 	 * Since: 2.26
1455 	 *
1456 	 * Throws: GException on failure.
1457 	 */
1458 	public DBusMessage sendMessageWithReplyFinish(AsyncResultIF res)
1459 	{
1460 		GError* err = null;
1461 
1462 		auto p = g_dbus_connection_send_message_with_reply_finish(gDBusConnection, (res is null) ? null : res.getAsyncResultStruct(), &err);
1463 
1464 		if (err !is null)
1465 		{
1466 			throw new GException( new ErrorG(err) );
1467 		}
1468 
1469 		if(p is null)
1470 		{
1471 			return null;
1472 		}
1473 
1474 		return ObjectG.getDObject!(DBusMessage)(cast(GDBusMessage*) p, true);
1475 	}
1476 
1477 	/**
1478 	 * Synchronously sends @message to the peer represented by @connection
1479 	 * and blocks the calling thread until a reply is received or the
1480 	 * timeout is reached. See g_dbus_connection_send_message_with_reply()
1481 	 * for the asynchronous version of this method.
1482 	 *
1483 	 * Unless @flags contain the
1484 	 * %G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag, the serial number
1485 	 * will be assigned by @connection and set on @message via
1486 	 * g_dbus_message_set_serial(). If @out_serial is not %NULL, then the
1487 	 * serial number used will be written to this location prior to
1488 	 * submitting the message to the underlying transport.
1489 	 *
1490 	 * If @connection is closed then the operation will fail with
1491 	 * %G_IO_ERROR_CLOSED. If @cancellable is canceled, the operation will
1492 	 * fail with %G_IO_ERROR_CANCELLED. If @message is not well-formed,
1493 	 * the operation fails with %G_IO_ERROR_INVALID_ARGUMENT.
1494 	 *
1495 	 * Note that @error is only set if a local in-process error
1496 	 * occurred. That is to say that the returned #GDBusMessage object may
1497 	 * be of type %G_DBUS_MESSAGE_TYPE_ERROR. Use
1498 	 * g_dbus_message_to_gerror() to transcode this to a #GError.
1499 	 *
1500 	 * See this [server][gdbus-server] and [client][gdbus-unix-fd-client]
1501 	 * for an example of how to use this low-level API to send and receive
1502 	 * UNIX file descriptors.
1503 	 *
1504 	 * Note that @message must be unlocked, unless @flags contain the
1505 	 * %G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag.
1506 	 *
1507 	 * Params:
1508 	 *     message = a #GDBusMessage
1509 	 *     flags = flags affecting how the message is sent.
1510 	 *     timeoutMsec = the timeout in milliseconds, -1 to use the default
1511 	 *         timeout or %G_MAXINT for no timeout
1512 	 *     outSerial = return location for serial number
1513 	 *         assigned to @message when sending it or %NULL
1514 	 *     cancellable = a #GCancellable or %NULL
1515 	 *
1516 	 * Returns: a locked #GDBusMessage that is the reply
1517 	 *     to @message or %NULL if @error is set
1518 	 *
1519 	 * Since: 2.26
1520 	 *
1521 	 * Throws: GException on failure.
1522 	 */
1523 	public DBusMessage sendMessageWithReplySync(DBusMessage message, GDBusSendMessageFlags flags, int timeoutMsec, out uint outSerial, Cancellable cancellable)
1524 	{
1525 		GError* err = null;
1526 
1527 		auto p = g_dbus_connection_send_message_with_reply_sync(gDBusConnection, (message is null) ? null : message.getDBusMessageStruct(), flags, timeoutMsec, &outSerial, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
1528 
1529 		if (err !is null)
1530 		{
1531 			throw new GException( new ErrorG(err) );
1532 		}
1533 
1534 		if(p is null)
1535 		{
1536 			return null;
1537 		}
1538 
1539 		return ObjectG.getDObject!(DBusMessage)(cast(GDBusMessage*) p, true);
1540 	}
1541 
1542 	/**
1543 	 * Sets whether the process should be terminated when @connection is
1544 	 * closed by the remote peer. See #GDBusConnection:exit-on-close for
1545 	 * more details.
1546 	 *
1547 	 * Note that this function should be used with care. Most modern UNIX
1548 	 * desktops tie the notion of a user session the session bus, and expect
1549 	 * all of a users applications to quit when their bus connection goes away.
1550 	 * If you are setting @exit_on_close to %FALSE for the shared session
1551 	 * bus connection, you should make sure that your application exits
1552 	 * when the user session ends.
1553 	 *
1554 	 * Params:
1555 	 *     exitOnClose = whether the process should be terminated
1556 	 *         when @connection is closed by the remote peer
1557 	 *
1558 	 * Since: 2.26
1559 	 */
1560 	public void setExitOnClose(bool exitOnClose)
1561 	{
1562 		g_dbus_connection_set_exit_on_close(gDBusConnection, exitOnClose);
1563 	}
1564 
1565 	/**
1566 	 * Subscribes to signals on @connection and invokes @callback with a whenever
1567 	 * the signal is received. Note that @callback will be invoked in the
1568 	 * [thread-default main context][g-main-context-push-thread-default]
1569 	 * of the thread you are calling this method from.
1570 	 *
1571 	 * If @connection is not a message bus connection, @sender must be
1572 	 * %NULL.
1573 	 *
1574 	 * If @sender is a well-known name note that @callback is invoked with
1575 	 * the unique name for the owner of @sender, not the well-known name
1576 	 * as one would expect. This is because the message bus rewrites the
1577 	 * name. As such, to avoid certain race conditions, users should be
1578 	 * tracking the name owner of the well-known name and use that when
1579 	 * processing the received signal.
1580 	 *
1581 	 * If one of %G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_NAMESPACE or
1582 	 * %G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_PATH are given, @arg0 is
1583 	 * interpreted as part of a namespace or path.  The first argument
1584 	 * of a signal is matched against that part as specified by D-Bus.
1585 	 *
1586 	 * If @user_data_free_func is non-%NULL, it will be called (in the
1587 	 * thread-default main context of the thread you are calling this
1588 	 * method from) at some point after @user_data is no longer
1589 	 * needed. (It is not guaranteed to be called synchronously when the
1590 	 * signal is unsubscribed from, and may be called after @connection
1591 	 * has been destroyed.)
1592 	 *
1593 	 * Params:
1594 	 *     sender = sender name to match on (unique or well-known name)
1595 	 *         or %NULL to listen from all senders
1596 	 *     interfaceName = D-Bus interface name to match on or %NULL to
1597 	 *         match on all interfaces
1598 	 *     member = D-Bus signal name to match on or %NULL to match on
1599 	 *         all signals
1600 	 *     objectPath = object path to match on or %NULL to match on
1601 	 *         all object paths
1602 	 *     arg0 = contents of first string argument to match on or %NULL
1603 	 *         to match on all kinds of arguments
1604 	 *     flags = #GDBusSignalFlags describing how arg0 is used in subscribing to the
1605 	 *         signal
1606 	 *     callback = callback to invoke when there is a signal matching the requested data
1607 	 *     userData = user data to pass to @callback
1608 	 *     userDataFreeFunc = function to free @user_data with when
1609 	 *         subscription is removed or %NULL
1610 	 *
1611 	 * Returns: a subscription identifier that can be used with g_dbus_connection_signal_unsubscribe()
1612 	 *
1613 	 * Since: 2.26
1614 	 */
1615 	public uint signalSubscribe(string sender, string interfaceName, string member, string objectPath, string arg0, GDBusSignalFlags flags, GDBusSignalCallback callback, void* userData, GDestroyNotify userDataFreeFunc)
1616 	{
1617 		return g_dbus_connection_signal_subscribe(gDBusConnection, Str.toStringz(sender), Str.toStringz(interfaceName), Str.toStringz(member), Str.toStringz(objectPath), Str.toStringz(arg0), flags, callback, userData, userDataFreeFunc);
1618 	}
1619 
1620 	/**
1621 	 * Unsubscribes from signals.
1622 	 *
1623 	 * Params:
1624 	 *     subscriptionId = a subscription id obtained from
1625 	 *         g_dbus_connection_signal_subscribe()
1626 	 *
1627 	 * Since: 2.26
1628 	 */
1629 	public void signalUnsubscribe(uint subscriptionId)
1630 	{
1631 		g_dbus_connection_signal_unsubscribe(gDBusConnection, subscriptionId);
1632 	}
1633 
1634 	/**
1635 	 * If @connection was created with
1636 	 * %G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING, this method
1637 	 * starts processing messages. Does nothing on if @connection wasn't
1638 	 * created with this flag or if the method has already been called.
1639 	 *
1640 	 * Since: 2.26
1641 	 */
1642 	public void startMessageProcessing()
1643 	{
1644 		g_dbus_connection_start_message_processing(gDBusConnection);
1645 	}
1646 
1647 	/**
1648 	 * Reverses the effect of a previous call to
1649 	 * g_dbus_connection_export_action_group().
1650 	 *
1651 	 * It is an error to call this function with an ID that wasn't returned
1652 	 * from g_dbus_connection_export_action_group() or to call it with the
1653 	 * same ID more than once.
1654 	 *
1655 	 * Params:
1656 	 *     exportId = the ID from g_dbus_connection_export_action_group()
1657 	 *
1658 	 * Since: 2.32
1659 	 */
1660 	public void unexportActionGroup(uint exportId)
1661 	{
1662 		g_dbus_connection_unexport_action_group(gDBusConnection, exportId);
1663 	}
1664 
1665 	/**
1666 	 * Reverses the effect of a previous call to
1667 	 * g_dbus_connection_export_menu_model().
1668 	 *
1669 	 * It is an error to call this function with an ID that wasn't returned
1670 	 * from g_dbus_connection_export_menu_model() or to call it with the
1671 	 * same ID more than once.
1672 	 *
1673 	 * Params:
1674 	 *     exportId = the ID from g_dbus_connection_export_menu_model()
1675 	 *
1676 	 * Since: 2.32
1677 	 */
1678 	public void unexportMenuModel(uint exportId)
1679 	{
1680 		g_dbus_connection_unexport_menu_model(gDBusConnection, exportId);
1681 	}
1682 
1683 	/**
1684 	 * Unregisters an object.
1685 	 *
1686 	 * Params:
1687 	 *     registrationId = a registration id obtained from
1688 	 *         g_dbus_connection_register_object()
1689 	 *
1690 	 * Returns: %TRUE if the object was unregistered, %FALSE otherwise
1691 	 *
1692 	 * Since: 2.26
1693 	 */
1694 	public bool unregisterObject(uint registrationId)
1695 	{
1696 		return g_dbus_connection_unregister_object(gDBusConnection, registrationId) != 0;
1697 	}
1698 
1699 	/**
1700 	 * Unregisters a subtree.
1701 	 *
1702 	 * Params:
1703 	 *     registrationId = a subtree registration id obtained from
1704 	 *         g_dbus_connection_register_subtree()
1705 	 *
1706 	 * Returns: %TRUE if the subtree was unregistered, %FALSE otherwise
1707 	 *
1708 	 * Since: 2.26
1709 	 */
1710 	public bool unregisterSubtree(uint registrationId)
1711 	{
1712 		return g_dbus_connection_unregister_subtree(gDBusConnection, registrationId) != 0;
1713 	}
1714 
1715 	protected class OnClosedDelegateWrapper
1716 	{
1717 		void delegate(bool, ErrorG, DBusConnection) dlg;
1718 		gulong handlerId;
1719 
1720 		this(void delegate(bool, ErrorG, DBusConnection) dlg)
1721 		{
1722 			this.dlg = dlg;
1723 			onClosedListeners ~= this;
1724 		}
1725 
1726 		void remove(OnClosedDelegateWrapper source)
1727 		{
1728 			foreach(index, wrapper; onClosedListeners)
1729 			{
1730 				if (wrapper.handlerId == source.handlerId)
1731 				{
1732 					onClosedListeners[index] = null;
1733 					onClosedListeners = std.algorithm.remove(onClosedListeners, index);
1734 					break;
1735 				}
1736 			}
1737 		}
1738 	}
1739 	OnClosedDelegateWrapper[] onClosedListeners;
1740 
1741 	/**
1742 	 * Emitted when the connection is closed.
1743 	 *
1744 	 * The cause of this event can be
1745 	 *
1746 	 * - If g_dbus_connection_close() is called. In this case
1747 	 * @remote_peer_vanished is set to %FALSE and @error is %NULL.
1748 	 *
1749 	 * - If the remote peer closes the connection. In this case
1750 	 * @remote_peer_vanished is set to %TRUE and @error is set.
1751 	 *
1752 	 * - If the remote peer sends invalid or malformed data. In this
1753 	 * case @remote_peer_vanished is set to %FALSE and @error is set.
1754 	 *
1755 	 * Upon receiving this signal, you should give up your reference to
1756 	 * @connection. You are guaranteed that this signal is emitted only
1757 	 * once.
1758 	 *
1759 	 * Params:
1760 	 *     remotePeerVanished = %TRUE if @connection is closed because the
1761 	 *         remote peer closed its end of the connection
1762 	 *     error = a #GError with more details about the event or %NULL
1763 	 *
1764 	 * Since: 2.26
1765 	 */
1766 	gulong addOnClosed(void delegate(bool, ErrorG, DBusConnection) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1767 	{
1768 		auto wrapper = new OnClosedDelegateWrapper(dlg);
1769 		wrapper.handlerId = Signals.connectData(
1770 			this,
1771 			"closed",
1772 			cast(GCallback)&callBackClosed,
1773 			cast(void*)wrapper,
1774 			cast(GClosureNotify)&callBackClosedDestroy,
1775 			connectFlags);
1776 		return wrapper.handlerId;
1777 	}
1778 
1779 	extern(C) static void callBackClosed(GDBusConnection* dbusconnectionStruct, bool remotePeerVanished, GError* error, OnClosedDelegateWrapper wrapper)
1780 	{
1781 		wrapper.dlg(remotePeerVanished, new ErrorG(error), wrapper.outer);
1782 	}
1783 
1784 	extern(C) static void callBackClosedDestroy(OnClosedDelegateWrapper wrapper, GClosure* closure)
1785 	{
1786 		wrapper.remove(wrapper);
1787 	}
1788 
1789 	/**
1790 	 * Asynchronously connects to the message bus specified by @bus_type.
1791 	 *
1792 	 * When the operation is finished, @callback will be invoked. You can
1793 	 * then call g_bus_get_finish() to get the result of the operation.
1794 	 *
1795 	 * This is a asynchronous failable function. See g_bus_get_sync() for
1796 	 * the synchronous version.
1797 	 *
1798 	 * Params:
1799 	 *     busType = a #GBusType
1800 	 *     cancellable = a #GCancellable or %NULL
1801 	 *     callback = a #GAsyncReadyCallback to call when the request is satisfied
1802 	 *     userData = the data to pass to @callback
1803 	 *
1804 	 * Since: 2.26
1805 	 */
1806 	public static void get(GBusType busType, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
1807 	{
1808 		g_bus_get(busType, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
1809 	}
1810 
1811 	/**
1812 	 * Finishes an operation started with g_bus_get().
1813 	 *
1814 	 * The returned object is a singleton, that is, shared with other
1815 	 * callers of g_bus_get() and g_bus_get_sync() for @bus_type. In the
1816 	 * event that you need a private message bus connection, use
1817 	 * g_dbus_address_get_for_bus_sync() and
1818 	 * g_dbus_connection_new_for_address().
1819 	 *
1820 	 * Note that the returned #GDBusConnection object will (usually) have
1821 	 * the #GDBusConnection:exit-on-close property set to %TRUE.
1822 	 *
1823 	 * Params:
1824 	 *     res = a #GAsyncResult obtained from the #GAsyncReadyCallback passed
1825 	 *         to g_bus_get()
1826 	 *
1827 	 * Returns: a #GDBusConnection or %NULL if @error is set.
1828 	 *     Free with g_object_unref().
1829 	 *
1830 	 * Since: 2.26
1831 	 *
1832 	 * Throws: GException on failure.
1833 	 */
1834 	public static DBusConnection getFinish(AsyncResultIF res)
1835 	{
1836 		GError* err = null;
1837 
1838 		auto p = g_bus_get_finish((res is null) ? null : res.getAsyncResultStruct(), &err);
1839 
1840 		if (err !is null)
1841 		{
1842 			throw new GException( new ErrorG(err) );
1843 		}
1844 
1845 		if(p is null)
1846 		{
1847 			return null;
1848 		}
1849 
1850 		return ObjectG.getDObject!(DBusConnection)(cast(GDBusConnection*) p, true);
1851 	}
1852 
1853 	/**
1854 	 * Synchronously connects to the message bus specified by @bus_type.
1855 	 * Note that the returned object may shared with other callers,
1856 	 * e.g. if two separate parts of a process calls this function with
1857 	 * the same @bus_type, they will share the same object.
1858 	 *
1859 	 * This is a synchronous failable function. See g_bus_get() and
1860 	 * g_bus_get_finish() for the asynchronous version.
1861 	 *
1862 	 * The returned object is a singleton, that is, shared with other
1863 	 * callers of g_bus_get() and g_bus_get_sync() for @bus_type. In the
1864 	 * event that you need a private message bus connection, use
1865 	 * g_dbus_address_get_for_bus_sync() and
1866 	 * g_dbus_connection_new_for_address().
1867 	 *
1868 	 * Note that the returned #GDBusConnection object will (usually) have
1869 	 * the #GDBusConnection:exit-on-close property set to %TRUE.
1870 	 *
1871 	 * Params:
1872 	 *     busType = a #GBusType
1873 	 *     cancellable = a #GCancellable or %NULL
1874 	 *
1875 	 * Returns: a #GDBusConnection or %NULL if @error is set.
1876 	 *     Free with g_object_unref().
1877 	 *
1878 	 * Since: 2.26
1879 	 *
1880 	 * Throws: GException on failure.
1881 	 */
1882 	public static DBusConnection getSync(GBusType busType, Cancellable cancellable)
1883 	{
1884 		GError* err = null;
1885 
1886 		auto p = g_bus_get_sync(busType, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
1887 
1888 		if (err !is null)
1889 		{
1890 			throw new GException( new ErrorG(err) );
1891 		}
1892 
1893 		if(p is null)
1894 		{
1895 			return null;
1896 		}
1897 
1898 		return ObjectG.getDObject!(DBusConnection)(cast(GDBusConnection*) p, true);
1899 	}
1900 }