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