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