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.DBusProxy;
26 
27 private import gio.AsyncInitableIF;
28 private import gio.AsyncInitableT;
29 private import gio.AsyncResultIF;
30 private import gio.Cancellable;
31 private import gio.DBusConnection;
32 private import gio.DBusInterfaceIF;
33 private import gio.DBusInterfaceInfo;
34 private import gio.DBusInterfaceT;
35 private import gio.InitableIF;
36 private import gio.InitableT;
37 private import gio.UnixFDList;
38 private import gio.c.functions;
39 public  import gio.c.types;
40 private import glib.ConstructionException;
41 private import glib.ErrorG;
42 private import glib.GException;
43 private import glib.Str;
44 private import glib.Variant;
45 private import gobject.ObjectG;
46 private import gobject.Signals;
47 public  import gtkc.giotypes;
48 private import std.algorithm;
49 
50 
51 /**
52  * #GDBusProxy is a base class used for proxies to access a D-Bus
53  * interface on a remote object. A #GDBusProxy can be constructed for
54  * both well-known and unique names.
55  * 
56  * By default, #GDBusProxy will cache all properties (and listen to
57  * changes) of the remote object, and proxy all signals that get
58  * emitted. This behaviour can be changed by passing suitable
59  * #GDBusProxyFlags when the proxy is created. If the proxy is for a
60  * well-known name, the property cache is flushed when the name owner
61  * vanishes and reloaded when a name owner appears.
62  * 
63  * The unique name owner of the proxy's name is tracked and can be read from
64  * #GDBusProxy:g-name-owner. Connect to the #GObject::notify signal to
65  * get notified of changes. Additionally, only signals and property
66  * changes emitted from the current name owner are considered and
67  * calls are always sent to the current name owner. This avoids a
68  * number of race conditions when the name is lost by one owner and
69  * claimed by another. However, if no name owner currently exists,
70  * then calls will be sent to the well-known name which may result in
71  * the message bus launching an owner (unless
72  * %G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START is set).
73  * 
74  * The generic #GDBusProxy::g-properties-changed and
75  * #GDBusProxy::g-signal signals are not very convenient to work with.
76  * Therefore, the recommended way of working with proxies is to subclass
77  * #GDBusProxy, and have more natural properties and signals in your derived
78  * class. This [example][gdbus-example-gdbus-codegen] shows how this can
79  * easily be done using the [gdbus-codegen][gdbus-codegen] tool.
80  * 
81  * A #GDBusProxy instance can be used from multiple threads but note
82  * that all signals (e.g. #GDBusProxy::g-signal, #GDBusProxy::g-properties-changed
83  * and #GObject::notify) are emitted in the
84  * [thread-default main context][g-main-context-push-thread-default]
85  * of the thread where the instance was constructed.
86  * 
87  * An example using a proxy for a well-known name can be found in
88  * [gdbus-example-watch-proxy.c](https://git.gnome.org/browse/glib/tree/gio/tests/gdbus-example-watch-proxy.c)
89  *
90  * Since: 2.26
91  */
92 public class DBusProxy : ObjectG, AsyncInitableIF, DBusInterfaceIF, InitableIF
93 {
94 	/** the main Gtk struct */
95 	protected GDBusProxy* gDBusProxy;
96 
97 	/** Get the main Gtk struct */
98 	public GDBusProxy* getDBusProxyStruct(bool transferOwnership = false)
99 	{
100 		if (transferOwnership)
101 			ownedRef = false;
102 		return gDBusProxy;
103 	}
104 
105 	/** the main Gtk struct as a void* */
106 	protected override void* getStruct()
107 	{
108 		return cast(void*)gDBusProxy;
109 	}
110 
111 	/**
112 	 * Sets our main struct and passes it to the parent class.
113 	 */
114 	public this (GDBusProxy* gDBusProxy, bool ownedRef = false)
115 	{
116 		this.gDBusProxy = gDBusProxy;
117 		super(cast(GObject*)gDBusProxy, ownedRef);
118 	}
119 
120 	// add the AsyncInitable capabilities
121 	mixin AsyncInitableT!(GDBusProxy);
122 
123 	// add the DBusInterface capabilities
124 	mixin DBusInterfaceT!(GDBusProxy);
125 
126 	// add the Initable capabilities
127 	mixin InitableT!(GDBusProxy);
128 
129 	/**
130 	 * Finishes creating a GDBusProxy.
131 	 *
132 	 * Params:
133 	 *     res    = A GAsyncResult obtained from the GAsyncReadyCallback
134 	 *              function passed to g_dbus_proxy_new().
135 	 *     forBus = If true finish an address.
136 	 *
137 	 * Throws: GException on failure.
138 	 * Throws: ConstructionException GTK+ fails to create the object.
139 	 *
140 	 * Since: 2.26
141 	 */
142 	public this (AsyncResultIF res, bool forBus = false)
143 	{
144 		GError* err = null;
145 		GDBusProxy* p;
146 
147 		if ( forBus )
148 		{
149 			p = g_dbus_proxy_new_for_bus_finish((res is null) ? null : res.getAsyncResultStruct(), &err);
150 		}
151 		else
152 		{
153 			p = g_dbus_proxy_new_finish((res is null) ? null : res.getAsyncResultStruct(), &err);
154 		}
155 
156 		if (err !is null)
157 		{
158 			throw new GException( new ErrorG(err) );
159 		}
160 
161 		if(p is null)
162 		{
163 			throw new ConstructionException("null returned by g_dbus_proxy_new_finish((res is null) ? null : res.getAsyncResultStruct(), &err)");
164 		}
165 		this(p, true);
166 	}
167 
168 	/**
169 	 */
170 
171 	/** */
172 	public static GType getType()
173 	{
174 		return g_dbus_proxy_get_type();
175 	}
176 
177 	/**
178 	 * Like g_dbus_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
179 	 *
180 	 * #GDBusProxy is used in this [example][gdbus-wellknown-proxy].
181 	 *
182 	 * Params:
183 	 *     busType = A #GBusType.
184 	 *     flags = Flags used when constructing the proxy.
185 	 *     info = A #GDBusInterfaceInfo specifying the minimal interface
186 	 *         that @proxy conforms to or %NULL.
187 	 *     name = A bus name (well-known or unique).
188 	 *     objectPath = An object path.
189 	 *     interfaceName = A D-Bus interface name.
190 	 *     cancellable = A #GCancellable or %NULL.
191 	 *
192 	 * Returns: A #GDBusProxy or %NULL if error is set.
193 	 *     Free with g_object_unref().
194 	 *
195 	 * Since: 2.26
196 	 *
197 	 * Throws: GException on failure.
198 	 * Throws: ConstructionException GTK+ fails to create the object.
199 	 */
200 	public this(GBusType busType, GDBusProxyFlags flags, DBusInterfaceInfo info, string name, string objectPath, string interfaceName, Cancellable cancellable)
201 	{
202 		GError* err = null;
203 
204 		auto __p = g_dbus_proxy_new_for_bus_sync(busType, flags, (info is null) ? null : info.getDBusInterfaceInfoStruct(), Str.toStringz(name), Str.toStringz(objectPath), Str.toStringz(interfaceName), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
205 
206 		if (err !is null)
207 		{
208 			throw new GException( new ErrorG(err) );
209 		}
210 
211 		if(__p is null)
212 		{
213 			throw new ConstructionException("null returned by new_for_bus_sync");
214 		}
215 
216 		this(cast(GDBusProxy*) __p, true);
217 	}
218 
219 	/**
220 	 * Creates a proxy for accessing @interface_name on the remote object
221 	 * at @object_path owned by @name at @connection and synchronously
222 	 * loads D-Bus properties unless the
223 	 * %G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES flag is used.
224 	 *
225 	 * If the %G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS flag is not set, also sets up
226 	 * match rules for signals. Connect to the #GDBusProxy::g-signal signal
227 	 * to handle signals from the remote object.
228 	 *
229 	 * If both %G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES and
230 	 * %G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS are set, this constructor is
231 	 * guaranteed to return immediately without blocking.
232 	 *
233 	 * If @name is a well-known name and the
234 	 * %G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START and %G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START_AT_CONSTRUCTION
235 	 * flags aren't set and no name owner currently exists, the message bus
236 	 * will be requested to launch a name owner for the name.
237 	 *
238 	 * This is a synchronous failable constructor. See g_dbus_proxy_new()
239 	 * and g_dbus_proxy_new_finish() for the asynchronous version.
240 	 *
241 	 * #GDBusProxy is used in this [example][gdbus-wellknown-proxy].
242 	 *
243 	 * Params:
244 	 *     connection = A #GDBusConnection.
245 	 *     flags = Flags used when constructing the proxy.
246 	 *     info = A #GDBusInterfaceInfo specifying the minimal interface that @proxy conforms to or %NULL.
247 	 *     name = A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
248 	 *     objectPath = An object path.
249 	 *     interfaceName = A D-Bus interface name.
250 	 *     cancellable = A #GCancellable or %NULL.
251 	 *
252 	 * Returns: A #GDBusProxy or %NULL if error is set.
253 	 *     Free with g_object_unref().
254 	 *
255 	 * Since: 2.26
256 	 *
257 	 * Throws: GException on failure.
258 	 * Throws: ConstructionException GTK+ fails to create the object.
259 	 */
260 	public this(DBusConnection connection, GDBusProxyFlags flags, DBusInterfaceInfo info, string name, string objectPath, string interfaceName, Cancellable cancellable)
261 	{
262 		GError* err = null;
263 
264 		auto __p = g_dbus_proxy_new_sync((connection is null) ? null : connection.getDBusConnectionStruct(), flags, (info is null) ? null : info.getDBusInterfaceInfoStruct(), Str.toStringz(name), Str.toStringz(objectPath), Str.toStringz(interfaceName), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
265 
266 		if (err !is null)
267 		{
268 			throw new GException( new ErrorG(err) );
269 		}
270 
271 		if(__p is null)
272 		{
273 			throw new ConstructionException("null returned by new_sync");
274 		}
275 
276 		this(cast(GDBusProxy*) __p, true);
277 	}
278 
279 	/**
280 	 * Creates a proxy for accessing @interface_name on the remote object
281 	 * at @object_path owned by @name at @connection and asynchronously
282 	 * loads D-Bus properties unless the
283 	 * %G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES flag is used. Connect to
284 	 * the #GDBusProxy::g-properties-changed signal to get notified about
285 	 * property changes.
286 	 *
287 	 * If the %G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS flag is not set, also sets up
288 	 * match rules for signals. Connect to the #GDBusProxy::g-signal signal
289 	 * to handle signals from the remote object.
290 	 *
291 	 * If both %G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES and
292 	 * %G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS are set, this constructor is
293 	 * guaranteed to complete immediately without blocking.
294 	 *
295 	 * If @name is a well-known name and the
296 	 * %G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START and %G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START_AT_CONSTRUCTION
297 	 * flags aren't set and no name owner currently exists, the message bus
298 	 * will be requested to launch a name owner for the name.
299 	 *
300 	 * This is a failable asynchronous constructor - when the proxy is
301 	 * ready, @callback will be invoked and you can use
302 	 * g_dbus_proxy_new_finish() to get the result.
303 	 *
304 	 * See g_dbus_proxy_new_sync() and for a synchronous version of this constructor.
305 	 *
306 	 * #GDBusProxy is used in this [example][gdbus-wellknown-proxy].
307 	 *
308 	 * Params:
309 	 *     connection = A #GDBusConnection.
310 	 *     flags = Flags used when constructing the proxy.
311 	 *     info = A #GDBusInterfaceInfo specifying the minimal interface that @proxy conforms to or %NULL.
312 	 *     name = A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
313 	 *     objectPath = An object path.
314 	 *     interfaceName = A D-Bus interface name.
315 	 *     cancellable = A #GCancellable or %NULL.
316 	 *     callback = Callback function to invoke when the proxy is ready.
317 	 *     userData = User data to pass to @callback.
318 	 *
319 	 * Since: 2.26
320 	 */
321 	public static void new_(DBusConnection connection, GDBusProxyFlags flags, DBusInterfaceInfo info, string name, string objectPath, string interfaceName, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
322 	{
323 		g_dbus_proxy_new((connection is null) ? null : connection.getDBusConnectionStruct(), flags, (info is null) ? null : info.getDBusInterfaceInfoStruct(), Str.toStringz(name), Str.toStringz(objectPath), Str.toStringz(interfaceName), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
324 	}
325 
326 	/**
327 	 * Like g_dbus_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
328 	 *
329 	 * #GDBusProxy is used in this [example][gdbus-wellknown-proxy].
330 	 *
331 	 * Params:
332 	 *     busType = A #GBusType.
333 	 *     flags = Flags used when constructing the proxy.
334 	 *     info = A #GDBusInterfaceInfo specifying the minimal interface that @proxy conforms to or %NULL.
335 	 *     name = A bus name (well-known or unique).
336 	 *     objectPath = An object path.
337 	 *     interfaceName = A D-Bus interface name.
338 	 *     cancellable = A #GCancellable or %NULL.
339 	 *     callback = Callback function to invoke when the proxy is ready.
340 	 *     userData = User data to pass to @callback.
341 	 *
342 	 * Since: 2.26
343 	 */
344 	public static void newForBus(GBusType busType, GDBusProxyFlags flags, DBusInterfaceInfo info, string name, string objectPath, string interfaceName, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
345 	{
346 		g_dbus_proxy_new_for_bus(busType, flags, (info is null) ? null : info.getDBusInterfaceInfoStruct(), Str.toStringz(name), Str.toStringz(objectPath), Str.toStringz(interfaceName), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
347 	}
348 
349 	/**
350 	 * Asynchronously invokes the @method_name method on @proxy.
351 	 *
352 	 * If @method_name contains any dots, then @name is split into interface and
353 	 * method name parts. This allows using @proxy for invoking methods on
354 	 * other interfaces.
355 	 *
356 	 * If the #GDBusConnection associated with @proxy is closed then
357 	 * the operation will fail with %G_IO_ERROR_CLOSED. If
358 	 * @cancellable is canceled, the operation will fail with
359 	 * %G_IO_ERROR_CANCELLED. If @parameters contains a value not
360 	 * compatible with the D-Bus protocol, the operation fails with
361 	 * %G_IO_ERROR_INVALID_ARGUMENT.
362 	 *
363 	 * If the @parameters #GVariant is floating, it is consumed. This allows
364 	 * convenient 'inline' use of g_variant_new(), e.g.:
365 	 * |[<!-- language="C" -->
366 	 * g_dbus_proxy_call (proxy,
367 	 * "TwoStrings",
368 	 * g_variant_new ("(ss)",
369 	 * "Thing One",
370 	 * "Thing Two"),
371 	 * G_DBUS_CALL_FLAGS_NONE,
372 	 * -1,
373 	 * NULL,
374 	 * (GAsyncReadyCallback) two_strings_done,
375 	 * &data);
376 	 * ]|
377 	 *
378 	 * If @proxy has an expected interface (see
379 	 * #GDBusProxy:g-interface-info) and @method_name is referenced by it,
380 	 * then the return value is checked against the return type.
381 	 *
382 	 * This is an asynchronous method. When the operation is finished,
383 	 * @callback will be invoked in the
384 	 * [thread-default main context][g-main-context-push-thread-default]
385 	 * of the thread you are calling this method from.
386 	 * You can then call g_dbus_proxy_call_finish() to get the result of
387 	 * the operation. See g_dbus_proxy_call_sync() for the synchronous
388 	 * version of this method.
389 	 *
390 	 * If @callback is %NULL then the D-Bus method call message will be sent with
391 	 * the %G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED flag set.
392 	 *
393 	 * Params:
394 	 *     methodName = Name of method to invoke.
395 	 *     parameters = A #GVariant tuple with parameters for the signal or %NULL if not passing parameters.
396 	 *     flags = Flags from the #GDBusCallFlags enumeration.
397 	 *     timeoutMsec = The timeout in milliseconds (with %G_MAXINT meaning
398 	 *         "infinite") or -1 to use the proxy default timeout.
399 	 *     cancellable = A #GCancellable or %NULL.
400 	 *     callback = A #GAsyncReadyCallback to call when the request is satisfied or %NULL if you don't
401 	 *         care about the result of the method invocation.
402 	 *     userData = The data to pass to @callback.
403 	 *
404 	 * Since: 2.26
405 	 */
406 	public void call(string methodName, Variant parameters, GDBusCallFlags flags, int timeoutMsec, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
407 	{
408 		g_dbus_proxy_call(gDBusProxy, Str.toStringz(methodName), (parameters is null) ? null : parameters.getVariantStruct(), flags, timeoutMsec, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
409 	}
410 
411 	/**
412 	 * Finishes an operation started with g_dbus_proxy_call().
413 	 *
414 	 * Params:
415 	 *     res = A #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_proxy_call().
416 	 *
417 	 * Returns: %NULL if @error is set. Otherwise a #GVariant tuple with
418 	 *     return values. Free with g_variant_unref().
419 	 *
420 	 * Since: 2.26
421 	 *
422 	 * Throws: GException on failure.
423 	 */
424 	public Variant callFinish(AsyncResultIF res)
425 	{
426 		GError* err = null;
427 
428 		auto __p = g_dbus_proxy_call_finish(gDBusProxy, (res is null) ? null : res.getAsyncResultStruct(), &err);
429 
430 		if (err !is null)
431 		{
432 			throw new GException( new ErrorG(err) );
433 		}
434 
435 		if(__p is null)
436 		{
437 			return null;
438 		}
439 
440 		return new Variant(cast(GVariant*) __p, true);
441 	}
442 
443 	/**
444 	 * Synchronously invokes the @method_name method on @proxy.
445 	 *
446 	 * If @method_name contains any dots, then @name is split into interface and
447 	 * method name parts. This allows using @proxy for invoking methods on
448 	 * other interfaces.
449 	 *
450 	 * If the #GDBusConnection associated with @proxy is disconnected then
451 	 * the operation will fail with %G_IO_ERROR_CLOSED. If
452 	 * @cancellable is canceled, the operation will fail with
453 	 * %G_IO_ERROR_CANCELLED. If @parameters contains a value not
454 	 * compatible with the D-Bus protocol, the operation fails with
455 	 * %G_IO_ERROR_INVALID_ARGUMENT.
456 	 *
457 	 * If the @parameters #GVariant is floating, it is consumed. This allows
458 	 * convenient 'inline' use of g_variant_new(), e.g.:
459 	 * |[<!-- language="C" -->
460 	 * g_dbus_proxy_call_sync (proxy,
461 	 * "TwoStrings",
462 	 * g_variant_new ("(ss)",
463 	 * "Thing One",
464 	 * "Thing Two"),
465 	 * G_DBUS_CALL_FLAGS_NONE,
466 	 * -1,
467 	 * NULL,
468 	 * &error);
469 	 * ]|
470 	 *
471 	 * The calling thread is blocked until a reply is received. See
472 	 * g_dbus_proxy_call() for the asynchronous version of this
473 	 * method.
474 	 *
475 	 * If @proxy has an expected interface (see
476 	 * #GDBusProxy:g-interface-info) and @method_name is referenced by it,
477 	 * then the return value is checked against the return type.
478 	 *
479 	 * Params:
480 	 *     methodName = Name of method to invoke.
481 	 *     parameters = A #GVariant tuple with parameters for the signal
482 	 *         or %NULL if not passing parameters.
483 	 *     flags = Flags from the #GDBusCallFlags enumeration.
484 	 *     timeoutMsec = The timeout in milliseconds (with %G_MAXINT meaning
485 	 *         "infinite") or -1 to use the proxy default timeout.
486 	 *     cancellable = A #GCancellable or %NULL.
487 	 *
488 	 * Returns: %NULL if @error is set. Otherwise a #GVariant tuple with
489 	 *     return values. Free with g_variant_unref().
490 	 *
491 	 * Since: 2.26
492 	 *
493 	 * Throws: GException on failure.
494 	 */
495 	public Variant callSync(string methodName, Variant parameters, GDBusCallFlags flags, int timeoutMsec, Cancellable cancellable)
496 	{
497 		GError* err = null;
498 
499 		auto __p = g_dbus_proxy_call_sync(gDBusProxy, Str.toStringz(methodName), (parameters is null) ? null : parameters.getVariantStruct(), flags, timeoutMsec, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
500 
501 		if (err !is null)
502 		{
503 			throw new GException( new ErrorG(err) );
504 		}
505 
506 		if(__p is null)
507 		{
508 			return null;
509 		}
510 
511 		return new Variant(cast(GVariant*) __p, true);
512 	}
513 
514 	/**
515 	 * Like g_dbus_proxy_call() but also takes a #GUnixFDList object.
516 	 *
517 	 * This method is only available on UNIX.
518 	 *
519 	 * Params:
520 	 *     methodName = Name of method to invoke.
521 	 *     parameters = A #GVariant tuple with parameters for the signal or %NULL if not passing parameters.
522 	 *     flags = Flags from the #GDBusCallFlags enumeration.
523 	 *     timeoutMsec = The timeout in milliseconds (with %G_MAXINT meaning
524 	 *         "infinite") or -1 to use the proxy default timeout.
525 	 *     fdList = A #GUnixFDList or %NULL.
526 	 *     cancellable = A #GCancellable or %NULL.
527 	 *     callback = A #GAsyncReadyCallback to call when the request is satisfied or %NULL if you don't
528 	 *         care about the result of the method invocation.
529 	 *     userData = The data to pass to @callback.
530 	 *
531 	 * Since: 2.30
532 	 */
533 	public void callWithUnixFdList(string methodName, Variant parameters, GDBusCallFlags flags, int timeoutMsec, UnixFDList fdList, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
534 	{
535 		g_dbus_proxy_call_with_unix_fd_list(gDBusProxy, Str.toStringz(methodName), (parameters is null) ? null : parameters.getVariantStruct(), flags, timeoutMsec, (fdList is null) ? null : fdList.getUnixFDListStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
536 	}
537 
538 	/**
539 	 * Finishes an operation started with g_dbus_proxy_call_with_unix_fd_list().
540 	 *
541 	 * Params:
542 	 *     outFdList = Return location for a #GUnixFDList or %NULL.
543 	 *     res = A #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_proxy_call_with_unix_fd_list().
544 	 *
545 	 * Returns: %NULL if @error is set. Otherwise a #GVariant tuple with
546 	 *     return values. Free with g_variant_unref().
547 	 *
548 	 * Since: 2.30
549 	 *
550 	 * Throws: GException on failure.
551 	 */
552 	public Variant callWithUnixFdListFinish(out UnixFDList outFdList, AsyncResultIF res)
553 	{
554 		GUnixFDList* outoutFdList = null;
555 		GError* err = null;
556 
557 		auto __p = g_dbus_proxy_call_with_unix_fd_list_finish(gDBusProxy, &outoutFdList, (res is null) ? null : res.getAsyncResultStruct(), &err);
558 
559 		if (err !is null)
560 		{
561 			throw new GException( new ErrorG(err) );
562 		}
563 
564 		outFdList = ObjectG.getDObject!(UnixFDList)(outoutFdList);
565 
566 		if(__p is null)
567 		{
568 			return null;
569 		}
570 
571 		return new Variant(cast(GVariant*) __p, true);
572 	}
573 
574 	/**
575 	 * Like g_dbus_proxy_call_sync() but also takes and returns #GUnixFDList objects.
576 	 *
577 	 * This method is only available on UNIX.
578 	 *
579 	 * Params:
580 	 *     methodName = Name of method to invoke.
581 	 *     parameters = A #GVariant tuple with parameters for the signal
582 	 *         or %NULL if not passing parameters.
583 	 *     flags = Flags from the #GDBusCallFlags enumeration.
584 	 *     timeoutMsec = The timeout in milliseconds (with %G_MAXINT meaning
585 	 *         "infinite") or -1 to use the proxy default timeout.
586 	 *     fdList = A #GUnixFDList or %NULL.
587 	 *     outFdList = Return location for a #GUnixFDList or %NULL.
588 	 *     cancellable = A #GCancellable or %NULL.
589 	 *
590 	 * Returns: %NULL if @error is set. Otherwise a #GVariant tuple with
591 	 *     return values. Free with g_variant_unref().
592 	 *
593 	 * Since: 2.30
594 	 *
595 	 * Throws: GException on failure.
596 	 */
597 	public Variant callWithUnixFdListSync(string methodName, Variant parameters, GDBusCallFlags flags, int timeoutMsec, UnixFDList fdList, out UnixFDList outFdList, Cancellable cancellable)
598 	{
599 		GUnixFDList* outoutFdList = null;
600 		GError* err = null;
601 
602 		auto __p = g_dbus_proxy_call_with_unix_fd_list_sync(gDBusProxy, Str.toStringz(methodName), (parameters is null) ? null : parameters.getVariantStruct(), flags, timeoutMsec, (fdList is null) ? null : fdList.getUnixFDListStruct(), &outoutFdList, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
603 
604 		if (err !is null)
605 		{
606 			throw new GException( new ErrorG(err) );
607 		}
608 
609 		outFdList = ObjectG.getDObject!(UnixFDList)(outoutFdList);
610 
611 		if(__p is null)
612 		{
613 			return null;
614 		}
615 
616 		return new Variant(cast(GVariant*) __p, true);
617 	}
618 
619 	/**
620 	 * Looks up the value for a property from the cache. This call does no
621 	 * blocking IO.
622 	 *
623 	 * If @proxy has an expected interface (see
624 	 * #GDBusProxy:g-interface-info) and @property_name is referenced by
625 	 * it, then @value is checked against the type of the property.
626 	 *
627 	 * Params:
628 	 *     propertyName = Property name.
629 	 *
630 	 * Returns: A reference to the #GVariant instance
631 	 *     that holds the value for @property_name or %NULL if the value is not in
632 	 *     the cache. The returned reference must be freed with g_variant_unref().
633 	 *
634 	 * Since: 2.26
635 	 */
636 	public Variant getCachedProperty(string propertyName)
637 	{
638 		auto __p = g_dbus_proxy_get_cached_property(gDBusProxy, Str.toStringz(propertyName));
639 
640 		if(__p is null)
641 		{
642 			return null;
643 		}
644 
645 		return new Variant(cast(GVariant*) __p, true);
646 	}
647 
648 	/**
649 	 * Gets the names of all cached properties on @proxy.
650 	 *
651 	 * Returns: A
652 	 *     %NULL-terminated array of strings or %NULL if
653 	 *     @proxy has no cached properties. Free the returned array with
654 	 *     g_strfreev().
655 	 *
656 	 * Since: 2.26
657 	 */
658 	public string[] getCachedPropertyNames()
659 	{
660 		auto retStr = g_dbus_proxy_get_cached_property_names(gDBusProxy);
661 
662 		scope(exit) Str.freeStringArray(retStr);
663 		return Str.toStringArray(retStr);
664 	}
665 
666 	/**
667 	 * Gets the connection @proxy is for.
668 	 *
669 	 * Returns: A #GDBusConnection owned by @proxy. Do not free.
670 	 *
671 	 * Since: 2.26
672 	 */
673 	public DBusConnection getConnection()
674 	{
675 		auto __p = g_dbus_proxy_get_connection(gDBusProxy);
676 
677 		if(__p is null)
678 		{
679 			return null;
680 		}
681 
682 		return ObjectG.getDObject!(DBusConnection)(cast(GDBusConnection*) __p);
683 	}
684 
685 	/**
686 	 * Gets the timeout to use if -1 (specifying default timeout) is
687 	 * passed as @timeout_msec in the g_dbus_proxy_call() and
688 	 * g_dbus_proxy_call_sync() functions.
689 	 *
690 	 * See the #GDBusProxy:g-default-timeout property for more details.
691 	 *
692 	 * Returns: Timeout to use for @proxy.
693 	 *
694 	 * Since: 2.26
695 	 */
696 	public int getDefaultTimeout()
697 	{
698 		return g_dbus_proxy_get_default_timeout(gDBusProxy);
699 	}
700 
701 	/**
702 	 * Gets the flags that @proxy was constructed with.
703 	 *
704 	 * Returns: Flags from the #GDBusProxyFlags enumeration.
705 	 *
706 	 * Since: 2.26
707 	 */
708 	public GDBusProxyFlags getFlags()
709 	{
710 		return g_dbus_proxy_get_flags(gDBusProxy);
711 	}
712 
713 	/**
714 	 * Returns the #GDBusInterfaceInfo, if any, specifying the interface
715 	 * that @proxy conforms to. See the #GDBusProxy:g-interface-info
716 	 * property for more details.
717 	 *
718 	 * Returns: A #GDBusInterfaceInfo or %NULL.
719 	 *     Do not unref the returned object, it is owned by @proxy.
720 	 *
721 	 * Since: 2.26
722 	 */
723 	public DBusInterfaceInfo getInterfaceInfo()
724 	{
725 		auto __p = g_dbus_proxy_get_interface_info(gDBusProxy);
726 
727 		if(__p is null)
728 		{
729 			return null;
730 		}
731 
732 		return ObjectG.getDObject!(DBusInterfaceInfo)(cast(GDBusInterfaceInfo*) __p);
733 	}
734 
735 	/**
736 	 * Gets the D-Bus interface name @proxy is for.
737 	 *
738 	 * Returns: A string owned by @proxy. Do not free.
739 	 *
740 	 * Since: 2.26
741 	 */
742 	public string getInterfaceName()
743 	{
744 		return Str.toString(g_dbus_proxy_get_interface_name(gDBusProxy));
745 	}
746 
747 	/**
748 	 * Gets the name that @proxy was constructed for.
749 	 *
750 	 * Returns: A string owned by @proxy. Do not free.
751 	 *
752 	 * Since: 2.26
753 	 */
754 	public string getName()
755 	{
756 		return Str.toString(g_dbus_proxy_get_name(gDBusProxy));
757 	}
758 
759 	/**
760 	 * The unique name that owns the name that @proxy is for or %NULL if
761 	 * no-one currently owns that name. You may connect to the
762 	 * #GObject::notify signal to track changes to the
763 	 * #GDBusProxy:g-name-owner property.
764 	 *
765 	 * Returns: The name owner or %NULL if no name
766 	 *     owner exists. Free with g_free().
767 	 *
768 	 * Since: 2.26
769 	 */
770 	public string getNameOwner()
771 	{
772 		auto retStr = g_dbus_proxy_get_name_owner(gDBusProxy);
773 
774 		scope(exit) Str.freeString(retStr);
775 		return Str.toString(retStr);
776 	}
777 
778 	/**
779 	 * Gets the object path @proxy is for.
780 	 *
781 	 * Returns: A string owned by @proxy. Do not free.
782 	 *
783 	 * Since: 2.26
784 	 */
785 	public string getObjectPath()
786 	{
787 		return Str.toString(g_dbus_proxy_get_object_path(gDBusProxy));
788 	}
789 
790 	/**
791 	 * If @value is not %NULL, sets the cached value for the property with
792 	 * name @property_name to the value in @value.
793 	 *
794 	 * If @value is %NULL, then the cached value is removed from the
795 	 * property cache.
796 	 *
797 	 * If @proxy has an expected interface (see
798 	 * #GDBusProxy:g-interface-info) and @property_name is referenced by
799 	 * it, then @value is checked against the type of the property.
800 	 *
801 	 * If the @value #GVariant is floating, it is consumed. This allows
802 	 * convenient 'inline' use of g_variant_new(), e.g.
803 	 * |[<!-- language="C" -->
804 	 * g_dbus_proxy_set_cached_property (proxy,
805 	 * "SomeProperty",
806 	 * g_variant_new ("(si)",
807 	 * "A String",
808 	 * 42));
809 	 * ]|
810 	 *
811 	 * Normally you will not need to use this method since @proxy
812 	 * is tracking changes using the
813 	 * `org.freedesktop.DBus.Properties.PropertiesChanged`
814 	 * D-Bus signal. However, for performance reasons an object may
815 	 * decide to not use this signal for some properties and instead
816 	 * use a proprietary out-of-band mechanism to transmit changes.
817 	 *
818 	 * As a concrete example, consider an object with a property
819 	 * `ChatroomParticipants` which is an array of strings. Instead of
820 	 * transmitting the same (long) array every time the property changes,
821 	 * it is more efficient to only transmit the delta using e.g. signals
822 	 * `ChatroomParticipantJoined(String name)` and
823 	 * `ChatroomParticipantParted(String name)`.
824 	 *
825 	 * Params:
826 	 *     propertyName = Property name.
827 	 *     value = Value for the property or %NULL to remove it from the cache.
828 	 *
829 	 * Since: 2.26
830 	 */
831 	public void setCachedProperty(string propertyName, Variant value)
832 	{
833 		g_dbus_proxy_set_cached_property(gDBusProxy, Str.toStringz(propertyName), (value is null) ? null : value.getVariantStruct());
834 	}
835 
836 	/**
837 	 * Sets the timeout to use if -1 (specifying default timeout) is
838 	 * passed as @timeout_msec in the g_dbus_proxy_call() and
839 	 * g_dbus_proxy_call_sync() functions.
840 	 *
841 	 * See the #GDBusProxy:g-default-timeout property for more details.
842 	 *
843 	 * Params:
844 	 *     timeoutMsec = Timeout in milliseconds.
845 	 *
846 	 * Since: 2.26
847 	 */
848 	public void setDefaultTimeout(int timeoutMsec)
849 	{
850 		g_dbus_proxy_set_default_timeout(gDBusProxy, timeoutMsec);
851 	}
852 
853 	/**
854 	 * Ensure that interactions with @proxy conform to the given
855 	 * interface. See the #GDBusProxy:g-interface-info property for more
856 	 * details.
857 	 *
858 	 * Params:
859 	 *     info = Minimum interface this proxy conforms to
860 	 *         or %NULL to unset.
861 	 *
862 	 * Since: 2.26
863 	 */
864 	public void setInterfaceInfo(DBusInterfaceInfo info)
865 	{
866 		g_dbus_proxy_set_interface_info(gDBusProxy, (info is null) ? null : info.getDBusInterfaceInfoStruct());
867 	}
868 
869 	/**
870 	 * Emitted when one or more D-Bus properties on @proxy changes. The
871 	 * local cache has already been updated when this signal fires. Note
872 	 * that both @changed_properties and @invalidated_properties are
873 	 * guaranteed to never be %NULL (either may be empty though).
874 	 *
875 	 * If the proxy has the flag
876 	 * %G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES set, then
877 	 * @invalidated_properties will always be empty.
878 	 *
879 	 * This signal corresponds to the
880 	 * `PropertiesChanged` D-Bus signal on the
881 	 * `org.freedesktop.DBus.Properties` interface.
882 	 *
883 	 * Params:
884 	 *     changedProperties = A #GVariant containing the properties that changed (type: `a{sv}`)
885 	 *     invalidatedProperties = A %NULL terminated array of properties that was invalidated
886 	 *
887 	 * Since: 2.26
888 	 */
889 	gulong addOnGPropertiesChanged(void delegate(Variant, string[], DBusProxy) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
890 	{
891 		return Signals.connect(this, "g-properties-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED);
892 	}
893 
894 	/**
895 	 * Emitted when a signal from the remote object and interface that @proxy is for, has been received.
896 	 *
897 	 * Params:
898 	 *     senderName = The sender of the signal or %NULL if the connection is not a bus connection.
899 	 *     signalName = The name of the signal.
900 	 *     parameters = A #GVariant tuple with parameters for the signal.
901 	 *
902 	 * Since: 2.26
903 	 */
904 	gulong addOnGSignal(void delegate(string, string, Variant, DBusProxy) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
905 	{
906 		return Signals.connect(this, "g-signal", dlg, connectFlags ^ ConnectFlags.SWAPPED);
907 	}
908 }