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 * Description 104 * The GMount interface represents user-visible mounts. Note, when 105 * porting from GnomeVFS, GMount is the moral equivalent of GnomeVFSVolume. 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 * Unmounting a GMount instance is an asynchronous operation. For 111 * more information about asynchronous operations, see GAsyncReady 112 * and GSimpleAsyncReady. To unmount a GMount instance, first call 113 * g_mount_unmount_with_operation() with (at least) the GMount instance and a 114 * GAsyncReadyCallback. The callback will be fired when the 115 * operation has resolved (either with success or failure), and a 116 * GAsyncReady structure will be passed to the callback. That 117 * callback should then call g_mount_unmount_with_operation_finish() with the GMount 118 * and the GAsyncReady data to see if the operation was completed 119 * successfully. If an error is present when g_mount_unmount_with_operation_finish() 120 * is called, then it will be filled with any error information. 121 */ 122 public interface MountIF 123 { 124 125 126 public GMount* getMountTStruct(); 127 128 /** the main Gtk struct as a void* */ 129 protected void* getStruct(); 130 131 132 /** 133 */ 134 135 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 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 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, GUnixMount 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 drive for the mount. 181 * This is a convenience method for getting the GVolume and then 182 * using that object to get the GDrive. 183 * 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] 184 */ 185 public DriveIF getDrive(); 186 187 /** 188 * Gets the root directory on mount. 189 * Returns: a GFile. The returned object should be unreffed with g_object_unref() when no longer needed. [transfer full] 190 */ 191 public File getRoot(); 192 193 /** 194 * Gets the volume for the mount. 195 * 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] 196 */ 197 public VolumeIF getVolume(); 198 199 /** 200 * Gets the default location of mount. The default location of the given 201 * mount is a path that reflects the main entry point for the user (e.g. 202 * the home directory, or the root of the volume). 203 * Returns: a GFile. The returned object should be unreffed with g_object_unref() when no longer needed. [transfer full] 204 */ 205 public File getDefaultLocation(); 206 207 /** 208 * Checks if mount can be mounted. 209 * Params: 210 * mount = a GMount. 211 * Returns: TRUE if the mount can be unmounted. 212 */ 213 public int canUnmount(); 214 215 /** 216 * Warning 217 * 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. 218 * Unmounts a mount. This is an asynchronous operation, and is 219 * finished by calling g_mount_unmount_finish() with the mount 220 * and GAsyncResult data returned in the callback. 221 * Params: 222 * mount = a GMount. 223 * flags = flags affecting the operation 224 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 225 * callback = a GAsyncReadyCallback, or NULL. [allow-none] 226 * userData = user data passed to callback. 227 */ 228 public void unmount(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 229 230 /** 231 * Warning 232 * 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. 233 * Finishes unmounting a mount. If any errors occurred during the operation, 234 * error will be set to contain the errors and FALSE will be returned. 235 * Params: 236 * mount = a GMount. 237 * result = a GAsyncResult. 238 * Returns: TRUE if the mount was successfully unmounted. FALSE otherwise. 239 * Throws: GException on failure. 240 */ 241 public int unmountFinish(AsyncResultIF result); 242 243 /** 244 * Unmounts a mount. This is an asynchronous operation, and is 245 * finished by calling g_mount_unmount_with_operation_finish() with the mount 246 * and GAsyncResult data returned in the callback. 247 * Since 2.22 248 * Params: 249 * mount = a GMount. 250 * flags = flags affecting the operation 251 * mountOperation = a GMountOperation or NULL to avoid 252 * user interaction. [allow-none] 253 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 254 * callback = a GAsyncReadyCallback, or NULL. [allow-none] 255 * userData = user data passed to callback. 256 */ 257 public void unmountWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 258 259 /** 260 * Finishes unmounting a mount. If any errors occurred during the operation, 261 * error will be set to contain the errors and FALSE will be returned. 262 * Since 2.22 263 * Params: 264 * mount = a GMount. 265 * result = a GAsyncResult. 266 * Returns: TRUE if the mount was successfully unmounted. FALSE otherwise. 267 * Throws: GException on failure. 268 */ 269 public int unmountWithOperationFinish(AsyncResultIF result); 270 271 /** 272 * Remounts a mount. This is an asynchronous operation, and is 273 * finished by calling g_mount_remount_finish() with the mount 274 * and GAsyncResults data returned in the callback. 275 * Remounting is useful when some setting affecting the operation 276 * of the volume has been changed, as these may need a remount to 277 * take affect. While this is semantically equivalent with unmounting 278 * and then remounting not all backends might need to actually be 279 * unmounted. 280 * Params: 281 * mount = a GMount. 282 * flags = flags affecting the operation 283 * mountOperation = a GMountOperation or NULL to avoid 284 * user interaction. [allow-none] 285 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 286 * callback = a GAsyncReadyCallback, or NULL. [allow-none] 287 * userData = user data passed to callback. 288 */ 289 public void remount(GMountMountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 290 291 /** 292 * Finishes remounting a mount. If any errors occurred during the operation, 293 * error will be set to contain the errors and FALSE will be returned. 294 * Params: 295 * mount = a GMount. 296 * result = a GAsyncResult. 297 * Returns: TRUE if the mount was successfully remounted. FALSE otherwise. 298 * Throws: GException on failure. 299 */ 300 public int remountFinish(AsyncResultIF result); 301 302 /** 303 * Checks if mount can be eject. 304 * Returns: TRUE if the mount can be ejected. 305 */ 306 public int canEject(); 307 308 /** 309 * Warning 310 * 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. 311 * Ejects a mount. This is an asynchronous operation, and is 312 * finished by calling g_mount_eject_finish() with the mount 313 * and GAsyncResult data returned in the callback. 314 * Params: 315 * mount = a GMount. 316 * flags = flags affecting the unmount if required for eject 317 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 318 * callback = a GAsyncReadyCallback, or NULL. [allow-none] 319 * userData = user data passed to callback. 320 */ 321 public void eject(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 322 323 /** 324 * Warning 325 * 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. 326 * Finishes ejecting a mount. If any errors occurred during the operation, 327 * error will be set to contain the errors and FALSE will be returned. 328 * Params: 329 * result = a GAsyncResult. 330 * Returns: TRUE if the mount was successfully ejected. FALSE otherwise. 331 * Throws: GException on failure. 332 */ 333 public int ejectFinish(AsyncResultIF result); 334 335 /** 336 * Ejects a mount. This is an asynchronous operation, and is 337 * finished by calling g_mount_eject_with_operation_finish() with the mount 338 * and GAsyncResult data returned in the callback. 339 * Since 2.22 340 * Params: 341 * mount = a GMount. 342 * flags = flags affecting the unmount if required for eject 343 * mountOperation = a GMountOperation or NULL to avoid 344 * user interaction. [allow-none] 345 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 346 * callback = a GAsyncReadyCallback, or NULL. [allow-none] 347 * userData = user data passed to callback. 348 */ 349 public void ejectWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 350 351 /** 352 * Finishes ejecting a mount. If any errors occurred during the operation, 353 * error will be set to contain the errors and FALSE will be returned. 354 * Since 2.22 355 * Params: 356 * result = a GAsyncResult. 357 * Returns: TRUE if the mount was successfully ejected. FALSE otherwise. 358 * Throws: GException on failure. 359 */ 360 public int ejectWithOperationFinish(AsyncResultIF result); 361 362 /** 363 * Tries to guess the type of content stored on mount. Returns one or 364 * more textual identifiers of well-known content types (typically 365 * prefixed with "x-content/"), e.g. x-content/image-dcf for camera 366 * memory cards. See the shared-mime-info 367 * specification for more on x-content types. 368 * This is an asynchronous operation (see 369 * g_mount_guess_content_type_sync() for the synchronous version), and 370 * is finished by calling g_mount_guess_content_type_finish() with the 371 * mount and GAsyncResult data returned in the callback. 372 * Since 2.18 373 * Params: 374 * forceRescan = Whether to force a rescan of the content. 375 * Otherwise a cached result will be used if available 376 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 377 * callback = a GAsyncReadyCallback 378 * userData = user data passed to callback 379 */ 380 public void guessContentType(int forceRescan, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 381 382 /** 383 * Finishes guessing content types of mount. If any errors occured 384 * during the operation, error will be set to contain the errors and 385 * FALSE will be returned. In particular, you may get an 386 * G_IO_ERROR_NOT_SUPPORTED if the mount does not support content 387 * guessing. 388 * Since 2.18 389 * Params: 390 * result = a GAsyncResult 391 * 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] 392 * Throws: GException on failure. 393 */ 394 public string[] guessContentTypeFinish(AsyncResultIF result); 395 396 /** 397 * Tries to guess the type of content stored on mount. Returns one or 398 * more textual identifiers of well-known content types (typically 399 * prefixed with "x-content/"), e.g. x-content/image-dcf for camera 400 * memory cards. See the shared-mime-info 401 * specification for more on x-content types. 402 * This is an synchronous operation and as such may block doing IO; 403 * see g_mount_guess_content_type() for the asynchronous version. 404 * Since 2.18 405 * Params: 406 * forceRescan = Whether to force a rescan of the content. 407 * Otherwise a cached result will be used if available 408 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 409 * 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] 410 * Throws: GException on failure. 411 */ 412 public string[] guessContentTypeSync(int forceRescan, Cancellable cancellable); 413 414 /** 415 * Determines if mount is shadowed. Applications or libraries should 416 * avoid displaying mount in the user interface if it is shadowed. 417 * A mount is said to be shadowed if there exists one or more user 418 * visible objects (currently GMount objects) with a root that is 419 * inside the root of mount. 420 * One application of shadow mounts is when exposing a single file 421 * system that is used to address several logical volumes. In this 422 * situation, a GVolumeMonitor implementation would create two 423 * GVolume objects (for example, one for the camera functionality of 424 * the device and one for a SD card reader on the device) with 425 * activation URIs gphoto2://[usb:001,002]/store1/ 426 * and gphoto2://[usb:001,002]/store2/. When the 427 * underlying mount (with root 428 * gphoto2://[usb:001,002]/) is mounted, said 429 * GVolumeMonitor implementation would create two GMount objects 430 * (each with their root matching the corresponding volume activation 431 * root) that would shadow the original mount. 432 * The proxy monitor in GVfs 2.26 and later, automatically creates and 433 * manage shadow mounts (and shadows the underlying mount) if the 434 * activation root on a GVolume is set. 435 * Since 2.20 436 * Returns: TRUE if mount is shadowed. 437 */ 438 public int isShadowed(); 439 440 /** 441 * Increments the shadow count on mount. Usually used by 442 * GVolumeMonitor implementations when creating a shadow mount for 443 * mount, see g_mount_is_shadowed() for more information. The caller 444 * will need to emit the "changed" signal on mount manually. 445 * Since 2.20 446 */ 447 public void shadow(); 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 "changed" signal on mount manually. 454 * Since 2.20 455 * Signal Details 456 * The "changed" signal 457 * void user_function (GMount *mount, 458 * gpointer user_data) : Run Last 459 * Emitted when the mount has been changed. 460 */ 461 public void unshadow(); 462 }