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 associated with a volume or a drive.
174 	 *     The returned object should be unreffed with
175 	 *     g_object_unref() when no longer needed.
176 	 */
177 	public DriveIF getDrive();
178 
179 	/**
180 	 * Gets the icon for @mount.
181 	 *
182 	 * Returns: a #GIcon.
183 	 *     The returned object should be unreffed with
184 	 *     g_object_unref() when no longer needed.
185 	 */
186 	public IconIF getIcon();
187 
188 	/**
189 	 * Gets the name of @mount.
190 	 *
191 	 * Returns: the name for the given @mount.
192 	 *     The returned string should be freed with g_free()
193 	 *     when no longer needed.
194 	 */
195 	public string getName();
196 
197 	/**
198 	 * Gets the root directory on @mount.
199 	 *
200 	 * Returns: a #GFile.
201 	 *     The returned object should be unreffed with
202 	 *     g_object_unref() when no longer needed.
203 	 */
204 	public FileIF getRoot();
205 
206 	/**
207 	 * Gets the sort key for @mount, if any.
208 	 *
209 	 * Returns: Sorting key for @mount or %NULL if no such key is available.
210 	 *
211 	 * Since: 2.32
212 	 */
213 	public string getSortKey();
214 
215 	/**
216 	 * Gets the symbolic icon for @mount.
217 	 *
218 	 * Returns: a #GIcon.
219 	 *     The returned object should be unreffed with
220 	 *     g_object_unref() when no longer needed.
221 	 *
222 	 * Since: 2.34
223 	 */
224 	public IconIF getSymbolicIcon();
225 
226 	/**
227 	 * Gets the UUID for the @mount. The reference is typically based on
228 	 * the file system UUID for the mount in question and should be
229 	 * considered an opaque string. Returns %NULL if there is no UUID
230 	 * available.
231 	 *
232 	 * Returns: the UUID for @mount or %NULL if no UUID can be computed.
233 	 *     The returned string should be freed with g_free()
234 	 *     when no longer needed.
235 	 */
236 	public string getUuid();
237 
238 	/**
239 	 * Gets the volume for the @mount.
240 	 *
241 	 * Returns: a #GVolume or %NULL if @mount is not associated with a volume.
242 	 *     The returned object should be unreffed with
243 	 *     g_object_unref() when no longer needed.
244 	 */
245 	public VolumeIF getVolume();
246 
247 	/**
248 	 * Tries to guess the type of content stored on @mount. Returns one or
249 	 * more textual identifiers of well-known content types (typically
250 	 * prefixed with "x-content/"), e.g. x-content/image-dcf for camera
251 	 * memory cards. See the
252 	 * [shared-mime-info](http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec)
253 	 * specification for more on x-content types.
254 	 *
255 	 * This is an asynchronous operation (see
256 	 * g_mount_guess_content_type_sync() for the synchronous version), and
257 	 * is finished by calling g_mount_guess_content_type_finish() with the
258 	 * @mount and #GAsyncResult data returned in the @callback.
259 	 *
260 	 * Params:
261 	 *     forceRescan = Whether to force a rescan of the content.
262 	 *         Otherwise a cached result will be used if available
263 	 *     cancellable = optional #GCancellable object, %NULL to ignore
264 	 *     callback = a #GAsyncReadyCallback
265 	 *     userData = user data passed to @callback
266 	 *
267 	 * Since: 2.18
268 	 */
269 	public void guessContentType(bool forceRescan, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
270 
271 	/**
272 	 * Finishes guessing content types of @mount. If any errors occurred
273 	 * during the operation, @error will be set to contain the errors and
274 	 * %FALSE will be returned. In particular, you may get an
275 	 * %G_IO_ERROR_NOT_SUPPORTED if the mount does not support content
276 	 * guessing.
277 	 *
278 	 * Params:
279 	 *     result = a #GAsyncResult
280 	 *
281 	 * Returns: a %NULL-terminated array of content types or %NULL on error.
282 	 *     Caller should free this array with g_strfreev() when done with it.
283 	 *
284 	 * Since: 2.18
285 	 *
286 	 * Throws: GException on failure.
287 	 */
288 	public string[] guessContentTypeFinish(AsyncResultIF result);
289 
290 	/**
291 	 * Tries to guess the type of content stored on @mount. Returns one or
292 	 * more textual identifiers of well-known content types (typically
293 	 * prefixed with "x-content/"), e.g. x-content/image-dcf for camera
294 	 * memory cards. See the
295 	 * [shared-mime-info](http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec)
296 	 * specification for more on x-content types.
297 	 *
298 	 * This is an synchronous operation and as such may block doing IO;
299 	 * see g_mount_guess_content_type() for the asynchronous version.
300 	 *
301 	 * Params:
302 	 *     forceRescan = Whether to force a rescan of the content.
303 	 *         Otherwise a cached result will be used if available
304 	 *     cancellable = optional #GCancellable object, %NULL to ignore
305 	 *
306 	 * Returns: a %NULL-terminated array of content types or %NULL on error.
307 	 *     Caller should free this array with g_strfreev() when done with it.
308 	 *
309 	 * Since: 2.18
310 	 *
311 	 * Throws: GException on failure.
312 	 */
313 	public string[] guessContentTypeSync(bool forceRescan, Cancellable cancellable);
314 
315 	/**
316 	 * Determines if @mount is shadowed. Applications or libraries should
317 	 * avoid displaying @mount in the user interface if it is shadowed.
318 	 *
319 	 * A mount is said to be shadowed if there exists one or more user
320 	 * visible objects (currently #GMount objects) with a root that is
321 	 * inside the root of @mount.
322 	 *
323 	 * One application of shadow mounts is when exposing a single file
324 	 * system that is used to address several logical volumes. In this
325 	 * situation, a #GVolumeMonitor implementation would create two
326 	 * #GVolume objects (for example, one for the camera functionality of
327 	 * the device and one for a SD card reader on the device) with
328 	 * activation URIs `gphoto2://[usb:001,002]/store1/`
329 	 * and `gphoto2://[usb:001,002]/store2/`. When the
330 	 * underlying mount (with root
331 	 * `gphoto2://[usb:001,002]/`) is mounted, said
332 	 * #GVolumeMonitor implementation would create two #GMount objects
333 	 * (each with their root matching the corresponding volume activation
334 	 * root) that would shadow the original mount.
335 	 *
336 	 * The proxy monitor in GVfs 2.26 and later, automatically creates and
337 	 * manage shadow mounts (and shadows the underlying mount) if the
338 	 * activation root on a #GVolume is set.
339 	 *
340 	 * Returns: %TRUE if @mount is shadowed.
341 	 *
342 	 * Since: 2.20
343 	 */
344 	public bool isShadowed();
345 
346 	/**
347 	 * Remounts a mount. This is an asynchronous operation, and is
348 	 * finished by calling g_mount_remount_finish() with the @mount
349 	 * and #GAsyncResults data returned in the @callback.
350 	 *
351 	 * Remounting is useful when some setting affecting the operation
352 	 * of the volume has been changed, as these may need a remount to
353 	 * take affect. While this is semantically equivalent with unmounting
354 	 * and then remounting not all backends might need to actually be
355 	 * unmounted.
356 	 *
357 	 * Params:
358 	 *     flags = flags affecting the operation
359 	 *     mountOperation = a #GMountOperation or %NULL to avoid
360 	 *         user interaction.
361 	 *     cancellable = optional #GCancellable object, %NULL to ignore.
362 	 *     callback = a #GAsyncReadyCallback, or %NULL.
363 	 *     userData = user data passed to @callback.
364 	 */
365 	public void remount(GMountMountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
366 
367 	/**
368 	 * Finishes remounting a mount. If any errors occurred during the operation,
369 	 * @error will be set to contain the errors and %FALSE will be returned.
370 	 *
371 	 * Params:
372 	 *     result = a #GAsyncResult.
373 	 *
374 	 * Returns: %TRUE if the mount was successfully remounted. %FALSE otherwise.
375 	 *
376 	 * Throws: GException on failure.
377 	 */
378 	public bool remountFinish(AsyncResultIF result);
379 
380 	/**
381 	 * Increments the shadow count on @mount. Usually used by
382 	 * #GVolumeMonitor implementations when creating a shadow mount for
383 	 * @mount, see g_mount_is_shadowed() for more information. The caller
384 	 * will need to emit the #GMount::changed signal on @mount manually.
385 	 *
386 	 * Since: 2.20
387 	 */
388 	public void shadow();
389 
390 	/**
391 	 * Unmounts a mount. This is an asynchronous operation, and is
392 	 * finished by calling g_mount_unmount_finish() with the @mount
393 	 * and #GAsyncResult data returned in the @callback.
394 	 *
395 	 * Deprecated: Use g_mount_unmount_with_operation() instead.
396 	 *
397 	 * Params:
398 	 *     flags = flags affecting the operation
399 	 *     cancellable = optional #GCancellable object, %NULL to ignore.
400 	 *     callback = a #GAsyncReadyCallback, or %NULL.
401 	 *     userData = user data passed to @callback.
402 	 */
403 	public void unmount(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
404 
405 	/**
406 	 * Finishes unmounting a mount. If any errors occurred during the operation,
407 	 * @error will be set to contain the errors and %FALSE will be returned.
408 	 *
409 	 * Deprecated: Use g_mount_unmount_with_operation_finish() instead.
410 	 *
411 	 * Params:
412 	 *     result = a #GAsyncResult.
413 	 *
414 	 * Returns: %TRUE if the mount was successfully unmounted. %FALSE otherwise.
415 	 *
416 	 * Throws: GException on failure.
417 	 */
418 	public bool unmountFinish(AsyncResultIF result);
419 
420 	/**
421 	 * Unmounts a mount. This is an asynchronous operation, and is
422 	 * finished by calling g_mount_unmount_with_operation_finish() with the @mount
423 	 * and #GAsyncResult data returned in the @callback.
424 	 *
425 	 * Params:
426 	 *     flags = flags affecting the operation
427 	 *     mountOperation = a #GMountOperation or %NULL to avoid
428 	 *         user interaction.
429 	 *     cancellable = optional #GCancellable object, %NULL to ignore.
430 	 *     callback = a #GAsyncReadyCallback, or %NULL.
431 	 *     userData = user data passed to @callback.
432 	 *
433 	 * Since: 2.22
434 	 */
435 	public void unmountWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
436 
437 	/**
438 	 * Finishes unmounting a mount. If any errors occurred during the operation,
439 	 * @error will be set to contain the errors and %FALSE will be returned.
440 	 *
441 	 * Params:
442 	 *     result = a #GAsyncResult.
443 	 *
444 	 * Returns: %TRUE if the mount was successfully unmounted. %FALSE otherwise.
445 	 *
446 	 * Since: 2.22
447 	 *
448 	 * Throws: GException on failure.
449 	 */
450 	public bool unmountWithOperationFinish(AsyncResultIF result);
451 
452 	/**
453 	 * Decrements the shadow count on @mount. Usually used by
454 	 * #GVolumeMonitor implementations when destroying a shadow mount for
455 	 * @mount, see g_mount_is_shadowed() for more information. The caller
456 	 * will need to emit the #GMount::changed signal on @mount manually.
457 	 *
458 	 * Since: 2.20
459 	 */
460 	public void unshadow();
461 
462 	/**
463 	 * Emitted when the mount has been changed.
464 	 */
465 	gulong addOnChanged(void delegate(MountIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
466 
467 	/**
468 	 * This signal may be emitted when the #GMount is about to be
469 	 * unmounted.
470 	 *
471 	 * This signal depends on the backend and is only emitted if
472 	 * GIO was used to unmount.
473 	 *
474 	 * Since: 2.22
475 	 */
476 	gulong addOnPreUnmount(void delegate(MountIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
477 
478 	/**
479 	 * This signal is emitted when the #GMount have been
480 	 * unmounted. If the recipient is holding references to the
481 	 * object they should release them so the object can be
482 	 * finalized.
483 	 */
484 	gulong addOnUnmounted(void delegate(MountIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
485 }