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