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  = GDrive.html
27  * outPack = gio
28  * outFile = DriveIF
29  * strct   = GDrive
30  * realStrct=
31  * ctorStrct=
32  * clss    = DriveT
33  * interf  = DriveIF
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_drive_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- glib.ErrorG
48  * 	- glib.GException
49  * 	- glib.ListG
50  * 	- gobject.Signals
51  * 	- gio.AsyncResultIF
52  * 	- gio.Cancellable
53  * 	- gio.Icon
54  * 	- gio.IconIF
55  * 	- gio.MountOperation
56  * structWrap:
57  * 	- GAsyncResult* -> AsyncResultIF
58  * 	- GCancellable* -> Cancellable
59  * 	- GIcon* -> IconIF
60  * 	- GList* -> ListG
61  * 	- GMountOperation* -> MountOperation
62  * module aliases:
63  * local aliases:
64  * overrides:
65  */
66 
67 module gio.DriveIF;
68 
69 public  import gtkc.giotypes;
70 
71 private import gtkc.gio;
72 private import glib.ConstructionException;
73 private import gobject.ObjectG;
74 
75 private import gobject.Signals;
76 public  import gtkc.gdktypes;
77 
78 private import glib.Str;
79 private import glib.ErrorG;
80 private import glib.GException;
81 private import glib.ListG;
82 private import gobject.Signals;
83 private import gio.AsyncResultIF;
84 private import gio.Cancellable;
85 private import gio.Icon;
86 private import gio.IconIF;
87 private import gio.MountOperation;
88 
89 
90 
91 
92 /**
93  * Description
94  * GDrive - this represent a piece of hardware connected to the machine.
95  * It's generally only created for removable hardware or hardware with
96  * removable media.
97  * GDrive is a container class for GVolume objects that stem from
98  * the same piece of media. As such, GDrive abstracts a drive with
99  * (or without) removable media and provides operations for querying
100  * whether media is available, determing whether media change is
101  * automatically detected and ejecting the media.
102  * If the GDrive reports that media isn't automatically detected, one
103  * can poll for media; typically one should not do this periodically
104  * as a poll for media operation is potententially expensive and may
105  * spin up the drive creating noise.
106  * GDrive supports starting and stopping drives with authentication
107  * support for the former. This can be used to support a diverse set
108  * of use cases including connecting/disconnecting iSCSI devices,
109  * powering down external disk enclosures and starting/stopping
110  * multi-disk devices such as RAID devices. Note that the actual
111  * semantics and side-effects of starting/stopping a GDrive may vary
112  * according to implementation. To choose the correct verbs in e.g. a
113  * file manager, use g_drive_get_start_stop_type().
114  * For porting from GnomeVFS note that there is no equivalent of
115  * GDrive in that API.
116  */
117 public interface DriveIF
118 {
119 	
120 	
121 	public GDrive* getDriveTStruct();
122 	
123 	/** the main Gtk struct as a void* */
124 	protected void* getStruct();
125 	
126 	
127 	/**
128 	 */
129 	
130 	void delegate(DriveIF)[] onChangedListeners();
131 	/**
132 	 * Emitted when the drive's state has changed.
133 	 */
134 	void addOnChanged(void delegate(DriveIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
135 	void delegate(DriveIF)[] onDisconnectedListeners();
136 	/**
137 	 * This signal is emitted when the GDrive have been
138 	 * disconnected. If the recipient is holding references to the
139 	 * object they should release them so the object can be
140 	 * finalized.
141 	 */
142 	void addOnDisconnected(void delegate(DriveIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
143 	void delegate(DriveIF)[] onEjectButtonListeners();
144 	/**
145 	 * Emitted when the physical eject button (if any) of a drive has
146 	 * been pressed.
147 	 */
148 	void addOnEjectButton(void delegate(DriveIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
149 	void delegate(DriveIF)[] onStopButtonListeners();
150 	/**
151 	 * Emitted when the physical stop button (if any) of a drive has
152 	 * been pressed.
153 	 * Since 2.22
154 	 */
155 	void addOnStopButton(void delegate(DriveIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
156 	
157 	/**
158 	 * Gets the name of drive.
159 	 * Returns: a string containing drive's name. The returned string should be freed when no longer needed.
160 	 */
161 	public string getName();
162 	
163 	/**
164 	 * Gets the icon for drive.
165 	 * Returns: GIcon for the drive. Free the returned object with g_object_unref(). [transfer full]
166 	 */
167 	public IconIF getIcon();
168 	
169 	/**
170 	 * Check if drive has any mountable volumes.
171 	 * Returns: TRUE if the drive contains volumes, FALSE otherwise.
172 	 */
173 	public int hasVolumes();
174 	
175 	/**
176 	 * Get a list of mountable volumes for drive.
177 	 * The returned list should be freed with g_list_free(), after
178 	 * its elements have been unreffed with g_object_unref().
179 	 * Returns: GList containing any GVolume objects on the given drive. [element-type GVolume][transfer full]
180 	 */
181 	public ListG getVolumes();
182 	
183 	/**
184 	 * Checks if a drive can be ejected.
185 	 * Returns: TRUE if the drive can be ejected, FALSE otherwise.
186 	 */
187 	public int canEject();
188 	
189 	/**
190 	 * Gets a hint about how a drive can be started/stopped.
191 	 * Since 2.22
192 	 * Returns: A value from the GDriveStartStopType enumeration.
193 	 */
194 	public GDriveStartStopType getStartStopType();
195 	
196 	/**
197 	 * Checks if a drive can be started.
198 	 * Since 2.22
199 	 * Returns: TRUE if the drive can be started, FALSE otherwise.
200 	 */
201 	public int canStart();
202 	
203 	/**
204 	 * Checks if a drive can be started degraded.
205 	 * Since 2.22
206 	 * Returns: TRUE if the drive can be started degraded, FALSE otherwise.
207 	 */
208 	public int canStartDegraded();
209 	
210 	/**
211 	 * Checks if a drive can be stopped.
212 	 * Since 2.22
213 	 * Returns: TRUE if the drive can be stopped, FALSE otherwise.
214 	 */
215 	public int canStop();
216 	
217 	/**
218 	 * Checks if a drive can be polled for media changes.
219 	 * Returns: TRUE if the drive can be polled for media changes, FALSE otherwise.
220 	 */
221 	public int canPollForMedia();
222 	
223 	/**
224 	 * Asynchronously polls drive to see if media has been inserted or removed.
225 	 * When the operation is finished, callback will be called.
226 	 * You can then call g_drive_poll_for_media_finish() to obtain the
227 	 * result of the operation.
228 	 * Params:
229 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
230 	 * callback = a GAsyncReadyCallback, or NULL. [allow-none]
231 	 * userData = user data to pass to callback
232 	 */
233 	public void pollForMedia(Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
234 	
235 	/**
236 	 * Finishes an operation started with g_drive_poll_for_media() on a drive.
237 	 * Params:
238 	 * result = a GAsyncResult.
239 	 * Returns: TRUE if the drive has been poll_for_mediaed successfully, FALSE otherwise.
240 	 * Throws: GException on failure.
241 	 */
242 	public int pollForMediaFinish(AsyncResultIF result);
243 	
244 	/**
245 	 * Checks if the drive has media. Note that the OS may not be polling
246 	 * the drive for media changes; see g_drive_is_media_check_automatic()
247 	 * for more details.
248 	 * Returns: TRUE if drive has media, FALSE otherwise.
249 	 */
250 	public int hasMedia();
251 	
252 	/**
253 	 * Checks if drive is capabable of automatically detecting media changes.
254 	 * Returns: TRUE if the drive is capabable of automatically detecting media changes, FALSE otherwise.
255 	 */
256 	public int isMediaCheckAutomatic();
257 	
258 	/**
259 	 * Checks if the drive supports removable media.
260 	 * Returns: TRUE if drive supports removable media, FALSE otherwise.
261 	 */
262 	public int isMediaRemovable();
263 	
264 	/**
265 	 * Warning
266 	 * g_drive_eject has been deprecated since version 2.22 and should not be used in newly-written code. Use g_drive_eject_with_operation() instead.
267 	 * Asynchronously ejects a drive.
268 	 * When the operation is finished, callback will be called.
269 	 * You can then call g_drive_eject_finish() to obtain the
270 	 * result of the operation.
271 	 * Params:
272 	 * flags = flags affecting the unmount if required for eject
273 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
274 	 * callback = a GAsyncReadyCallback, or NULL. [allow-none]
275 	 * userData = user data to pass to callback
276 	 */
277 	public void eject(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
278 	
279 	/**
280 	 * Warning
281 	 * g_drive_eject_finish has been deprecated since version 2.22 and should not be used in newly-written code. Use g_drive_eject_with_operation_finish() instead.
282 	 * Finishes ejecting a drive.
283 	 * Params:
284 	 * result = a GAsyncResult.
285 	 * Returns: TRUE if the drive has been ejected successfully, FALSE otherwise.
286 	 * Throws: GException on failure.
287 	 */
288 	public int ejectFinish(AsyncResultIF result);
289 	
290 	/**
291 	 * Ejects a drive. This is an asynchronous operation, and is
292 	 * finished by calling g_drive_eject_with_operation_finish() with the drive
293 	 * and GAsyncResult data returned in the callback.
294 	 * Since 2.22
295 	 * Params:
296 	 * flags = flags affecting the unmount if required for eject
297 	 * mountOperation = a GMountOperation or NULL to avoid
298 	 * user interaction. [allow-none]
299 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
300 	 * callback = a GAsyncReadyCallback, or NULL. [allow-none]
301 	 * userData = user data passed to callback.
302 	 */
303 	public void ejectWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
304 	
305 	/**
306 	 * Finishes ejecting a drive. If any errors occurred during the operation,
307 	 * error will be set to contain the errors and FALSE will be returned.
308 	 * Since 2.22
309 	 * Params:
310 	 * result = a GAsyncResult.
311 	 * Returns: TRUE if the drive was successfully ejected. FALSE otherwise.
312 	 * Throws: GException on failure.
313 	 */
314 	public int ejectWithOperationFinish(AsyncResultIF result);
315 	
316 	/**
317 	 * Asynchronously starts a drive.
318 	 * When the operation is finished, callback will be called.
319 	 * You can then call g_drive_start_finish() to obtain the
320 	 * result of the operation.
321 	 * Since 2.22
322 	 * Params:
323 	 * flags = flags affecting the start operation.
324 	 * mountOperation = a GMountOperation or NULL to avoid
325 	 * user interaction. [allow-none]
326 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
327 	 * callback = a GAsyncReadyCallback, or NULL. [allow-none]
328 	 * userData = user data to pass to callback
329 	 */
330 	public void start(GDriveStartFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
331 	
332 	/**
333 	 * Finishes starting a drive.
334 	 * Since 2.22
335 	 * Params:
336 	 * result = a GAsyncResult.
337 	 * Returns: TRUE if the drive has been started successfully, FALSE otherwise.
338 	 * Throws: GException on failure.
339 	 */
340 	public int startFinish(AsyncResultIF result);
341 	
342 	/**
343 	 * Asynchronously stops a drive.
344 	 * When the operation is finished, callback will be called.
345 	 * You can then call g_drive_stop_finish() to obtain the
346 	 * result of the operation.
347 	 * Since 2.22
348 	 * Params:
349 	 * flags = flags affecting the unmount if required for stopping.
350 	 * mountOperation = a GMountOperation or NULL to avoid
351 	 * user interaction. [allow-none]
352 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
353 	 * callback = a GAsyncReadyCallback, or NULL. [allow-none]
354 	 * userData = user data to pass to callback
355 	 */
356 	public void stop(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
357 	
358 	/**
359 	 * Finishes stopping a drive.
360 	 * Since 2.22
361 	 * Params:
362 	 * result = a GAsyncResult.
363 	 * Returns: TRUE if the drive has been stopped successfully, FALSE otherwise.
364 	 * Throws: GException on failure.
365 	 */
366 	public int stopFinish(AsyncResultIF result);
367 	
368 	/**
369 	 * Gets the kinds of identifiers that drive has.
370 	 * Use g_drive_get_identifer() to obtain the identifiers
371 	 * themselves.
372 	 * Returns: a NULL-terminated array of strings containing kinds of identifiers. Use g_strfreev() to free. [transfer full][array zero-terminated=1]
373 	 */
374 	public string[] enumerateIdentifiers();
375 	
376 	/**
377 	 * Gets the identifier of the given kind for drive.
378 	 * Params:
379 	 * kind = the kind of identifier to return
380 	 * Returns: a newly allocated string containing the requested identfier, or NULL if the GDrive doesn't have this kind of identifier. Signal Details The "changed" signal void user_function (GDrive *drive, gpointer user_data) : Run Last Emitted when the drive's state has changed.
381 	 */
382 	public string getIdentifier(string kind);
383 }