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