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  = GAsyncResult.html
27  * outPack = gio
28  * outFile = AsyncResultT
29  * strct   = GAsyncResult
30  * realStrct=
31  * ctorStrct=
32  * clss    = AsyncResultT
33  * interf  = AsyncResultIF
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * 	- TStruct
38  * extend  = 
39  * implements:
40  * prefixes:
41  * 	- g_async_result_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- gobject.ObjectG
48  * structWrap:
49  * 	- GObject* -> ObjectG
50  * module aliases:
51  * local aliases:
52  * overrides:
53  */
54 
55 module gio.AsyncResultT;
56 
57 public  import gtkc.giotypes;
58 
59 public import gtkc.gio;
60 public import glib.ConstructionException;
61 public import gobject.ObjectG;
62 
63 
64 public import gobject.ObjectG;
65 
66 
67 
68 
69 /**
70  * Description
71  * Provides a base class for implementing asynchronous function results.
72  * Asynchronous operations are broken up into two separate operations
73  * which are chained together by a GAsyncReadyCallback. To begin
74  * an asynchronous operation, provide a GAsyncReadyCallback to the
75  * asynchronous function. This callback will be triggered when the
76  * operation has completed, and will be passed a GAsyncResult instance
77  * filled with the details of the operation's success or failure, the
78  * object the asynchronous function was started for and any error codes
79  * returned. The asynchronous callback function is then expected to call
80  * the corresponding "_finish()" function, passing the object the
81  * function was called for, the GAsyncResult instance, and (optionally)
82  * an error to grab any error conditions that may have occurred.
83  * The "_finish()" function for an operation takes the generic result
84  * (of type GAsyncResult) and returns the specific result that the
85  * operation in question yields (e.g. a GFileEnumerator for a
86  * "enumerate children" operation). If the result or error status of the
87  * operation is not needed, there is no need to call the "_finish()"
88  * function; GIO will take care of cleaning up the result and error
89  * information after the GAsyncReadyCallback returns. Applications may
90  * also take a reference to the GAsyncResult and call "_finish()"
91  * later; however, the "_finish()" function may be called at most once.
92  * Example of a typical asynchronous operation flow:
93  * $(DDOC_COMMENT example)
94  * The callback for an asynchronous operation is called only once, and is
95  * always called, even in the case of a cancelled operation. On cancellation
96  * the result is a G_IO_ERROR_CANCELLED error.
97  * Some asynchronous operations are implemented using synchronous calls.
98  * These are run in a separate thread, if GThread has been initialized, but
99  * otherwise they are sent to the Main Event Loop and processed in an idle
100  * function. So, if you truly need asynchronous operations, make sure to
101  * initialize GThread.
102  */
103 public template AsyncResultT(TStruct)
104 {
105 	
106 	/** the main Gtk struct */
107 	protected GAsyncResult* gAsyncResult;
108 	
109 	
110 	public GAsyncResult* getAsyncResultTStruct()
111 	{
112 		return cast(GAsyncResult*)getStruct();
113 	}
114 	
115 	
116 	/**
117 	 */
118 	
119 	/**
120 	 * Gets the user data from a GAsyncResult.
121 	 * Returns: the user data for res. [transfer full]
122 	 */
123 	public void* getUserData()
124 	{
125 		// gpointer g_async_result_get_user_data (GAsyncResult *res);
126 		return g_async_result_get_user_data(getAsyncResultTStruct());
127 	}
128 	
129 	/**
130 	 * Gets the source object from a GAsyncResult.
131 	 * Returns: a new reference to the source object for the res, or NULL if there is none. [transfer full]
132 	 */
133 	public ObjectG getSourceObject()
134 	{
135 		// GObject * g_async_result_get_source_object (GAsyncResult *res);
136 		auto p = g_async_result_get_source_object(getAsyncResultTStruct());
137 		
138 		if(p is null)
139 		{
140 			return null;
141 		}
142 		
143 		return ObjectG.getDObject!(ObjectG)(cast(GObject*) p);
144 	}
145 }