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.MountIF;
26 
27 private import gio.AsyncResultIF;
28 private import gio.Cancellable;
29 private import gio.DriveIF;
30 private import gio.FileIF;
31 private import gio.IconIF;
32 private import gio.MountOperation;
33 private import gio.VolumeIF;
34 private import gio.c.functions;
35 public  import gio.c.types;
36 private import glib.ErrorG;
37 private import glib.GException;
38 private import glib.Str;
39 private import gobject.ObjectG;
40 private import gobject.Signals;
41 public  import gtkc.giotypes;
42 private import std.algorithm;
43 
44 
45 /**
46  * The #GMount interface represents user-visible mounts. Note, when
47  * porting from GnomeVFS, #GMount is the moral equivalent of #GnomeVFSVolume.
48  * 
49  * #GMount is a "mounted" filesystem that you can access. Mounted is in
50  * quotes because it's not the same as a unix mount, it might be a gvfs
51  * mount, but you can still access the files on it if you use GIO. Might or
52  * might not be related to a volume object.
53  * 
54  * Unmounting a #GMount instance is an asynchronous operation. For
55  * more information about asynchronous operations, see #GAsyncResult
56  * and #GTask. To unmount a #GMount instance, first call
57  * g_mount_unmount_with_operation() with (at least) the #GMount instance and a
58  * #GAsyncReadyCallback.  The callback will be fired when the
59  * operation has resolved (either with success or failure), and a
60  * #GAsyncResult structure will be passed to the callback.  That
61  * callback should then call g_mount_unmount_with_operation_finish() with the #GMount
62  * and the #GAsyncResult data to see if the operation was completed
63  * successfully.  If an @error is present when g_mount_unmount_with_operation_finish()
64  * is called, then it will be filled with any error information.
65  */
66 public interface MountIF{
67 	/** Get the main Gtk struct */
68 	public GMount* getMountStruct(bool transferOwnership = false);
69 
70 	/** the main Gtk struct as a void* */
71 	protected void* getStruct();
72 
73 
74 	/** */
75 	public static GType getType()
76 	{
77 		return g_mount_get_type();
78 	}
79 
80 	/**
81 	 * Checks if @mount can be ejected.
82 	 *
83 	 * Returns: %TRUE if the @mount can be ejected.
84 	 */
85 	public bool canEject();
86 
87 	/**
88 	 * Checks if @mount can be unmounted.
89 	 *
90 	 * Returns: %TRUE if the @mount can be unmounted.
91 	 */
92 	public bool canUnmount();
93 
94 	/**
95 	 * Ejects a mount. This is an asynchronous operation, and is
96 	 * finished by calling g_mount_eject_finish() with the @mount
97 	 * and #GAsyncResult data returned in the @callback.
98 	 *
99 	 * Deprecated: Use g_mount_eject_with_operation() instead.
100 	 *
101 	 * Params:
102 	 *     flags = flags affecting the unmount if required for eject
103 	 *     cancellable = optional #GCancellable object, %NULL to ignore.
104 	 *     callback = a #GAsyncReadyCallback, or %NULL.
105 	 *     userData = user data passed to @callback.
106 	 */
107 	public void eject(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
108 
109 	/**
110 	 * Finishes ejecting a mount. If any errors occurred during the operation,
111 	 * @error will be set to contain the errors and %FALSE will be returned.
112 	 *
113 	 * Deprecated: Use g_mount_eject_with_operation_finish() instead.
114 	 *
115 	 * Params:
116 	 *     result = a #GAsyncResult.
117 	 *
118 	 * Returns: %TRUE if the mount was successfully ejected. %FALSE otherwise.
119 	 *
120 	 * Throws: GException on failure.
121 	 */
122 	public bool ejectFinish(AsyncResultIF result);
123 
124 	/**
125 	 * Ejects a mount. This is an asynchronous operation, and is
126 	 * finished by calling g_mount_eject_with_operation_finish() with the @mount
127 	 * and #GAsyncResult data returned in the @callback.
128 	 *
129 	 * Params:
130 	 *     flags = flags affecting the unmount if required for eject
131 	 *     mountOperation = a #GMountOperation or %NULL to avoid
132 	 *         user interaction.
133 	 *     cancellable = optional #GCancellable object, %NULL to ignore.
134 	 *     callback = a #GAsyncReadyCallback, or %NULL.
135 	 *     userData = user data passed to @callback.
136 	 *
137 	 * Since: 2.22
138 	 */
139 	public void ejectWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
140 
141 	/**
142 	 * Finishes ejecting a mount. If any errors occurred during the operation,
143 	 * @error will be set to contain the errors and %FALSE will be returned.
144 	 *
145 	 * Params:
146 	 *     result = a #GAsyncResult.
147 	 *
148 	 * Returns: %TRUE if the mount was successfully ejected. %FALSE otherwise.
149 	 *
150 	 * Since: 2.22
151 	 *
152 	 * Throws: GException on failure.
153 	 */
154 	public bool ejectWithOperationFinish(AsyncResultIF result);
155 
156 	/**
157 	 * Gets the default location of @mount. The default location of the given
158 	 * @mount is a path that reflects the main entry point for the user (e.g.
159 	 * the home directory, or the root of the volume).
160 	 *
161 	 * Returns: a #GFile.
162 	 *     The returned object should be unreffed with
163 	 *     g_object_unref() when no longer needed.
164 	 */
165 	public FileIF getDefaultLocation();
166 
167 	/**
168 	 * Gets the drive for the @mount.
169 	 *
170 	 * This is a convenience method for getting the #GVolume and then
171 	 * using that object to get the #GDrive.
172 	 *
173 	 * Returns: a #GDrive or %NULL if @mount is not
174 	 *     associated with a volume or a drive.
175 	 *     The returned object should be unreffed with
176 	 *     g_object_unref() when no longer needed.
177 	 */
178 	public DriveIF getDrive();
179 
180 	/**
181 	 * Gets the icon for @mount.
182 	 *
183 	 * Returns: a #GIcon.
184 	 *     The returned object should be unreffed with
185 	 *     g_object_unref() when no longer needed.
186 	 */
187 	public IconIF getIcon();
188 
189 	/**
190 	 * Gets the name of @mount.
191 	 *
192 	 * Returns: the name for the given @mount.
193 	 *     The returned string should be freed with g_free()
194 	 *     when no longer needed.
195 	 */
196 	public string getName();
197 
198 	/**
199 	 * Gets the root directory on @mount.
200 	 *
201 	 * Returns: a #GFile.
202 	 *     The returned object should be unreffed with
203 	 *     g_object_unref() when no longer needed.
204 	 */
205 	public FileIF getRoot();
206 
207 	/**
208 	 * Gets the sort key for @mount, if any.
209 	 *
210 	 * Returns: Sorting key for @mount or %NULL if no such key is available.
211 	 *
212 	 * Since: 2.32
213 	 */
214 	public string getSortKey();
215 
216 	/**
217 	 * Gets the symbolic icon for @mount.
218 	 *
219 	 * Returns: a #GIcon.
220 	 *     The returned object should be unreffed with
221 	 *     g_object_unref() when no longer needed.
222 	 *
223 	 * Since: 2.34
224 	 */
225 	public IconIF getSymbolicIcon();
226 
227 	/**
228 	 * Gets the UUID for the @mount. The reference is typically based on
229 	 * the file system UUID for the mount in question and should be
230 	 * considered an opaque string. Returns %NULL if there is no UUID
231 	 * available.
232 	 *
233 	 * Returns: the UUID for @mount or %NULL if no UUID
234 	 *     can be computed.
235 	 *     The returned string should be freed with g_free()
236 	 *     when no longer needed.
237 	 */
238 	public string getUuid();
239 
240 	/**
241 	 * Gets the volume for the @mount.
242 	 *
243 	 * Returns: a #GVolume or %NULL if @mount is not
244 	 *     associated with a volume.
245 	 *     The returned object should be unreffed with
246 	 *     g_object_unref() when no longer needed.
247 	 */
248 	public VolumeIF getVolume();
249 
250 	/**
251 	 * Tries to guess the type of content stored on @mount. Returns one or
252 	 * more textual identifiers of well-known content types (typically
253 	 * prefixed with "x-content/"), e.g. x-content/image-dcf for camera
254 	 * memory cards. See the
255 	 * [shared-mime-info](http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec)
256 	 * specification for more on x-content types.
257 	 *
258 	 * This is an asynchronous operation (see
259 	 * g_mount_guess_content_type_sync() for the synchronous version), and
260 	 * is finished by calling g_mount_guess_content_type_finish() with the
261 	 * @mount and #GAsyncResult data returned in the @callback.
262 	 *
263 	 * Params:
264 	 *     forceRescan = Whether to force a rescan of the content.
265 	 *         Otherwise a cached result will be used if available
266 	 *     cancellable = optional #GCancellable object, %NULL to ignore
267 	 *     callback = a #GAsyncReadyCallback
268 	 *     userData = user data passed to @callback
269 	 *
270 	 * Since: 2.18
271 	 */
272 	public void guessContentType(bool forceRescan, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
273 
274 	/**
275 	 * Finishes guessing content types of @mount. If any errors occurred
276 	 * during the operation, @error will be set to contain the errors and
277 	 * %FALSE will be returned. In particular, you may get an
278 	 * %G_IO_ERROR_NOT_SUPPORTED if the mount does not support content
279 	 * guessing.
280 	 *
281 	 * Params:
282 	 *     result = a #GAsyncResult
283 	 *
284 	 * Returns: a %NULL-terminated array of content types or %NULL on error.
285 	 *     Caller should free this array with g_strfreev() when done with it.
286 	 *
287 	 * Since: 2.18
288 	 *
289 	 * Throws: GException on failure.
290 	 */
291 	public string[] guessContentTypeFinish(AsyncResultIF result);
292 
293 	/**
294 	 * Tries to guess the type of content stored on @mount. Returns one or
295 	 * more textual identifiers of well-known content types (typically
296 	 * prefixed with "x-content/"), e.g. x-content/image-dcf for camera
297 	 * memory cards. See the
298 	 * [shared-mime-info](http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec)
299 	 * specification for more on x-content types.
300 	 *
301 	 * This is a synchronous operation and as such may block doing IO;
302 	 * see g_mount_guess_content_type() for the asynchronous version.
303 	 *
304 	 * Params:
305 	 *     forceRescan = Whether to force a rescan of the content.
306 	 *         Otherwise a cached result will be used if available
307 	 *     cancellable = optional #GCancellable object, %NULL to ignore
308 	 *
309 	 * Returns: a %NULL-terminated array of content types or %NULL on error.
310 	 *     Caller should free this array with g_strfreev() when done with it.
311 	 *
312 	 * Since: 2.18
313 	 *
314 	 * Throws: GException on failure.
315 	 */
316 	public string[] guessContentTypeSync(bool forceRescan, Cancellable cancellable);
317 
318 	/**
319 	 * Determines if @mount is shadowed. Applications or libraries should
320 	 * avoid displaying @mount in the user interface if it is shadowed.
321 	 *
322 	 * A mount is said to be shadowed if there exists one or more user
323 	 * visible objects (currently #GMount objects) with a root that is
324 	 * inside the root of @mount.
325 	 *
326 	 * One application of shadow mounts is when exposing a single file
327 	 * system that is used to address several logical volumes. In this
328 	 * situation, a #GVolumeMonitor implementation would create two
329 	 * #GVolume objects (for example, one for the camera functionality of
330 	 * the device and one for a SD card reader on the device) with
331 	 * activation URIs `gphoto2://[usb:001,002]/store1/`
332 	 * and `gphoto2://[usb:001,002]/store2/`. When the
333 	 * underlying mount (with root
334 	 * `gphoto2://[usb:001,002]/`) is mounted, said
335 	 * #GVolumeMonitor implementation would create two #GMount objects
336 	 * (each with their root matching the corresponding volume activation
337 	 * root) that would shadow the original mount.
338 	 *
339 	 * The proxy monitor in GVfs 2.26 and later, automatically creates and
340 	 * manage shadow mounts (and shadows the underlying mount) if the
341 	 * activation root on a #GVolume is set.
342 	 *
343 	 * Returns: %TRUE if @mount is shadowed.
344 	 *
345 	 * Since: 2.20
346 	 */
347 	public bool isShadowed();
348 
349 	/**
350 	 * Remounts a mount. This is an asynchronous operation, and is
351 	 * finished by calling g_mount_remount_finish() with the @mount
352 	 * and #GAsyncResults data returned in the @callback.
353 	 *
354 	 * Remounting is useful when some setting affecting the operation
355 	 * of the volume has been changed, as these may need a remount to
356 	 * take affect. While this is semantically equivalent with unmounting
357 	 * and then remounting not all backends might need to actually be
358 	 * unmounted.
359 	 *
360 	 * Params:
361 	 *     flags = flags affecting the operation
362 	 *     mountOperation = a #GMountOperation or %NULL to avoid
363 	 *         user interaction.
364 	 *     cancellable = optional #GCancellable object, %NULL to ignore.
365 	 *     callback = a #GAsyncReadyCallback, or %NULL.
366 	 *     userData = user data passed to @callback.
367 	 */
368 	public void remount(GMountMountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
369 
370 	/**
371 	 * Finishes remounting a mount. If any errors occurred during the operation,
372 	 * @error will be set to contain the errors and %FALSE will be returned.
373 	 *
374 	 * Params:
375 	 *     result = a #GAsyncResult.
376 	 *
377 	 * Returns: %TRUE if the mount was successfully remounted. %FALSE otherwise.
378 	 *
379 	 * Throws: GException on failure.
380 	 */
381 	public bool remountFinish(AsyncResultIF result);
382 
383 	/**
384 	 * Increments the shadow count on @mount. Usually used by
385 	 * #GVolumeMonitor implementations when creating a shadow mount for
386 	 * @mount, see g_mount_is_shadowed() for more information. The caller
387 	 * will need to emit the #GMount::changed signal on @mount manually.
388 	 *
389 	 * Since: 2.20
390 	 */
391 	public void shadow();
392 
393 	/**
394 	 * Unmounts a mount. This is an asynchronous operation, and is
395 	 * finished by calling g_mount_unmount_finish() with the @mount
396 	 * and #GAsyncResult data returned in the @callback.
397 	 *
398 	 * Deprecated: Use g_mount_unmount_with_operation() instead.
399 	 *
400 	 * Params:
401 	 *     flags = flags affecting the operation
402 	 *     cancellable = optional #GCancellable object, %NULL to ignore.
403 	 *     callback = a #GAsyncReadyCallback, or %NULL.
404 	 *     userData = user data passed to @callback.
405 	 */
406 	public void unmount(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
407 
408 	/**
409 	 * Finishes unmounting a mount. If any errors occurred during the operation,
410 	 * @error will be set to contain the errors and %FALSE will be returned.
411 	 *
412 	 * Deprecated: Use g_mount_unmount_with_operation_finish() instead.
413 	 *
414 	 * Params:
415 	 *     result = a #GAsyncResult.
416 	 *
417 	 * Returns: %TRUE if the mount was successfully unmounted. %FALSE otherwise.
418 	 *
419 	 * Throws: GException on failure.
420 	 */
421 	public bool unmountFinish(AsyncResultIF result);
422 
423 	/**
424 	 * Unmounts a mount. This is an asynchronous operation, and is
425 	 * finished by calling g_mount_unmount_with_operation_finish() with the @mount
426 	 * and #GAsyncResult data returned in the @callback.
427 	 *
428 	 * Params:
429 	 *     flags = flags affecting the operation
430 	 *     mountOperation = a #GMountOperation or %NULL to avoid
431 	 *         user interaction.
432 	 *     cancellable = optional #GCancellable object, %NULL to ignore.
433 	 *     callback = a #GAsyncReadyCallback, or %NULL.
434 	 *     userData = user data passed to @callback.
435 	 *
436 	 * Since: 2.22
437 	 */
438 	public void unmountWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
439 
440 	/**
441 	 * Finishes unmounting a mount. If any errors occurred during the operation,
442 	 * @error will be set to contain the errors and %FALSE will be returned.
443 	 *
444 	 * Params:
445 	 *     result = a #GAsyncResult.
446 	 *
447 	 * Returns: %TRUE if the mount was successfully unmounted. %FALSE otherwise.
448 	 *
449 	 * Since: 2.22
450 	 *
451 	 * Throws: GException on failure.
452 	 */
453 	public bool unmountWithOperationFinish(AsyncResultIF result);
454 
455 	/**
456 	 * Decrements the shadow count on @mount. Usually used by
457 	 * #GVolumeMonitor implementations when destroying a shadow mount for
458 	 * @mount, see g_mount_is_shadowed() for more information. The caller
459 	 * will need to emit the #GMount::changed signal on @mount manually.
460 	 *
461 	 * Since: 2.20
462 	 */
463 	public void unshadow();
464 
465 	/**
466 	 * Emitted when the mount has been changed.
467 	 */
468 	gulong addOnChanged(void delegate(MountIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
469 
470 	/**
471 	 * This signal may be emitted when the #GMount is about to be
472 	 * unmounted.
473 	 *
474 	 * This signal depends on the backend and is only emitted if
475 	 * GIO was used to unmount.
476 	 *
477 	 * Since: 2.22
478 	 */
479 	gulong addOnPreUnmount(void delegate(MountIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
480 
481 	/**
482 	 * This signal is emitted when the #GMount have been
483 	 * unmounted. If the recipient is holding references to the
484 	 * object they should release them so the object can be
485 	 * finalized.
486 	 */
487 	gulong addOnUnmounted(void delegate(MountIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
488 }