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