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