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