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 public import glib.Str; 85 public import glib.ErrorG; 86 public import glib.GException; 87 public import gobject.Signals; 88 public import gio.AsyncResultIF; 89 public import gio.Cancellable; 90 public import gio.Drive; 91 public import gio.DriveIF; 92 public import gio.File; 93 public import gio.Icon; 94 public import gio.IconIF; 95 public import gio.MountOperation; 96 public import gio.Volume; 97 public import gio.VolumeIF; 98 99 100 101 /** 102 * The GMount interface represents user-visible mounts. Note, when 103 * porting from GnomeVFS, GMount is the moral equivalent of GnomeVFSVolume. 104 * 105 * GMount is a "mounted" filesystem that you can access. Mounted is in 106 * quotes because it's not the same as a unix mount, it might be a gvfs 107 * mount, but you can still access the files on it if you use GIO. Might or 108 * might not be related to a volume object. 109 * 110 * Unmounting a GMount instance is an asynchronous operation. For 111 * more information about asynchronous operations, see GAsyncResult 112 * and GTask. 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 template MountT(TStruct) 123 { 124 125 /** the main Gtk struct */ 126 protected GMount* gMount; 127 128 129 /** Get the main Gtk struct */ 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 @property 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 @property 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 @property 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, GUnixMountEntry, GUnixMountPoint 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 symbolic icon for mount. 283 * Since 2.34 284 * Returns: a GIcon. The returned object should be unreffed with g_object_unref() when no longer needed. [transfer full] 285 */ 286 public IconIF getSymbolicIcon() 287 { 288 // GIcon * g_mount_get_symbolic_icon (GMount *mount); 289 auto p = g_mount_get_symbolic_icon(getMountTStruct()); 290 291 if(p is null) 292 { 293 return null; 294 } 295 296 return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p); 297 } 298 299 /** 300 * Gets the drive for the mount. 301 * This is a convenience method for getting the GVolume and then 302 * using that object to get the GDrive. 303 * 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] 304 */ 305 public DriveIF getDrive() 306 { 307 // GDrive * g_mount_get_drive (GMount *mount); 308 auto p = g_mount_get_drive(getMountTStruct()); 309 310 if(p is null) 311 { 312 return null; 313 } 314 315 return ObjectG.getDObject!(Drive, DriveIF)(cast(GDrive*) p); 316 } 317 318 /** 319 * Gets the root directory on mount. 320 * Returns: a GFile. The returned object should be unreffed with g_object_unref() when no longer needed. [transfer full] 321 */ 322 public File getRoot() 323 { 324 // GFile * g_mount_get_root (GMount *mount); 325 auto p = g_mount_get_root(getMountTStruct()); 326 327 if(p is null) 328 { 329 return null; 330 } 331 332 return ObjectG.getDObject!(File)(cast(GFile*) p); 333 } 334 335 /** 336 * Gets the volume for the mount. 337 * 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] 338 */ 339 public VolumeIF getVolume() 340 { 341 // GVolume * g_mount_get_volume (GMount *mount); 342 auto p = g_mount_get_volume(getMountTStruct()); 343 344 if(p is null) 345 { 346 return null; 347 } 348 349 return ObjectG.getDObject!(Volume, VolumeIF)(cast(GVolume*) p); 350 } 351 352 /** 353 * Gets the default location of mount. The default location of the given 354 * mount is a path that reflects the main entry point for the user (e.g. 355 * the home directory, or the root of the volume). 356 * Returns: a GFile. The returned object should be unreffed with g_object_unref() when no longer needed. [transfer full] 357 */ 358 public File getDefaultLocation() 359 { 360 // GFile * g_mount_get_default_location (GMount *mount); 361 auto p = g_mount_get_default_location(getMountTStruct()); 362 363 if(p is null) 364 { 365 return null; 366 } 367 368 return ObjectG.getDObject!(File)(cast(GFile*) p); 369 } 370 371 /** 372 * Checks if mount can be mounted. 373 * Params: 374 * mount = a GMount. 375 * Returns: TRUE if the mount can be unmounted. 376 */ 377 public int canUnmount() 378 { 379 // gboolean g_mount_can_unmount (GMount *mount); 380 return g_mount_can_unmount(getMountTStruct()); 381 } 382 383 /** 384 * Warning 385 * 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. 386 * Unmounts a mount. This is an asynchronous operation, and is 387 * finished by calling g_mount_unmount_finish() with the mount 388 * and GAsyncResult data returned in the callback. 389 * Params: 390 * mount = a GMount. 391 * flags = flags affecting the operation 392 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 393 * callback = a GAsyncReadyCallback, or NULL. [allow-none] 394 * userData = user data passed to callback. 395 */ 396 public void unmount(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 397 { 398 // void g_mount_unmount (GMount *mount, GMountUnmountFlags flags, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 399 g_mount_unmount(getMountTStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 400 } 401 402 /** 403 * Warning 404 * 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. 405 * Finishes unmounting a mount. If any errors occurred during the operation, 406 * error will be set to contain the errors and FALSE will be returned. 407 * Params: 408 * mount = a GMount. 409 * result = a GAsyncResult. 410 * Returns: TRUE if the mount was successfully unmounted. FALSE otherwise. 411 * Throws: GException on failure. 412 */ 413 public int unmountFinish(AsyncResultIF result) 414 { 415 // gboolean g_mount_unmount_finish (GMount *mount, GAsyncResult *result, GError **error); 416 GError* err = null; 417 418 auto p = g_mount_unmount_finish(getMountTStruct(), (result is null) ? null : result.getAsyncResultTStruct(), &err); 419 420 if (err !is null) 421 { 422 throw new GException( new ErrorG(err) ); 423 } 424 425 return p; 426 } 427 428 /** 429 * Unmounts a mount. This is an asynchronous operation, and is 430 * finished by calling g_mount_unmount_with_operation_finish() with the mount 431 * and GAsyncResult data returned in the callback. 432 * Since 2.22 433 * Params: 434 * mount = a GMount. 435 * flags = flags affecting the operation 436 * mountOperation = a GMountOperation or NULL to avoid 437 * user interaction. [allow-none] 438 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 439 * callback = a GAsyncReadyCallback, or NULL. [allow-none] 440 * userData = user data passed to callback. 441 */ 442 public void unmountWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 443 { 444 // void g_mount_unmount_with_operation (GMount *mount, GMountUnmountFlags flags, GMountOperation *mount_operation, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 445 g_mount_unmount_with_operation(getMountTStruct(), flags, (mountOperation is null) ? null : mountOperation.getMountOperationStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 446 } 447 448 /** 449 * Finishes unmounting a mount. If any errors occurred during the operation, 450 * error will be set to contain the errors and FALSE will be returned. 451 * Since 2.22 452 * Params: 453 * mount = a GMount. 454 * result = a GAsyncResult. 455 * Returns: TRUE if the mount was successfully unmounted. FALSE otherwise. 456 * Throws: GException on failure. 457 */ 458 public int unmountWithOperationFinish(AsyncResultIF result) 459 { 460 // gboolean g_mount_unmount_with_operation_finish (GMount *mount, GAsyncResult *result, GError **error); 461 GError* err = null; 462 463 auto p = g_mount_unmount_with_operation_finish(getMountTStruct(), (result is null) ? null : result.getAsyncResultTStruct(), &err); 464 465 if (err !is null) 466 { 467 throw new GException( new ErrorG(err) ); 468 } 469 470 return p; 471 } 472 473 /** 474 * Remounts a mount. This is an asynchronous operation, and is 475 * finished by calling g_mount_remount_finish() with the mount 476 * and GAsyncResults data returned in the callback. 477 * Remounting is useful when some setting affecting the operation 478 * of the volume has been changed, as these may need a remount to 479 * take affect. While this is semantically equivalent with unmounting 480 * and then remounting not all backends might need to actually be 481 * unmounted. 482 * Params: 483 * mount = a GMount. 484 * flags = flags affecting the operation 485 * mountOperation = a GMountOperation or NULL to avoid 486 * user interaction. [allow-none] 487 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 488 * callback = a GAsyncReadyCallback, or NULL. [allow-none] 489 * userData = user data passed to callback. 490 */ 491 public void remount(GMountMountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 492 { 493 // void g_mount_remount (GMount *mount, GMountMountFlags flags, GMountOperation *mount_operation, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 494 g_mount_remount(getMountTStruct(), flags, (mountOperation is null) ? null : mountOperation.getMountOperationStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 495 } 496 497 /** 498 * Finishes remounting a mount. If any errors occurred during the operation, 499 * error will be set to contain the errors and FALSE will be returned. 500 * Params: 501 * mount = a GMount. 502 * result = a GAsyncResult. 503 * Returns: TRUE if the mount was successfully remounted. FALSE otherwise. 504 * Throws: GException on failure. 505 */ 506 public int remountFinish(AsyncResultIF result) 507 { 508 // gboolean g_mount_remount_finish (GMount *mount, GAsyncResult *result, GError **error); 509 GError* err = null; 510 511 auto p = g_mount_remount_finish(getMountTStruct(), (result is null) ? null : result.getAsyncResultTStruct(), &err); 512 513 if (err !is null) 514 { 515 throw new GException( new ErrorG(err) ); 516 } 517 518 return p; 519 } 520 521 /** 522 * Checks if mount can be eject. 523 * Returns: TRUE if the mount can be ejected. 524 */ 525 public int canEject() 526 { 527 // gboolean g_mount_can_eject (GMount *mount); 528 return g_mount_can_eject(getMountTStruct()); 529 } 530 531 /** 532 * Warning 533 * 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. 534 * Ejects a mount. This is an asynchronous operation, and is 535 * finished by calling g_mount_eject_finish() with the mount 536 * and GAsyncResult data returned in the callback. 537 * Params: 538 * mount = a GMount. 539 * flags = flags affecting the unmount if required for eject 540 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 541 * callback = a GAsyncReadyCallback, or NULL. [allow-none] 542 * userData = user data passed to callback. 543 */ 544 public void eject(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 545 { 546 // void g_mount_eject (GMount *mount, GMountUnmountFlags flags, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 547 g_mount_eject(getMountTStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 548 } 549 550 /** 551 * Warning 552 * 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. 553 * Finishes ejecting a mount. If any errors occurred during the operation, 554 * error will be set to contain the errors and FALSE will be returned. 555 * Params: 556 * result = a GAsyncResult. 557 * Returns: TRUE if the mount was successfully ejected. FALSE otherwise. 558 * Throws: GException on failure. 559 */ 560 public int ejectFinish(AsyncResultIF result) 561 { 562 // gboolean g_mount_eject_finish (GMount *mount, GAsyncResult *result, GError **error); 563 GError* err = null; 564 565 auto p = g_mount_eject_finish(getMountTStruct(), (result is null) ? null : result.getAsyncResultTStruct(), &err); 566 567 if (err !is null) 568 { 569 throw new GException( new ErrorG(err) ); 570 } 571 572 return p; 573 } 574 575 /** 576 * Ejects a mount. This is an asynchronous operation, and is 577 * finished by calling g_mount_eject_with_operation_finish() with the mount 578 * and GAsyncResult data returned in the callback. 579 * Since 2.22 580 * Params: 581 * mount = a GMount. 582 * flags = flags affecting the unmount if required for eject 583 * mountOperation = a GMountOperation or NULL to avoid 584 * user interaction. [allow-none] 585 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 586 * callback = a GAsyncReadyCallback, or NULL. [allow-none] 587 * userData = user data passed to callback. 588 */ 589 public void ejectWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 590 { 591 // void g_mount_eject_with_operation (GMount *mount, GMountUnmountFlags flags, GMountOperation *mount_operation, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 592 g_mount_eject_with_operation(getMountTStruct(), flags, (mountOperation is null) ? null : mountOperation.getMountOperationStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 593 } 594 595 /** 596 * Finishes ejecting a mount. If any errors occurred during the operation, 597 * error will be set to contain the errors and FALSE will be returned. 598 * Since 2.22 599 * Params: 600 * result = a GAsyncResult. 601 * Returns: TRUE if the mount was successfully ejected. FALSE otherwise. 602 * Throws: GException on failure. 603 */ 604 public int ejectWithOperationFinish(AsyncResultIF result) 605 { 606 // gboolean g_mount_eject_with_operation_finish (GMount *mount, GAsyncResult *result, GError **error); 607 GError* err = null; 608 609 auto p = g_mount_eject_with_operation_finish(getMountTStruct(), (result is null) ? null : result.getAsyncResultTStruct(), &err); 610 611 if (err !is null) 612 { 613 throw new GException( new ErrorG(err) ); 614 } 615 616 return p; 617 } 618 619 /** 620 * Tries to guess the type of content stored on mount. Returns one or 621 * more textual identifiers of well-known content types (typically 622 * prefixed with "x-content/"), e.g. x-content/image-dcf for camera 623 * memory cards. See the shared-mime-info 624 * specification for more on x-content types. 625 * This is an asynchronous operation (see 626 * g_mount_guess_content_type_sync() for the synchronous version), and 627 * is finished by calling g_mount_guess_content_type_finish() with the 628 * mount and GAsyncResult data returned in the callback. 629 * Since 2.18 630 * Params: 631 * forceRescan = Whether to force a rescan of the content. 632 * Otherwise a cached result will be used if available 633 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 634 * callback = a GAsyncReadyCallback 635 * userData = user data passed to callback 636 */ 637 public void guessContentType(int forceRescan, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 638 { 639 // void g_mount_guess_content_type (GMount *mount, gboolean force_rescan, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 640 g_mount_guess_content_type(getMountTStruct(), forceRescan, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 641 } 642 643 /** 644 * Finishes guessing content types of mount. If any errors occurred 645 * during the operation, error will be set to contain the errors and 646 * FALSE will be returned. In particular, you may get an 647 * G_IO_ERROR_NOT_SUPPORTED if the mount does not support content 648 * guessing. 649 * Since 2.18 650 * Params: 651 * result = a GAsyncResult 652 * 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] 653 * Throws: GException on failure. 654 */ 655 public string[] guessContentTypeFinish(AsyncResultIF result) 656 { 657 // gchar ** g_mount_guess_content_type_finish (GMount *mount, GAsyncResult *result, GError **error); 658 GError* err = null; 659 660 auto p = g_mount_guess_content_type_finish(getMountTStruct(), (result is null) ? null : result.getAsyncResultTStruct(), &err); 661 662 if (err !is null) 663 { 664 throw new GException( new ErrorG(err) ); 665 } 666 667 return Str.toStringArray(p); 668 } 669 670 /** 671 * Tries to guess the type of content stored on mount. Returns one or 672 * more textual identifiers of well-known content types (typically 673 * prefixed with "x-content/"), e.g. x-content/image-dcf for camera 674 * memory cards. See the shared-mime-info 675 * specification for more on x-content types. 676 * This is an synchronous operation and as such may block doing IO; 677 * see g_mount_guess_content_type() for the asynchronous version. 678 * Since 2.18 679 * Params: 680 * forceRescan = Whether to force a rescan of the content. 681 * Otherwise a cached result will be used if available 682 * cancellable = optional GCancellable object, NULL to ignore. [allow-none] 683 * 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] 684 * Throws: GException on failure. 685 */ 686 public string[] guessContentTypeSync(int forceRescan, Cancellable cancellable) 687 { 688 // gchar ** g_mount_guess_content_type_sync (GMount *mount, gboolean force_rescan, GCancellable *cancellable, GError **error); 689 GError* err = null; 690 691 auto p = g_mount_guess_content_type_sync(getMountTStruct(), forceRescan, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); 692 693 if (err !is null) 694 { 695 throw new GException( new ErrorG(err) ); 696 } 697 698 return Str.toStringArray(p); 699 } 700 701 /** 702 * Determines if mount is shadowed. Applications or libraries should 703 * avoid displaying mount in the user interface if it is shadowed. 704 * A mount is said to be shadowed if there exists one or more user 705 * visible objects (currently GMount objects) with a root that is 706 * inside the root of mount. 707 * One application of shadow mounts is when exposing a single file 708 * system that is used to address several logical volumes. In this 709 * situation, a GVolumeMonitor implementation would create two 710 * GVolume objects (for example, one for the camera functionality of 711 * the device and one for a SD card reader on the device) with 712 * activation URIs gphoto2://[usb:001,002]/store1/ 713 * and gphoto2://[usb:001,002]/store2/. When the 714 * underlying mount (with root 715 * gphoto2://[usb:001,002]/) is mounted, said 716 * GVolumeMonitor implementation would create two GMount objects 717 * (each with their root matching the corresponding volume activation 718 * root) that would shadow the original mount. 719 * The proxy monitor in GVfs 2.26 and later, automatically creates and 720 * manage shadow mounts (and shadows the underlying mount) if the 721 * activation root on a GVolume is set. 722 * Since 2.20 723 * Returns: TRUE if mount is shadowed. 724 */ 725 public int isShadowed() 726 { 727 // gboolean g_mount_is_shadowed (GMount *mount); 728 return g_mount_is_shadowed(getMountTStruct()); 729 } 730 731 /** 732 * Increments the shadow count on mount. Usually used by 733 * GVolumeMonitor implementations when creating a shadow mount for 734 * mount, see g_mount_is_shadowed() for more information. The caller 735 * will need to emit the "changed" signal on mount manually. 736 * Since 2.20 737 */ 738 public void shadow() 739 { 740 // void g_mount_shadow (GMount *mount); 741 g_mount_shadow(getMountTStruct()); 742 } 743 744 /** 745 * Decrements the shadow count on mount. Usually used by 746 * GVolumeMonitor implementations when destroying a shadow mount for 747 * mount, see g_mount_is_shadowed() for more information. The caller 748 * will need to emit the "changed" signal on mount manually. 749 * Since 2.20 750 */ 751 public void unshadow() 752 { 753 // void g_mount_unshadow (GMount *mount); 754 g_mount_unshadow(getMountTStruct()); 755 } 756 757 /** 758 * Gets the sort key for mount, if any. 759 * Since 2.32 760 * Signal Details 761 * The "changed" signal 762 * void user_function (GMount *mount, 763 * gpointer user_data) : Run Last 764 * Emitted when the mount has been changed. 765 * Returns: Sorting key for mount or NULL if no such key is available. 766 */ 767 public string getSortKey() 768 { 769 // const gchar * g_mount_get_sort_key (GMount *mount); 770 return Str.toString(g_mount_get_sort_key(getMountTStruct())); 771 } 772 }