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