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