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