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