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