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