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