root/trunk/src/gio/DBusProxy.d

Revision 951, 27.1 kB (checked in by Mike Wey, 2 weeks ago)

Merge github pull request 7.

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