root/trunk/src/gio/AsyncInitableT.d

Revision 938, 9.6 kB (checked in by Mike Wey, 3 months ago)

Update Gio to 2.28.

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  = GAsyncInitable.html
27  * outPack = gio
28  * outFile = AsyncInitableT
29  * strct   = GAsyncInitable
30  * realStrct=
31  * ctorStrct=
32  * clss    = AsyncInitableT
33  * interf  = AsyncInitableIF
34  * class Code: No
35  * interface Code: No
36  * template for:
37  *  - TStruct
38  * extend  =
39  * implements:
40  * prefixes:
41  *  - g_initable_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  *  - glib.Str
48  *  - glib.ErrorG
49  *  - glib.GException
50  *  - gobject.ObjectG
51  *  - gio.AsyncResultIF
52  *  - gio.Cancellable
53  * structWrap:
54  *  - GAsyncResult* -> AsyncResultIF
55  *  - GCancellable* -> Cancellable
56  *  - GObject* -> ObjectG
57  * module aliases:
58  * local aliases:
59  * overrides:
60  */
61
62 module gio.AsyncInitableT;
63
64 public  import gtkc.giotypes;
65
66 public import gtkc.gio;
67 public import glib.ConstructionException;
68
69
70 public import glib.Str;
71 public import glib.ErrorG;
72 public import glib.GException;
73 public import gobject.ObjectG;
74 public import gio.AsyncResultIF;
75 public import gio.Cancellable;
76
77
78
79
80 /**
81  * Description
82  * This is the asynchronous version of GInitable; it behaves the same
83  * in all ways except that initialization is asynchronous. For more details
84  * see the descriptions on GInitable.
85  * A class may implement both the GInitable and GAsyncInitable interfaces.
86  * Users of objects implementing this are not intended to use the interface
87  * method directly; instead it will be used automatically in various ways.
88  * For C applications you generally just call g_async_initable_new_async()
89  * directly, or indirectly via a foo_thing_new_async() wrapper. This will call
90  * g_async_initable_init_async() under the cover, calling back with NULL and
91  * a set GError on failure.
92  * A typical implementation might look something like this:
93  * $(DDOC_COMMENT example)
94  */
95 public template AsyncInitableT(TStruct)
96 {
97    
98     /** the main Gtk struct */
99     protected GAsyncInitable* gAsyncInitable;
100    
101    
102     public GAsyncInitable* getAsyncInitableTStruct()
103     {
104         return cast(GAsyncInitable*)getStruct();
105     }
106    
107    
108     /**
109      */
110    
111     /**
112      * Starts asynchronous initialization of the object implementing the
113      * interface. This must be done before any real use of the object after
114      * initial construction. If the object also implements GInitable you can
115      * optionally call g_initable_init() instead.
116      * When the initialization is finished, callback will be called. You can
117      * then call g_async_initable_init_finish() to get the result of the
118      * initialization.
119      * Implementations may also support cancellation. If cancellable is not
120      * NULL, then initialization can be cancelled by triggering the cancellable
121      * object from another thread. If the operation was cancelled, the error
122      * G_IO_ERROR_CANCELLED will be returned. If cancellable is not NULL, and
123      * the object doesn't support cancellable initialization, the error
124      * G_IO_ERROR_NOT_SUPPORTED will be returned.
125      * If this function is not called, or returns with an error, then all
126      * operations on the object should fail, generally returning the
127      * error G_IO_ERROR_NOT_INITIALIZED.
128      * Implementations of this method must be idempotent: i.e. multiple calls
129      * to this function with the same argument should return the same results.
130      * Only the first call initializes the object; further calls return the result
131      * of the first call. This is so that it's safe to implement the singleton
132      * pattern in the GObject constructor function.
133      * For classes that also support the GInitable interface, the default
134      * implementation of this method will run the g_initable_init() function
135      * in a thread, so if you want to support asynchronous initialization via
136      * threads, just implement the GAsyncInitable interface without overriding
137      * any interface methods.
138      * Since 2.22
139      * Params:
140      * ioPriority = the I/O priority
141      * of the operation.
142      * cancellable = optional GCancellable object, NULL to ignore.
143      * callback = a GAsyncReadyCallback to call when the request is satisfied
144      * userData = the data to pass to callback function
145      */
146     public void gAsyncInitableInitAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
147     {
148         // void g_async_initable_init_async (GAsyncInitable *initable,  int io_priority,  GCancellable *cancellable,  GAsyncReadyCallback callback,  gpointer user_data);
149         g_async_initable_init_async(getAsyncInitableTStruct(), ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
150     }
151    
152     /**
153      * Finishes asynchronous initialization and returns the result.
154      * See g_async_initable_init_async().
155      * Since 2.22
156      * Params:
157      * res = a GAsyncResult.
158      * Returns: TRUE if successful. If an error has occurred, this function will return FALSE and set error appropriately if present.
159      * Throws: GException on failure.
160      */
161     public int gAsyncInitableInitFinish(AsyncResultIF res)
162     {
163         // gboolean g_async_initable_init_finish (GAsyncInitable *initable,  GAsyncResult *res,  GError **error);
164         GError* err = null;
165        
166         auto p = g_async_initable_init_finish(getAsyncInitableTStruct(), (res is null) ? null : res.getAsyncResultTStruct(), &err);
167        
168         if (err !is null)
169         {
170             throw new GException( new ErrorG(err) );
171         }
172        
173         return p;
174     }
175    
176     /**
177      * Finishes the async construction for the various g_async_initable_new calls,
178      * returning the created object or NULL on error.
179      * Since 2.22
180      * Params:
181      * res = the GAsyncResult.from the callback
182      * Returns: a newly created GObject, or NULL on error. Free with g_object_unref(). [transfer full]
183      * Throws: GException on failure.
184      */
185     public ObjectG gAsyncInitableNewFinish(AsyncResultIF res)
186     {
187         // GObject * g_async_initable_new_finish (GAsyncInitable *initable,  GAsyncResult *res,  GError **error);
188         GError* err = null;
189        
190         auto p = g_async_initable_new_finish(getAsyncInitableTStruct(), (res is null) ? null : res.getAsyncResultTStruct(), &err);
191        
192         if (err !is null)
193         {
194             throw new GException( new ErrorG(err) );
195         }
196        
197         if(p is null)
198         {
199             return null;
200         }
201         return new ObjectG(cast(GObject*) p);
202     }
203    
204     /**
205      * Helper function for constructing GAsyncInitiable object. This is
206      * similar to g_object_new_valist() but also initializes the object
207      * asynchronously.
208      * When the initialization is finished, callback will be called. You can
209      * then call g_async_initable_new_finish() to get the new object and check
210      * for any errors.
211      * Since 2.22
212      * Params:
213      * objectType = a GType supporting GAsyncInitable.
214      * firstPropertyName = the name of the first property, followed by
215      * the value, and other property value pairs, and ended by NULL.
216      * varArgs = The var args list generated from first_property_name.
217      * ioPriority = the I/O priority
218      * of the operation.
219      * cancellable = optional GCancellable object, NULL to ignore.
220      * callback = a GAsyncReadyCallback to call when the initialization is
221      * finished
222      * userData = the data to pass to callback function
223      */
224     public static void gAsyncInitableNewValistAsync(GType objectType, string firstPropertyName, void* varArgs, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
225     {
226         // void g_async_initable_new_valist_async (GType object_type,  const gchar *first_property_name,  va_list var_args,  int io_priority,  GCancellable *cancellable,  GAsyncReadyCallback callback,  gpointer user_data);
227         g_async_initable_new_valist_async(objectType, Str.toStringz(firstPropertyName), varArgs, ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
228     }
229    
230     /**
231      * Helper function for constructing GAsyncInitiable object. This is
232      * similar to g_object_newv() but also initializes the object asynchronously.
233      * When the initialization is finished, callback will be called. You can
234      * then call g_async_initable_new_finish() to get the new object and check
235      * for any errors.
236      * Since 2.22
237      * Params:
238      * objectType = a GType supporting GAsyncInitable.
239      * parameters = the parameters to use to construct the object
240      * ioPriority = the I/O priority
241      * of the operation.
242      * cancellable = optional GCancellable object, NULL to ignore.
243      * callback = a GAsyncReadyCallback to call when the initialization is
244      * finished
245      * userData = the data to pass to callback function
246      */
247     public static void gAsyncInitableNewvAsync(GType objectType, GParameter[] parameters, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
248     {
249         // void g_async_initable_newv_async (GType object_type,  guint n_parameters,  GParameter *parameters,  int io_priority,  GCancellable *cancellable,  GAsyncReadyCallback callback,  gpointer user_data);
250         g_async_initable_newv_async(objectType, cast(int) parameters.length, parameters.ptr, ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
251     }
252 }
Note: See TracBrowser for help on using the browser.