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 = MountT 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 * - TStruct 38 * extend = 39 * implements: 40 * prefixes: 41 * - g_mount_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * omit signals: 46 * imports: 47 * - glib.Str 48 * - glib.ErrorG 49 * - glib.GException 50 * - gobject.Signals 51 * - gio.AsyncResultIF 52 * - gio.Cancellable 53 * - gio.Drive 54 * - gio.DriveIF 55 * - gio.File 56 * - gio.Icon 57 * - gio.IconIF 58 * - gio.MountOperation 59 * - gio.Volume 60 * - gio.VolumeIF 61 * structWrap: 62 * - GAsyncResult* -> AsyncResultIF 63 * - GCancellable* -> Cancellable 64 * - GDrive* -> DriveIF 65 * - GFile* -> File 66 * - GIcon* -> IconIF 67 * - GMountOperation* -> MountOperation 68 * - GVolume* -> VolumeIF 69 * module aliases: 70 * local aliases: 71 * overrides: 72 */ 73 74 module gio.MountT; 75 76 public import gtkc.giotypes; 77 78 public import gtkc.gio; 79 public import glib.ConstructionException; 80 public import gobject.ObjectG; 81 82 public import gobject.Signals; 83 public import gtkc.gdktypes; 84 85 public import glib.Str; 86 public import glib.ErrorG; 87 public import glib.GException; 88 public import gobject.Signals; 89 public import gio.AsyncResultIF; 90 public import gio.Cancellable; 91 public import gio.Drive; 92 public import gio.DriveIF; 93 public import gio.File; 94 public import gio.Icon; 95 public import gio.IconIF; 96 public import gio.MountOperation; 97 public import gio.Volume; 98 public import gio.VolumeIF; 99 100 101 102 103 /** 104 * Description 105 * The GMount interface represents user-visible mounts. Note, when 106 * porting from GnomeVFS, GMount is the moral equivalent of GnomeVFSVolume. 107 * GMount is a "mounted" filesystem that you can access. Mounted is in 108 * quotes because it's not the same as a unix mount, it might be a gvfs 109 * mount, but you can still access the files on it if you use GIO. Might or 110 * might not be related to a volume object. 111 * Unmounting a GMount instance is an asynchronous operation. For 112 * more information about asynchronous operations, see GAsyncReady 113 * and GSimpleAsyncReady. 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 template MountT(TStruct) 124 { 125 126 /** the main Gtk struct */ 127 protected GMount* gMount; 128 129 130 public GMount* getMountTStruct() 131 { 132 return cast(GMount*)getStruct(); 133 } 134 135 136 /** 137 */ 138 int[string] connectedSignals; 139 140 void delegate(MountIF)[] _onChangedListeners; 141 void delegate(MountIF)[] onChangedListeners() 142 { 143 return _onChangedListeners; 144 } 145 /** 146 * Emitted when the mount has been changed. 147 */ 148 void addOnChanged(void delegate(MountIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 149 { 150 if ( !("changed" in connectedSignals) ) 151 { 152 Signals.connectData( 153 getStruct(), 154 "changed", 155 cast(GCallback)&callBackChanged, 156 cast(void*)cast(MountIF)this, 157 null, 158 connectFlags); 159 connectedSignals["changed"] = 1; 160 } 161 _onChangedListeners ~= dlg; 162 } 163 extern(C) static void callBackChanged(GMount* mountStruct, MountIF _mountIF) 164 { 165 foreach ( void delegate(MountIF) dlg ; _mountIF.onChangedListeners ) 166 { 167 dlg(_mountIF); 168 } 169 } 170 171 void delegate(MountIF)[] _onPreUnmountListeners; 172 void delegate(MountIF)[] onPreUnmountListeners() 173 { 174 return _onPreUnmountListeners; 175 } 176 /** 177 * This signal is emitted when the GMount is about to be 178 * unmounted. 179 * Since 2.22 180 */ 181 void addOnPreUnmount(void delegate(MountIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 182 { 183 if ( !("pre-unmount" in connectedSignals) ) 184 { 185 Signals.connectData( 186 getStruct(), 187 "pre-unmount", 188 cast(GCallback)&callBackPreUnmount, 189 cast(void*)cast(MountIF)this, 190 null, 191 connectFlags); 192 connectedSignals["pre-unmount"] = 1; 193 } 194 _onPreUnmountListeners ~= dlg; 195 } 196 extern(C) static void callBackPreUnmount(GMount* mountStruct, MountIF _mountIF) 197 { 198 foreach ( void delegate(MountIF) dlg ; _mountIF.onPreUnmountListeners ) 199 { 200 dlg(_mountIF); 201 } 202 } 203 204 void delegate(MountIF)[] _onUnmountedListeners; 205 void delegate(MountIF)[] onUnmountedListeners() 206 { 207 return _onUnmountedListeners; 208 } 209 /** 210 * This signal is emitted when the GMount have been 211 * unmounted. If the recipient is holding references to the 212 * object they should release them so the object can be 213 * finalized. 214 * See Also 215 * GVolume, GUnixMount 216 */ 217 void addOnUnmounted(void delegate(MountIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 218 { 219 if ( !("unmounted" in connectedSignals) ) 220 { 221 Signals.connectData( 222 getStruct(), 223 "unmounted", 224 cast(GCallback)&callBackUnmounted, 225 cast(void*)cast(MountIF)this, 226 null, 227 connectFlags); 228 connectedSignals["unmounted"] = 1; 229 } 230 _onUnmountedListeners ~= dlg; 231 } 232 extern(C) static void callBackUnmounted(GMount* mountStruct, MountIF _mountIF) 233 { 234 foreach ( void delegate(MountIF) dlg ; _mountIF.onUnmountedListeners ) 235 { 236 dlg(_mountIF); 237 } 238 } 239 240 241 /** 242 * Gets the name of mount. 243 * Returns: the name for the given mount. The returned string should be freed with g_free() when no longer needed. 244 */ 245 public string getName() 246 { 247 // char * g_mount_get_name (GMount *mount); 248 return Str.toString(g_mount_get_name(getMountTStruct())); 249 } 250 251 /** 252 * Gets the UUID for the mount. The reference is typically based on 253 * the file system UUID for the mount in question and should be 254 * considered an opaque string. Returns NULL if there is no UUID 255 * available. 256 * 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. 257 */ 258 public string getUuid() 259 { 260 // char * g_mount_get_uuid (GMount *mount); 261 return Str.toString(g_mount_get_uuid(getMountTStruct())); 262 } 263 264 /** 265 * Gets the icon for mount. 266 * Returns: a GIcon. The returned object should be unreffed with g_object_unref() when no longer needed. [transfer full] 267 */ 268 public IconIF getIcon() 269 { 270 // GIcon * g_mount_get_icon (GMount *mount); 271 auto p = g_mount_get_icon(getMountTStruct()); 272 273 if(p is null) 274 { 275 return null; 276 } 277 278 return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p); 279 } 280 281 /** 282 * Gets the drive for the mount. 283 * This is a convenience method for getting the GVolume and then 284 * using that object to get the GDrive. 285 * 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] 286 */ 287 public DriveIF getDrive() 288 { 289 // GDrive * g_mount_get_drive (GMount *mount); 290 auto p = g_mount_get_drive(getMountTStruct()); 291 292 if(p is null) 293 { 294 return null; 295 } 296 297 return ObjectG.getDObject!(Drive, DriveIF)(cast(GDrive*) p); 298 } 299 300 /** 301 * Gets the root directory on mount. 302 * Returns: a GFile. The returned object should be unreffed with g_object_unref() when no longer needed. [transfer full] 303 */ 304 public File getRoot() 305 { 306 // GFile * g_mount_get_root (GMount *mount); 307 auto p = g_mount_get_root(getMountTStruct()); 308 309 if(p is null) 310 { 311 return null; 312 } 313 314 return ObjectG.getDObject!(File)(cast(GFile*) p); 315 } 316 317 /** 318 * Gets the volume for the mount. 319 * 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] 320 */ 321 public VolumeIF getVolume() 322 { 323 // GVolume * g_mount_get_volume (GMount *mount); 324 auto p = g_mount_get_volume(getMountTStruct()); 325 326 if(p is null) 327 { 328 return null; 329 } 330 331 return ObjectG.getDObject!(Volume, VolumeIF)(cast(GVolume*) p); 332 } 333 334 /** 335 * Gets the default location of mount. The default location of the given 336 * mount is a path that reflects the main entry point for the user (e.g. 337 * the home directory, or the root of the volume). 338 * Returns: a GFile. The returned object should be unreffed with g_object_unref() when no longer needed. [transfer full] 339 */ 340 public File getDefaultLocation() 341 { 342 // GFile * g_mount_get_default_location (GMount *mount); 343 auto p = g_mount_get_default_location(getMountTStruct()); 344 345 if(p is null) 346 { 347 return null; 348 } 349 350 return ObjectG.getDObject!(File)(cast(GFile*) p); 351 } 352 353 /** 354 * Checks if mount can be mounted. 355 * Params: 356 * mount = a GMount. 357 * Returns: TRUE if the mount can be unmounted. 358 */ 359 public int canUnmount() 360 { 361 // gboolean g_mount_can_unmount (GMount *mount); 362 return g_mount_can_unmount(getMountTStruct()); 363 } 364 365 /** 366 * Warning 367 * 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. 368 * Unmounts a mount. This is an asynchronous operation, and is 369 * finished by calling g_mount_unmount_finish() with the mount 370 * and GAsyncResult data returned in the callback. 371 * Params: 372 * mount = a GMount. 373 * flags = flags affecting the operation 374 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 375 * callback = a GAsyncReadyCallback, or NULL. [allow-none] 376 * userData = user data passed to callback. 377 */ 378 public void unmount(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 379 { 380 // void g_mount_unmount (GMount *mount, GMountUnmountFlags flags, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 381 g_mount_unmount(getMountTStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 382 } 383 384 /** 385 * Warning 386 * 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. 387 * Finishes unmounting a mount. If any errors occurred during the operation, 388 * error will be set to contain the errors and FALSE will be returned. 389 * Params: 390 * mount = a GMount. 391 * result = a GAsyncResult. 392 * Returns: TRUE if the mount was successfully unmounted. FALSE otherwise. 393 * Throws: GException on failure. 394 */ 395 public int unmountFinish(AsyncResultIF result) 396 { 397 // gboolean g_mount_unmount_finish (GMount *mount, GAsyncResult *result, GError **error); 398 GError* err = null; 399 400 auto p = g_mount_unmount_finish(getMountTStruct(), (result is null) ? null : result.getAsyncResultTStruct(), &err); 401 402 if (err !is null) 403 { 404 throw new GException( new ErrorG(err) ); 405 } 406 407 return p; 408 } 409 410 /** 411 * Unmounts a mount. This is an asynchronous operation, and is 412 * finished by calling g_mount_unmount_with_operation_finish() with the mount 413 * and GAsyncResult data returned in the callback. 414 * Since 2.22 415 * Params: 416 * mount = a GMount. 417 * flags = flags affecting the operation 418 * mountOperation = a GMountOperation or NULL to avoid 419 * user interaction. [allow-none] 420 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 421 * callback = a GAsyncReadyCallback, or NULL. [allow-none] 422 * userData = user data passed to callback. 423 */ 424 public void unmountWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 425 { 426 // void g_mount_unmount_with_operation (GMount *mount, GMountUnmountFlags flags, GMountOperation *mount_operation, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 427 g_mount_unmount_with_operation(getMountTStruct(), flags, (mountOperation is null) ? null : mountOperation.getMountOperationStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 428 } 429 430 /** 431 * Finishes unmounting a mount. If any errors occurred during the operation, 432 * error will be set to contain the errors and FALSE will be returned. 433 * Since 2.22 434 * Params: 435 * mount = a GMount. 436 * result = a GAsyncResult. 437 * Returns: TRUE if the mount was successfully unmounted. FALSE otherwise. 438 * Throws: GException on failure. 439 */ 440 public int unmountWithOperationFinish(AsyncResultIF result) 441 { 442 // gboolean g_mount_unmount_with_operation_finish (GMount *mount, GAsyncResult *result, GError **error); 443 GError* err = null; 444 445 auto p = g_mount_unmount_with_operation_finish(getMountTStruct(), (result is null) ? null : result.getAsyncResultTStruct(), &err); 446 447 if (err !is null) 448 { 449 throw new GException( new ErrorG(err) ); 450 } 451 452 return p; 453 } 454 455 /** 456 * Remounts a mount. This is an asynchronous operation, and is 457 * finished by calling g_mount_remount_finish() with the mount 458 * and GAsyncResults data returned in the callback. 459 * Remounting is useful when some setting affecting the operation 460 * of the volume has been changed, as these may need a remount to 461 * take affect. While this is semantically equivalent with unmounting 462 * and then remounting not all backends might need to actually be 463 * unmounted. 464 * Params: 465 * mount = a GMount. 466 * flags = flags affecting the operation 467 * mountOperation = a GMountOperation or NULL to avoid 468 * user interaction. [allow-none] 469 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 470 * callback = a GAsyncReadyCallback, or NULL. [allow-none] 471 * userData = user data passed to callback. 472 */ 473 public void remount(GMountMountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 474 { 475 // void g_mount_remount (GMount *mount, GMountMountFlags flags, GMountOperation *mount_operation, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 476 g_mount_remount(getMountTStruct(), flags, (mountOperation is null) ? null : mountOperation.getMountOperationStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 477 } 478 479 /** 480 * Finishes remounting a mount. If any errors occurred during the operation, 481 * error will be set to contain the errors and FALSE will be returned. 482 * Params: 483 * mount = a GMount. 484 * result = a GAsyncResult. 485 * Returns: TRUE if the mount was successfully remounted. FALSE otherwise. 486 * Throws: GException on failure. 487 */ 488 public int remountFinish(AsyncResultIF result) 489 { 490 // gboolean g_mount_remount_finish (GMount *mount, GAsyncResult *result, GError **error); 491 GError* err = null; 492 493 auto p = g_mount_remount_finish(getMountTStruct(), (result is null) ? null : result.getAsyncResultTStruct(), &err); 494 495 if (err !is null) 496 { 497 throw new GException( new ErrorG(err) ); 498 } 499 500 return p; 501 } 502 503 /** 504 * Checks if mount can be eject. 505 * Returns: TRUE if the mount can be ejected. 506 */ 507 public int canEject() 508 { 509 // gboolean g_mount_can_eject (GMount *mount); 510 return g_mount_can_eject(getMountTStruct()); 511 } 512 513 /** 514 * Warning 515 * 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. 516 * Ejects a mount. This is an asynchronous operation, and is 517 * finished by calling g_mount_eject_finish() with the mount 518 * and GAsyncResult data returned in the callback. 519 * Params: 520 * mount = a GMount. 521 * flags = flags affecting the unmount if required for eject 522 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 523 * callback = a GAsyncReadyCallback, or NULL. [allow-none] 524 * userData = user data passed to callback. 525 */ 526 public void eject(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 527 { 528 // void g_mount_eject (GMount *mount, GMountUnmountFlags flags, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 529 g_mount_eject(getMountTStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 530 } 531 532 /** 533 * Warning 534 * 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. 535 * Finishes ejecting a mount. If any errors occurred during the operation, 536 * error will be set to contain the errors and FALSE will be returned. 537 * Params: 538 * result = a GAsyncResult. 539 * Returns: TRUE if the mount was successfully ejected. FALSE otherwise. 540 * Throws: GException on failure. 541 */ 542 public int ejectFinish(AsyncResultIF result) 543 { 544 // gboolean g_mount_eject_finish (GMount *mount, GAsyncResult *result, GError **error); 545 GError* err = null; 546 547 auto p = g_mount_eject_finish(getMountTStruct(), (result is null) ? null : result.getAsyncResultTStruct(), &err); 548 549 if (err !is null) 550 { 551 throw new GException( new ErrorG(err) ); 552 } 553 554 return p; 555 } 556 557 /** 558 * Ejects a mount. This is an asynchronous operation, and is 559 * finished by calling g_mount_eject_with_operation_finish() with the mount 560 * and GAsyncResult data returned in the callback. 561 * Since 2.22 562 * Params: 563 * mount = a GMount. 564 * flags = flags affecting the unmount if required for eject 565 * mountOperation = a GMountOperation or NULL to avoid 566 * user interaction. [allow-none] 567 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 568 * callback = a GAsyncReadyCallback, or NULL. [allow-none] 569 * userData = user data passed to callback. 570 */ 571 public void ejectWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 572 { 573 // void g_mount_eject_with_operation (GMount *mount, GMountUnmountFlags flags, GMountOperation *mount_operation, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 574 g_mount_eject_with_operation(getMountTStruct(), flags, (mountOperation is null) ? null : mountOperation.getMountOperationStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 575 } 576 577 /** 578 * Finishes ejecting a mount. If any errors occurred during the operation, 579 * error will be set to contain the errors and FALSE will be returned. 580 * Since 2.22 581 * Params: 582 * result = a GAsyncResult. 583 * Returns: TRUE if the mount was successfully ejected. FALSE otherwise. 584 * Throws: GException on failure. 585 */ 586 public int ejectWithOperationFinish(AsyncResultIF result) 587 { 588 // gboolean g_mount_eject_with_operation_finish (GMount *mount, GAsyncResult *result, GError **error); 589 GError* err = null; 590 591 auto p = g_mount_eject_with_operation_finish(getMountTStruct(), (result is null) ? null : result.getAsyncResultTStruct(), &err); 592 593 if (err !is null) 594 { 595 throw new GException( new ErrorG(err) ); 596 } 597 598 return p; 599 } 600 601 /** 602 * Tries to guess the type of content stored on mount. Returns one or 603 * more textual identifiers of well-known content types (typically 604 * prefixed with "x-content/"), e.g. x-content/image-dcf for camera 605 * memory cards. See the shared-mime-info 606 * specification for more on x-content types. 607 * This is an asynchronous operation (see 608 * g_mount_guess_content_type_sync() for the synchronous version), and 609 * is finished by calling g_mount_guess_content_type_finish() with the 610 * mount and GAsyncResult data returned in the callback. 611 * Since 2.18 612 * Params: 613 * forceRescan = Whether to force a rescan of the content. 614 * Otherwise a cached result will be used if available 615 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 616 * callback = a GAsyncReadyCallback 617 * userData = user data passed to callback 618 */ 619 public void guessContentType(int forceRescan, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 620 { 621 // void g_mount_guess_content_type (GMount *mount, gboolean force_rescan, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 622 g_mount_guess_content_type(getMountTStruct(), forceRescan, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 623 } 624 625 /** 626 * Finishes guessing content types of mount. If any errors occured 627 * during the operation, error will be set to contain the errors and 628 * FALSE will be returned. In particular, you may get an 629 * G_IO_ERROR_NOT_SUPPORTED if the mount does not support content 630 * guessing. 631 * Since 2.18 632 * Params: 633 * result = a GAsyncResult 634 * 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] 635 * Throws: GException on failure. 636 */ 637 public string[] guessContentTypeFinish(AsyncResultIF result) 638 { 639 // gchar ** g_mount_guess_content_type_finish (GMount *mount, GAsyncResult *result, GError **error); 640 GError* err = null; 641 642 auto p = g_mount_guess_content_type_finish(getMountTStruct(), (result is null) ? null : result.getAsyncResultTStruct(), &err); 643 644 if (err !is null) 645 { 646 throw new GException( new ErrorG(err) ); 647 } 648 649 return Str.toStringArray(p); 650 } 651 652 /** 653 * Tries to guess the type of content stored on mount. Returns one or 654 * more textual identifiers of well-known content types (typically 655 * prefixed with "x-content/"), e.g. x-content/image-dcf for camera 656 * memory cards. See the shared-mime-info 657 * specification for more on x-content types. 658 * This is an synchronous operation and as such may block doing IO; 659 * see g_mount_guess_content_type() for the asynchronous version. 660 * Since 2.18 661 * Params: 662 * forceRescan = Whether to force a rescan of the content. 663 * Otherwise a cached result will be used if available 664 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 665 * 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] 666 * Throws: GException on failure. 667 */ 668 public string[] guessContentTypeSync(int forceRescan, Cancellable cancellable) 669 { 670 // gchar ** g_mount_guess_content_type_sync (GMount *mount, gboolean force_rescan, GCancellable *cancellable, GError **error); 671 GError* err = null; 672 673 auto p = g_mount_guess_content_type_sync(getMountTStruct(), forceRescan, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); 674 675 if (err !is null) 676 { 677 throw new GException( new ErrorG(err) ); 678 } 679 680 return Str.toStringArray(p); 681 } 682 683 /** 684 * Determines if mount is shadowed. Applications or libraries should 685 * avoid displaying mount in the user interface if it is shadowed. 686 * A mount is said to be shadowed if there exists one or more user 687 * visible objects (currently GMount objects) with a root that is 688 * inside the root of mount. 689 * One application of shadow mounts is when exposing a single file 690 * system that is used to address several logical volumes. In this 691 * situation, a GVolumeMonitor implementation would create two 692 * GVolume objects (for example, one for the camera functionality of 693 * the device and one for a SD card reader on the device) with 694 * activation URIs gphoto2://[usb:001,002]/store1/ 695 * and gphoto2://[usb:001,002]/store2/. When the 696 * underlying mount (with root 697 * gphoto2://[usb:001,002]/) is mounted, said 698 * GVolumeMonitor implementation would create two GMount objects 699 * (each with their root matching the corresponding volume activation 700 * root) that would shadow the original mount. 701 * The proxy monitor in GVfs 2.26 and later, automatically creates and 702 * manage shadow mounts (and shadows the underlying mount) if the 703 * activation root on a GVolume is set. 704 * Since 2.20 705 * Returns: TRUE if mount is shadowed. 706 */ 707 public int isShadowed() 708 { 709 // gboolean g_mount_is_shadowed (GMount *mount); 710 return g_mount_is_shadowed(getMountTStruct()); 711 } 712 713 /** 714 * Increments the shadow count on mount. Usually used by 715 * GVolumeMonitor implementations when creating a shadow mount for 716 * mount, see g_mount_is_shadowed() for more information. The caller 717 * will need to emit the "changed" signal on mount manually. 718 * Since 2.20 719 */ 720 public void shadow() 721 { 722 // void g_mount_shadow (GMount *mount); 723 g_mount_shadow(getMountTStruct()); 724 } 725 726 /** 727 * Decrements the shadow count on mount. Usually used by 728 * GVolumeMonitor implementations when destroying a shadow mount for 729 * mount, see g_mount_is_shadowed() for more information. The caller 730 * will need to emit the "changed" signal on mount manually. 731 * Since 2.20 732 * Signal Details 733 * The "changed" signal 734 * void user_function (GMount *mount, 735 * gpointer user_data) : Run Last 736 * Emitted when the mount has been changed. 737 */ 738 public void unshadow() 739 { 740 // void g_mount_unshadow (GMount *mount); 741 g_mount_unshadow(getMountTStruct()); 742 } 743 }