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