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