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