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(bool transferOwnership = false); 138 139 /** the main Gtk struct as a void* */ 140 protected void* getStruct(); 141 142 143 /** 144 * Constructs a #GFile with the given @parse_name (i.e. something 145 * given by g_file_get_parse_name()). This operation never fails, 146 * but the returned object might not support any I/O operation if 147 * the @parse_name cannot be parsed. 148 * 149 * Params: 150 * parseName = a file name or path to be parsed 151 * 152 * Returns: a new #GFile. 153 */ 154 public static FileIF parseName(string parseName); 155 156 /** 157 * Gets an output stream for appending data to the file. 158 * If the file doesn't already exist it is created. 159 * 160 * By default files created are generally readable by everyone, 161 * but if you pass #G_FILE_CREATE_PRIVATE in @flags the file 162 * will be made readable only to the current user, to the level that 163 * is supported on the target filesystem. 164 * 165 * If @cancellable is not %NULL, then the operation can be cancelled 166 * by triggering the cancellable object from another thread. If the 167 * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be 168 * returned. 169 * 170 * Some file systems don't allow all file names, and may return an 171 * %G_IO_ERROR_INVALID_FILENAME error. If the file is a directory the 172 * %G_IO_ERROR_IS_DIRECTORY error will be returned. Other errors are 173 * possible too, and depend on what kind of filesystem the file is on. 174 * 175 * Params: 176 * flags = a set of #GFileCreateFlags 177 * cancellable = optional #GCancellable object, 178 * %NULL to ignore 179 * 180 * Returns: a #GFileOutputStream, or %NULL on error. 181 * Free the returned object with g_object_unref(). 182 * 183 * Throws: GException on failure. 184 */ 185 public FileOutputStream appendTo(GFileCreateFlags flags, Cancellable cancellable); 186 187 /** 188 * Asynchronously opens @file for appending. 189 * 190 * For more details, see g_file_append_to() which is 191 * the synchronous version of this call. 192 * 193 * When the operation is finished, @callback will be called. 194 * You can then call g_file_append_to_finish() to get the result 195 * of the operation. 196 * 197 * Params: 198 * flags = a set of #GFileCreateFlags 199 * ioPriority = the [I/O priority][io-priority] of the request 200 * cancellable = optional #GCancellable object, 201 * %NULL to ignore 202 * callback = a #GAsyncReadyCallback to call 203 * when the request is satisfied 204 * userData = the data to pass to callback function 205 */ 206 public void appendToAsync(GFileCreateFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 207 208 /** 209 * Finishes an asynchronous file append operation started with 210 * g_file_append_to_async(). 211 * 212 * Params: 213 * res = #GAsyncResult 214 * 215 * Returns: a valid #GFileOutputStream 216 * or %NULL on error. 217 * Free the returned object with g_object_unref(). 218 * 219 * Throws: GException on failure. 220 */ 221 public FileOutputStream appendToFinish(AsyncResultIF res); 222 223 /** 224 * Copies the file @source to the location specified by @destination. 225 * Can not handle recursive copies of directories. 226 * 227 * If the flag #G_FILE_COPY_OVERWRITE is specified an already 228 * existing @destination file is overwritten. 229 * 230 * If the flag #G_FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlinks 231 * will be copied as symlinks, otherwise the target of the 232 * @source symlink will be copied. 233 * 234 * If @cancellable is not %NULL, then the operation can be cancelled by 235 * triggering the cancellable object from another thread. If the operation 236 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 237 * 238 * If @progress_callback is not %NULL, then the operation can be monitored 239 * by setting this to a #GFileProgressCallback function. 240 * @progress_callback_data will be passed to this function. It is guaranteed 241 * that this callback will be called after all data has been transferred with 242 * the total number of bytes copied during the operation. 243 * 244 * If the @source file does not exist, then the %G_IO_ERROR_NOT_FOUND error 245 * is returned, independent on the status of the @destination. 246 * 247 * If #G_FILE_COPY_OVERWRITE is not specified and the target exists, then 248 * the error %G_IO_ERROR_EXISTS is returned. 249 * 250 * If trying to overwrite a file over a directory, the %G_IO_ERROR_IS_DIRECTORY 251 * error is returned. If trying to overwrite a directory with a directory the 252 * %G_IO_ERROR_WOULD_MERGE error is returned. 253 * 254 * If the source is a directory and the target does not exist, or 255 * #G_FILE_COPY_OVERWRITE is specified and the target is a file, then the 256 * %G_IO_ERROR_WOULD_RECURSE error is returned. 257 * 258 * If you are interested in copying the #GFile object itself (not the on-disk 259 * file), see g_file_dup(). 260 * 261 * Params: 262 * destination = destination #GFile 263 * flags = set of #GFileCopyFlags 264 * cancellable = optional #GCancellable object, 265 * %NULL to ignore 266 * progressCallback = function to callback with 267 * progress information, or %NULL if progress information is not needed 268 * progressCallbackData = user data to pass to @progress_callback 269 * 270 * Returns: %TRUE on success, %FALSE otherwise. 271 * 272 * Throws: GException on failure. 273 */ 274 public bool copy(FileIF destination, GFileCopyFlags flags, Cancellable cancellable, GFileProgressCallback progressCallback, void* progressCallbackData); 275 276 /** 277 * Copies the file @source to the location specified by @destination 278 * asynchronously. For details of the behaviour, see g_file_copy(). 279 * 280 * If @progress_callback is not %NULL, then that function that will be called 281 * just like in g_file_copy(). The callback will run in the default main context 282 * of the thread calling g_file_copy_async() — the same context as @callback is 283 * run in. 284 * 285 * When the operation is finished, @callback will be called. You can then call 286 * g_file_copy_finish() to get the result of the operation. 287 * 288 * Params: 289 * destination = destination #GFile 290 * flags = set of #GFileCopyFlags 291 * ioPriority = the [I/O priority][io-priority] of the request 292 * cancellable = optional #GCancellable object, 293 * %NULL to ignore 294 * progressCallback = function to callback with progress 295 * information, or %NULL if progress information is not needed 296 * progressCallbackData = user data to pass to @progress_callback 297 * callback = a #GAsyncReadyCallback to call when the request is satisfied 298 * userData = the data to pass to callback function 299 */ 300 public void copyAsync(FileIF destination, GFileCopyFlags flags, int ioPriority, Cancellable cancellable, GFileProgressCallback progressCallback, void* progressCallbackData, GAsyncReadyCallback callback, void* userData); 301 302 /** 303 * Copies the file attributes from @source to @destination. 304 * 305 * Normally only a subset of the file attributes are copied, 306 * those that are copies in a normal file copy operation 307 * (which for instance does not include e.g. owner). However 308 * if #G_FILE_COPY_ALL_METADATA is specified in @flags, then 309 * all the metadata that is possible to copy is copied. This 310 * is useful when implementing move by copy + delete source. 311 * 312 * Params: 313 * destination = a #GFile to copy attributes to 314 * flags = a set of #GFileCopyFlags 315 * cancellable = optional #GCancellable object, 316 * %NULL to ignore 317 * 318 * Returns: %TRUE if the attributes were copied successfully, 319 * %FALSE otherwise. 320 * 321 * Throws: GException on failure. 322 */ 323 public bool copyAttributes(FileIF destination, GFileCopyFlags flags, Cancellable cancellable); 324 325 /** 326 * Finishes copying the file started with g_file_copy_async(). 327 * 328 * Params: 329 * res = a #GAsyncResult 330 * 331 * Returns: a %TRUE on success, %FALSE on error. 332 * 333 * Throws: GException on failure. 334 */ 335 public bool copyFinish(AsyncResultIF res); 336 337 /** 338 * Creates a new file and returns an output stream for writing to it. 339 * The file must not already exist. 340 * 341 * By default files created are generally readable by everyone, 342 * but if you pass #G_FILE_CREATE_PRIVATE in @flags the file 343 * will be made readable only to the current user, to the level 344 * that is supported on the target filesystem. 345 * 346 * If @cancellable is not %NULL, then the operation can be cancelled 347 * by triggering the cancellable object from another thread. If the 348 * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be 349 * returned. 350 * 351 * If a file or directory with this name already exists the 352 * %G_IO_ERROR_EXISTS error will be returned. Some file systems don't 353 * allow all file names, and may return an %G_IO_ERROR_INVALID_FILENAME 354 * error, and if the name is to long %G_IO_ERROR_FILENAME_TOO_LONG will 355 * be returned. Other errors are possible too, and depend on what kind 356 * of filesystem the file is on. 357 * 358 * Params: 359 * flags = a set of #GFileCreateFlags 360 * cancellable = optional #GCancellable object, 361 * %NULL to ignore 362 * 363 * Returns: a #GFileOutputStream for the newly created 364 * file, or %NULL on error. 365 * Free the returned object with g_object_unref(). 366 * 367 * Throws: GException on failure. 368 */ 369 public FileOutputStream create(GFileCreateFlags flags, Cancellable cancellable); 370 371 /** 372 * Asynchronously creates a new file and returns an output stream 373 * for writing to it. The file must not already exist. 374 * 375 * For more details, see g_file_create() which is 376 * the synchronous version of this call. 377 * 378 * When the operation is finished, @callback will be called. 379 * You can then call g_file_create_finish() to get the result 380 * of the operation. 381 * 382 * Params: 383 * flags = a set of #GFileCreateFlags 384 * ioPriority = the [I/O priority][io-priority] of the request 385 * cancellable = optional #GCancellable object, 386 * %NULL to ignore 387 * callback = a #GAsyncReadyCallback to call 388 * when the request is satisfied 389 * userData = the data to pass to callback function 390 */ 391 public void createAsync(GFileCreateFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 392 393 /** 394 * Finishes an asynchronous file create operation started with 395 * g_file_create_async(). 396 * 397 * Params: 398 * res = a #GAsyncResult 399 * 400 * Returns: a #GFileOutputStream or %NULL on error. 401 * Free the returned object with g_object_unref(). 402 * 403 * Throws: GException on failure. 404 */ 405 public FileOutputStream createFinish(AsyncResultIF res); 406 407 /** 408 * Creates a new file and returns a stream for reading and 409 * writing to it. The file must not already exist. 410 * 411 * By default files created are generally readable by everyone, 412 * but if you pass #G_FILE_CREATE_PRIVATE in @flags the file 413 * will be made readable only to the current user, to the level 414 * that is supported on the target filesystem. 415 * 416 * If @cancellable is not %NULL, then the operation can be cancelled 417 * by triggering the cancellable object from another thread. If the 418 * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be 419 * returned. 420 * 421 * If a file or directory with this name already exists, the 422 * %G_IO_ERROR_EXISTS error will be returned. Some file systems don't 423 * allow all file names, and may return an %G_IO_ERROR_INVALID_FILENAME 424 * error, and if the name is too long, %G_IO_ERROR_FILENAME_TOO_LONG 425 * will be returned. Other errors are possible too, and depend on what 426 * kind of filesystem the file is on. 427 * 428 * Note that in many non-local file cases read and write streams are 429 * not supported, so make sure you really need to do read and write 430 * streaming, rather than just opening for reading or writing. 431 * 432 * Params: 433 * flags = a set of #GFileCreateFlags 434 * cancellable = optional #GCancellable object, 435 * %NULL to ignore 436 * 437 * Returns: a #GFileIOStream for the newly created 438 * file, or %NULL on error. 439 * Free the returned object with g_object_unref(). 440 * 441 * Since: 2.22 442 * 443 * Throws: GException on failure. 444 */ 445 public FileIOStream createReadwrite(GFileCreateFlags flags, Cancellable cancellable); 446 447 /** 448 * Asynchronously creates a new file and returns a stream 449 * for reading and writing to it. The file must not already exist. 450 * 451 * For more details, see g_file_create_readwrite() which is 452 * the synchronous version of this call. 453 * 454 * When the operation is finished, @callback will be called. 455 * You can then call g_file_create_readwrite_finish() to get 456 * the result of the operation. 457 * 458 * Params: 459 * flags = a set of #GFileCreateFlags 460 * ioPriority = the [I/O priority][io-priority] of the request 461 * cancellable = optional #GCancellable object, 462 * %NULL to ignore 463 * callback = a #GAsyncReadyCallback to call 464 * when the request is satisfied 465 * userData = the data to pass to callback function 466 * 467 * Since: 2.22 468 */ 469 public void createReadwriteAsync(GFileCreateFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 470 471 /** 472 * Finishes an asynchronous file create operation started with 473 * g_file_create_readwrite_async(). 474 * 475 * Params: 476 * res = a #GAsyncResult 477 * 478 * Returns: a #GFileIOStream or %NULL on error. 479 * Free the returned object with g_object_unref(). 480 * 481 * Since: 2.22 482 * 483 * Throws: GException on failure. 484 */ 485 public FileIOStream createReadwriteFinish(AsyncResultIF res); 486 487 /** 488 * Deletes a file. If the @file is a directory, it will only be 489 * deleted if it is empty. This has the same semantics as g_unlink(). 490 * 491 * If @cancellable is not %NULL, then the operation can be cancelled by 492 * triggering the cancellable object from another thread. If the operation 493 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 494 * 495 * Params: 496 * cancellable = optional #GCancellable object, 497 * %NULL to ignore 498 * 499 * Returns: %TRUE if the file was deleted. %FALSE otherwise. 500 * 501 * Throws: GException on failure. 502 */ 503 public bool delet(Cancellable cancellable); 504 505 /** 506 * Asynchronously delete a file. If the @file is a directory, it will 507 * only be deleted if it is empty. This has the same semantics as 508 * g_unlink(). 509 * 510 * Params: 511 * ioPriority = the [I/O priority][io-priority] of the request 512 * cancellable = optional #GCancellable object, 513 * %NULL to ignore 514 * callback = a #GAsyncReadyCallback to call 515 * when the request is satisfied 516 * userData = the data to pass to callback function 517 * 518 * Since: 2.34 519 */ 520 public void deleteAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 521 522 /** 523 * Finishes deleting a file started with g_file_delete_async(). 524 * 525 * Params: 526 * result = a #GAsyncResult 527 * 528 * Returns: %TRUE if the file was deleted. %FALSE otherwise. 529 * 530 * Since: 2.34 531 * 532 * Throws: GException on failure. 533 */ 534 public bool deleteFinish(AsyncResultIF result); 535 536 /** 537 * Duplicates a #GFile handle. This operation does not duplicate 538 * the actual file or directory represented by the #GFile; see 539 * g_file_copy() if attempting to copy a file. 540 * 541 * This call does no blocking I/O. 542 * 543 * Returns: a new #GFile that is a duplicate 544 * of the given #GFile. 545 */ 546 public FileIF dup(); 547 548 /** 549 * Starts an asynchronous eject on a mountable. 550 * When this operation has completed, @callback will be called with 551 * @user_user data, and the operation can be finalized with 552 * g_file_eject_mountable_finish(). 553 * 554 * If @cancellable is not %NULL, then the operation can be cancelled by 555 * triggering the cancellable object from another thread. If the operation 556 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 557 * 558 * Deprecated: Use g_file_eject_mountable_with_operation() instead. 559 * 560 * Params: 561 * flags = flags affecting the operation 562 * cancellable = optional #GCancellable object, 563 * %NULL to ignore 564 * callback = a #GAsyncReadyCallback to call 565 * when the request is satisfied, or %NULL 566 * userData = the data to pass to callback function 567 */ 568 public void ejectMountable(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 569 570 /** 571 * Finishes an asynchronous eject operation started by 572 * g_file_eject_mountable(). 573 * 574 * Deprecated: Use g_file_eject_mountable_with_operation_finish() 575 * instead. 576 * 577 * Params: 578 * result = a #GAsyncResult 579 * 580 * Returns: %TRUE if the @file was ejected successfully. 581 * %FALSE otherwise. 582 * 583 * Throws: GException on failure. 584 */ 585 public bool ejectMountableFinish(AsyncResultIF result); 586 587 /** 588 * Starts an asynchronous eject on a mountable. 589 * When this operation has completed, @callback will be called with 590 * @user_user data, and the operation can be finalized with 591 * g_file_eject_mountable_with_operation_finish(). 592 * 593 * If @cancellable is not %NULL, then the operation can be cancelled by 594 * triggering the cancellable object from another thread. If the operation 595 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 596 * 597 * Params: 598 * flags = flags affecting the operation 599 * mountOperation = a #GMountOperation, 600 * or %NULL to avoid user interaction 601 * cancellable = optional #GCancellable object, 602 * %NULL to ignore 603 * callback = a #GAsyncReadyCallback to call 604 * when the request is satisfied, or %NULL 605 * userData = the data to pass to callback function 606 * 607 * Since: 2.22 608 */ 609 public void ejectMountableWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 610 611 /** 612 * Finishes an asynchronous eject operation started by 613 * g_file_eject_mountable_with_operation(). 614 * 615 * Params: 616 * result = a #GAsyncResult 617 * 618 * Returns: %TRUE if the @file was ejected successfully. 619 * %FALSE otherwise. 620 * 621 * Since: 2.22 622 * 623 * Throws: GException on failure. 624 */ 625 public bool ejectMountableWithOperationFinish(AsyncResultIF result); 626 627 /** 628 * Gets the requested information about the files in a directory. 629 * The result is a #GFileEnumerator object that will give out 630 * #GFileInfo objects for all the files in the directory. 631 * 632 * The @attributes value is a string that specifies the file 633 * attributes that should be gathered. It is not an error if 634 * it's not possible to read a particular requested attribute 635 * from a file - it just won't be set. @attributes should 636 * be a comma-separated list of attributes or attribute wildcards. 637 * The wildcard "*" means all attributes, and a wildcard like 638 * "standard::*" means all attributes in the standard namespace. 639 * An example attribute query be "standard::*,owner::user". 640 * The standard attributes are available as defines, like 641 * #G_FILE_ATTRIBUTE_STANDARD_NAME. 642 * 643 * If @cancellable is not %NULL, then the operation can be cancelled 644 * by triggering the cancellable object from another thread. If the 645 * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be 646 * returned. 647 * 648 * If the file does not exist, the %G_IO_ERROR_NOT_FOUND error will 649 * be returned. If the file is not a directory, the %G_IO_ERROR_NOT_DIRECTORY 650 * error will be returned. Other errors are possible too. 651 * 652 * Params: 653 * attributes = an attribute query string 654 * flags = a set of #GFileQueryInfoFlags 655 * cancellable = optional #GCancellable object, 656 * %NULL to ignore 657 * 658 * Returns: A #GFileEnumerator if successful, 659 * %NULL on error. Free the returned object with g_object_unref(). 660 * 661 * Throws: GException on failure. 662 */ 663 public FileEnumerator enumerateChildren(string attributes, GFileQueryInfoFlags flags, Cancellable cancellable); 664 665 /** 666 * Asynchronously gets the requested information about the files 667 * in a directory. The result is a #GFileEnumerator object that will 668 * give out #GFileInfo objects for all the files in the directory. 669 * 670 * For more details, see g_file_enumerate_children() which is 671 * the synchronous version of this call. 672 * 673 * When the operation is finished, @callback will be called. You can 674 * then call g_file_enumerate_children_finish() to get the result of 675 * the operation. 676 * 677 * Params: 678 * attributes = an attribute query string 679 * flags = a set of #GFileQueryInfoFlags 680 * ioPriority = the [I/O priority][io-priority] of the request 681 * cancellable = optional #GCancellable object, 682 * %NULL to ignore 683 * callback = a #GAsyncReadyCallback to call when the 684 * request is satisfied 685 * userData = the data to pass to callback function 686 */ 687 public void enumerateChildrenAsync(string attributes, GFileQueryInfoFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 688 689 /** 690 * Finishes an async enumerate children operation. 691 * See g_file_enumerate_children_async(). 692 * 693 * Params: 694 * res = a #GAsyncResult 695 * 696 * Returns: a #GFileEnumerator or %NULL 697 * if an error occurred. 698 * Free the returned object with g_object_unref(). 699 * 700 * Throws: GException on failure. 701 */ 702 public FileEnumerator enumerateChildrenFinish(AsyncResultIF res); 703 704 /** 705 * Checks if the two given #GFiles refer to the same file. 706 * 707 * Note that two #GFiles that differ can still refer to the same 708 * file on the filesystem due to various forms of filename 709 * aliasing. 710 * 711 * This call does no blocking I/O. 712 * 713 * Params: 714 * file2 = the second #GFile 715 * 716 * Returns: %TRUE if @file1 and @file2 are equal. 717 */ 718 public bool equal(FileIF file2); 719 720 /** 721 * Gets a #GMount for the #GFile. 722 * 723 * If the #GFileIface for @file does not have a mount (e.g. 724 * possibly a remote share), @error will be set to %G_IO_ERROR_NOT_FOUND 725 * and %NULL will be returned. 726 * 727 * If @cancellable is not %NULL, then the operation can be cancelled by 728 * triggering the cancellable object from another thread. If the operation 729 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 730 * 731 * Params: 732 * cancellable = optional #GCancellable object, 733 * %NULL to ignore 734 * 735 * Returns: a #GMount where the @file is located 736 * or %NULL on error. 737 * Free the returned object with g_object_unref(). 738 * 739 * Throws: GException on failure. 740 */ 741 public MountIF findEnclosingMount(Cancellable cancellable); 742 743 /** 744 * Asynchronously gets the mount for the file. 745 * 746 * For more details, see g_file_find_enclosing_mount() which is 747 * the synchronous version of this call. 748 * 749 * When the operation is finished, @callback will be called. 750 * You can then call g_file_find_enclosing_mount_finish() to 751 * get the result of the operation. 752 * 753 * Params: 754 * ioPriority = the [I/O priority][io-priority] of the request 755 * cancellable = optional #GCancellable object, 756 * %NULL to ignore 757 * callback = a #GAsyncReadyCallback to call 758 * when the request is satisfied 759 * userData = the data to pass to callback function 760 */ 761 public void findEnclosingMountAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 762 763 /** 764 * Finishes an asynchronous find mount request. 765 * See g_file_find_enclosing_mount_async(). 766 * 767 * Params: 768 * res = a #GAsyncResult 769 * 770 * Returns: #GMount for given @file or %NULL on error. 771 * Free the returned object with g_object_unref(). 772 * 773 * Throws: GException on failure. 774 */ 775 public MountIF findEnclosingMountFinish(AsyncResultIF res); 776 777 /** 778 * Gets the base name (the last component of the path) for a given #GFile. 779 * 780 * If called for the top level of a system (such as the filesystem root 781 * or a uri like sftp://host/) it will return a single directory separator 782 * (and on Windows, possibly a drive letter). 783 * 784 * The base name is a byte string (not UTF-8). It has no defined encoding 785 * or rules other than it may not contain zero bytes. If you want to use 786 * filenames in a user interface you should use the display name that you 787 * can get by requesting the %G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME 788 * attribute with g_file_query_info(). 789 * 790 * This call does no blocking I/O. 791 * 792 * Returns: string containing the #GFile's 793 * base name, or %NULL if given #GFile is invalid. The returned string 794 * should be freed with g_free() when no longer needed. 795 */ 796 public string getBasename(); 797 798 /** 799 * Gets a child of @file with basename equal to @name. 800 * 801 * Note that the file with that specific name might not exist, but 802 * you can still have a #GFile that points to it. You can use this 803 * for instance to create that file. 804 * 805 * This call does no blocking I/O. 806 * 807 * Params: 808 * name = string containing the child's basename 809 * 810 * Returns: a #GFile to a child specified by @name. 811 * Free the returned object with g_object_unref(). 812 */ 813 public FileIF getChild(string name); 814 815 /** 816 * Gets the child of @file for a given @display_name (i.e. a UTF-8 817 * version of the name). If this function fails, it returns %NULL 818 * and @error will be set. This is very useful when constructing a 819 * #GFile for a new file and the user entered the filename in the 820 * user interface, for instance when you select a directory and 821 * type a filename in the file selector. 822 * 823 * This call does no blocking I/O. 824 * 825 * Params: 826 * displayName = string to a possible child 827 * 828 * Returns: a #GFile to the specified child, or 829 * %NULL if the display name couldn't be converted. 830 * Free the returned object with g_object_unref(). 831 * 832 * Throws: GException on failure. 833 */ 834 public FileIF getChildForDisplayName(string displayName); 835 836 /** 837 * Gets the parent directory for the @file. 838 * If the @file represents the root directory of the 839 * file system, then %NULL will be returned. 840 * 841 * This call does no blocking I/O. 842 * 843 * Returns: a #GFile structure to the 844 * parent of the given #GFile or %NULL if there is no parent. Free 845 * the returned object with g_object_unref(). 846 */ 847 public FileIF getParent(); 848 849 /** 850 * Gets the parse name of the @file. 851 * A parse name is a UTF-8 string that describes the 852 * file such that one can get the #GFile back using 853 * g_file_parse_name(). 854 * 855 * This is generally used to show the #GFile as a nice 856 * full-pathname kind of string in a user interface, 857 * like in a location entry. 858 * 859 * For local files with names that can safely be converted 860 * to UTF-8 the pathname is used, otherwise the IRI is used 861 * (a form of URI that allows UTF-8 characters unescaped). 862 * 863 * This call does no blocking I/O. 864 * 865 * Returns: a string containing the #GFile's parse name. 866 * The returned string should be freed with g_free() 867 * when no longer needed. 868 */ 869 public string getParseName(); 870 871 /** 872 * Gets the local pathname for #GFile, if one exists. If non-%NULL, this is 873 * guaranteed to be an absolute, canonical path. It might contain symlinks. 874 * 875 * This call does no blocking I/O. 876 * 877 * Returns: string containing the #GFile's path, 878 * or %NULL if no such path exists. The returned string should be freed 879 * with g_free() when no longer needed. 880 */ 881 public string getPath(); 882 883 /** 884 * Gets the path for @descendant relative to @parent. 885 * 886 * This call does no blocking I/O. 887 * 888 * Params: 889 * descendant = input #GFile 890 * 891 * Returns: string with the relative path from 892 * @descendant to @parent, or %NULL if @descendant doesn't have @parent as 893 * prefix. The returned string should be freed with g_free() when 894 * no longer needed. 895 */ 896 public string getRelativePath(FileIF descendant); 897 898 /** 899 * Gets the URI for the @file. 900 * 901 * This call does no blocking I/O. 902 * 903 * Returns: a string containing the #GFile's URI. 904 * The returned string should be freed with g_free() 905 * when no longer needed. 906 */ 907 public string getUri(); 908 909 /** 910 * Gets the URI scheme for a #GFile. 911 * RFC 3986 decodes the scheme as: 912 * |[ 913 * URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] 914 * ]| 915 * Common schemes include "file", "http", "ftp", etc. 916 * 917 * This call does no blocking I/O. 918 * 919 * Returns: a string containing the URI scheme for the given 920 * #GFile. The returned string should be freed with g_free() 921 * when no longer needed. 922 */ 923 public string getUriScheme(); 924 925 /** 926 * Checks if @file has a parent, and optionally, if it is @parent. 927 * 928 * If @parent is %NULL then this function returns %TRUE if @file has any 929 * parent at all. If @parent is non-%NULL then %TRUE is only returned 930 * if @file is an immediate child of @parent. 931 * 932 * Params: 933 * parent = the parent to check for, or %NULL 934 * 935 * Returns: %TRUE if @file is an immediate child of @parent (or any parent in 936 * the case that @parent is %NULL). 937 * 938 * Since: 2.24 939 */ 940 public bool hasParent(FileIF parent); 941 942 /** 943 * Checks whether @file has the prefix specified by @prefix. 944 * 945 * In other words, if the names of initial elements of @file's 946 * pathname match @prefix. Only full pathname elements are matched, 947 * so a path like /foo is not considered a prefix of /foobar, only 948 * of /foo/bar. 949 * 950 * A #GFile is not a prefix of itself. If you want to check for 951 * equality, use g_file_equal(). 952 * 953 * This call does no I/O, as it works purely on names. As such it can 954 * sometimes return %FALSE even if @file is inside a @prefix (from a 955 * filesystem point of view), because the prefix of @file is an alias 956 * of @prefix. 957 * 958 * Params: 959 * prefix = input #GFile 960 * 961 * Returns: %TRUE if the @files's parent, grandparent, etc is @prefix, 962 * %FALSE otherwise. 963 */ 964 public bool hasPrefix(FileIF prefix); 965 966 /** 967 * Checks to see if a #GFile has a given URI scheme. 968 * 969 * This call does no blocking I/O. 970 * 971 * Params: 972 * uriScheme = a string containing a URI scheme 973 * 974 * Returns: %TRUE if #GFile's backend supports the 975 * given URI scheme, %FALSE if URI scheme is %NULL, 976 * not supported, or #GFile is invalid. 977 */ 978 public bool hasUriScheme(string uriScheme); 979 980 /** 981 * Creates a hash value for a #GFile. 982 * 983 * This call does no blocking I/O. 984 * 985 * Returns: 0 if @file is not a valid #GFile, otherwise an 986 * integer that can be used as hash value for the #GFile. 987 * This function is intended for easily hashing a #GFile to 988 * add to a #GHashTable or similar data structure. 989 */ 990 public uint hash(); 991 992 /** 993 * Checks to see if a file is native to the platform. 994 * 995 * A native file s one expressed in the platform-native filename format, 996 * e.g. "C:\Windows" or "/usr/bin/". This does not mean the file is local, 997 * as it might be on a locally mounted remote filesystem. 998 * 999 * On some systems non-native files may be available using the native 1000 * filesystem via a userspace filesystem (FUSE), in these cases this call 1001 * will return %FALSE, but g_file_get_path() will still return a native path. 1002 * 1003 * This call does no blocking I/O. 1004 * 1005 * Returns: %TRUE if @file is native 1006 */ 1007 public bool isNative(); 1008 1009 /** 1010 * Loads the content of the file into memory. The data is always 1011 * zero-terminated, but this is not included in the resultant @length. 1012 * The returned @content should be freed with g_free() when no longer 1013 * needed. 1014 * 1015 * If @cancellable is not %NULL, then the operation can be cancelled by 1016 * triggering the cancellable object from another thread. If the operation 1017 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1018 * 1019 * Params: 1020 * cancellable = optional #GCancellable object, %NULL to ignore 1021 * contents = a location to place the contents of the file 1022 * length = a location to place the length of the contents of the file, 1023 * or %NULL if the length is not needed 1024 * etagOut = a location to place the current entity tag for the file, 1025 * or %NULL if the entity tag is not needed 1026 * 1027 * Returns: %TRUE if the @file's contents were successfully loaded. 1028 * %FALSE if there were errors. 1029 * 1030 * Throws: GException on failure. 1031 */ 1032 public bool loadContents(Cancellable cancellable, out string contents, out string etagOut); 1033 1034 /** 1035 * Starts an asynchronous load of the @file's contents. 1036 * 1037 * For more details, see g_file_load_contents() which is 1038 * the synchronous version of this call. 1039 * 1040 * When the load operation has completed, @callback will be called 1041 * with @user data. To finish the operation, call 1042 * g_file_load_contents_finish() with the #GAsyncResult returned by 1043 * the @callback. 1044 * 1045 * If @cancellable is not %NULL, then the operation can be cancelled by 1046 * triggering the cancellable object from another thread. If the operation 1047 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1048 * 1049 * Params: 1050 * cancellable = optional #GCancellable object, %NULL to ignore 1051 * callback = a #GAsyncReadyCallback to call when the request is satisfied 1052 * userData = the data to pass to callback function 1053 */ 1054 public void loadContentsAsync(Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 1055 1056 /** 1057 * Finishes an asynchronous load of the @file's contents. 1058 * The contents are placed in @contents, and @length is set to the 1059 * size of the @contents string. The @content should be freed with 1060 * g_free() when no longer needed. If @etag_out is present, it will be 1061 * set to the new entity tag for the @file. 1062 * 1063 * Params: 1064 * res = a #GAsyncResult 1065 * contents = a location to place the contents of the file 1066 * length = a location to place the length of the contents of the file, 1067 * or %NULL if the length is not needed 1068 * etagOut = a location to place the current entity tag for the file, 1069 * or %NULL if the entity tag is not needed 1070 * 1071 * Returns: %TRUE if the load was successful. If %FALSE and @error is 1072 * present, it will be set appropriately. 1073 * 1074 * Throws: GException on failure. 1075 */ 1076 public bool loadContentsFinish(AsyncResultIF res, out string contents, out string etagOut); 1077 1078 /** 1079 * Reads the partial contents of a file. A #GFileReadMoreCallback should 1080 * be used to stop reading from the file when appropriate, else this 1081 * function will behave exactly as g_file_load_contents_async(). This 1082 * operation can be finished by g_file_load_partial_contents_finish(). 1083 * 1084 * Users of this function should be aware that @user_data is passed to 1085 * both the @read_more_callback and the @callback. 1086 * 1087 * If @cancellable is not %NULL, then the operation can be cancelled by 1088 * triggering the cancellable object from another thread. If the operation 1089 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1090 * 1091 * Params: 1092 * cancellable = optional #GCancellable object, %NULL to ignore 1093 * readMoreCallback = a #GFileReadMoreCallback to receive partial data 1094 * and to specify whether further data should be read 1095 * callback = a #GAsyncReadyCallback to call when the request is satisfied 1096 * userData = the data to pass to the callback functions 1097 */ 1098 public void loadPartialContentsAsync(Cancellable cancellable, GFileReadMoreCallback readMoreCallback, GAsyncReadyCallback callback, void* userData); 1099 1100 /** 1101 * Finishes an asynchronous partial load operation that was started 1102 * with g_file_load_partial_contents_async(). The data is always 1103 * zero-terminated, but this is not included in the resultant @length. 1104 * The returned @content should be freed with g_free() when no longer 1105 * needed. 1106 * 1107 * Params: 1108 * res = a #GAsyncResult 1109 * contents = a location to place the contents of the file 1110 * length = a location to place the length of the contents of the file, 1111 * or %NULL if the length is not needed 1112 * etagOut = a location to place the current entity tag for the file, 1113 * or %NULL if the entity tag is not needed 1114 * 1115 * Returns: %TRUE if the load was successful. If %FALSE and @error is 1116 * present, it will be set appropriately. 1117 * 1118 * Throws: GException on failure. 1119 */ 1120 public bool loadPartialContentsFinish(AsyncResultIF res, out string contents, out string etagOut); 1121 1122 /** 1123 * Creates a directory. Note that this will only create a child directory 1124 * of the immediate parent directory of the path or URI given by the #GFile. 1125 * To recursively create directories, see g_file_make_directory_with_parents(). 1126 * This function will fail if the parent directory does not exist, setting 1127 * @error to %G_IO_ERROR_NOT_FOUND. If the file system doesn't support 1128 * creating directories, this function will fail, setting @error to 1129 * %G_IO_ERROR_NOT_SUPPORTED. 1130 * 1131 * For a local #GFile the newly created directory will have the default 1132 * (current) ownership and permissions of the current process. 1133 * 1134 * If @cancellable is not %NULL, then the operation can be cancelled by 1135 * triggering the cancellable object from another thread. If the operation 1136 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1137 * 1138 * Params: 1139 * cancellable = optional #GCancellable object, 1140 * %NULL to ignore 1141 * 1142 * Returns: %TRUE on successful creation, %FALSE otherwise. 1143 * 1144 * Throws: GException on failure. 1145 */ 1146 public bool makeDirectory(Cancellable cancellable); 1147 1148 /** 1149 * Asynchronously creates a directory. 1150 * 1151 * Params: 1152 * ioPriority = the [I/O priority][io-priority] of the request 1153 * cancellable = optional #GCancellable object, 1154 * %NULL to ignore 1155 * callback = a #GAsyncReadyCallback to call 1156 * when the request is satisfied 1157 * userData = the data to pass to callback function 1158 * 1159 * Since: 2.38 1160 */ 1161 public void makeDirectoryAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 1162 1163 /** 1164 * Finishes an asynchronous directory creation, started with 1165 * g_file_make_directory_async(). 1166 * 1167 * Params: 1168 * result = a #GAsyncResult 1169 * 1170 * Returns: %TRUE on successful directory creation, %FALSE otherwise. 1171 * 1172 * Since: 2.38 1173 * 1174 * Throws: GException on failure. 1175 */ 1176 public bool makeDirectoryFinish(AsyncResultIF result); 1177 1178 /** 1179 * Creates a directory and any parent directories that may not 1180 * exist similar to 'mkdir -p'. If the file system does not support 1181 * creating directories, this function will fail, setting @error to 1182 * %G_IO_ERROR_NOT_SUPPORTED. If the directory itself already exists, 1183 * this function will fail setting @error to %G_IO_ERROR_EXISTS, unlike 1184 * the similar g_mkdir_with_parents(). 1185 * 1186 * For a local #GFile the newly created directories will have the default 1187 * (current) ownership and permissions of the current process. 1188 * 1189 * If @cancellable is not %NULL, then the operation can be cancelled by 1190 * triggering the cancellable object from another thread. If the operation 1191 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1192 * 1193 * Params: 1194 * cancellable = optional #GCancellable object, 1195 * %NULL to ignore 1196 * 1197 * Returns: %TRUE if all directories have been successfully created, %FALSE 1198 * otherwise. 1199 * 1200 * Since: 2.18 1201 * 1202 * Throws: GException on failure. 1203 */ 1204 public bool makeDirectoryWithParents(Cancellable cancellable); 1205 1206 /** 1207 * Creates a symbolic link named @file which contains the string 1208 * @symlink_value. 1209 * 1210 * If @cancellable is not %NULL, then the operation can be cancelled by 1211 * triggering the cancellable object from another thread. If the operation 1212 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1213 * 1214 * Params: 1215 * symlinkValue = a string with the path for the target 1216 * of the new symlink 1217 * cancellable = optional #GCancellable object, 1218 * %NULL to ignore 1219 * 1220 * Returns: %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 * Returns: %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 * Returns: %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 * Returns: 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 * Returns: 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 * Returns: 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 * Returns: %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 * Returns: 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 * Returns: %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 * Returns: #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 * Returns: 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 * Returns: %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 * Returns: 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 * Returns: %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 * Returns: 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 * Returns: 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 * Returns: #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 * Returns: 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 * Returns: #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 * Returns: 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 * Returns: 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 * Returns: #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 * Returns: 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 * Returns: 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. Internally, it uses g_file_replace(), so will try to replace the 2048 * file contents in the safest way possible. For example, atomic renames are 2049 * used when replacing local files’ contents. 2050 * 2051 * If @cancellable is not %NULL, then the operation can be cancelled by 2052 * triggering the cancellable object from another thread. If the operation 2053 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2054 * 2055 * The returned @new_etag can be used to verify that the file hasn't 2056 * changed the next time it is saved over. 2057 * 2058 * Params: 2059 * contents = a string containing the new contents for @file 2060 * length = the length of @contents in bytes 2061 * etag = the old [entity-tag][gfile-etag] for the document, 2062 * or %NULL 2063 * makeBackup = %TRUE if a backup should be created 2064 * flags = a set of #GFileCreateFlags 2065 * newEtag = a location to a new [entity tag][gfile-etag] 2066 * for the document. This should be freed with g_free() when no longer 2067 * needed, or %NULL 2068 * cancellable = optional #GCancellable object, %NULL to ignore 2069 * 2070 * Returns: %TRUE if successful. If an error has occurred, this function 2071 * will return %FALSE and set @error appropriately if present. 2072 * 2073 * Throws: GException on failure. 2074 */ 2075 public bool replaceContents(string contents, string etag, bool makeBackup, GFileCreateFlags flags, out string newEtag, Cancellable cancellable); 2076 2077 /** 2078 * Starts an asynchronous replacement of @file with the given 2079 * @contents of @length bytes. @etag will replace the document's 2080 * current entity tag. 2081 * 2082 * When this operation has completed, @callback will be called with 2083 * @user_user data, and the operation can be finalized with 2084 * g_file_replace_contents_finish(). 2085 * 2086 * If @cancellable is not %NULL, then the operation can be cancelled by 2087 * triggering the cancellable object from another thread. If the operation 2088 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2089 * 2090 * If @make_backup is %TRUE, this function will attempt to 2091 * make a backup of @file. 2092 * 2093 * Note that no copy of @content will be made, so it must stay valid 2094 * until @callback is called. See g_file_replace_contents_bytes_async() 2095 * for a #GBytes version that will automatically hold a reference to the 2096 * contents (without copying) for the duration of the call. 2097 * 2098 * Params: 2099 * contents = string of contents to replace the file with 2100 * length = the length of @contents in bytes 2101 * etag = a new [entity tag][gfile-etag] for the @file, or %NULL 2102 * makeBackup = %TRUE if a backup should be created 2103 * flags = a set of #GFileCreateFlags 2104 * cancellable = optional #GCancellable object, %NULL to ignore 2105 * callback = a #GAsyncReadyCallback to call when the request is satisfied 2106 * userData = the data to pass to callback function 2107 */ 2108 public void replaceContentsAsync(string contents, string etag, bool makeBackup, GFileCreateFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 2109 2110 /** 2111 * Same as g_file_replace_contents_async() but takes a #GBytes input instead. 2112 * This function will keep a ref on @contents until the operation is done. 2113 * Unlike g_file_replace_contents_async() this allows forgetting about the 2114 * content without waiting for the callback. 2115 * 2116 * When this operation has completed, @callback will be called with 2117 * @user_user data, and the operation can be finalized with 2118 * g_file_replace_contents_finish(). 2119 * 2120 * Params: 2121 * contents = a #GBytes 2122 * etag = a new [entity tag][gfile-etag] for the @file, or %NULL 2123 * makeBackup = %TRUE if a backup should be created 2124 * flags = a set of #GFileCreateFlags 2125 * cancellable = optional #GCancellable object, %NULL to ignore 2126 * callback = a #GAsyncReadyCallback to call when the request is satisfied 2127 * userData = the data to pass to callback function 2128 * 2129 * Since: 2.40 2130 */ 2131 public void replaceContentsBytesAsync(Bytes contents, string etag, bool makeBackup, GFileCreateFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 2132 2133 /** 2134 * Finishes an asynchronous replace of the given @file. See 2135 * g_file_replace_contents_async(). Sets @new_etag to the new entity 2136 * tag for the document, if present. 2137 * 2138 * Params: 2139 * res = a #GAsyncResult 2140 * newEtag = a location of a new [entity tag][gfile-etag] 2141 * for the document. This should be freed with g_free() when it is no 2142 * longer needed, or %NULL 2143 * 2144 * Returns: %TRUE on success, %FALSE on failure. 2145 * 2146 * Throws: GException on failure. 2147 */ 2148 public bool replaceContentsFinish(AsyncResultIF res, out string newEtag); 2149 2150 /** 2151 * Finishes an asynchronous file replace operation started with 2152 * g_file_replace_async(). 2153 * 2154 * Params: 2155 * res = a #GAsyncResult 2156 * 2157 * Returns: a #GFileOutputStream, or %NULL on error. 2158 * Free the returned object with g_object_unref(). 2159 * 2160 * Throws: GException on failure. 2161 */ 2162 public FileOutputStream replaceFinish(AsyncResultIF res); 2163 2164 /** 2165 * Returns an output stream for overwriting the file in readwrite mode, 2166 * possibly creating a backup copy of the file first. If the file doesn't 2167 * exist, it will be created. 2168 * 2169 * For details about the behaviour, see g_file_replace() which does the 2170 * same thing but returns an output stream only. 2171 * 2172 * Note that in many non-local file cases read and write streams are not 2173 * supported, so make sure you really need to do read and write streaming, 2174 * rather than just opening for reading or writing. 2175 * 2176 * Params: 2177 * etag = an optional [entity tag][gfile-etag] 2178 * for the current #GFile, or #NULL to ignore 2179 * makeBackup = %TRUE if a backup should be created 2180 * flags = a set of #GFileCreateFlags 2181 * cancellable = optional #GCancellable object, 2182 * %NULL to ignore 2183 * 2184 * Returns: a #GFileIOStream or %NULL on error. 2185 * Free the returned object with g_object_unref(). 2186 * 2187 * Since: 2.22 2188 * 2189 * Throws: GException on failure. 2190 */ 2191 public FileIOStream replaceReadwrite(string etag, bool makeBackup, GFileCreateFlags flags, Cancellable cancellable); 2192 2193 /** 2194 * Asynchronously overwrites the file in read-write mode, 2195 * replacing the contents, possibly creating a backup copy 2196 * of the file first. 2197 * 2198 * For more details, see g_file_replace_readwrite() which is 2199 * the synchronous version of this call. 2200 * 2201 * When the operation is finished, @callback will be called. 2202 * You can then call g_file_replace_readwrite_finish() to get 2203 * the result of the operation. 2204 * 2205 * Params: 2206 * etag = an [entity tag][gfile-etag] for the current #GFile, 2207 * or %NULL to ignore 2208 * makeBackup = %TRUE if a backup should be created 2209 * flags = a set of #GFileCreateFlags 2210 * ioPriority = the [I/O priority][io-priority] of the request 2211 * cancellable = optional #GCancellable object, 2212 * %NULL to ignore 2213 * callback = a #GAsyncReadyCallback to call 2214 * when the request is satisfied 2215 * userData = the data to pass to callback function 2216 * 2217 * Since: 2.22 2218 */ 2219 public void replaceReadwriteAsync(string etag, bool makeBackup, GFileCreateFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 2220 2221 /** 2222 * Finishes an asynchronous file replace operation started with 2223 * g_file_replace_readwrite_async(). 2224 * 2225 * Params: 2226 * res = a #GAsyncResult 2227 * 2228 * Returns: a #GFileIOStream, or %NULL on error. 2229 * Free the returned object with g_object_unref(). 2230 * 2231 * Since: 2.22 2232 * 2233 * Throws: GException on failure. 2234 */ 2235 public FileIOStream replaceReadwriteFinish(AsyncResultIF res); 2236 2237 /** 2238 * Resolves a relative path for @file to an absolute path. 2239 * 2240 * This call does no blocking I/O. 2241 * 2242 * Params: 2243 * relativePath = a given relative path string 2244 * 2245 * Returns: #GFile to the resolved path. 2246 * %NULL if @relative_path is %NULL or if @file is invalid. 2247 * Free the returned object with g_object_unref(). 2248 */ 2249 public FileIF resolveRelativePath(string relativePath); 2250 2251 /** 2252 * Sets an attribute in the file with attribute name @attribute to @value. 2253 * 2254 * Some attributes can be unset by setting @attribute to 2255 * %G_FILE_ATTRIBUTE_TYPE_INVALID and @value_p to %NULL. 2256 * 2257 * If @cancellable is not %NULL, then the operation can be cancelled by 2258 * triggering the cancellable object from another thread. If the operation 2259 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2260 * 2261 * Params: 2262 * attribute = a string containing the attribute's name 2263 * type = The type of the attribute 2264 * valueP = a pointer to the value (or the pointer 2265 * itself if the type is a pointer type) 2266 * flags = a set of #GFileQueryInfoFlags 2267 * cancellable = optional #GCancellable object, 2268 * %NULL to ignore 2269 * 2270 * Returns: %TRUE if the attribute was set, %FALSE otherwise. 2271 * 2272 * Throws: GException on failure. 2273 */ 2274 public bool setAttribute(string attribute, GFileAttributeType type, void* valueP, GFileQueryInfoFlags flags, Cancellable cancellable); 2275 2276 /** 2277 * Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_BYTE_STRING to @value. 2278 * If @attribute is of a different type, this operation will fail, 2279 * returning %FALSE. 2280 * 2281 * If @cancellable is not %NULL, then the operation can be cancelled by 2282 * triggering the cancellable object from another thread. If the operation 2283 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2284 * 2285 * Params: 2286 * attribute = a string containing the attribute's name 2287 * value = a string containing the attribute's new value 2288 * flags = a #GFileQueryInfoFlags 2289 * cancellable = optional #GCancellable object, 2290 * %NULL to ignore 2291 * 2292 * Returns: %TRUE if the @attribute was successfully set to @value 2293 * in the @file, %FALSE otherwise. 2294 * 2295 * Throws: GException on failure. 2296 */ 2297 public bool setAttributeByteString(string attribute, string value, GFileQueryInfoFlags flags, Cancellable cancellable); 2298 2299 /** 2300 * Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_INT32 to @value. 2301 * If @attribute is of a different type, this operation will fail. 2302 * 2303 * If @cancellable is not %NULL, then the operation can be cancelled by 2304 * triggering the cancellable object from another thread. If the operation 2305 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2306 * 2307 * Params: 2308 * attribute = a string containing the attribute's name 2309 * value = a #gint32 containing the attribute's new value 2310 * flags = a #GFileQueryInfoFlags 2311 * cancellable = optional #GCancellable object, 2312 * %NULL to ignore 2313 * 2314 * Returns: %TRUE if the @attribute was successfully set to @value 2315 * in the @file, %FALSE otherwise. 2316 * 2317 * Throws: GException on failure. 2318 */ 2319 public bool setAttributeInt32(string attribute, int value, GFileQueryInfoFlags flags, Cancellable cancellable); 2320 2321 /** 2322 * Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_INT64 to @value. 2323 * If @attribute is of a different type, this operation will fail. 2324 * 2325 * If @cancellable is not %NULL, then the operation can be cancelled by 2326 * triggering the cancellable object from another thread. If the operation 2327 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2328 * 2329 * Params: 2330 * attribute = a string containing the attribute's name 2331 * value = a #guint64 containing the attribute's new value 2332 * flags = a #GFileQueryInfoFlags 2333 * cancellable = optional #GCancellable object, 2334 * %NULL to ignore 2335 * 2336 * Returns: %TRUE if the @attribute was successfully set, %FALSE otherwise. 2337 * 2338 * Throws: GException on failure. 2339 */ 2340 public bool setAttributeInt64(string attribute, long value, GFileQueryInfoFlags flags, Cancellable cancellable); 2341 2342 /** 2343 * Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_STRING to @value. 2344 * If @attribute is of a different type, this operation will fail. 2345 * 2346 * If @cancellable is not %NULL, then the operation can be cancelled by 2347 * triggering the cancellable object from another thread. If the operation 2348 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2349 * 2350 * Params: 2351 * attribute = a string containing the attribute's name 2352 * value = a string containing the attribute's value 2353 * flags = #GFileQueryInfoFlags 2354 * cancellable = optional #GCancellable object, 2355 * %NULL to ignore 2356 * 2357 * Returns: %TRUE if the @attribute was successfully set, %FALSE otherwise. 2358 * 2359 * Throws: GException on failure. 2360 */ 2361 public bool setAttributeString(string attribute, string value, GFileQueryInfoFlags flags, Cancellable cancellable); 2362 2363 /** 2364 * Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_UINT32 to @value. 2365 * If @attribute is of a different type, this operation will fail. 2366 * 2367 * If @cancellable is not %NULL, then the operation can be cancelled by 2368 * triggering the cancellable object from another thread. If the operation 2369 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2370 * 2371 * Params: 2372 * attribute = a string containing the attribute's name 2373 * value = a #guint32 containing the attribute's new value 2374 * flags = a #GFileQueryInfoFlags 2375 * cancellable = optional #GCancellable object, 2376 * %NULL to ignore 2377 * 2378 * Returns: %TRUE if the @attribute was successfully set to @value 2379 * in the @file, %FALSE otherwise. 2380 * 2381 * Throws: GException on failure. 2382 */ 2383 public bool setAttributeUint32(string attribute, uint value, GFileQueryInfoFlags flags, Cancellable cancellable); 2384 2385 /** 2386 * Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_UINT64 to @value. 2387 * If @attribute is of a different type, this operation will fail. 2388 * 2389 * If @cancellable is not %NULL, then the operation can be cancelled by 2390 * triggering the cancellable object from another thread. If the operation 2391 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2392 * 2393 * Params: 2394 * attribute = a string containing the attribute's name 2395 * value = a #guint64 containing the attribute's new value 2396 * flags = a #GFileQueryInfoFlags 2397 * cancellable = optional #GCancellable object, 2398 * %NULL to ignore 2399 * 2400 * Returns: %TRUE if the @attribute was successfully set to @value 2401 * in the @file, %FALSE otherwise. 2402 * 2403 * Throws: GException on failure. 2404 */ 2405 public bool setAttributeUint64(string attribute, ulong value, GFileQueryInfoFlags flags, Cancellable cancellable); 2406 2407 /** 2408 * Asynchronously sets the attributes of @file with @info. 2409 * 2410 * For more details, see g_file_set_attributes_from_info(), 2411 * which is the synchronous version of this call. 2412 * 2413 * When the operation is finished, @callback will be called. 2414 * You can then call g_file_set_attributes_finish() to get 2415 * the result of the operation. 2416 * 2417 * Params: 2418 * info = a #GFileInfo 2419 * flags = a #GFileQueryInfoFlags 2420 * ioPriority = the [I/O priority][io-priority] of the request 2421 * cancellable = optional #GCancellable object, 2422 * %NULL to ignore 2423 * callback = a #GAsyncReadyCallback 2424 * userData = a #gpointer 2425 */ 2426 public void setAttributesAsync(FileInfo info, GFileQueryInfoFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 2427 2428 /** 2429 * Finishes setting an attribute started in g_file_set_attributes_async(). 2430 * 2431 * Params: 2432 * result = a #GAsyncResult 2433 * info = a #GFileInfo 2434 * 2435 * Returns: %TRUE if the attributes were set correctly, %FALSE otherwise. 2436 * 2437 * Throws: GException on failure. 2438 */ 2439 public bool setAttributesFinish(AsyncResultIF result, out FileInfo info); 2440 2441 /** 2442 * Tries to set all attributes in the #GFileInfo on the target 2443 * values, not stopping on the first error. 2444 * 2445 * If there is any error during this operation then @error will 2446 * be set to the first error. Error on particular fields are flagged 2447 * by setting the "status" field in the attribute value to 2448 * %G_FILE_ATTRIBUTE_STATUS_ERROR_SETTING, which means you can 2449 * also detect further errors. 2450 * 2451 * If @cancellable is not %NULL, then the operation can be cancelled by 2452 * triggering the cancellable object from another thread. If the operation 2453 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2454 * 2455 * Params: 2456 * info = a #GFileInfo 2457 * flags = #GFileQueryInfoFlags 2458 * cancellable = optional #GCancellable object, 2459 * %NULL to ignore 2460 * 2461 * Returns: %FALSE if there was any error, %TRUE otherwise. 2462 * 2463 * Throws: GException on failure. 2464 */ 2465 public bool setAttributesFromInfo(FileInfo info, GFileQueryInfoFlags flags, Cancellable cancellable); 2466 2467 /** 2468 * Renames @file to the specified display name. 2469 * 2470 * The display name is converted from UTF-8 to the correct encoding 2471 * for the target filesystem if possible and the @file is renamed to this. 2472 * 2473 * If you want to implement a rename operation in the user interface the 2474 * edit name (#G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME) should be used as the 2475 * initial value in the rename widget, and then the result after editing 2476 * should be passed to g_file_set_display_name(). 2477 * 2478 * On success the resulting converted filename is returned. 2479 * 2480 * If @cancellable is not %NULL, then the operation can be cancelled by 2481 * triggering the cancellable object from another thread. If the operation 2482 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2483 * 2484 * Params: 2485 * displayName = a string 2486 * cancellable = optional #GCancellable object, 2487 * %NULL to ignore 2488 * 2489 * Returns: a #GFile specifying what @file was renamed to, 2490 * or %NULL if there was an error. 2491 * Free the returned object with g_object_unref(). 2492 * 2493 * Throws: GException on failure. 2494 */ 2495 public FileIF setDisplayName(string displayName, Cancellable cancellable); 2496 2497 /** 2498 * Asynchronously sets the display name for a given #GFile. 2499 * 2500 * For more details, see g_file_set_display_name() which is 2501 * the synchronous version of this call. 2502 * 2503 * When the operation is finished, @callback will be called. 2504 * You can then call g_file_set_display_name_finish() to get 2505 * the result of the operation. 2506 * 2507 * Params: 2508 * displayName = a string 2509 * ioPriority = the [I/O priority][io-priority] of the request 2510 * cancellable = optional #GCancellable object, 2511 * %NULL to ignore 2512 * callback = a #GAsyncReadyCallback to call 2513 * when the request is satisfied 2514 * userData = the data to pass to callback function 2515 */ 2516 public void setDisplayNameAsync(string displayName, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 2517 2518 /** 2519 * Finishes setting a display name started with 2520 * g_file_set_display_name_async(). 2521 * 2522 * Params: 2523 * res = a #GAsyncResult 2524 * 2525 * Returns: a #GFile or %NULL on error. 2526 * Free the returned object with g_object_unref(). 2527 * 2528 * Throws: GException on failure. 2529 */ 2530 public FileIF setDisplayNameFinish(AsyncResultIF res); 2531 2532 /** 2533 * Starts a file of type #G_FILE_TYPE_MOUNTABLE. 2534 * Using @start_operation, you can request callbacks when, for instance, 2535 * passwords are needed during authentication. 2536 * 2537 * If @cancellable is not %NULL, then the operation can be cancelled by 2538 * triggering the cancellable object from another thread. If the operation 2539 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2540 * 2541 * When the operation is finished, @callback will be called. 2542 * You can then call g_file_mount_mountable_finish() to get 2543 * the result of the operation. 2544 * 2545 * Params: 2546 * flags = flags affecting the operation 2547 * startOperation = a #GMountOperation, or %NULL to avoid user interaction 2548 * cancellable = optional #GCancellable object, %NULL to ignore 2549 * callback = a #GAsyncReadyCallback to call when the request is satisfied, or %NULL 2550 * userData = the data to pass to callback function 2551 * 2552 * Since: 2.22 2553 */ 2554 public void startMountable(GDriveStartFlags flags, MountOperation startOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 2555 2556 /** 2557 * Finishes a start operation. See g_file_start_mountable() for details. 2558 * 2559 * Finish an asynchronous start operation that was started 2560 * with g_file_start_mountable(). 2561 * 2562 * Params: 2563 * result = a #GAsyncResult 2564 * 2565 * Returns: %TRUE if the operation finished successfully. %FALSE 2566 * otherwise. 2567 * 2568 * Since: 2.22 2569 * 2570 * Throws: GException on failure. 2571 */ 2572 public bool startMountableFinish(AsyncResultIF result); 2573 2574 /** 2575 * Stops a file of type #G_FILE_TYPE_MOUNTABLE. 2576 * 2577 * If @cancellable is not %NULL, then the operation can be cancelled by 2578 * triggering the cancellable object from another thread. If the operation 2579 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2580 * 2581 * When the operation is finished, @callback will be called. 2582 * You can then call g_file_stop_mountable_finish() to get 2583 * the result of the operation. 2584 * 2585 * Params: 2586 * flags = flags affecting the operation 2587 * mountOperation = a #GMountOperation, 2588 * or %NULL to avoid user interaction. 2589 * cancellable = optional #GCancellable object, 2590 * %NULL to ignore 2591 * callback = a #GAsyncReadyCallback to call 2592 * when the request is satisfied, or %NULL 2593 * userData = the data to pass to callback function 2594 * 2595 * Since: 2.22 2596 */ 2597 public void stopMountable(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 2598 2599 /** 2600 * Finishes an stop operation, see g_file_stop_mountable() for details. 2601 * 2602 * Finish an asynchronous stop operation that was started 2603 * with g_file_stop_mountable(). 2604 * 2605 * Params: 2606 * result = a #GAsyncResult 2607 * 2608 * Returns: %TRUE if the operation finished successfully. 2609 * %FALSE otherwise. 2610 * 2611 * Since: 2.22 2612 * 2613 * Throws: GException on failure. 2614 */ 2615 public bool stopMountableFinish(AsyncResultIF result); 2616 2617 /** 2618 * Checks if @file supports 2619 * [thread-default contexts][g-main-context-push-thread-default-context]. 2620 * If this returns %FALSE, you cannot perform asynchronous operations on 2621 * @file in a thread that has a thread-default context. 2622 * 2623 * Returns: Whether or not @file supports thread-default contexts. 2624 * 2625 * Since: 2.22 2626 */ 2627 public bool supportsThreadContexts(); 2628 2629 /** 2630 * Sends @file to the "Trashcan", if possible. This is similar to 2631 * deleting it, but the user can recover it before emptying the trashcan. 2632 * Not all file systems support trashing, so this call can return the 2633 * %G_IO_ERROR_NOT_SUPPORTED error. 2634 * 2635 * If @cancellable is not %NULL, then the operation can be cancelled by 2636 * triggering the cancellable object from another thread. If the operation 2637 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2638 * 2639 * Params: 2640 * cancellable = optional #GCancellable object, 2641 * %NULL to ignore 2642 * 2643 * Returns: %TRUE on successful trash, %FALSE otherwise. 2644 * 2645 * Throws: GException on failure. 2646 */ 2647 public bool trash(Cancellable cancellable); 2648 2649 /** 2650 * Asynchronously sends @file to the Trash location, if possible. 2651 * 2652 * Params: 2653 * ioPriority = the [I/O priority][io-priority] of the request 2654 * cancellable = optional #GCancellable object, 2655 * %NULL to ignore 2656 * callback = a #GAsyncReadyCallback to call 2657 * when the request is satisfied 2658 * userData = the data to pass to callback function 2659 * 2660 * Since: 2.38 2661 */ 2662 public void trashAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 2663 2664 /** 2665 * Finishes an asynchronous file trashing operation, started with 2666 * g_file_trash_async(). 2667 * 2668 * Params: 2669 * result = a #GAsyncResult 2670 * 2671 * Returns: %TRUE on successful trash, %FALSE otherwise. 2672 * 2673 * Since: 2.38 2674 * 2675 * Throws: GException on failure. 2676 */ 2677 public bool trashFinish(AsyncResultIF result); 2678 2679 /** 2680 * Unmounts a file of type G_FILE_TYPE_MOUNTABLE. 2681 * 2682 * If @cancellable is not %NULL, then the operation can be cancelled by 2683 * triggering the cancellable object from another thread. If the operation 2684 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2685 * 2686 * When the operation is finished, @callback will be called. 2687 * You can then call g_file_unmount_mountable_finish() to get 2688 * the result of the operation. 2689 * 2690 * Deprecated: Use g_file_unmount_mountable_with_operation() instead. 2691 * 2692 * Params: 2693 * flags = flags affecting the operation 2694 * cancellable = optional #GCancellable object, 2695 * %NULL to ignore 2696 * callback = a #GAsyncReadyCallback to call 2697 * when the request is satisfied, or %NULL 2698 * userData = the data to pass to callback function 2699 */ 2700 public void unmountMountable(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 2701 2702 /** 2703 * Finishes an unmount operation, see g_file_unmount_mountable() for details. 2704 * 2705 * Finish an asynchronous unmount operation that was started 2706 * with g_file_unmount_mountable(). 2707 * 2708 * Deprecated: Use g_file_unmount_mountable_with_operation_finish() 2709 * instead. 2710 * 2711 * Params: 2712 * result = a #GAsyncResult 2713 * 2714 * Returns: %TRUE if the operation finished successfully. 2715 * %FALSE otherwise. 2716 * 2717 * Throws: GException on failure. 2718 */ 2719 public bool unmountMountableFinish(AsyncResultIF result); 2720 2721 /** 2722 * Unmounts a file of type #G_FILE_TYPE_MOUNTABLE. 2723 * 2724 * If @cancellable is not %NULL, then the operation can be cancelled by 2725 * triggering the cancellable object from another thread. If the operation 2726 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2727 * 2728 * When the operation is finished, @callback will be called. 2729 * You can then call g_file_unmount_mountable_finish() to get 2730 * the result of the operation. 2731 * 2732 * Params: 2733 * flags = flags affecting the operation 2734 * mountOperation = a #GMountOperation, 2735 * or %NULL to avoid user interaction 2736 * cancellable = optional #GCancellable object, 2737 * %NULL to ignore 2738 * callback = a #GAsyncReadyCallback to call 2739 * when the request is satisfied, or %NULL 2740 * userData = the data to pass to callback function 2741 * 2742 * Since: 2.22 2743 */ 2744 public void unmountMountableWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 2745 2746 /** 2747 * Finishes an unmount operation, 2748 * see g_file_unmount_mountable_with_operation() for details. 2749 * 2750 * Finish an asynchronous unmount operation that was started 2751 * with g_file_unmount_mountable_with_operation(). 2752 * 2753 * Params: 2754 * result = a #GAsyncResult 2755 * 2756 * Returns: %TRUE if the operation finished successfully. 2757 * %FALSE otherwise. 2758 * 2759 * Since: 2.22 2760 * 2761 * Throws: GException on failure. 2762 */ 2763 public bool unmountMountableWithOperationFinish(AsyncResultIF result); 2764 }