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  * GDrive - this represent a piece of hardware connected to the machine.
94  * It's generally only created for removable hardware or hardware with
95  * removable media.
96  *
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, determining whether media change is
101  * automatically detected and ejecting the media.
102  *
103  * If the GDrive reports that media isn't automatically detected, one
104  * can poll for media; typically one should not do this periodically
105  * as a poll for media operation is potententially expensive and may
106  * spin up the drive creating noise.
107  *
108  * GDrive supports starting and stopping drives with authentication
109  * support for the former. This can be used to support a diverse set
110  * of use cases including connecting/disconnecting iSCSI devices,
111  * powering down external disk enclosures and starting/stopping
112  * multi-disk devices such as RAID devices. Note that the actual
113  * semantics and side-effects of starting/stopping a GDrive may vary
114  * according to implementation. To choose the correct verbs in e.g. a
115  * file manager, use g_drive_get_start_stop_type().
116  *
117  * For porting from GnomeVFS note that there is no equivalent of
118  * GDrive in that API.
119  */
120 public interface DriveIF
121 {
122 	
123 	
124 	public GDrive* getDriveTStruct();
125 	
126 	/** the main Gtk struct as a void* */
127 	protected void* getStruct();
128 	
129 	
130 	/**
131 	 */
132 	
133 	void delegate(DriveIF)[] onChangedListeners();
134 	/**
135 	 * Emitted when the drive's state has changed.
136 	 */
137 	void addOnChanged(void delegate(DriveIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
138 	void delegate(DriveIF)[] onDisconnectedListeners();
139 	/**
140 	 * This signal is emitted when the GDrive have been
141 	 * disconnected. If the recipient is holding references to the
142 	 * object they should release them so the object can be
143 	 * finalized.
144 	 */
145 	void addOnDisconnected(void delegate(DriveIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
146 	void delegate(DriveIF)[] onEjectButtonListeners();
147 	/**
148 	 * Emitted when the physical eject button (if any) of a drive has
149 	 * been pressed.
150 	 */
151 	void addOnEjectButton(void delegate(DriveIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
152 	void delegate(DriveIF)[] onStopButtonListeners();
153 	/**
154 	 * Emitted when the physical stop button (if any) of a drive has
155 	 * been pressed.
156 	 * Since 2.22
157 	 */
158 	void addOnStopButton(void delegate(DriveIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
159 	
160 	/**
161 	 * Gets the name of drive.
162 	 * Returns: a string containing drive's name. The returned string should be freed when no longer needed.
163 	 */
164 	public string getName();
165 	
166 	/**
167 	 * Gets the icon for drive.
168 	 * Returns: GIcon for the drive. Free the returned object with g_object_unref(). [transfer full]
169 	 */
170 	public IconIF getIcon();
171 	
172 	/**
173 	 * Gets the icon for drive.
174 	 * Since 2.34
175 	 * Returns: symbolic GIcon for the drive. Free the returned object with g_object_unref(). [transfer full]
176 	 */
177 	public IconIF getSymbolicIcon();
178 	
179 	/**
180 	 * Check if drive has any mountable volumes.
181 	 * Returns: TRUE if the drive contains volumes, FALSE otherwise.
182 	 */
183 	public int hasVolumes();
184 	
185 	/**
186 	 * Get a list of mountable volumes for drive.
187 	 * The returned list should be freed with g_list_free(), after
188 	 * its elements have been unreffed with g_object_unref().
189 	 * Returns: GList containing any GVolume objects on the given drive. [element-type GVolume][transfer full]
190 	 */
191 	public ListG getVolumes();
192 	
193 	/**
194 	 * Checks if a drive can be ejected.
195 	 * Returns: TRUE if the drive can be ejected, FALSE otherwise.
196 	 */
197 	public int canEject();
198 	
199 	/**
200 	 * Gets a hint about how a drive can be started/stopped.
201 	 * Since 2.22
202 	 * Returns: A value from the GDriveStartStopType enumeration.
203 	 */
204 	public GDriveStartStopType getStartStopType();
205 	
206 	/**
207 	 * Checks if a drive can be started.
208 	 * Since 2.22
209 	 * Returns: TRUE if the drive can be started, FALSE otherwise.
210 	 */
211 	public int canStart();
212 	
213 	/**
214 	 * Checks if a drive can be started degraded.
215 	 * Since 2.22
216 	 * Returns: TRUE if the drive can be started degraded, FALSE otherwise.
217 	 */
218 	public int canStartDegraded();
219 	
220 	/**
221 	 * Checks if a drive can be stopped.
222 	 * Since 2.22
223 	 * Returns: TRUE if the drive can be stopped, FALSE otherwise.
224 	 */
225 	public int canStop();
226 	
227 	/**
228 	 * Checks if a drive can be polled for media changes.
229 	 * Returns: TRUE if the drive can be polled for media changes, FALSE otherwise.
230 	 */
231 	public int canPollForMedia();
232 	
233 	/**
234 	 * Asynchronously polls drive to see if media has been inserted or removed.
235 	 * When the operation is finished, callback will be called.
236 	 * You can then call g_drive_poll_for_media_finish() to obtain the
237 	 * result of the operation.
238 	 * Params:
239 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
240 	 * callback = a GAsyncReadyCallback, or NULL. [allow-none]
241 	 * userData = user data to pass to callback
242 	 */
243 	public void pollForMedia(Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
244 	
245 	/**
246 	 * Finishes an operation started with g_drive_poll_for_media() on a drive.
247 	 * Params:
248 	 * result = a GAsyncResult.
249 	 * Returns: TRUE if the drive has been poll_for_mediaed successfully, FALSE otherwise.
250 	 * Throws: GException on failure.
251 	 */
252 	public int pollForMediaFinish(AsyncResultIF result);
253 	
254 	/**
255 	 * Checks if the drive has media. Note that the OS may not be polling
256 	 * the drive for media changes; see g_drive_is_media_check_automatic()
257 	 * for more details.
258 	 * Returns: TRUE if drive has media, FALSE otherwise.
259 	 */
260 	public int hasMedia();
261 	
262 	/**
263 	 * Checks if drive is capabable of automatically detecting media changes.
264 	 * Returns: TRUE if the drive is capabable of automatically detecting media changes, FALSE otherwise.
265 	 */
266 	public int isMediaCheckAutomatic();
267 	
268 	/**
269 	 * Checks if the drive supports removable media.
270 	 * Returns: TRUE if drive supports removable media, FALSE otherwise.
271 	 */
272 	public int isMediaRemovable();
273 	
274 	/**
275 	 * Warning
276 	 * 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.
277 	 * Asynchronously ejects a drive.
278 	 * When the operation is finished, callback will be called.
279 	 * You can then call g_drive_eject_finish() to obtain the
280 	 * result of the operation.
281 	 * Params:
282 	 * flags = flags affecting the unmount if required for eject
283 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
284 	 * callback = a GAsyncReadyCallback, or NULL. [allow-none]
285 	 * userData = user data to pass to callback
286 	 */
287 	public void eject(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
288 	
289 	/**
290 	 * Warning
291 	 * 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.
292 	 * Finishes ejecting a drive.
293 	 * Params:
294 	 * result = a GAsyncResult.
295 	 * Returns: TRUE if the drive has been ejected successfully, FALSE otherwise.
296 	 * Throws: GException on failure.
297 	 */
298 	public int ejectFinish(AsyncResultIF result);
299 	
300 	/**
301 	 * Ejects a drive. This is an asynchronous operation, and is
302 	 * finished by calling g_drive_eject_with_operation_finish() with the drive
303 	 * and GAsyncResult data returned in the callback.
304 	 * Since 2.22
305 	 * Params:
306 	 * flags = flags affecting the unmount if required for eject
307 	 * mountOperation = a GMountOperation or NULL to avoid
308 	 * user interaction. [allow-none]
309 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
310 	 * callback = a GAsyncReadyCallback, or NULL. [allow-none]
311 	 * userData = user data passed to callback.
312 	 */
313 	public void ejectWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
314 	
315 	/**
316 	 * Finishes ejecting a drive. If any errors occurred during the operation,
317 	 * error will be set to contain the errors and FALSE will be returned.
318 	 * Since 2.22
319 	 * Params:
320 	 * result = a GAsyncResult.
321 	 * Returns: TRUE if the drive was successfully ejected. FALSE otherwise.
322 	 * Throws: GException on failure.
323 	 */
324 	public int ejectWithOperationFinish(AsyncResultIF result);
325 	
326 	/**
327 	 * Asynchronously starts a drive.
328 	 * When the operation is finished, callback will be called.
329 	 * You can then call g_drive_start_finish() to obtain the
330 	 * result of the operation.
331 	 * Since 2.22
332 	 * Params:
333 	 * flags = flags affecting the start operation.
334 	 * mountOperation = a GMountOperation or NULL to avoid
335 	 * user interaction. [allow-none]
336 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
337 	 * callback = a GAsyncReadyCallback, or NULL. [allow-none]
338 	 * userData = user data to pass to callback
339 	 */
340 	public void start(GDriveStartFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
341 	
342 	/**
343 	 * Finishes starting a drive.
344 	 * Since 2.22
345 	 * Params:
346 	 * result = a GAsyncResult.
347 	 * Returns: TRUE if the drive has been started successfully, FALSE otherwise.
348 	 * Throws: GException on failure.
349 	 */
350 	public int startFinish(AsyncResultIF result);
351 	
352 	/**
353 	 * Asynchronously stops a drive.
354 	 * When the operation is finished, callback will be called.
355 	 * You can then call g_drive_stop_finish() to obtain the
356 	 * result of the operation.
357 	 * Since 2.22
358 	 * Params:
359 	 * flags = flags affecting the unmount if required for stopping.
360 	 * mountOperation = a GMountOperation or NULL to avoid
361 	 * user interaction. [allow-none]
362 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
363 	 * callback = a GAsyncReadyCallback, or NULL. [allow-none]
364 	 * userData = user data to pass to callback
365 	 */
366 	public void stop(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
367 	
368 	/**
369 	 * Finishes stopping a drive.
370 	 * Since 2.22
371 	 * Params:
372 	 * result = a GAsyncResult.
373 	 * Returns: TRUE if the drive has been stopped successfully, FALSE otherwise.
374 	 * Throws: GException on failure.
375 	 */
376 	public int stopFinish(AsyncResultIF result);
377 	
378 	/**
379 	 * Gets the kinds of identifiers that drive has.
380 	 * Use g_drive_get_identifier() to obtain the identifiers
381 	 * themselves.
382 	 * Returns: a NULL-terminated array of strings containing kinds of identifiers. Use g_strfreev() to free. [transfer full][array zero-terminated=1]
383 	 */
384 	public string[] enumerateIdentifiers();
385 	
386 	/**
387 	 * Gets the identifier of the given kind for drive.
388 	 * Params:
389 	 * kind = the kind of identifier to return
390 	 * Returns: a newly allocated string containing the requested identfier, or NULL if the GDrive doesn't have this kind of identifier.
391 	 */
392 	public string getIdentifier(string kind);
393 	
394 	/**
395 	 * Gets the sort key for drive, if any.
396 	 * Since 2.32
397 	 * Signal Details
398 	 * The "changed" signal
399 	 * void user_function (GDrive *drive,
400 	 *  gpointer user_data) : Run Last
401 	 * Emitted when the drive's state has changed.
402 	 * Returns: Sorting key for drive or NULL if no such key is available.
403 	 */
404 	public string getSortKey();
405 }