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  = libgda-GdaExport.html
27  * outPack = gda
28  * outFile = Export
29  * strct   = GdaExport
30  * realStrct=
31  * ctorStrct=
32  * clss    = Export
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = GObject
38  * implements:
39  * prefixes:
40  * 	- gda_export_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- glib.ListG
48  * 	- gda.Connection
49  * structWrap:
50  * 	- GList* -> ListG
51  * 	- GdaConnection* -> Connection
52  * module aliases:
53  * local aliases:
54  * overrides:
55  */
56 
57 module gda.Export;
58 
59 public  import gdac.gdatypes;
60 
61 private import gdac.gda;
62 private import glib.ConstructionException;
63 private import gobject.ObjectG;
64 
65 
66 private import glib.Str;
67 private import glib.ListG;
68 private import gda.Connection;
69 
70 
71 
72 private import gobject.ObjectG;
73 
74 /**
75  * Description
76  */
77 public class Export : ObjectG
78 {
79 	
80 	/** the main Gtk struct */
81 	protected GdaExport* gdaExport;
82 	
83 	
84 	public GdaExport* getExportStruct()
85 	{
86 		return gdaExport;
87 	}
88 	
89 	
90 	/** the main Gtk struct as a void* */
91 	protected override void* getStruct()
92 	{
93 		return cast(void*)gdaExport;
94 	}
95 	
96 	/**
97 	 * Sets our main struct and passes it to the parent class
98 	 */
99 	public this (GdaExport* gdaExport)
100 	{
101 		super(cast(GObject*)gdaExport);
102 		this.gdaExport = gdaExport;
103 	}
104 	
105 	protected override void setStruct(GObject* obj)
106 	{
107 		super.setStruct(obj);
108 		gdaExport = cast(GdaExport*)obj;
109 	}
110 	
111 	/**
112 	 */
113 	
114 	/**
115 	 * Creates a new GdaExport object, which allows you to easily add
116 	 * exporting functionality to your programs.
117 	 * It works by first having a GdaConnection object associated
118 	 * to it, and then allowing you to retrieve information about all
119 	 * the objects present in the database, and also to add/remove
120 	 * those objects from a list of selected objects.
121 	 * When you're done, you just run the export (gda_export_run), first
122 	 * connecting to the different signals that will let you be
123 	 * informed of the export process progress.
124 	 * Params:
125 	 * cnc = a GdaConnection object.
126 	 * Throws: ConstructionException GTK+ fails to create the object.
127 	 */
128 	public this (Connection cnc)
129 	{
130 		// GdaExport* gda_export_new (GdaConnection *cnc);
131 		auto p = gda_export_new((cnc is null) ? null : cnc.getConnectionStruct());
132 		if(p is null)
133 		{
134 			throw new ConstructionException("null returned by gda_export_new((cnc is null) ? null : cnc.getConnectionStruct())");
135 		}
136 		this(cast(GdaExport*) p);
137 	}
138 	
139 	/**
140 	 * Returns a list of all tables that exist in the GdaConnection
141 	 * being used by the given GdaExport object. This function is
142 	 * useful when you're building, for example, a list for the user
143 	 * to select which tables he/she wants in the export process.
144 	 * You are responsible to free the returned value yourself.
145 	 * Returns: a GList containing the names of all the tables.
146 	 */
147 	public ListG getTables()
148 	{
149 		// GList* gda_export_get_tables (GdaExport *exp);
150 		auto p = gda_export_get_tables(gdaExport);
151 		
152 		if(p is null)
153 		{
154 			return null;
155 		}
156 		
157 		return ObjectG.getDObject!(ListG)(cast(GList*) p);
158 	}
159 	
160 	/**
161 	 * Returns a list with the names of all the currently selected objects
162 	 * in the given GdaExport object.
163 	 * You are responsible to free the returned value yourself.
164 	 * Returns: a GList containing the names of the selected tables.
165 	 */
166 	public ListG getSelectedTables()
167 	{
168 		// GList* gda_export_get_selected_tables (GdaExport *exp);
169 		auto p = gda_export_get_selected_tables(gdaExport);
170 		
171 		if(p is null)
172 		{
173 			return null;
174 		}
175 		
176 		return ObjectG.getDObject!(ListG)(cast(GList*) p);
177 	}
178 	
179 	/**
180 	 * Adds the given table to the list of selected tables.
181 	 * Params:
182 	 * table = name of the table.
183 	 */
184 	public void selectTable(string table)
185 	{
186 		// void gda_export_select_table (GdaExport *exp,  const gchar *table);
187 		gda_export_select_table(gdaExport, Str.toStringz(table));
188 	}
189 	
190 	/**
191 	 * Adds all the tables contained in the given list to the list of
192 	 * selected tables.
193 	 * Params:
194 	 * list = list of tables to be selected.
195 	 */
196 	public void selectTableList(ListG list)
197 	{
198 		// void gda_export_select_table_list (GdaExport *exp,  GList *list);
199 		gda_export_select_table_list(gdaExport, (list is null) ? null : list.getListGStruct());
200 	}
201 	
202 	/**
203 	 * Removes the given table name from the list of selected tables.
204 	 * Params:
205 	 * table = name of the table.
206 	 */
207 	public void unselectTable(string table)
208 	{
209 		// void gda_export_unselect_table (GdaExport *exp,  const gchar *table);
210 		gda_export_unselect_table(gdaExport, Str.toStringz(table));
211 	}
212 	
213 	/**
214 	 * Starts the execution of the given export object. This means that, after
215 	 * calling this function, your application will lose control about the export
216 	 * process and will only receive notifications via the class signals.
217 	 * Params:
218 	 * flags = execution flags.
219 	 */
220 	public void run(GdaExportFlags flags)
221 	{
222 		// void gda_export_run (GdaExport *exp,  GdaExportFlags flags);
223 		gda_export_run(gdaExport, flags);
224 	}
225 	
226 	/**
227 	 * Stops execution of the given export object.
228 	 */
229 	public void stop()
230 	{
231 		// void gda_export_stop (GdaExport *exp);
232 		gda_export_stop(gdaExport);
233 	}
234 	
235 	/**
236 	 * Returns: the GdaConnection object associated with the given GdaExport.
237 	 */
238 	public Connection getConnection()
239 	{
240 		// GdaConnection* gda_export_get_connection (GdaExport *exp);
241 		auto p = gda_export_get_connection(gdaExport);
242 		
243 		if(p is null)
244 		{
245 			return null;
246 		}
247 		
248 		return ObjectG.getDObject!(Connection)(cast(GdaConnection*) p);
249 	}
250 	
251 	/**
252 	 * Associates the given GdaConnection with the given GdaExport.
253 	 * Params:
254 	 * cnc = a GdaConnection object.
255 	 */
256 	public void setConnection(Connection cnc)
257 	{
258 		// void gda_export_set_connection (GdaExport *exp,  GdaConnection *cnc);
259 		gda_export_set_connection(gdaExport, (cnc is null) ? null : cnc.getConnectionStruct());
260 	}
261 }