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 module gio.FileIF; 26 27 private import gio.AppInfoIF; 28 private import gio.AsyncResultIF; 29 private import gio.Cancellable; 30 private import gio.FileAttributeInfoList; 31 private import gio.FileEnumerator; 32 private import gio.FileIF; 33 private import gio.FileIOStream; 34 private import gio.FileInfo; 35 private import gio.FileInputStream; 36 private import gio.FileMonitor; 37 private import gio.FileOutputStream; 38 private import gio.MountIF; 39 private import gio.MountOperation; 40 private import gio.c.functions; 41 public import gio.c.types; 42 private import glib.Bytes; 43 private import glib.ConstructionException; 44 private import glib.ErrorG; 45 private import glib.GException; 46 private import glib.Str; 47 private import gobject.ObjectG; 48 public import gtkc.giotypes; 49 50 51 /** 52 * #GFile is a high level abstraction for manipulating files on a 53 * virtual file system. #GFiles are lightweight, immutable objects 54 * that do no I/O upon creation. It is necessary to understand that 55 * #GFile objects do not represent files, merely an identifier for a 56 * file. All file content I/O is implemented as streaming operations 57 * (see #GInputStream and #GOutputStream). 58 * 59 * To construct a #GFile, you can use: 60 * - g_file_new_for_path() if you have a path. 61 * - g_file_new_for_uri() if you have a URI. 62 * - g_file_new_for_commandline_arg() for a command line argument. 63 * - g_file_new_tmp() to create a temporary file from a template. 64 * - g_file_parse_name() from a UTF-8 string gotten from g_file_get_parse_name(). 65 * 66 * One way to think of a #GFile is as an abstraction of a pathname. For 67 * normal files the system pathname is what is stored internally, but as 68 * #GFiles are extensible it could also be something else that corresponds 69 * to a pathname in a userspace implementation of a filesystem. 70 * 71 * #GFiles make up hierarchies of directories and files that correspond to 72 * the files on a filesystem. You can move through the file system with 73 * #GFile using g_file_get_parent() to get an identifier for the parent 74 * directory, g_file_get_child() to get a child within a directory, 75 * g_file_resolve_relative_path() to resolve a relative path between two 76 * #GFiles. There can be multiple hierarchies, so you may not end up at 77 * the same root if you repeatedly call g_file_get_parent() on two different 78 * files. 79 * 80 * All #GFiles have a basename (get with g_file_get_basename()). These names 81 * are byte strings that are used to identify the file on the filesystem 82 * (relative to its parent directory) and there is no guarantees that they 83 * have any particular charset encoding or even make any sense at all. If 84 * you want to use filenames in a user interface you should use the display 85 * name that you can get by requesting the 86 * %G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME attribute with g_file_query_info(). 87 * This is guaranteed to be in UTF-8 and can be used in a user interface. 88 * But always store the real basename or the #GFile to use to actually 89 * access the file, because there is no way to go from a display name to 90 * the actual name. 91 * 92 * Using #GFile as an identifier has the same weaknesses as using a path 93 * in that there may be multiple aliases for the same file. For instance, 94 * hard or soft links may cause two different #GFiles to refer to the same 95 * file. Other possible causes for aliases are: case insensitive filesystems, 96 * short and long names on FAT/NTFS, or bind mounts in Linux. If you want to 97 * check if two #GFiles point to the same file you can query for the 98 * %G_FILE_ATTRIBUTE_ID_FILE attribute. Note that #GFile does some trivial 99 * canonicalization of pathnames passed in, so that trivial differences in 100 * the path string used at creation (duplicated slashes, slash at end of 101 * path, "." or ".." path segments, etc) does not create different #GFiles. 102 * 103 * Many #GFile operations have both synchronous and asynchronous versions 104 * to suit your application. Asynchronous versions of synchronous functions 105 * simply have _async() appended to their function names. The asynchronous 106 * I/O functions call a #GAsyncReadyCallback which is then used to finalize 107 * the operation, producing a GAsyncResult which is then passed to the 108 * function's matching _finish() operation. 109 * 110 * It is highly recommended to use asynchronous calls when running within a 111 * shared main loop, such as in the main thread of an application. This avoids 112 * I/O operations blocking other sources on the main loop from being dispatched. 113 * Synchronous I/O operations should be performed from worker threads. See the 114 * [introduction to asynchronous programming section][async-programming] for 115 * more. 116 * 117 * Some #GFile operations almost always take a noticeable amount of time, and 118 * so do not have synchronous analogs. Notable cases include: 119 * - g_file_mount_mountable() to mount a mountable file. 120 * - g_file_unmount_mountable_with_operation() to unmount a mountable file. 121 * - g_file_eject_mountable_with_operation() to eject a mountable file. 122 * 123 * ## Entity Tags # {#gfile-etag} 124 * 125 * One notable feature of #GFiles are entity tags, or "etags" for 126 * short. Entity tags are somewhat like a more abstract version of the 127 * traditional mtime, and can be used to quickly determine if the file 128 * has been modified from the version on the file system. See the 129 * HTTP 1.1 130 * [specification](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html) 131 * for HTTP Etag headers, which are a very similar concept. 132 */ 133 public interface FileIF{ 134 /** Get the main Gtk struct */ 135 public GFile* getFileStruct(bool transferOwnership = false); 136 137 /** the main Gtk struct as a void* */ 138 protected void* getStruct(); 139 140 141 /** */ 142 public static GType getType() 143 { 144 return g_file_get_type(); 145 } 146 147 /** 148 * Constructs a #GFile with the given @parse_name (i.e. something 149 * given by g_file_get_parse_name()). This operation never fails, 150 * but the returned object might not support any I/O operation if 151 * the @parse_name cannot be parsed. 152 * 153 * Params: 154 * parseName = a file name or path to be parsed 155 * 156 * Returns: a new #GFile. 157 */ 158 public static FileIF parseName(string parseName) 159 { 160 auto p = g_file_parse_name(Str.toStringz(parseName)); 161 162 if(p is null) 163 { 164 return null; 165 } 166 167 return ObjectG.getDObject!(FileIF)(cast(GFile*) p, true); 168 } 169 170 /** 171 * Gets an output stream for appending data to the file. 172 * If the file doesn't already exist it is created. 173 * 174 * By default files created are generally readable by everyone, 175 * but if you pass #G_FILE_CREATE_PRIVATE in @flags the file 176 * will be made readable only to the current user, to the level that 177 * is supported on the target filesystem. 178 * 179 * If @cancellable is not %NULL, then the operation can be cancelled 180 * by triggering the cancellable object from another thread. If the 181 * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be 182 * returned. 183 * 184 * Some file systems don't allow all file names, and may return an 185 * %G_IO_ERROR_INVALID_FILENAME error. If the file is a directory the 186 * %G_IO_ERROR_IS_DIRECTORY error will be returned. Other errors are 187 * possible too, and depend on what kind of filesystem the file is on. 188 * 189 * Params: 190 * flags = a set of #GFileCreateFlags 191 * cancellable = optional #GCancellable object, 192 * %NULL to ignore 193 * 194 * Returns: a #GFileOutputStream, or %NULL on error. 195 * Free the returned object with g_object_unref(). 196 * 197 * Throws: GException on failure. 198 */ 199 public FileOutputStream appendTo(GFileCreateFlags flags, Cancellable cancellable); 200 201 /** 202 * Asynchronously opens @file for appending. 203 * 204 * For more details, see g_file_append_to() which is 205 * the synchronous version of this call. 206 * 207 * When the operation is finished, @callback will be called. 208 * You can then call g_file_append_to_finish() to get the result 209 * of the operation. 210 * 211 * Params: 212 * flags = a set of #GFileCreateFlags 213 * ioPriority = the [I/O priority][io-priority] of the request 214 * cancellable = optional #GCancellable object, 215 * %NULL to ignore 216 * callback = a #GAsyncReadyCallback to call 217 * when the request is satisfied 218 * userData = the data to pass to callback function 219 */ 220 public void appendToAsync(GFileCreateFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 221 222 /** 223 * Finishes an asynchronous file append operation started with 224 * g_file_append_to_async(). 225 * 226 * Params: 227 * res = #GAsyncResult 228 * 229 * Returns: a valid #GFileOutputStream 230 * or %NULL on error. 231 * Free the returned object with g_object_unref(). 232 * 233 * Throws: GException on failure. 234 */ 235 public FileOutputStream appendToFinish(AsyncResultIF res); 236 237 /** 238 * Copies the file @source to the location specified by @destination. 239 * Can not handle recursive copies of directories. 240 * 241 * If the flag #G_FILE_COPY_OVERWRITE is specified an already 242 * existing @destination file is overwritten. 243 * 244 * If the flag #G_FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlinks 245 * will be copied as symlinks, otherwise the target of the 246 * @source symlink will be copied. 247 * 248 * If the flag #G_FILE_COPY_ALL_METADATA is specified then all the metadata 249 * that is possible to copy is copied, not just the default subset (which, 250 * for instance, does not include the owner, see #GFileInfo). 251 * 252 * If @cancellable is not %NULL, then the operation can be cancelled by 253 * triggering the cancellable object from another thread. If the operation 254 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 255 * 256 * If @progress_callback is not %NULL, then the operation can be monitored 257 * by setting this to a #GFileProgressCallback function. 258 * @progress_callback_data will be passed to this function. It is guaranteed 259 * that this callback will be called after all data has been transferred with 260 * the total number of bytes copied during the operation. 261 * 262 * If the @source file does not exist, then the %G_IO_ERROR_NOT_FOUND error 263 * is returned, independent on the status of the @destination. 264 * 265 * If #G_FILE_COPY_OVERWRITE is not specified and the target exists, then 266 * the error %G_IO_ERROR_EXISTS is returned. 267 * 268 * If trying to overwrite a file over a directory, the %G_IO_ERROR_IS_DIRECTORY 269 * error is returned. If trying to overwrite a directory with a directory the 270 * %G_IO_ERROR_WOULD_MERGE error is returned. 271 * 272 * If the source is a directory and the target does not exist, or 273 * #G_FILE_COPY_OVERWRITE is specified and the target is a file, then the 274 * %G_IO_ERROR_WOULD_RECURSE error is returned. 275 * 276 * If you are interested in copying the #GFile object itself (not the on-disk 277 * file), see g_file_dup(). 278 * 279 * Params: 280 * destination = destination #GFile 281 * flags = set of #GFileCopyFlags 282 * cancellable = optional #GCancellable object, 283 * %NULL to ignore 284 * progressCallback = function to callback with 285 * progress information, or %NULL if progress information is not needed 286 * progressCallbackData = user data to pass to @progress_callback 287 * 288 * Returns: %TRUE on success, %FALSE otherwise. 289 * 290 * Throws: GException on failure. 291 */ 292 public bool copy(FileIF destination, GFileCopyFlags flags, Cancellable cancellable, GFileProgressCallback progressCallback, void* progressCallbackData); 293 294 /** 295 * Copies the file @source to the location specified by @destination 296 * asynchronously. For details of the behaviour, see g_file_copy(). 297 * 298 * If @progress_callback is not %NULL, then that function that will be called 299 * just like in g_file_copy(). The callback will run in the default main context 300 * of the thread calling g_file_copy_async() — the same context as @callback is 301 * run in. 302 * 303 * When the operation is finished, @callback will be called. You can then call 304 * g_file_copy_finish() to get the result of the operation. 305 * 306 * Params: 307 * destination = destination #GFile 308 * flags = set of #GFileCopyFlags 309 * ioPriority = the [I/O priority][io-priority] of the request 310 * cancellable = optional #GCancellable object, 311 * %NULL to ignore 312 * progressCallback = function to callback with progress 313 * information, or %NULL if progress information is not needed 314 * progressCallbackData = user data to pass to @progress_callback 315 * callback = a #GAsyncReadyCallback to call when the request is satisfied 316 * userData = the data to pass to callback function 317 */ 318 public void copyAsync(FileIF destination, GFileCopyFlags flags, int ioPriority, Cancellable cancellable, GFileProgressCallback progressCallback, void* progressCallbackData, GAsyncReadyCallback callback, void* userData); 319 320 /** 321 * Copies the file attributes from @source to @destination. 322 * 323 * Normally only a subset of the file attributes are copied, 324 * those that are copies in a normal file copy operation 325 * (which for instance does not include e.g. owner). However 326 * if #G_FILE_COPY_ALL_METADATA is specified in @flags, then 327 * all the metadata that is possible to copy is copied. This 328 * is useful when implementing move by copy + delete source. 329 * 330 * Params: 331 * destination = a #GFile to copy attributes to 332 * flags = a set of #GFileCopyFlags 333 * cancellable = optional #GCancellable object, 334 * %NULL to ignore 335 * 336 * Returns: %TRUE if the attributes were copied successfully, 337 * %FALSE otherwise. 338 * 339 * Throws: GException on failure. 340 */ 341 public bool copyAttributes(FileIF destination, GFileCopyFlags flags, Cancellable cancellable); 342 343 /** 344 * Finishes copying the file started with g_file_copy_async(). 345 * 346 * Params: 347 * res = a #GAsyncResult 348 * 349 * Returns: a %TRUE on success, %FALSE on error. 350 * 351 * Throws: GException on failure. 352 */ 353 public bool copyFinish(AsyncResultIF res); 354 355 /** 356 * Creates a new file and returns an output stream for writing to it. 357 * The file must not already exist. 358 * 359 * By default files created are generally readable by everyone, 360 * but if you pass #G_FILE_CREATE_PRIVATE in @flags the file 361 * will be made readable only to the current user, to the level 362 * that is supported on the target filesystem. 363 * 364 * If @cancellable is not %NULL, then the operation can be cancelled 365 * by triggering the cancellable object from another thread. If the 366 * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be 367 * returned. 368 * 369 * If a file or directory with this name already exists the 370 * %G_IO_ERROR_EXISTS error will be returned. Some file systems don't 371 * allow all file names, and may return an %G_IO_ERROR_INVALID_FILENAME 372 * error, and if the name is to long %G_IO_ERROR_FILENAME_TOO_LONG will 373 * be returned. Other errors are possible too, and depend on what kind 374 * of filesystem the file is on. 375 * 376 * Params: 377 * flags = a set of #GFileCreateFlags 378 * cancellable = optional #GCancellable object, 379 * %NULL to ignore 380 * 381 * Returns: a #GFileOutputStream for the newly created 382 * file, or %NULL on error. 383 * Free the returned object with g_object_unref(). 384 * 385 * Throws: GException on failure. 386 */ 387 public FileOutputStream create(GFileCreateFlags flags, Cancellable cancellable); 388 389 /** 390 * Asynchronously creates a new file and returns an output stream 391 * for writing to it. The file must not already exist. 392 * 393 * For more details, see g_file_create() which is 394 * the synchronous version of this call. 395 * 396 * When the operation is finished, @callback will be called. 397 * You can then call g_file_create_finish() to get the result 398 * of the operation. 399 * 400 * Params: 401 * flags = a set of #GFileCreateFlags 402 * ioPriority = the [I/O priority][io-priority] of the request 403 * cancellable = optional #GCancellable object, 404 * %NULL to ignore 405 * callback = a #GAsyncReadyCallback to call 406 * when the request is satisfied 407 * userData = the data to pass to callback function 408 */ 409 public void createAsync(GFileCreateFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 410 411 /** 412 * Finishes an asynchronous file create operation started with 413 * g_file_create_async(). 414 * 415 * Params: 416 * res = a #GAsyncResult 417 * 418 * Returns: a #GFileOutputStream or %NULL on error. 419 * Free the returned object with g_object_unref(). 420 * 421 * Throws: GException on failure. 422 */ 423 public FileOutputStream createFinish(AsyncResultIF res); 424 425 /** 426 * Creates a new file and returns a stream for reading and 427 * writing to it. The file must not already exist. 428 * 429 * By default files created are generally readable by everyone, 430 * but if you pass #G_FILE_CREATE_PRIVATE in @flags the file 431 * will be made readable only to the current user, to the level 432 * that is supported on the target filesystem. 433 * 434 * If @cancellable is not %NULL, then the operation can be cancelled 435 * by triggering the cancellable object from another thread. If the 436 * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be 437 * returned. 438 * 439 * If a file or directory with this name already exists, the 440 * %G_IO_ERROR_EXISTS error will be returned. Some file systems don't 441 * allow all file names, and may return an %G_IO_ERROR_INVALID_FILENAME 442 * error, and if the name is too long, %G_IO_ERROR_FILENAME_TOO_LONG 443 * will be returned. Other errors are possible too, and depend on what 444 * kind of filesystem the file is on. 445 * 446 * Note that in many non-local file cases read and write streams are 447 * not supported, so make sure you really need to do read and write 448 * streaming, rather than just opening for reading or writing. 449 * 450 * Params: 451 * flags = a set of #GFileCreateFlags 452 * cancellable = optional #GCancellable object, 453 * %NULL to ignore 454 * 455 * Returns: a #GFileIOStream for the newly created 456 * file, or %NULL on error. 457 * Free the returned object with g_object_unref(). 458 * 459 * Since: 2.22 460 * 461 * Throws: GException on failure. 462 */ 463 public FileIOStream createReadwrite(GFileCreateFlags flags, Cancellable cancellable); 464 465 /** 466 * Asynchronously creates a new file and returns a stream 467 * for reading and writing to it. The file must not already exist. 468 * 469 * For more details, see g_file_create_readwrite() which is 470 * the synchronous version of this call. 471 * 472 * When the operation is finished, @callback will be called. 473 * You can then call g_file_create_readwrite_finish() to get 474 * the result of the operation. 475 * 476 * Params: 477 * flags = a set of #GFileCreateFlags 478 * ioPriority = the [I/O priority][io-priority] of the request 479 * cancellable = optional #GCancellable object, 480 * %NULL to ignore 481 * callback = a #GAsyncReadyCallback to call 482 * when the request is satisfied 483 * userData = the data to pass to callback function 484 * 485 * Since: 2.22 486 */ 487 public void createReadwriteAsync(GFileCreateFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 488 489 /** 490 * Finishes an asynchronous file create operation started with 491 * g_file_create_readwrite_async(). 492 * 493 * Params: 494 * res = a #GAsyncResult 495 * 496 * Returns: a #GFileIOStream or %NULL on error. 497 * Free the returned object with g_object_unref(). 498 * 499 * Since: 2.22 500 * 501 * Throws: GException on failure. 502 */ 503 public FileIOStream createReadwriteFinish(AsyncResultIF res); 504 505 /** 506 * Deletes a file. If the @file is a directory, it will only be 507 * deleted if it is empty. This has the same semantics as g_unlink(). 508 * 509 * If @cancellable is not %NULL, then the operation can be cancelled by 510 * triggering the cancellable object from another thread. If the operation 511 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 512 * 513 * Params: 514 * cancellable = optional #GCancellable object, 515 * %NULL to ignore 516 * 517 * Returns: %TRUE if the file was deleted. %FALSE otherwise. 518 * 519 * Throws: GException on failure. 520 */ 521 public bool delet(Cancellable cancellable); 522 523 /** 524 * Asynchronously delete a file. If the @file is a directory, it will 525 * only be deleted if it is empty. This has the same semantics as 526 * g_unlink(). 527 * 528 * Params: 529 * ioPriority = the [I/O priority][io-priority] of the request 530 * cancellable = optional #GCancellable object, 531 * %NULL to ignore 532 * callback = a #GAsyncReadyCallback to call 533 * when the request is satisfied 534 * userData = the data to pass to callback function 535 * 536 * Since: 2.34 537 */ 538 public void deleteAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 539 540 /** 541 * Finishes deleting a file started with g_file_delete_async(). 542 * 543 * Params: 544 * result = a #GAsyncResult 545 * 546 * Returns: %TRUE if the file was deleted. %FALSE otherwise. 547 * 548 * Since: 2.34 549 * 550 * Throws: GException on failure. 551 */ 552 public bool deleteFinish(AsyncResultIF result); 553 554 /** 555 * Duplicates a #GFile handle. This operation does not duplicate 556 * the actual file or directory represented by the #GFile; see 557 * g_file_copy() if attempting to copy a file. 558 * 559 * This call does no blocking I/O. 560 * 561 * Returns: a new #GFile that is a duplicate 562 * of the given #GFile. 563 */ 564 public FileIF dup(); 565 566 /** 567 * Starts an asynchronous eject on a mountable. 568 * When this operation has completed, @callback will be called with 569 * @user_user data, and the operation can be finalized with 570 * g_file_eject_mountable_finish(). 571 * 572 * If @cancellable is not %NULL, then the operation can be cancelled by 573 * triggering the cancellable object from another thread. If the operation 574 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 575 * 576 * Deprecated: Use g_file_eject_mountable_with_operation() instead. 577 * 578 * Params: 579 * flags = flags affecting the operation 580 * cancellable = optional #GCancellable object, 581 * %NULL to ignore 582 * callback = a #GAsyncReadyCallback to call 583 * when the request is satisfied, or %NULL 584 * userData = the data to pass to callback function 585 */ 586 public void ejectMountable(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 587 588 /** 589 * Finishes an asynchronous eject operation started by 590 * g_file_eject_mountable(). 591 * 592 * Deprecated: Use g_file_eject_mountable_with_operation_finish() 593 * instead. 594 * 595 * Params: 596 * result = a #GAsyncResult 597 * 598 * Returns: %TRUE if the @file was ejected successfully. 599 * %FALSE otherwise. 600 * 601 * Throws: GException on failure. 602 */ 603 public bool ejectMountableFinish(AsyncResultIF result); 604 605 /** 606 * Starts an asynchronous eject on a mountable. 607 * When this operation has completed, @callback will be called with 608 * @user_user data, and the operation can be finalized with 609 * g_file_eject_mountable_with_operation_finish(). 610 * 611 * If @cancellable is not %NULL, then the operation can be cancelled by 612 * triggering the cancellable object from another thread. If the operation 613 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 614 * 615 * Params: 616 * flags = flags affecting the operation 617 * mountOperation = a #GMountOperation, 618 * or %NULL to avoid user interaction 619 * cancellable = optional #GCancellable object, 620 * %NULL to ignore 621 * callback = a #GAsyncReadyCallback to call 622 * when the request is satisfied, or %NULL 623 * userData = the data to pass to callback function 624 * 625 * Since: 2.22 626 */ 627 public void ejectMountableWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 628 629 /** 630 * Finishes an asynchronous eject operation started by 631 * g_file_eject_mountable_with_operation(). 632 * 633 * Params: 634 * result = a #GAsyncResult 635 * 636 * Returns: %TRUE if the @file was ejected successfully. 637 * %FALSE otherwise. 638 * 639 * Since: 2.22 640 * 641 * Throws: GException on failure. 642 */ 643 public bool ejectMountableWithOperationFinish(AsyncResultIF result); 644 645 /** 646 * Gets the requested information about the files in a directory. 647 * The result is a #GFileEnumerator object that will give out 648 * #GFileInfo objects for all the files in the directory. 649 * 650 * The @attributes value is a string that specifies the file 651 * attributes that should be gathered. It is not an error if 652 * it's not possible to read a particular requested attribute 653 * from a file - it just won't be set. @attributes should 654 * be a comma-separated list of attributes or attribute wildcards. 655 * The wildcard "*" means all attributes, and a wildcard like 656 * "standard::*" means all attributes in the standard namespace. 657 * An example attribute query be "standard::*,owner::user". 658 * The standard attributes are available as defines, like 659 * #G_FILE_ATTRIBUTE_STANDARD_NAME. 660 * 661 * If @cancellable is not %NULL, then the operation can be cancelled 662 * by triggering the cancellable object from another thread. If the 663 * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be 664 * returned. 665 * 666 * If the file does not exist, the %G_IO_ERROR_NOT_FOUND error will 667 * be returned. If the file is not a directory, the %G_IO_ERROR_NOT_DIRECTORY 668 * error will be returned. Other errors are possible too. 669 * 670 * Params: 671 * attributes = an attribute query string 672 * flags = a set of #GFileQueryInfoFlags 673 * cancellable = optional #GCancellable object, 674 * %NULL to ignore 675 * 676 * Returns: A #GFileEnumerator if successful, 677 * %NULL on error. Free the returned object with g_object_unref(). 678 * 679 * Throws: GException on failure. 680 */ 681 public FileEnumerator enumerateChildren(string attributes, GFileQueryInfoFlags flags, Cancellable cancellable); 682 683 /** 684 * Asynchronously gets the requested information about the files 685 * in a directory. The result is a #GFileEnumerator object that will 686 * give out #GFileInfo objects for all the files in the directory. 687 * 688 * For more details, see g_file_enumerate_children() which is 689 * the synchronous version of this call. 690 * 691 * When the operation is finished, @callback will be called. You can 692 * then call g_file_enumerate_children_finish() to get the result of 693 * the operation. 694 * 695 * Params: 696 * attributes = an attribute query string 697 * flags = a set of #GFileQueryInfoFlags 698 * ioPriority = the [I/O priority][io-priority] of the request 699 * cancellable = optional #GCancellable object, 700 * %NULL to ignore 701 * callback = a #GAsyncReadyCallback to call when the 702 * request is satisfied 703 * userData = the data to pass to callback function 704 */ 705 public void enumerateChildrenAsync(string attributes, GFileQueryInfoFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 706 707 /** 708 * Finishes an async enumerate children operation. 709 * See g_file_enumerate_children_async(). 710 * 711 * Params: 712 * res = a #GAsyncResult 713 * 714 * Returns: a #GFileEnumerator or %NULL 715 * if an error occurred. 716 * Free the returned object with g_object_unref(). 717 * 718 * Throws: GException on failure. 719 */ 720 public FileEnumerator enumerateChildrenFinish(AsyncResultIF res); 721 722 /** 723 * Checks if the two given #GFiles refer to the same file. 724 * 725 * Note that two #GFiles that differ can still refer to the same 726 * file on the filesystem due to various forms of filename 727 * aliasing. 728 * 729 * This call does no blocking I/O. 730 * 731 * Params: 732 * file2 = the second #GFile 733 * 734 * Returns: %TRUE if @file1 and @file2 are equal. 735 */ 736 public bool equal(FileIF file2); 737 738 /** 739 * Gets a #GMount for the #GFile. 740 * 741 * If the #GFileIface for @file does not have a mount (e.g. 742 * possibly a remote share), @error will be set to %G_IO_ERROR_NOT_FOUND 743 * and %NULL will be returned. 744 * 745 * If @cancellable is not %NULL, then the operation can be cancelled by 746 * triggering the cancellable object from another thread. If the operation 747 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 748 * 749 * Params: 750 * cancellable = optional #GCancellable object, 751 * %NULL to ignore 752 * 753 * Returns: a #GMount where the @file is located 754 * or %NULL on error. 755 * Free the returned object with g_object_unref(). 756 * 757 * Throws: GException on failure. 758 */ 759 public MountIF findEnclosingMount(Cancellable cancellable); 760 761 /** 762 * Asynchronously gets the mount for the file. 763 * 764 * For more details, see g_file_find_enclosing_mount() which is 765 * the synchronous version of this call. 766 * 767 * When the operation is finished, @callback will be called. 768 * You can then call g_file_find_enclosing_mount_finish() to 769 * get the result of the operation. 770 * 771 * Params: 772 * ioPriority = the [I/O priority][io-priority] of the request 773 * cancellable = optional #GCancellable object, 774 * %NULL to ignore 775 * callback = a #GAsyncReadyCallback to call 776 * when the request is satisfied 777 * userData = the data to pass to callback function 778 */ 779 public void findEnclosingMountAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 780 781 /** 782 * Finishes an asynchronous find mount request. 783 * See g_file_find_enclosing_mount_async(). 784 * 785 * Params: 786 * res = a #GAsyncResult 787 * 788 * Returns: #GMount for given @file or %NULL on error. 789 * Free the returned object with g_object_unref(). 790 * 791 * Throws: GException on failure. 792 */ 793 public MountIF findEnclosingMountFinish(AsyncResultIF res); 794 795 /** 796 * Gets the base name (the last component of the path) for a given #GFile. 797 * 798 * If called for the top level of a system (such as the filesystem root 799 * or a uri like sftp://host/) it will return a single directory separator 800 * (and on Windows, possibly a drive letter). 801 * 802 * The base name is a byte string (not UTF-8). It has no defined encoding 803 * or rules other than it may not contain zero bytes. If you want to use 804 * filenames in a user interface you should use the display name that you 805 * can get by requesting the %G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME 806 * attribute with g_file_query_info(). 807 * 808 * This call does no blocking I/O. 809 * 810 * Returns: string containing the #GFile's 811 * base name, or %NULL if given #GFile is invalid. The returned string 812 * should be freed with g_free() when no longer needed. 813 */ 814 public string getBasename(); 815 816 /** 817 * Gets a child of @file with basename equal to @name. 818 * 819 * Note that the file with that specific name might not exist, but 820 * you can still have a #GFile that points to it. You can use this 821 * for instance to create that file. 822 * 823 * This call does no blocking I/O. 824 * 825 * Params: 826 * name = string containing the child's basename 827 * 828 * Returns: a #GFile to a child specified by @name. 829 * Free the returned object with g_object_unref(). 830 */ 831 public FileIF getChild(string name); 832 833 /** 834 * Gets the child of @file for a given @display_name (i.e. a UTF-8 835 * version of the name). If this function fails, it returns %NULL 836 * and @error will be set. This is very useful when constructing a 837 * #GFile for a new file and the user entered the filename in the 838 * user interface, for instance when you select a directory and 839 * type a filename in the file selector. 840 * 841 * This call does no blocking I/O. 842 * 843 * Params: 844 * displayName = string to a possible child 845 * 846 * Returns: a #GFile to the specified child, or 847 * %NULL if the display name couldn't be converted. 848 * Free the returned object with g_object_unref(). 849 * 850 * Throws: GException on failure. 851 */ 852 public FileIF getChildForDisplayName(string displayName); 853 854 /** 855 * Gets the parent directory for the @file. 856 * If the @file represents the root directory of the 857 * file system, then %NULL will be returned. 858 * 859 * This call does no blocking I/O. 860 * 861 * Returns: a #GFile structure to the 862 * parent of the given #GFile or %NULL if there is no parent. Free 863 * the returned object with g_object_unref(). 864 */ 865 public FileIF getParent(); 866 867 /** 868 * Gets the parse name of the @file. 869 * A parse name is a UTF-8 string that describes the 870 * file such that one can get the #GFile back using 871 * g_file_parse_name(). 872 * 873 * This is generally used to show the #GFile as a nice 874 * full-pathname kind of string in a user interface, 875 * like in a location entry. 876 * 877 * For local files with names that can safely be converted 878 * to UTF-8 the pathname is used, otherwise the IRI is used 879 * (a form of URI that allows UTF-8 characters unescaped). 880 * 881 * This call does no blocking I/O. 882 * 883 * Returns: a string containing the #GFile's parse name. 884 * The returned string should be freed with g_free() 885 * when no longer needed. 886 */ 887 public string getParseName(); 888 889 /** 890 * Gets the local pathname for #GFile, if one exists. If non-%NULL, this is 891 * guaranteed to be an absolute, canonical path. It might contain symlinks. 892 * 893 * This call does no blocking I/O. 894 * 895 * Returns: string containing the #GFile's path, 896 * or %NULL if no such path exists. The returned string should be freed 897 * with g_free() when no longer needed. 898 */ 899 public string getPath(); 900 901 /** 902 * Gets the path for @descendant relative to @parent. 903 * 904 * This call does no blocking I/O. 905 * 906 * Params: 907 * descendant = input #GFile 908 * 909 * Returns: string with the relative path from 910 * @descendant to @parent, or %NULL if @descendant doesn't have @parent as 911 * prefix. The returned string should be freed with g_free() when 912 * no longer needed. 913 */ 914 public string getRelativePath(FileIF descendant); 915 916 /** 917 * Gets the URI for the @file. 918 * 919 * This call does no blocking I/O. 920 * 921 * Returns: a string containing the #GFile's URI. 922 * The returned string should be freed with g_free() 923 * when no longer needed. 924 */ 925 public string getUri(); 926 927 /** 928 * Gets the URI scheme for a #GFile. 929 * RFC 3986 decodes the scheme as: 930 * |[ 931 * URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] 932 * ]| 933 * Common schemes include "file", "http", "ftp", etc. 934 * 935 * This call does no blocking I/O. 936 * 937 * Returns: a string containing the URI scheme for the given 938 * #GFile. The returned string should be freed with g_free() 939 * when no longer needed. 940 */ 941 public string getUriScheme(); 942 943 /** 944 * Checks if @file has a parent, and optionally, if it is @parent. 945 * 946 * If @parent is %NULL then this function returns %TRUE if @file has any 947 * parent at all. If @parent is non-%NULL then %TRUE is only returned 948 * if @file is an immediate child of @parent. 949 * 950 * Params: 951 * parent = the parent to check for, or %NULL 952 * 953 * Returns: %TRUE if @file is an immediate child of @parent (or any parent in 954 * the case that @parent is %NULL). 955 * 956 * Since: 2.24 957 */ 958 public bool hasParent(FileIF parent); 959 960 /** 961 * Checks whether @file has the prefix specified by @prefix. 962 * 963 * In other words, if the names of initial elements of @file's 964 * pathname match @prefix. Only full pathname elements are matched, 965 * so a path like /foo is not considered a prefix of /foobar, only 966 * of /foo/bar. 967 * 968 * A #GFile is not a prefix of itself. If you want to check for 969 * equality, use g_file_equal(). 970 * 971 * This call does no I/O, as it works purely on names. As such it can 972 * sometimes return %FALSE even if @file is inside a @prefix (from a 973 * filesystem point of view), because the prefix of @file is an alias 974 * of @prefix. 975 * 976 * Params: 977 * prefix = input #GFile 978 * 979 * Returns: %TRUE if the @files's parent, grandparent, etc is @prefix, 980 * %FALSE otherwise. 981 */ 982 public bool hasPrefix(FileIF prefix); 983 984 /** 985 * Checks to see if a #GFile has a given URI scheme. 986 * 987 * This call does no blocking I/O. 988 * 989 * Params: 990 * uriScheme = a string containing a URI scheme 991 * 992 * Returns: %TRUE if #GFile's backend supports the 993 * given URI scheme, %FALSE if URI scheme is %NULL, 994 * not supported, or #GFile is invalid. 995 */ 996 public bool hasUriScheme(string uriScheme); 997 998 /** 999 * Creates a hash value for a #GFile. 1000 * 1001 * This call does no blocking I/O. 1002 * 1003 * Returns: 0 if @file is not a valid #GFile, otherwise an 1004 * integer that can be used as hash value for the #GFile. 1005 * This function is intended for easily hashing a #GFile to 1006 * add to a #GHashTable or similar data structure. 1007 */ 1008 public uint hash(); 1009 1010 /** 1011 * Checks to see if a file is native to the platform. 1012 * 1013 * A native file s one expressed in the platform-native filename format, 1014 * e.g. "C:\Windows" or "/usr/bin/". This does not mean the file is local, 1015 * as it might be on a locally mounted remote filesystem. 1016 * 1017 * On some systems non-native files may be available using the native 1018 * filesystem via a userspace filesystem (FUSE), in these cases this call 1019 * will return %FALSE, but g_file_get_path() will still return a native path. 1020 * 1021 * This call does no blocking I/O. 1022 * 1023 * Returns: %TRUE if @file is native 1024 */ 1025 public bool isNative(); 1026 1027 /** 1028 * Loads the content of the file into memory. The data is always 1029 * zero-terminated, but this is not included in the resultant @length. 1030 * The returned @content should be freed with g_free() when no longer 1031 * needed. 1032 * 1033 * If @cancellable is not %NULL, then the operation can be cancelled by 1034 * triggering the cancellable object from another thread. If the operation 1035 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1036 * 1037 * Params: 1038 * cancellable = optional #GCancellable object, %NULL to ignore 1039 * contents = a location to place the contents of the file 1040 * etagOut = a location to place the current entity tag for the file, 1041 * or %NULL if the entity tag is not needed 1042 * 1043 * Returns: %TRUE if the @file's contents were successfully loaded. 1044 * %FALSE if there were errors. 1045 * 1046 * Throws: GException on failure. 1047 */ 1048 public bool loadContents(Cancellable cancellable, out string contents, out string etagOut); 1049 1050 /** 1051 * Starts an asynchronous load of the @file's contents. 1052 * 1053 * For more details, see g_file_load_contents() which is 1054 * the synchronous version of this call. 1055 * 1056 * When the load operation has completed, @callback will be called 1057 * with @user data. To finish the operation, call 1058 * g_file_load_contents_finish() with the #GAsyncResult returned by 1059 * the @callback. 1060 * 1061 * If @cancellable is not %NULL, then the operation can be cancelled by 1062 * triggering the cancellable object from another thread. If the operation 1063 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1064 * 1065 * Params: 1066 * cancellable = optional #GCancellable object, %NULL to ignore 1067 * callback = a #GAsyncReadyCallback to call when the request is satisfied 1068 * userData = the data to pass to callback function 1069 */ 1070 public void loadContentsAsync(Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 1071 1072 /** 1073 * Finishes an asynchronous load of the @file's contents. 1074 * The contents are placed in @contents, and @length is set to the 1075 * size of the @contents string. The @content should be freed with 1076 * g_free() when no longer needed. If @etag_out is present, it will be 1077 * set to the new entity tag for the @file. 1078 * 1079 * Params: 1080 * res = a #GAsyncResult 1081 * contents = a location to place the contents of the file 1082 * etagOut = a location to place the current entity tag for the file, 1083 * or %NULL if the entity tag is not needed 1084 * 1085 * Returns: %TRUE if the load was successful. If %FALSE and @error is 1086 * present, it will be set appropriately. 1087 * 1088 * Throws: GException on failure. 1089 */ 1090 public bool loadContentsFinish(AsyncResultIF res, out string contents, out string etagOut); 1091 1092 /** 1093 * Reads the partial contents of a file. A #GFileReadMoreCallback should 1094 * be used to stop reading from the file when appropriate, else this 1095 * function will behave exactly as g_file_load_contents_async(). This 1096 * operation can be finished by g_file_load_partial_contents_finish(). 1097 * 1098 * Users of this function should be aware that @user_data is passed to 1099 * both the @read_more_callback and the @callback. 1100 * 1101 * If @cancellable is not %NULL, then the operation can be cancelled by 1102 * triggering the cancellable object from another thread. If the operation 1103 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1104 * 1105 * Params: 1106 * cancellable = optional #GCancellable object, %NULL to ignore 1107 * readMoreCallback = a #GFileReadMoreCallback to receive partial data 1108 * and to specify whether further data should be read 1109 * callback = a #GAsyncReadyCallback to call when the request is satisfied 1110 * userData = the data to pass to the callback functions 1111 */ 1112 public void loadPartialContentsAsync(Cancellable cancellable, GFileReadMoreCallback readMoreCallback, GAsyncReadyCallback callback, void* userData); 1113 1114 /** 1115 * Finishes an asynchronous partial load operation that was started 1116 * with g_file_load_partial_contents_async(). The data is always 1117 * zero-terminated, but this is not included in the resultant @length. 1118 * The returned @content should be freed with g_free() when no longer 1119 * needed. 1120 * 1121 * Params: 1122 * res = a #GAsyncResult 1123 * contents = a location to place the contents of the file 1124 * etagOut = a location to place the current entity tag for the file, 1125 * or %NULL if the entity tag is not needed 1126 * 1127 * Returns: %TRUE if the load was successful. If %FALSE and @error is 1128 * present, it will be set appropriately. 1129 * 1130 * Throws: GException on failure. 1131 */ 1132 public bool loadPartialContentsFinish(AsyncResultIF res, out string contents, out string etagOut); 1133 1134 /** 1135 * Creates a directory. Note that this will only create a child directory 1136 * of the immediate parent directory of the path or URI given by the #GFile. 1137 * To recursively create directories, see g_file_make_directory_with_parents(). 1138 * This function will fail if the parent directory does not exist, setting 1139 * @error to %G_IO_ERROR_NOT_FOUND. If the file system doesn't support 1140 * creating directories, this function will fail, setting @error to 1141 * %G_IO_ERROR_NOT_SUPPORTED. 1142 * 1143 * For a local #GFile the newly created directory will have the default 1144 * (current) ownership and permissions of the current process. 1145 * 1146 * If @cancellable is not %NULL, then the operation can be cancelled by 1147 * triggering the cancellable object from another thread. If the operation 1148 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1149 * 1150 * Params: 1151 * cancellable = optional #GCancellable object, 1152 * %NULL to ignore 1153 * 1154 * Returns: %TRUE on successful creation, %FALSE otherwise. 1155 * 1156 * Throws: GException on failure. 1157 */ 1158 public bool makeDirectory(Cancellable cancellable); 1159 1160 /** 1161 * Asynchronously creates a directory. 1162 * 1163 * Params: 1164 * ioPriority = the [I/O priority][io-priority] of the request 1165 * cancellable = optional #GCancellable object, 1166 * %NULL to ignore 1167 * callback = a #GAsyncReadyCallback to call 1168 * when the request is satisfied 1169 * userData = the data to pass to callback function 1170 * 1171 * Since: 2.38 1172 */ 1173 public void makeDirectoryAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 1174 1175 /** 1176 * Finishes an asynchronous directory creation, started with 1177 * g_file_make_directory_async(). 1178 * 1179 * Params: 1180 * result = a #GAsyncResult 1181 * 1182 * Returns: %TRUE on successful directory creation, %FALSE otherwise. 1183 * 1184 * Since: 2.38 1185 * 1186 * Throws: GException on failure. 1187 */ 1188 public bool makeDirectoryFinish(AsyncResultIF result); 1189 1190 /** 1191 * Creates a directory and any parent directories that may not 1192 * exist similar to 'mkdir -p'. If the file system does not support 1193 * creating directories, this function will fail, setting @error to 1194 * %G_IO_ERROR_NOT_SUPPORTED. If the directory itself already exists, 1195 * this function will fail setting @error to %G_IO_ERROR_EXISTS, unlike 1196 * the similar g_mkdir_with_parents(). 1197 * 1198 * For a local #GFile the newly created directories will have the default 1199 * (current) ownership and permissions of the current process. 1200 * 1201 * If @cancellable is not %NULL, then the operation can be cancelled by 1202 * triggering the cancellable object from another thread. If the operation 1203 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1204 * 1205 * Params: 1206 * cancellable = optional #GCancellable object, 1207 * %NULL to ignore 1208 * 1209 * Returns: %TRUE if all directories have been successfully created, %FALSE 1210 * otherwise. 1211 * 1212 * Since: 2.18 1213 * 1214 * Throws: GException on failure. 1215 */ 1216 public bool makeDirectoryWithParents(Cancellable cancellable); 1217 1218 /** 1219 * Creates a symbolic link named @file which contains the string 1220 * @symlink_value. 1221 * 1222 * If @cancellable is not %NULL, then the operation can be cancelled by 1223 * triggering the cancellable object from another thread. If the operation 1224 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1225 * 1226 * Params: 1227 * symlinkValue = a string with the path for the target 1228 * of the new symlink 1229 * cancellable = optional #GCancellable object, 1230 * %NULL to ignore 1231 * 1232 * Returns: %TRUE on the creation of a new symlink, %FALSE otherwise. 1233 * 1234 * Throws: GException on failure. 1235 */ 1236 public bool makeSymbolicLink(string symlinkValue, Cancellable cancellable); 1237 1238 /** 1239 * Recursively measures the disk usage of @file. 1240 * 1241 * This is essentially an analog of the 'du' command, but it also 1242 * reports the number of directories and non-directory files encountered 1243 * (including things like symbolic links). 1244 * 1245 * By default, errors are only reported against the toplevel file 1246 * itself. Errors found while recursing are silently ignored, unless 1247 * %G_FILE_DISK_USAGE_REPORT_ALL_ERRORS is given in @flags. 1248 * 1249 * The returned size, @disk_usage, is in bytes and should be formatted 1250 * with g_format_size() in order to get something reasonable for showing 1251 * in a user interface. 1252 * 1253 * @progress_callback and @progress_data can be given to request 1254 * periodic progress updates while scanning. See the documentation for 1255 * #GFileMeasureProgressCallback for information about when and how the 1256 * callback will be invoked. 1257 * 1258 * Params: 1259 * flags = #GFileMeasureFlags 1260 * cancellable = optional #GCancellable 1261 * progressCallback = a #GFileMeasureProgressCallback 1262 * progressData = user_data for @progress_callback 1263 * diskUsage = the number of bytes of disk space used 1264 * numDirs = the number of directories encountered 1265 * numFiles = the number of non-directories encountered 1266 * 1267 * Returns: %TRUE if successful, with the out parameters set. 1268 * %FALSE otherwise, with @error set. 1269 * 1270 * Since: 2.38 1271 * 1272 * Throws: GException on failure. 1273 */ 1274 public bool measureDiskUsage(GFileMeasureFlags flags, Cancellable cancellable, GFileMeasureProgressCallback progressCallback, void* progressData, out ulong diskUsage, out ulong numDirs, out ulong numFiles); 1275 1276 /** 1277 * Recursively measures the disk usage of @file. 1278 * 1279 * This is the asynchronous version of g_file_measure_disk_usage(). See 1280 * there for more information. 1281 * 1282 * Params: 1283 * flags = #GFileMeasureFlags 1284 * ioPriority = the [I/O priority][io-priority] of the request 1285 * cancellable = optional #GCancellable 1286 * progressCallback = a #GFileMeasureProgressCallback 1287 * progressData = user_data for @progress_callback 1288 * callback = a #GAsyncReadyCallback to call when complete 1289 * userData = the data to pass to callback function 1290 * 1291 * Since: 2.38 1292 */ 1293 public void measureDiskUsageAsync(GFileMeasureFlags flags, int ioPriority, Cancellable cancellable, GFileMeasureProgressCallback progressCallback, void* progressData, GAsyncReadyCallback callback, void* userData); 1294 1295 /** 1296 * Collects the results from an earlier call to 1297 * g_file_measure_disk_usage_async(). See g_file_measure_disk_usage() for 1298 * more information. 1299 * 1300 * Params: 1301 * result = the #GAsyncResult passed to your #GAsyncReadyCallback 1302 * diskUsage = the number of bytes of disk space used 1303 * numDirs = the number of directories encountered 1304 * numFiles = the number of non-directories encountered 1305 * 1306 * Returns: %TRUE if successful, with the out parameters set. 1307 * %FALSE otherwise, with @error set. 1308 * 1309 * Since: 2.38 1310 * 1311 * Throws: GException on failure. 1312 */ 1313 public bool measureDiskUsageFinish(AsyncResultIF result, out ulong diskUsage, out ulong numDirs, out ulong numFiles); 1314 1315 /** 1316 * Obtains a file or directory monitor for the given file, 1317 * depending on the type of the file. 1318 * 1319 * If @cancellable is not %NULL, then the operation can be cancelled by 1320 * triggering the cancellable object from another thread. If the operation 1321 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1322 * 1323 * Params: 1324 * flags = a set of #GFileMonitorFlags 1325 * cancellable = optional #GCancellable object, 1326 * %NULL to ignore 1327 * 1328 * Returns: a #GFileMonitor for the given @file, 1329 * or %NULL on error. 1330 * Free the returned object with g_object_unref(). 1331 * 1332 * Since: 2.18 1333 * 1334 * Throws: GException on failure. 1335 */ 1336 public FileMonitor monitor(GFileMonitorFlags flags, Cancellable cancellable); 1337 1338 /** 1339 * Obtains a directory monitor for the given file. 1340 * This may fail if directory monitoring is not supported. 1341 * 1342 * If @cancellable is not %NULL, then the operation can be cancelled by 1343 * triggering the cancellable object from another thread. If the operation 1344 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1345 * 1346 * It does not make sense for @flags to contain 1347 * %G_FILE_MONITOR_WATCH_HARD_LINKS, since hard links can not be made to 1348 * directories. It is not possible to monitor all the files in a 1349 * directory for changes made via hard links; if you want to do this then 1350 * you must register individual watches with g_file_monitor(). 1351 * 1352 * Params: 1353 * flags = a set of #GFileMonitorFlags 1354 * cancellable = optional #GCancellable object, 1355 * %NULL to ignore 1356 * 1357 * Returns: a #GFileMonitor for the given @file, 1358 * or %NULL on error. 1359 * Free the returned object with g_object_unref(). 1360 * 1361 * Throws: GException on failure. 1362 */ 1363 public FileMonitor monitorDirectory(GFileMonitorFlags flags, Cancellable cancellable); 1364 1365 /** 1366 * Obtains a file monitor for the given file. If no file notification 1367 * mechanism exists, then regular polling of the file is used. 1368 * 1369 * If @cancellable is not %NULL, then the operation can be cancelled by 1370 * triggering the cancellable object from another thread. If the operation 1371 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1372 * 1373 * If @flags contains %G_FILE_MONITOR_WATCH_HARD_LINKS then the monitor 1374 * will also attempt to report changes made to the file via another 1375 * filename (ie, a hard link). Without this flag, you can only rely on 1376 * changes made through the filename contained in @file to be 1377 * reported. Using this flag may result in an increase in resource 1378 * usage, and may not have any effect depending on the #GFileMonitor 1379 * backend and/or filesystem type. 1380 * 1381 * Params: 1382 * flags = a set of #GFileMonitorFlags 1383 * cancellable = optional #GCancellable object, 1384 * %NULL to ignore 1385 * 1386 * Returns: a #GFileMonitor for the given @file, 1387 * or %NULL on error. 1388 * Free the returned object with g_object_unref(). 1389 * 1390 * Throws: GException on failure. 1391 */ 1392 public FileMonitor monitorFile(GFileMonitorFlags flags, Cancellable cancellable); 1393 1394 /** 1395 * Starts a @mount_operation, mounting the volume that contains 1396 * the file @location. 1397 * 1398 * When this operation has completed, @callback will be called with 1399 * @user_user data, and the operation can be finalized with 1400 * g_file_mount_enclosing_volume_finish(). 1401 * 1402 * If @cancellable is not %NULL, then the operation can be cancelled by 1403 * triggering the cancellable object from another thread. If the operation 1404 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1405 * 1406 * Params: 1407 * flags = flags affecting the operation 1408 * mountOperation = a #GMountOperation 1409 * or %NULL to avoid user interaction 1410 * cancellable = optional #GCancellable object, 1411 * %NULL to ignore 1412 * callback = a #GAsyncReadyCallback to call 1413 * when the request is satisfied, or %NULL 1414 * userData = the data to pass to callback function 1415 */ 1416 public void mountEnclosingVolume(GMountMountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 1417 1418 /** 1419 * Finishes a mount operation started by g_file_mount_enclosing_volume(). 1420 * 1421 * Params: 1422 * result = a #GAsyncResult 1423 * 1424 * Returns: %TRUE if successful. If an error has occurred, 1425 * this function will return %FALSE and set @error 1426 * appropriately if present. 1427 * 1428 * Throws: GException on failure. 1429 */ 1430 public bool mountEnclosingVolumeFinish(AsyncResultIF result); 1431 1432 /** 1433 * Mounts a file of type G_FILE_TYPE_MOUNTABLE. 1434 * Using @mount_operation, you can request callbacks when, for instance, 1435 * passwords are needed during authentication. 1436 * 1437 * If @cancellable is not %NULL, then the operation can be cancelled by 1438 * triggering the cancellable object from another thread. If the operation 1439 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1440 * 1441 * When the operation is finished, @callback will be called. 1442 * You can then call g_file_mount_mountable_finish() to get 1443 * the result of the operation. 1444 * 1445 * Params: 1446 * flags = flags affecting the operation 1447 * mountOperation = a #GMountOperation, 1448 * or %NULL to avoid user interaction 1449 * cancellable = optional #GCancellable object, 1450 * %NULL to ignore 1451 * callback = a #GAsyncReadyCallback to call 1452 * when the request is satisfied, or %NULL 1453 * userData = the data to pass to callback function 1454 */ 1455 public void mountMountable(GMountMountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 1456 1457 /** 1458 * Finishes a mount operation. See g_file_mount_mountable() for details. 1459 * 1460 * Finish an asynchronous mount operation that was started 1461 * with g_file_mount_mountable(). 1462 * 1463 * Params: 1464 * result = a #GAsyncResult 1465 * 1466 * Returns: a #GFile or %NULL on error. 1467 * Free the returned object with g_object_unref(). 1468 * 1469 * Throws: GException on failure. 1470 */ 1471 public FileIF mountMountableFinish(AsyncResultIF result); 1472 1473 /** 1474 * Tries to move the file or directory @source to the location specified 1475 * by @destination. If native move operations are supported then this is 1476 * used, otherwise a copy + delete fallback is used. The native 1477 * implementation may support moving directories (for instance on moves 1478 * inside the same filesystem), but the fallback code does not. 1479 * 1480 * If the flag #G_FILE_COPY_OVERWRITE is specified an already 1481 * existing @destination file is overwritten. 1482 * 1483 * If the flag #G_FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlinks 1484 * will be copied as symlinks, otherwise the target of the 1485 * @source symlink will be copied. 1486 * 1487 * If @cancellable is not %NULL, then the operation can be cancelled by 1488 * triggering the cancellable object from another thread. If the operation 1489 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1490 * 1491 * If @progress_callback is not %NULL, then the operation can be monitored 1492 * by setting this to a #GFileProgressCallback function. 1493 * @progress_callback_data will be passed to this function. It is 1494 * guaranteed that this callback will be called after all data has been 1495 * transferred with the total number of bytes copied during the operation. 1496 * 1497 * If the @source file does not exist, then the %G_IO_ERROR_NOT_FOUND 1498 * error is returned, independent on the status of the @destination. 1499 * 1500 * If #G_FILE_COPY_OVERWRITE is not specified and the target exists, 1501 * then the error %G_IO_ERROR_EXISTS is returned. 1502 * 1503 * If trying to overwrite a file over a directory, the %G_IO_ERROR_IS_DIRECTORY 1504 * error is returned. If trying to overwrite a directory with a directory the 1505 * %G_IO_ERROR_WOULD_MERGE error is returned. 1506 * 1507 * If the source is a directory and the target does not exist, or 1508 * #G_FILE_COPY_OVERWRITE is specified and the target is a file, then 1509 * the %G_IO_ERROR_WOULD_RECURSE error may be returned (if the native 1510 * move operation isn't available). 1511 * 1512 * Params: 1513 * destination = #GFile pointing to the destination location 1514 * flags = set of #GFileCopyFlags 1515 * cancellable = optional #GCancellable object, 1516 * %NULL to ignore 1517 * progressCallback = #GFileProgressCallback 1518 * function for updates 1519 * progressCallbackData = gpointer to user data for 1520 * the callback function 1521 * 1522 * Returns: %TRUE on successful move, %FALSE otherwise. 1523 * 1524 * Throws: GException on failure. 1525 */ 1526 public bool move(FileIF destination, GFileCopyFlags flags, Cancellable cancellable, GFileProgressCallback progressCallback, void* progressCallbackData); 1527 1528 /** 1529 * Opens an existing file for reading and writing. The result is 1530 * a #GFileIOStream that can be used to read and write the contents 1531 * of the file. 1532 * 1533 * If @cancellable is not %NULL, then the operation can be cancelled 1534 * by triggering the cancellable object from another thread. If the 1535 * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be 1536 * returned. 1537 * 1538 * If the file does not exist, the %G_IO_ERROR_NOT_FOUND error will 1539 * be returned. If the file is a directory, the %G_IO_ERROR_IS_DIRECTORY 1540 * error will be returned. Other errors are possible too, and depend on 1541 * what kind of filesystem the file is on. Note that in many non-local 1542 * file cases read and write streams are not supported, so make sure you 1543 * really need to do read and write streaming, rather than just opening 1544 * for reading or writing. 1545 * 1546 * Params: 1547 * cancellable = a #GCancellable 1548 * 1549 * Returns: #GFileIOStream or %NULL on error. 1550 * Free the returned object with g_object_unref(). 1551 * 1552 * Since: 2.22 1553 * 1554 * Throws: GException on failure. 1555 */ 1556 public FileIOStream openReadwrite(Cancellable cancellable); 1557 1558 /** 1559 * Asynchronously opens @file for reading and writing. 1560 * 1561 * For more details, see g_file_open_readwrite() which is 1562 * the synchronous version of this call. 1563 * 1564 * When the operation is finished, @callback will be called. 1565 * You can then call g_file_open_readwrite_finish() to get 1566 * the result of the operation. 1567 * 1568 * Params: 1569 * ioPriority = the [I/O priority][io-priority] of the request 1570 * cancellable = optional #GCancellable object, 1571 * %NULL to ignore 1572 * callback = a #GAsyncReadyCallback to call 1573 * when the request is satisfied 1574 * userData = the data to pass to callback function 1575 * 1576 * Since: 2.22 1577 */ 1578 public void openReadwriteAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 1579 1580 /** 1581 * Finishes an asynchronous file read operation started with 1582 * g_file_open_readwrite_async(). 1583 * 1584 * Params: 1585 * res = a #GAsyncResult 1586 * 1587 * Returns: a #GFileIOStream or %NULL on error. 1588 * Free the returned object with g_object_unref(). 1589 * 1590 * Since: 2.22 1591 * 1592 * Throws: GException on failure. 1593 */ 1594 public FileIOStream openReadwriteFinish(AsyncResultIF res); 1595 1596 /** 1597 * Polls a file of type #G_FILE_TYPE_MOUNTABLE. 1598 * 1599 * If @cancellable is not %NULL, then the operation can be cancelled by 1600 * triggering the cancellable object from another thread. If the operation 1601 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1602 * 1603 * When the operation is finished, @callback will be called. 1604 * You can then call g_file_mount_mountable_finish() to get 1605 * the result of the operation. 1606 * 1607 * Params: 1608 * cancellable = optional #GCancellable object, %NULL to ignore 1609 * callback = a #GAsyncReadyCallback to call 1610 * when the request is satisfied, or %NULL 1611 * userData = the data to pass to callback function 1612 * 1613 * Since: 2.22 1614 */ 1615 public void pollMountable(Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 1616 1617 /** 1618 * Finishes a poll operation. See g_file_poll_mountable() for details. 1619 * 1620 * Finish an asynchronous poll operation that was polled 1621 * with g_file_poll_mountable(). 1622 * 1623 * Params: 1624 * result = a #GAsyncResult 1625 * 1626 * Returns: %TRUE if the operation finished successfully. %FALSE 1627 * otherwise. 1628 * 1629 * Since: 2.22 1630 * 1631 * Throws: GException on failure. 1632 */ 1633 public bool pollMountableFinish(AsyncResultIF result); 1634 1635 /** 1636 * Returns the #GAppInfo that is registered as the default 1637 * application to handle the file specified by @file. 1638 * 1639 * If @cancellable is not %NULL, then the operation can be cancelled by 1640 * triggering the cancellable object from another thread. If the operation 1641 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1642 * 1643 * Params: 1644 * cancellable = optional #GCancellable object, %NULL to ignore 1645 * 1646 * Returns: a #GAppInfo if the handle was found, 1647 * %NULL if there were errors. 1648 * When you are done with it, release it with g_object_unref() 1649 * 1650 * Throws: GException on failure. 1651 */ 1652 public AppInfoIF queryDefaultHandler(Cancellable cancellable); 1653 1654 /** 1655 * Utility function to check if a particular file exists. This is 1656 * implemented using g_file_query_info() and as such does blocking I/O. 1657 * 1658 * Note that in many cases it is racy to first check for file existence 1659 * and then execute something based on the outcome of that, because the 1660 * file might have been created or removed in between the operations. The 1661 * general approach to handling that is to not check, but just do the 1662 * operation and handle the errors as they come. 1663 * 1664 * As an example of race-free checking, take the case of reading a file, 1665 * and if it doesn't exist, creating it. There are two racy versions: read 1666 * it, and on error create it; and: check if it exists, if not create it. 1667 * These can both result in two processes creating the file (with perhaps 1668 * a partially written file as the result). The correct approach is to 1669 * always try to create the file with g_file_create() which will either 1670 * atomically create the file or fail with a %G_IO_ERROR_EXISTS error. 1671 * 1672 * However, in many cases an existence check is useful in a user interface, 1673 * for instance to make a menu item sensitive/insensitive, so that you don't 1674 * have to fool users that something is possible and then just show an error 1675 * dialog. If you do this, you should make sure to also handle the errors 1676 * that can happen due to races when you execute the operation. 1677 * 1678 * Params: 1679 * cancellable = optional #GCancellable object, 1680 * %NULL to ignore 1681 * 1682 * Returns: %TRUE if the file exists (and can be detected without error), 1683 * %FALSE otherwise (or if cancelled). 1684 */ 1685 public bool queryExists(Cancellable cancellable); 1686 1687 /** 1688 * Utility function to inspect the #GFileType of a file. This is 1689 * implemented using g_file_query_info() and as such does blocking I/O. 1690 * 1691 * The primary use case of this method is to check if a file is 1692 * a regular file, directory, or symlink. 1693 * 1694 * Params: 1695 * flags = a set of #GFileQueryInfoFlags passed to g_file_query_info() 1696 * cancellable = optional #GCancellable object, 1697 * %NULL to ignore 1698 * 1699 * Returns: The #GFileType of the file and #G_FILE_TYPE_UNKNOWN 1700 * if the file does not exist 1701 * 1702 * Since: 2.18 1703 */ 1704 public GFileType queryFileType(GFileQueryInfoFlags flags, Cancellable cancellable); 1705 1706 /** 1707 * Similar to g_file_query_info(), but obtains information 1708 * about the filesystem the @file is on, rather than the file itself. 1709 * For instance the amount of space available and the type of 1710 * the filesystem. 1711 * 1712 * The @attributes value is a string that specifies the attributes 1713 * that should be gathered. It is not an error if it's not possible 1714 * to read a particular requested attribute from a file - it just 1715 * won't be set. @attributes should be a comma-separated list of 1716 * attributes or attribute wildcards. The wildcard "*" means all 1717 * attributes, and a wildcard like "filesystem::*" means all attributes 1718 * in the filesystem namespace. The standard namespace for filesystem 1719 * attributes is "filesystem". Common attributes of interest are 1720 * #G_FILE_ATTRIBUTE_FILESYSTEM_SIZE (the total size of the filesystem 1721 * in bytes), #G_FILE_ATTRIBUTE_FILESYSTEM_FREE (number of bytes available), 1722 * and #G_FILE_ATTRIBUTE_FILESYSTEM_TYPE (type of the filesystem). 1723 * 1724 * If @cancellable is not %NULL, then the operation can be cancelled 1725 * by triggering the cancellable object from another thread. If the 1726 * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be 1727 * returned. 1728 * 1729 * If the file does not exist, the %G_IO_ERROR_NOT_FOUND error will 1730 * be returned. Other errors are possible too, and depend on what 1731 * kind of filesystem the file is on. 1732 * 1733 * Params: 1734 * attributes = an attribute query string 1735 * cancellable = optional #GCancellable object, 1736 * %NULL to ignore 1737 * 1738 * Returns: a #GFileInfo or %NULL if there was an error. 1739 * Free the returned object with g_object_unref(). 1740 * 1741 * Throws: GException on failure. 1742 */ 1743 public FileInfo queryFilesystemInfo(string attributes, Cancellable cancellable); 1744 1745 /** 1746 * Asynchronously gets the requested information about the filesystem 1747 * that the specified @file is on. The result is a #GFileInfo object 1748 * that contains key-value attributes (such as type or size for the 1749 * file). 1750 * 1751 * For more details, see g_file_query_filesystem_info() which is the 1752 * synchronous version of this call. 1753 * 1754 * When the operation is finished, @callback will be called. You can 1755 * then call g_file_query_info_finish() to get the result of the 1756 * operation. 1757 * 1758 * Params: 1759 * attributes = an attribute query string 1760 * ioPriority = the [I/O priority][io-priority] of the request 1761 * cancellable = optional #GCancellable object, 1762 * %NULL to ignore 1763 * callback = a #GAsyncReadyCallback to call 1764 * when the request is satisfied 1765 * userData = the data to pass to callback function 1766 */ 1767 public void queryFilesystemInfoAsync(string attributes, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 1768 1769 /** 1770 * Finishes an asynchronous filesystem info query. 1771 * See g_file_query_filesystem_info_async(). 1772 * 1773 * Params: 1774 * res = a #GAsyncResult 1775 * 1776 * Returns: #GFileInfo for given @file 1777 * or %NULL on error. 1778 * Free the returned object with g_object_unref(). 1779 * 1780 * Throws: GException on failure. 1781 */ 1782 public FileInfo queryFilesystemInfoFinish(AsyncResultIF res); 1783 1784 /** 1785 * Gets the requested information about specified @file. 1786 * The result is a #GFileInfo object that contains key-value 1787 * attributes (such as the type or size of the file). 1788 * 1789 * The @attributes value is a string that specifies the file 1790 * attributes that should be gathered. It is not an error if 1791 * it's not possible to read a particular requested attribute 1792 * from a file - it just won't be set. @attributes should be a 1793 * comma-separated list of attributes or attribute wildcards. 1794 * The wildcard "*" means all attributes, and a wildcard like 1795 * "standard::*" means all attributes in the standard namespace. 1796 * An example attribute query be "standard::*,owner::user". 1797 * The standard attributes are available as defines, like 1798 * #G_FILE_ATTRIBUTE_STANDARD_NAME. 1799 * 1800 * If @cancellable is not %NULL, then the operation can be cancelled 1801 * by triggering the cancellable object from another thread. If the 1802 * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be 1803 * returned. 1804 * 1805 * For symlinks, normally the information about the target of the 1806 * symlink is returned, rather than information about the symlink 1807 * itself. However if you pass #G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS 1808 * in @flags the information about the symlink itself will be returned. 1809 * Also, for symlinks that point to non-existing files the information 1810 * about the symlink itself will be returned. 1811 * 1812 * If the file does not exist, the %G_IO_ERROR_NOT_FOUND error will be 1813 * returned. Other errors are possible too, and depend on what kind of 1814 * filesystem the file is on. 1815 * 1816 * Params: 1817 * attributes = an attribute query string 1818 * flags = a set of #GFileQueryInfoFlags 1819 * cancellable = optional #GCancellable object, 1820 * %NULL to ignore 1821 * 1822 * Returns: a #GFileInfo for the given @file, or %NULL 1823 * on error. Free the returned object with g_object_unref(). 1824 * 1825 * Throws: GException on failure. 1826 */ 1827 public FileInfo queryInfo(string attributes, GFileQueryInfoFlags flags, Cancellable cancellable); 1828 1829 /** 1830 * Asynchronously gets the requested information about specified @file. 1831 * The result is a #GFileInfo object that contains key-value attributes 1832 * (such as type or size for the file). 1833 * 1834 * For more details, see g_file_query_info() which is the synchronous 1835 * version of this call. 1836 * 1837 * When the operation is finished, @callback will be called. You can 1838 * then call g_file_query_info_finish() to get the result of the operation. 1839 * 1840 * Params: 1841 * attributes = an attribute query string 1842 * flags = a set of #GFileQueryInfoFlags 1843 * ioPriority = the [I/O priority][io-priority] of the request 1844 * cancellable = optional #GCancellable object, 1845 * %NULL to ignore 1846 * callback = a #GAsyncReadyCallback to call when the 1847 * request is satisfied 1848 * userData = the data to pass to callback function 1849 */ 1850 public void queryInfoAsync(string attributes, GFileQueryInfoFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 1851 1852 /** 1853 * Finishes an asynchronous file info query. 1854 * See g_file_query_info_async(). 1855 * 1856 * Params: 1857 * res = a #GAsyncResult 1858 * 1859 * Returns: #GFileInfo for given @file 1860 * or %NULL on error. Free the returned object with 1861 * g_object_unref(). 1862 * 1863 * Throws: GException on failure. 1864 */ 1865 public FileInfo queryInfoFinish(AsyncResultIF res); 1866 1867 /** 1868 * Obtain the list of settable attributes for the file. 1869 * 1870 * Returns the type and full attribute name of all the attributes 1871 * that can be set on this file. This doesn't mean setting it will 1872 * always succeed though, you might get an access failure, or some 1873 * specific file may not support a specific attribute. 1874 * 1875 * If @cancellable is not %NULL, then the operation can be cancelled by 1876 * triggering the cancellable object from another thread. If the operation 1877 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1878 * 1879 * Params: 1880 * cancellable = optional #GCancellable object, 1881 * %NULL to ignore 1882 * 1883 * Returns: a #GFileAttributeInfoList describing the settable attributes. 1884 * When you are done with it, release it with 1885 * g_file_attribute_info_list_unref() 1886 * 1887 * Throws: GException on failure. 1888 */ 1889 public FileAttributeInfoList querySettableAttributes(Cancellable cancellable); 1890 1891 /** 1892 * Obtain the list of attribute namespaces where new attributes 1893 * can be created by a user. An example of this is extended 1894 * attributes (in the "xattr" namespace). 1895 * 1896 * If @cancellable is not %NULL, then the operation can be cancelled by 1897 * triggering the cancellable object from another thread. If the operation 1898 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1899 * 1900 * Params: 1901 * cancellable = optional #GCancellable object, 1902 * %NULL to ignore 1903 * 1904 * Returns: a #GFileAttributeInfoList describing the writable namespaces. 1905 * When you are done with it, release it with 1906 * g_file_attribute_info_list_unref() 1907 * 1908 * Throws: GException on failure. 1909 */ 1910 public FileAttributeInfoList queryWritableNamespaces(Cancellable cancellable); 1911 1912 /** 1913 * Opens a file for reading. The result is a #GFileInputStream that 1914 * can be used to read the contents of the file. 1915 * 1916 * If @cancellable is not %NULL, then the operation can be cancelled by 1917 * triggering the cancellable object from another thread. If the operation 1918 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1919 * 1920 * If the file does not exist, the %G_IO_ERROR_NOT_FOUND error will be 1921 * returned. If the file is a directory, the %G_IO_ERROR_IS_DIRECTORY 1922 * error will be returned. Other errors are possible too, and depend 1923 * on what kind of filesystem the file is on. 1924 * 1925 * Params: 1926 * cancellable = a #GCancellable 1927 * 1928 * Returns: #GFileInputStream or %NULL on error. 1929 * Free the returned object with g_object_unref(). 1930 * 1931 * Throws: GException on failure. 1932 */ 1933 public FileInputStream read(Cancellable cancellable); 1934 1935 /** 1936 * Asynchronously opens @file for reading. 1937 * 1938 * For more details, see g_file_read() which is 1939 * the synchronous version of this call. 1940 * 1941 * When the operation is finished, @callback will be called. 1942 * You can then call g_file_read_finish() to get the result 1943 * of the operation. 1944 * 1945 * Params: 1946 * ioPriority = the [I/O priority][io-priority] of the request 1947 * cancellable = optional #GCancellable object, 1948 * %NULL to ignore 1949 * callback = a #GAsyncReadyCallback to call 1950 * when the request is satisfied 1951 * userData = the data to pass to callback function 1952 */ 1953 public void readAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 1954 1955 /** 1956 * Finishes an asynchronous file read operation started with 1957 * g_file_read_async(). 1958 * 1959 * Params: 1960 * res = a #GAsyncResult 1961 * 1962 * Returns: a #GFileInputStream or %NULL on error. 1963 * Free the returned object with g_object_unref(). 1964 * 1965 * Throws: GException on failure. 1966 */ 1967 public FileInputStream readFinish(AsyncResultIF res); 1968 1969 /** 1970 * Returns an output stream for overwriting the file, possibly 1971 * creating a backup copy of the file first. If the file doesn't exist, 1972 * it will be created. 1973 * 1974 * This will try to replace the file in the safest way possible so 1975 * that any errors during the writing will not affect an already 1976 * existing copy of the file. For instance, for local files it 1977 * may write to a temporary file and then atomically rename over 1978 * the destination when the stream is closed. 1979 * 1980 * By default files created are generally readable by everyone, 1981 * but if you pass #G_FILE_CREATE_PRIVATE in @flags the file 1982 * will be made readable only to the current user, to the level that 1983 * is supported on the target filesystem. 1984 * 1985 * If @cancellable is not %NULL, then the operation can be cancelled 1986 * by triggering the cancellable object from another thread. If the 1987 * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be 1988 * returned. 1989 * 1990 * If you pass in a non-%NULL @etag value and @file already exists, then 1991 * this value is compared to the current entity tag of the file, and if 1992 * they differ an %G_IO_ERROR_WRONG_ETAG error is returned. This 1993 * generally means that the file has been changed since you last read 1994 * it. You can get the new etag from g_file_output_stream_get_etag() 1995 * after you've finished writing and closed the #GFileOutputStream. When 1996 * you load a new file you can use g_file_input_stream_query_info() to 1997 * get the etag of the file. 1998 * 1999 * If @make_backup is %TRUE, this function will attempt to make a 2000 * backup of the current file before overwriting it. If this fails 2001 * a %G_IO_ERROR_CANT_CREATE_BACKUP error will be returned. If you 2002 * want to replace anyway, try again with @make_backup set to %FALSE. 2003 * 2004 * If the file is a directory the %G_IO_ERROR_IS_DIRECTORY error will 2005 * be returned, and if the file is some other form of non-regular file 2006 * then a %G_IO_ERROR_NOT_REGULAR_FILE error will be returned. Some 2007 * file systems don't allow all file names, and may return an 2008 * %G_IO_ERROR_INVALID_FILENAME error, and if the name is to long 2009 * %G_IO_ERROR_FILENAME_TOO_LONG will be returned. Other errors are 2010 * possible too, and depend on what kind of filesystem the file is on. 2011 * 2012 * Params: 2013 * etag = an optional [entity tag][gfile-etag] 2014 * for the current #GFile, or #NULL to ignore 2015 * makeBackup = %TRUE if a backup should be created 2016 * flags = a set of #GFileCreateFlags 2017 * cancellable = optional #GCancellable object, 2018 * %NULL to ignore 2019 * 2020 * Returns: a #GFileOutputStream or %NULL on error. 2021 * Free the returned object with g_object_unref(). 2022 * 2023 * Throws: GException on failure. 2024 */ 2025 public FileOutputStream replace(string etag, bool makeBackup, GFileCreateFlags flags, Cancellable cancellable); 2026 2027 /** 2028 * Asynchronously overwrites the file, replacing the contents, 2029 * possibly creating a backup copy of the file first. 2030 * 2031 * For more details, see g_file_replace() which is 2032 * the synchronous version of this call. 2033 * 2034 * When the operation is finished, @callback will be called. 2035 * You can then call g_file_replace_finish() to get the result 2036 * of the operation. 2037 * 2038 * Params: 2039 * etag = an [entity tag][gfile-etag] for the current #GFile, 2040 * or %NULL to ignore 2041 * makeBackup = %TRUE if a backup should be created 2042 * flags = a set of #GFileCreateFlags 2043 * ioPriority = the [I/O priority][io-priority] of the request 2044 * cancellable = optional #GCancellable object, 2045 * %NULL to ignore 2046 * callback = a #GAsyncReadyCallback to call 2047 * when the request is satisfied 2048 * userData = the data to pass to callback function 2049 */ 2050 public void replaceAsync(string etag, bool makeBackup, GFileCreateFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 2051 2052 /** 2053 * Replaces the contents of @file with @contents of @length bytes. 2054 * 2055 * If @etag is specified (not %NULL), any existing file must have that etag, 2056 * or the error %G_IO_ERROR_WRONG_ETAG will be returned. 2057 * 2058 * If @make_backup is %TRUE, this function will attempt to make a backup 2059 * of @file. Internally, it uses g_file_replace(), so will try to replace the 2060 * file contents in the safest way possible. For example, atomic renames are 2061 * used when replacing local files’ contents. 2062 * 2063 * If @cancellable is not %NULL, then the operation can be cancelled by 2064 * triggering the cancellable object from another thread. If the operation 2065 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2066 * 2067 * The returned @new_etag can be used to verify that the file hasn't 2068 * changed the next time it is saved over. 2069 * 2070 * Params: 2071 * contents = a string containing the new contents for @file 2072 * etag = the old [entity-tag][gfile-etag] for the document, 2073 * or %NULL 2074 * makeBackup = %TRUE if a backup should be created 2075 * flags = a set of #GFileCreateFlags 2076 * newEtag = a location to a new [entity tag][gfile-etag] 2077 * for the document. This should be freed with g_free() when no longer 2078 * needed, or %NULL 2079 * cancellable = optional #GCancellable object, %NULL to ignore 2080 * 2081 * Returns: %TRUE if successful. If an error has occurred, this function 2082 * will return %FALSE and set @error appropriately if present. 2083 * 2084 * Throws: GException on failure. 2085 */ 2086 public bool replaceContents(string contents, string etag, bool makeBackup, GFileCreateFlags flags, out string newEtag, Cancellable cancellable); 2087 2088 /** 2089 * Starts an asynchronous replacement of @file with the given 2090 * @contents of @length bytes. @etag will replace the document's 2091 * current entity tag. 2092 * 2093 * When this operation has completed, @callback will be called with 2094 * @user_user data, and the operation can be finalized with 2095 * g_file_replace_contents_finish(). 2096 * 2097 * If @cancellable is not %NULL, then the operation can be cancelled by 2098 * triggering the cancellable object from another thread. If the operation 2099 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2100 * 2101 * If @make_backup is %TRUE, this function will attempt to 2102 * make a backup of @file. 2103 * 2104 * Note that no copy of @content will be made, so it must stay valid 2105 * until @callback is called. See g_file_replace_contents_bytes_async() 2106 * for a #GBytes version that will automatically hold a reference to the 2107 * contents (without copying) for the duration of the call. 2108 * 2109 * Params: 2110 * contents = string of contents to replace the file with 2111 * etag = a new [entity tag][gfile-etag] for the @file, or %NULL 2112 * makeBackup = %TRUE if a backup should be created 2113 * flags = a set of #GFileCreateFlags 2114 * cancellable = optional #GCancellable object, %NULL to ignore 2115 * callback = a #GAsyncReadyCallback to call when the request is satisfied 2116 * userData = the data to pass to callback function 2117 */ 2118 public void replaceContentsAsync(string contents, string etag, bool makeBackup, GFileCreateFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 2119 2120 /** 2121 * Same as g_file_replace_contents_async() but takes a #GBytes input instead. 2122 * This function will keep a ref on @contents until the operation is done. 2123 * Unlike g_file_replace_contents_async() this allows forgetting about the 2124 * content without waiting for the callback. 2125 * 2126 * When this operation has completed, @callback will be called with 2127 * @user_user data, and the operation can be finalized with 2128 * g_file_replace_contents_finish(). 2129 * 2130 * Params: 2131 * contents = a #GBytes 2132 * etag = a new [entity tag][gfile-etag] for the @file, or %NULL 2133 * makeBackup = %TRUE if a backup should be created 2134 * flags = a set of #GFileCreateFlags 2135 * cancellable = optional #GCancellable object, %NULL to ignore 2136 * callback = a #GAsyncReadyCallback to call when the request is satisfied 2137 * userData = the data to pass to callback function 2138 * 2139 * Since: 2.40 2140 */ 2141 public void replaceContentsBytesAsync(Bytes contents, string etag, bool makeBackup, GFileCreateFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 2142 2143 /** 2144 * Finishes an asynchronous replace of the given @file. See 2145 * g_file_replace_contents_async(). Sets @new_etag to the new entity 2146 * tag for the document, if present. 2147 * 2148 * Params: 2149 * res = a #GAsyncResult 2150 * newEtag = a location of a new [entity tag][gfile-etag] 2151 * for the document. This should be freed with g_free() when it is no 2152 * longer needed, or %NULL 2153 * 2154 * Returns: %TRUE on success, %FALSE on failure. 2155 * 2156 * Throws: GException on failure. 2157 */ 2158 public bool replaceContentsFinish(AsyncResultIF res, out string newEtag); 2159 2160 /** 2161 * Finishes an asynchronous file replace operation started with 2162 * g_file_replace_async(). 2163 * 2164 * Params: 2165 * res = a #GAsyncResult 2166 * 2167 * Returns: a #GFileOutputStream, or %NULL on error. 2168 * Free the returned object with g_object_unref(). 2169 * 2170 * Throws: GException on failure. 2171 */ 2172 public FileOutputStream replaceFinish(AsyncResultIF res); 2173 2174 /** 2175 * Returns an output stream for overwriting the file in readwrite mode, 2176 * possibly creating a backup copy of the file first. If the file doesn't 2177 * exist, it will be created. 2178 * 2179 * For details about the behaviour, see g_file_replace() which does the 2180 * same thing but returns an output stream only. 2181 * 2182 * Note that in many non-local file cases read and write streams are not 2183 * supported, so make sure you really need to do read and write streaming, 2184 * rather than just opening for reading or writing. 2185 * 2186 * Params: 2187 * etag = an optional [entity tag][gfile-etag] 2188 * for the current #GFile, or #NULL to ignore 2189 * makeBackup = %TRUE if a backup should be created 2190 * flags = a set of #GFileCreateFlags 2191 * cancellable = optional #GCancellable object, 2192 * %NULL to ignore 2193 * 2194 * Returns: a #GFileIOStream or %NULL on error. 2195 * Free the returned object with g_object_unref(). 2196 * 2197 * Since: 2.22 2198 * 2199 * Throws: GException on failure. 2200 */ 2201 public FileIOStream replaceReadwrite(string etag, bool makeBackup, GFileCreateFlags flags, Cancellable cancellable); 2202 2203 /** 2204 * Asynchronously overwrites the file in read-write mode, 2205 * replacing the contents, possibly creating a backup copy 2206 * of the file first. 2207 * 2208 * For more details, see g_file_replace_readwrite() which is 2209 * the synchronous version of this call. 2210 * 2211 * When the operation is finished, @callback will be called. 2212 * You can then call g_file_replace_readwrite_finish() to get 2213 * the result of the operation. 2214 * 2215 * Params: 2216 * etag = an [entity tag][gfile-etag] for the current #GFile, 2217 * or %NULL to ignore 2218 * makeBackup = %TRUE if a backup should be created 2219 * flags = a set of #GFileCreateFlags 2220 * ioPriority = the [I/O priority][io-priority] of the request 2221 * cancellable = optional #GCancellable object, 2222 * %NULL to ignore 2223 * callback = a #GAsyncReadyCallback to call 2224 * when the request is satisfied 2225 * userData = the data to pass to callback function 2226 * 2227 * Since: 2.22 2228 */ 2229 public void replaceReadwriteAsync(string etag, bool makeBackup, GFileCreateFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 2230 2231 /** 2232 * Finishes an asynchronous file replace operation started with 2233 * g_file_replace_readwrite_async(). 2234 * 2235 * Params: 2236 * res = a #GAsyncResult 2237 * 2238 * Returns: a #GFileIOStream, or %NULL on error. 2239 * Free the returned object with g_object_unref(). 2240 * 2241 * Since: 2.22 2242 * 2243 * Throws: GException on failure. 2244 */ 2245 public FileIOStream replaceReadwriteFinish(AsyncResultIF res); 2246 2247 /** 2248 * Resolves a relative path for @file to an absolute path. 2249 * 2250 * This call does no blocking I/O. 2251 * 2252 * Params: 2253 * relativePath = a given relative path string 2254 * 2255 * Returns: #GFile to the resolved path. 2256 * %NULL if @relative_path is %NULL or if @file is invalid. 2257 * Free the returned object with g_object_unref(). 2258 */ 2259 public FileIF resolveRelativePath(string relativePath); 2260 2261 /** 2262 * Sets an attribute in the file with attribute name @attribute to @value. 2263 * 2264 * Some attributes can be unset by setting @attribute to 2265 * %G_FILE_ATTRIBUTE_TYPE_INVALID and @value_p to %NULL. 2266 * 2267 * If @cancellable is not %NULL, then the operation can be cancelled by 2268 * triggering the cancellable object from another thread. If the operation 2269 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2270 * 2271 * Params: 2272 * attribute = a string containing the attribute's name 2273 * type = The type of the attribute 2274 * valueP = a pointer to the value (or the pointer 2275 * itself if the type is a pointer type) 2276 * flags = a set of #GFileQueryInfoFlags 2277 * cancellable = optional #GCancellable object, 2278 * %NULL to ignore 2279 * 2280 * Returns: %TRUE if the attribute was set, %FALSE otherwise. 2281 * 2282 * Throws: GException on failure. 2283 */ 2284 public bool setAttribute(string attribute, GFileAttributeType type, void* valueP, GFileQueryInfoFlags flags, Cancellable cancellable); 2285 2286 /** 2287 * Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_BYTE_STRING to @value. 2288 * If @attribute is of a different type, this operation will fail, 2289 * returning %FALSE. 2290 * 2291 * If @cancellable is not %NULL, then the operation can be cancelled by 2292 * triggering the cancellable object from another thread. If the operation 2293 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2294 * 2295 * Params: 2296 * attribute = a string containing the attribute's name 2297 * value = a string containing the attribute's new value 2298 * flags = a #GFileQueryInfoFlags 2299 * cancellable = optional #GCancellable object, 2300 * %NULL to ignore 2301 * 2302 * Returns: %TRUE if the @attribute was successfully set to @value 2303 * in the @file, %FALSE otherwise. 2304 * 2305 * Throws: GException on failure. 2306 */ 2307 public bool setAttributeByteString(string attribute, string value, GFileQueryInfoFlags flags, Cancellable cancellable); 2308 2309 /** 2310 * Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_INT32 to @value. 2311 * If @attribute is of a different type, this operation will fail. 2312 * 2313 * If @cancellable is not %NULL, then the operation can be cancelled by 2314 * triggering the cancellable object from another thread. If the operation 2315 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2316 * 2317 * Params: 2318 * attribute = a string containing the attribute's name 2319 * value = a #gint32 containing the attribute's new value 2320 * flags = a #GFileQueryInfoFlags 2321 * cancellable = optional #GCancellable object, 2322 * %NULL to ignore 2323 * 2324 * Returns: %TRUE if the @attribute was successfully set to @value 2325 * in the @file, %FALSE otherwise. 2326 * 2327 * Throws: GException on failure. 2328 */ 2329 public bool setAttributeInt32(string attribute, int value, GFileQueryInfoFlags flags, Cancellable cancellable); 2330 2331 /** 2332 * Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_INT64 to @value. 2333 * If @attribute is of a different type, this operation will fail. 2334 * 2335 * If @cancellable is not %NULL, then the operation can be cancelled by 2336 * triggering the cancellable object from another thread. If the operation 2337 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2338 * 2339 * Params: 2340 * attribute = a string containing the attribute's name 2341 * value = a #guint64 containing the attribute's new value 2342 * flags = a #GFileQueryInfoFlags 2343 * cancellable = optional #GCancellable object, 2344 * %NULL to ignore 2345 * 2346 * Returns: %TRUE if the @attribute was successfully set, %FALSE otherwise. 2347 * 2348 * Throws: GException on failure. 2349 */ 2350 public bool setAttributeInt64(string attribute, long value, GFileQueryInfoFlags flags, Cancellable cancellable); 2351 2352 /** 2353 * Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_STRING to @value. 2354 * If @attribute is of a different type, this operation will fail. 2355 * 2356 * If @cancellable is not %NULL, then the operation can be cancelled by 2357 * triggering the cancellable object from another thread. If the operation 2358 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2359 * 2360 * Params: 2361 * attribute = a string containing the attribute's name 2362 * value = a string containing the attribute's value 2363 * flags = #GFileQueryInfoFlags 2364 * cancellable = optional #GCancellable object, 2365 * %NULL to ignore 2366 * 2367 * Returns: %TRUE if the @attribute was successfully set, %FALSE otherwise. 2368 * 2369 * Throws: GException on failure. 2370 */ 2371 public bool setAttributeString(string attribute, string value, GFileQueryInfoFlags flags, Cancellable cancellable); 2372 2373 /** 2374 * Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_UINT32 to @value. 2375 * If @attribute is of a different type, this operation will fail. 2376 * 2377 * If @cancellable is not %NULL, then the operation can be cancelled by 2378 * triggering the cancellable object from another thread. If the operation 2379 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2380 * 2381 * Params: 2382 * attribute = a string containing the attribute's name 2383 * value = a #guint32 containing the attribute's new value 2384 * flags = a #GFileQueryInfoFlags 2385 * cancellable = optional #GCancellable object, 2386 * %NULL to ignore 2387 * 2388 * Returns: %TRUE if the @attribute was successfully set to @value 2389 * in the @file, %FALSE otherwise. 2390 * 2391 * Throws: GException on failure. 2392 */ 2393 public bool setAttributeUint32(string attribute, uint value, GFileQueryInfoFlags flags, Cancellable cancellable); 2394 2395 /** 2396 * Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_UINT64 to @value. 2397 * If @attribute is of a different type, this operation will fail. 2398 * 2399 * If @cancellable is not %NULL, then the operation can be cancelled by 2400 * triggering the cancellable object from another thread. If the operation 2401 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2402 * 2403 * Params: 2404 * attribute = a string containing the attribute's name 2405 * value = a #guint64 containing the attribute's new value 2406 * flags = a #GFileQueryInfoFlags 2407 * cancellable = optional #GCancellable object, 2408 * %NULL to ignore 2409 * 2410 * Returns: %TRUE if the @attribute was successfully set to @value 2411 * in the @file, %FALSE otherwise. 2412 * 2413 * Throws: GException on failure. 2414 */ 2415 public bool setAttributeUint64(string attribute, ulong value, GFileQueryInfoFlags flags, Cancellable cancellable); 2416 2417 /** 2418 * Asynchronously sets the attributes of @file with @info. 2419 * 2420 * For more details, see g_file_set_attributes_from_info(), 2421 * which is the synchronous version of this call. 2422 * 2423 * When the operation is finished, @callback will be called. 2424 * You can then call g_file_set_attributes_finish() to get 2425 * the result of the operation. 2426 * 2427 * Params: 2428 * info = a #GFileInfo 2429 * flags = a #GFileQueryInfoFlags 2430 * ioPriority = the [I/O priority][io-priority] of the request 2431 * cancellable = optional #GCancellable object, 2432 * %NULL to ignore 2433 * callback = a #GAsyncReadyCallback 2434 * userData = a #gpointer 2435 */ 2436 public void setAttributesAsync(FileInfo info, GFileQueryInfoFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 2437 2438 /** 2439 * Finishes setting an attribute started in g_file_set_attributes_async(). 2440 * 2441 * Params: 2442 * result = a #GAsyncResult 2443 * info = a #GFileInfo 2444 * 2445 * Returns: %TRUE if the attributes were set correctly, %FALSE otherwise. 2446 * 2447 * Throws: GException on failure. 2448 */ 2449 public bool setAttributesFinish(AsyncResultIF result, out FileInfo info); 2450 2451 /** 2452 * Tries to set all attributes in the #GFileInfo on the target 2453 * values, not stopping on the first error. 2454 * 2455 * If there is any error during this operation then @error will 2456 * be set to the first error. Error on particular fields are flagged 2457 * by setting the "status" field in the attribute value to 2458 * %G_FILE_ATTRIBUTE_STATUS_ERROR_SETTING, which means you can 2459 * also detect further errors. 2460 * 2461 * If @cancellable is not %NULL, then the operation can be cancelled by 2462 * triggering the cancellable object from another thread. If the operation 2463 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2464 * 2465 * Params: 2466 * info = a #GFileInfo 2467 * flags = #GFileQueryInfoFlags 2468 * cancellable = optional #GCancellable object, 2469 * %NULL to ignore 2470 * 2471 * Returns: %FALSE if there was any error, %TRUE otherwise. 2472 * 2473 * Throws: GException on failure. 2474 */ 2475 public bool setAttributesFromInfo(FileInfo info, GFileQueryInfoFlags flags, Cancellable cancellable); 2476 2477 /** 2478 * Renames @file to the specified display name. 2479 * 2480 * The display name is converted from UTF-8 to the correct encoding 2481 * for the target filesystem if possible and the @file is renamed to this. 2482 * 2483 * If you want to implement a rename operation in the user interface the 2484 * edit name (#G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME) should be used as the 2485 * initial value in the rename widget, and then the result after editing 2486 * should be passed to g_file_set_display_name(). 2487 * 2488 * On success the resulting converted filename is returned. 2489 * 2490 * If @cancellable is not %NULL, then the operation can be cancelled by 2491 * triggering the cancellable object from another thread. If the operation 2492 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2493 * 2494 * Params: 2495 * displayName = a string 2496 * cancellable = optional #GCancellable object, 2497 * %NULL to ignore 2498 * 2499 * Returns: a #GFile specifying what @file was renamed to, 2500 * or %NULL if there was an error. 2501 * Free the returned object with g_object_unref(). 2502 * 2503 * Throws: GException on failure. 2504 */ 2505 public FileIF setDisplayName(string displayName, Cancellable cancellable); 2506 2507 /** 2508 * Asynchronously sets the display name for a given #GFile. 2509 * 2510 * For more details, see g_file_set_display_name() which is 2511 * the synchronous version of this call. 2512 * 2513 * When the operation is finished, @callback will be called. 2514 * You can then call g_file_set_display_name_finish() to get 2515 * the result of the operation. 2516 * 2517 * Params: 2518 * displayName = a string 2519 * ioPriority = the [I/O priority][io-priority] of the request 2520 * cancellable = optional #GCancellable object, 2521 * %NULL to ignore 2522 * callback = a #GAsyncReadyCallback to call 2523 * when the request is satisfied 2524 * userData = the data to pass to callback function 2525 */ 2526 public void setDisplayNameAsync(string displayName, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 2527 2528 /** 2529 * Finishes setting a display name started with 2530 * g_file_set_display_name_async(). 2531 * 2532 * Params: 2533 * res = a #GAsyncResult 2534 * 2535 * Returns: a #GFile or %NULL on error. 2536 * Free the returned object with g_object_unref(). 2537 * 2538 * Throws: GException on failure. 2539 */ 2540 public FileIF setDisplayNameFinish(AsyncResultIF res); 2541 2542 /** 2543 * Starts a file of type #G_FILE_TYPE_MOUNTABLE. 2544 * Using @start_operation, you can request callbacks when, for instance, 2545 * passwords are needed during authentication. 2546 * 2547 * If @cancellable is not %NULL, then the operation can be cancelled by 2548 * triggering the cancellable object from another thread. If the operation 2549 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2550 * 2551 * When the operation is finished, @callback will be called. 2552 * You can then call g_file_mount_mountable_finish() to get 2553 * the result of the operation. 2554 * 2555 * Params: 2556 * flags = flags affecting the operation 2557 * startOperation = a #GMountOperation, or %NULL to avoid user interaction 2558 * cancellable = optional #GCancellable object, %NULL to ignore 2559 * callback = a #GAsyncReadyCallback to call when the request is satisfied, or %NULL 2560 * userData = the data to pass to callback function 2561 * 2562 * Since: 2.22 2563 */ 2564 public void startMountable(GDriveStartFlags flags, MountOperation startOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 2565 2566 /** 2567 * Finishes a start operation. See g_file_start_mountable() for details. 2568 * 2569 * Finish an asynchronous start operation that was started 2570 * with g_file_start_mountable(). 2571 * 2572 * Params: 2573 * result = a #GAsyncResult 2574 * 2575 * Returns: %TRUE if the operation finished successfully. %FALSE 2576 * otherwise. 2577 * 2578 * Since: 2.22 2579 * 2580 * Throws: GException on failure. 2581 */ 2582 public bool startMountableFinish(AsyncResultIF result); 2583 2584 /** 2585 * Stops a file of type #G_FILE_TYPE_MOUNTABLE. 2586 * 2587 * If @cancellable is not %NULL, then the operation can be cancelled by 2588 * triggering the cancellable object from another thread. If the operation 2589 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2590 * 2591 * When the operation is finished, @callback will be called. 2592 * You can then call g_file_stop_mountable_finish() to get 2593 * the result of the operation. 2594 * 2595 * Params: 2596 * flags = flags affecting the operation 2597 * mountOperation = a #GMountOperation, 2598 * or %NULL to avoid user interaction. 2599 * cancellable = optional #GCancellable object, 2600 * %NULL to ignore 2601 * callback = a #GAsyncReadyCallback to call 2602 * when the request is satisfied, or %NULL 2603 * userData = the data to pass to callback function 2604 * 2605 * Since: 2.22 2606 */ 2607 public void stopMountable(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 2608 2609 /** 2610 * Finishes an stop operation, see g_file_stop_mountable() for details. 2611 * 2612 * Finish an asynchronous stop operation that was started 2613 * with g_file_stop_mountable(). 2614 * 2615 * Params: 2616 * result = a #GAsyncResult 2617 * 2618 * Returns: %TRUE if the operation finished successfully. 2619 * %FALSE otherwise. 2620 * 2621 * Since: 2.22 2622 * 2623 * Throws: GException on failure. 2624 */ 2625 public bool stopMountableFinish(AsyncResultIF result); 2626 2627 /** 2628 * Checks if @file supports 2629 * [thread-default contexts][g-main-context-push-thread-default-context]. 2630 * If this returns %FALSE, you cannot perform asynchronous operations on 2631 * @file in a thread that has a thread-default context. 2632 * 2633 * Returns: Whether or not @file supports thread-default contexts. 2634 * 2635 * Since: 2.22 2636 */ 2637 public bool supportsThreadContexts(); 2638 2639 /** 2640 * Sends @file to the "Trashcan", if possible. This is similar to 2641 * deleting it, but the user can recover it before emptying the trashcan. 2642 * Not all file systems support trashing, so this call can return the 2643 * %G_IO_ERROR_NOT_SUPPORTED error. 2644 * 2645 * If @cancellable is not %NULL, then the operation can be cancelled by 2646 * triggering the cancellable object from another thread. If the operation 2647 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2648 * 2649 * Params: 2650 * cancellable = optional #GCancellable object, 2651 * %NULL to ignore 2652 * 2653 * Returns: %TRUE on successful trash, %FALSE otherwise. 2654 * 2655 * Throws: GException on failure. 2656 */ 2657 public bool trash(Cancellable cancellable); 2658 2659 /** 2660 * Asynchronously sends @file to the Trash location, if possible. 2661 * 2662 * Params: 2663 * ioPriority = the [I/O priority][io-priority] of the request 2664 * cancellable = optional #GCancellable object, 2665 * %NULL to ignore 2666 * callback = a #GAsyncReadyCallback to call 2667 * when the request is satisfied 2668 * userData = the data to pass to callback function 2669 * 2670 * Since: 2.38 2671 */ 2672 public void trashAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 2673 2674 /** 2675 * Finishes an asynchronous file trashing operation, started with 2676 * g_file_trash_async(). 2677 * 2678 * Params: 2679 * result = a #GAsyncResult 2680 * 2681 * Returns: %TRUE on successful trash, %FALSE otherwise. 2682 * 2683 * Since: 2.38 2684 * 2685 * Throws: GException on failure. 2686 */ 2687 public bool trashFinish(AsyncResultIF result); 2688 2689 /** 2690 * Unmounts a file of type G_FILE_TYPE_MOUNTABLE. 2691 * 2692 * If @cancellable is not %NULL, then the operation can be cancelled by 2693 * triggering the cancellable object from another thread. If the operation 2694 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2695 * 2696 * When the operation is finished, @callback will be called. 2697 * You can then call g_file_unmount_mountable_finish() to get 2698 * the result of the operation. 2699 * 2700 * Deprecated: Use g_file_unmount_mountable_with_operation() instead. 2701 * 2702 * Params: 2703 * flags = flags affecting the operation 2704 * cancellable = optional #GCancellable object, 2705 * %NULL to ignore 2706 * callback = a #GAsyncReadyCallback to call 2707 * when the request is satisfied, or %NULL 2708 * userData = the data to pass to callback function 2709 */ 2710 public void unmountMountable(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 2711 2712 /** 2713 * Finishes an unmount operation, see g_file_unmount_mountable() for details. 2714 * 2715 * Finish an asynchronous unmount operation that was started 2716 * with g_file_unmount_mountable(). 2717 * 2718 * Deprecated: Use g_file_unmount_mountable_with_operation_finish() 2719 * instead. 2720 * 2721 * Params: 2722 * result = a #GAsyncResult 2723 * 2724 * Returns: %TRUE if the operation finished successfully. 2725 * %FALSE otherwise. 2726 * 2727 * Throws: GException on failure. 2728 */ 2729 public bool unmountMountableFinish(AsyncResultIF result); 2730 2731 /** 2732 * Unmounts a file of type #G_FILE_TYPE_MOUNTABLE. 2733 * 2734 * If @cancellable is not %NULL, then the operation can be cancelled by 2735 * triggering the cancellable object from another thread. If the operation 2736 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2737 * 2738 * When the operation is finished, @callback will be called. 2739 * You can then call g_file_unmount_mountable_finish() to get 2740 * the result of the operation. 2741 * 2742 * Params: 2743 * flags = flags affecting the operation 2744 * mountOperation = a #GMountOperation, 2745 * or %NULL to avoid user interaction 2746 * cancellable = optional #GCancellable object, 2747 * %NULL to ignore 2748 * callback = a #GAsyncReadyCallback to call 2749 * when the request is satisfied, or %NULL 2750 * userData = the data to pass to callback function 2751 * 2752 * Since: 2.22 2753 */ 2754 public void unmountMountableWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 2755 2756 /** 2757 * Finishes an unmount operation, 2758 * see g_file_unmount_mountable_with_operation() for details. 2759 * 2760 * Finish an asynchronous unmount operation that was started 2761 * with g_file_unmount_mountable_with_operation(). 2762 * 2763 * Params: 2764 * result = a #GAsyncResult 2765 * 2766 * Returns: %TRUE if the operation finished successfully. 2767 * %FALSE otherwise. 2768 * 2769 * Since: 2.22 2770 * 2771 * Throws: GException on failure. 2772 */ 2773 public bool unmountMountableWithOperationFinish(AsyncResultIF result); 2774 }