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