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