1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gio.FileIF; 26 27 private import gio.AppInfoIF; 28 private import gio.AsyncResultIF; 29 private import gio.Cancellable; 30 private import gio.FileAttributeInfoList; 31 private import gio.FileEnumerator; 32 private import gio.FileIF; 33 private import gio.FileIOStream; 34 private import gio.FileInfo; 35 private import gio.FileInputStream; 36 private import gio.FileMonitor; 37 private import gio.FileOutputStream; 38 private import gio.MountIF; 39 private import gio.MountOperation; 40 private import gio.c.functions; 41 public import gio.c.types; 42 private import glib.Bytes; 43 private import glib.ConstructionException; 44 private import glib.ErrorG; 45 private import glib.GException; 46 private import glib.Str; 47 private import gobject.ObjectG; 48 public import gtkc.giotypes; 49 50 51 /** 52 * #GFile is a high level abstraction for manipulating files on a 53 * virtual file system. #GFiles are lightweight, immutable objects 54 * that do no I/O upon creation. It is necessary to understand that 55 * #GFile objects do not represent files, merely an identifier for a 56 * file. All file content I/O is implemented as streaming operations 57 * (see #GInputStream and #GOutputStream). 58 * 59 * To construct a #GFile, you can use: 60 * - g_file_new_for_path() if you have a path. 61 * - g_file_new_for_uri() if you have a URI. 62 * - g_file_new_for_commandline_arg() for a command line argument. 63 * - g_file_new_tmp() to create a temporary file from a template. 64 * - g_file_parse_name() from a UTF-8 string gotten from g_file_get_parse_name(). 65 * 66 * One way to think of a #GFile is as an abstraction of a pathname. For 67 * normal files the system pathname is what is stored internally, but as 68 * #GFiles are extensible it could also be something else that corresponds 69 * to a pathname in a userspace implementation of a filesystem. 70 * 71 * #GFiles make up hierarchies of directories and files that correspond to 72 * the files on a filesystem. You can move through the file system with 73 * #GFile using g_file_get_parent() to get an identifier for the parent 74 * directory, g_file_get_child() to get a child within a directory, 75 * g_file_resolve_relative_path() to resolve a relative path between two 76 * #GFiles. There can be multiple hierarchies, so you may not end up at 77 * the same root if you repeatedly call g_file_get_parent() on two different 78 * files. 79 * 80 * All #GFiles have a basename (get with g_file_get_basename()). These names 81 * are byte strings that are used to identify the file on the filesystem 82 * (relative to its parent directory) and there is no guarantees that they 83 * have any particular charset encoding or even make any sense at all. If 84 * you want to use filenames in a user interface you should use the display 85 * name that you can get by requesting the 86 * %G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME attribute with g_file_query_info(). 87 * This is guaranteed to be in UTF-8 and can be used in a user interface. 88 * But always store the real basename or the #GFile to use to actually 89 * access the file, because there is no way to go from a display name to 90 * the actual name. 91 * 92 * Using #GFile as an identifier has the same weaknesses as using a path 93 * in that there may be multiple aliases for the same file. For instance, 94 * hard or soft links may cause two different #GFiles to refer to the same 95 * file. Other possible causes for aliases are: case insensitive filesystems, 96 * short and long names on FAT/NTFS, or bind mounts in Linux. If you want to 97 * check if two #GFiles point to the same file you can query for the 98 * %G_FILE_ATTRIBUTE_ID_FILE attribute. Note that #GFile does some trivial 99 * canonicalization of pathnames passed in, so that trivial differences in 100 * the path string used at creation (duplicated slashes, slash at end of 101 * path, "." or ".." path segments, etc) does not create different #GFiles. 102 * 103 * Many #GFile operations have both synchronous and asynchronous versions 104 * to suit your application. Asynchronous versions of synchronous functions 105 * simply have _async() appended to their function names. The asynchronous 106 * I/O functions call a #GAsyncReadyCallback which is then used to finalize 107 * the operation, producing a GAsyncResult which is then passed to the 108 * function's matching _finish() operation. 109 * 110 * It is highly recommended to use asynchronous calls when running within a 111 * shared main loop, such as in the main thread of an application. This avoids 112 * I/O operations blocking other sources on the main loop from being dispatched. 113 * Synchronous I/O operations should be performed from worker threads. See the 114 * [introduction to asynchronous programming section][async-programming] for 115 * more. 116 * 117 * Some #GFile operations almost always take a noticeable amount of time, and 118 * so do not have synchronous analogs. Notable cases include: 119 * - g_file_mount_mountable() to mount a mountable file. 120 * - g_file_unmount_mountable_with_operation() to unmount a mountable file. 121 * - g_file_eject_mountable_with_operation() to eject a mountable file. 122 * 123 * ## Entity Tags # {#gfile-etag} 124 * 125 * One notable feature of #GFiles are entity tags, or "etags" for 126 * short. Entity tags are somewhat like a more abstract version of the 127 * traditional mtime, and can be used to quickly determine if the file 128 * has been modified from the version on the file system. See the 129 * HTTP 1.1 130 * [specification](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html) 131 * for HTTP Etag headers, which are a very similar concept. 132 */ 133 public interface FileIF{ 134 /** Get the main Gtk struct */ 135 public GFile* getFileStruct(bool transferOwnership = false); 136 137 /** the main Gtk struct as a void* */ 138 protected void* getStruct(); 139 140 141 /** */ 142 public static GType getType() 143 { 144 return g_file_get_type(); 145 } 146 147 /** 148 * Constructs a #GFile with the given @parse_name (i.e. something 149 * given by g_file_get_parse_name()). This operation never fails, 150 * but the returned object might not support any I/O operation if 151 * the @parse_name cannot be parsed. 152 * 153 * Params: 154 * parseName = a file name or path to be parsed 155 * 156 * Returns: a new #GFile. 157 */ 158 public static FileIF parseName(string parseName); 159 160 /** 161 * Gets an output stream for appending data to the file. 162 * If the file doesn't already exist it is created. 163 * 164 * By default files created are generally readable by everyone, 165 * but if you pass #G_FILE_CREATE_PRIVATE in @flags the file 166 * will be made readable only to the current user, to the level that 167 * is supported on the target filesystem. 168 * 169 * If @cancellable is not %NULL, then the operation can be cancelled 170 * by triggering the cancellable object from another thread. If the 171 * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be 172 * returned. 173 * 174 * Some file systems don't allow all file names, and may return an 175 * %G_IO_ERROR_INVALID_FILENAME error. If the file is a directory the 176 * %G_IO_ERROR_IS_DIRECTORY error will be returned. Other errors are 177 * possible too, and depend on what kind of filesystem the file is on. 178 * 179 * Params: 180 * flags = a set of #GFileCreateFlags 181 * cancellable = optional #GCancellable object, 182 * %NULL to ignore 183 * 184 * Returns: a #GFileOutputStream, or %NULL on error. 185 * Free the returned object with g_object_unref(). 186 * 187 * Throws: GException on failure. 188 */ 189 public FileOutputStream appendTo(GFileCreateFlags flags, Cancellable cancellable); 190 191 /** 192 * Asynchronously opens @file for appending. 193 * 194 * For more details, see g_file_append_to() which is 195 * the synchronous version of this call. 196 * 197 * When the operation is finished, @callback will be called. 198 * You can then call g_file_append_to_finish() to get the result 199 * of the operation. 200 * 201 * Params: 202 * flags = a set of #GFileCreateFlags 203 * ioPriority = the [I/O priority][io-priority] of the request 204 * cancellable = optional #GCancellable object, 205 * %NULL to ignore 206 * callback = a #GAsyncReadyCallback to call 207 * when the request is satisfied 208 * userData = the data to pass to callback function 209 */ 210 public void appendToAsync(GFileCreateFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 211 212 /** 213 * Finishes an asynchronous file append operation started with 214 * g_file_append_to_async(). 215 * 216 * Params: 217 * res = #GAsyncResult 218 * 219 * Returns: a valid #GFileOutputStream 220 * or %NULL on error. 221 * Free the returned object with g_object_unref(). 222 * 223 * Throws: GException on failure. 224 */ 225 public FileOutputStream appendToFinish(AsyncResultIF res); 226 227 /** 228 * Copies the file @source to the location specified by @destination. 229 * Can not handle recursive copies of directories. 230 * 231 * If the flag #G_FILE_COPY_OVERWRITE is specified an already 232 * existing @destination file is overwritten. 233 * 234 * If the flag #G_FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlinks 235 * will be copied as symlinks, otherwise the target of the 236 * @source symlink will be copied. 237 * 238 * If the flag #G_FILE_COPY_ALL_METADATA is specified then all the metadata 239 * that is possible to copy is copied, not just the default subset (which, 240 * for instance, does not include the owner, see #GFileInfo). 241 * 242 * If @cancellable is not %NULL, then the operation can be cancelled by 243 * triggering the cancellable object from another thread. If the operation 244 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 245 * 246 * If @progress_callback is not %NULL, then the operation can be monitored 247 * by setting this to a #GFileProgressCallback function. 248 * @progress_callback_data will be passed to this function. It is guaranteed 249 * that this callback will be called after all data has been transferred with 250 * the total number of bytes copied during the operation. 251 * 252 * If the @source file does not exist, then the %G_IO_ERROR_NOT_FOUND error 253 * is returned, independent on the status of the @destination. 254 * 255 * If #G_FILE_COPY_OVERWRITE is not specified and the target exists, then 256 * the error %G_IO_ERROR_EXISTS is returned. 257 * 258 * If trying to overwrite a file over a directory, the %G_IO_ERROR_IS_DIRECTORY 259 * error is returned. If trying to overwrite a directory with a directory the 260 * %G_IO_ERROR_WOULD_MERGE error is returned. 261 * 262 * If the source is a directory and the target does not exist, or 263 * #G_FILE_COPY_OVERWRITE is specified and the target is a file, then the 264 * %G_IO_ERROR_WOULD_RECURSE error is returned. 265 * 266 * If you are interested in copying the #GFile object itself (not the on-disk 267 * file), see g_file_dup(). 268 * 269 * Params: 270 * destination = destination #GFile 271 * flags = set of #GFileCopyFlags 272 * cancellable = optional #GCancellable object, 273 * %NULL to ignore 274 * progressCallback = function to callback with 275 * progress information, or %NULL if progress information is not needed 276 * progressCallbackData = user data to pass to @progress_callback 277 * 278 * Returns: %TRUE on success, %FALSE otherwise. 279 * 280 * Throws: GException on failure. 281 */ 282 public bool copy(FileIF destination, GFileCopyFlags flags, Cancellable cancellable, GFileProgressCallback progressCallback, void* progressCallbackData); 283 284 /** 285 * Copies the file @source to the location specified by @destination 286 * asynchronously. For details of the behaviour, see g_file_copy(). 287 * 288 * If @progress_callback is not %NULL, then that function that will be called 289 * just like in g_file_copy(). The callback will run in the default main context 290 * of the thread calling g_file_copy_async() — the same context as @callback is 291 * run in. 292 * 293 * When the operation is finished, @callback will be called. You can then call 294 * g_file_copy_finish() to get the result of the operation. 295 * 296 * Params: 297 * destination = destination #GFile 298 * flags = set of #GFileCopyFlags 299 * ioPriority = the [I/O priority][io-priority] of the request 300 * cancellable = optional #GCancellable object, 301 * %NULL to ignore 302 * progressCallback = function to callback with progress 303 * information, or %NULL if progress information is not needed 304 * progressCallbackData = user data to pass to @progress_callback 305 * callback = a #GAsyncReadyCallback to call when the request is satisfied 306 * userData = the data to pass to callback function 307 */ 308 public void copyAsync(FileIF destination, GFileCopyFlags flags, int ioPriority, Cancellable cancellable, GFileProgressCallback progressCallback, void* progressCallbackData, GAsyncReadyCallback callback, void* userData); 309 310 /** 311 * Copies the file attributes from @source to @destination. 312 * 313 * Normally only a subset of the file attributes are copied, 314 * those that are copies in a normal file copy operation 315 * (which for instance does not include e.g. owner). However 316 * if #G_FILE_COPY_ALL_METADATA is specified in @flags, then 317 * all the metadata that is possible to copy is copied. This 318 * is useful when implementing move by copy + delete source. 319 * 320 * Params: 321 * destination = a #GFile to copy attributes to 322 * flags = a set of #GFileCopyFlags 323 * cancellable = optional #GCancellable object, 324 * %NULL to ignore 325 * 326 * Returns: %TRUE if the attributes were copied successfully, 327 * %FALSE otherwise. 328 * 329 * Throws: GException on failure. 330 */ 331 public bool copyAttributes(FileIF destination, GFileCopyFlags flags, Cancellable cancellable); 332 333 /** 334 * Finishes copying the file started with g_file_copy_async(). 335 * 336 * Params: 337 * res = a #GAsyncResult 338 * 339 * Returns: a %TRUE on success, %FALSE on error. 340 * 341 * Throws: GException on failure. 342 */ 343 public bool copyFinish(AsyncResultIF res); 344 345 /** 346 * Creates a new file and returns an output stream for writing to it. 347 * The file must not already exist. 348 * 349 * By default files created are generally readable by everyone, 350 * but if you pass #G_FILE_CREATE_PRIVATE in @flags the file 351 * will be made readable only to the current user, to the level 352 * that is supported on the target filesystem. 353 * 354 * If @cancellable is not %NULL, then the operation can be cancelled 355 * by triggering the cancellable object from another thread. If the 356 * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be 357 * returned. 358 * 359 * If a file or directory with this name already exists the 360 * %G_IO_ERROR_EXISTS error will be returned. Some file systems don't 361 * allow all file names, and may return an %G_IO_ERROR_INVALID_FILENAME 362 * error, and if the name is to long %G_IO_ERROR_FILENAME_TOO_LONG will 363 * be returned. Other errors are possible too, and depend on what kind 364 * of filesystem the file is on. 365 * 366 * Params: 367 * flags = a set of #GFileCreateFlags 368 * cancellable = optional #GCancellable object, 369 * %NULL to ignore 370 * 371 * Returns: a #GFileOutputStream for the newly created 372 * file, or %NULL on error. 373 * Free the returned object with g_object_unref(). 374 * 375 * Throws: GException on failure. 376 */ 377 public FileOutputStream create(GFileCreateFlags flags, Cancellable cancellable); 378 379 /** 380 * Asynchronously creates a new file and returns an output stream 381 * for writing to it. The file must not already exist. 382 * 383 * For more details, see g_file_create() which is 384 * the synchronous version of this call. 385 * 386 * When the operation is finished, @callback will be called. 387 * You can then call g_file_create_finish() to get the result 388 * of the operation. 389 * 390 * Params: 391 * flags = a set of #GFileCreateFlags 392 * ioPriority = the [I/O priority][io-priority] of the request 393 * cancellable = optional #GCancellable object, 394 * %NULL to ignore 395 * callback = a #GAsyncReadyCallback to call 396 * when the request is satisfied 397 * userData = the data to pass to callback function 398 */ 399 public void createAsync(GFileCreateFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 400 401 /** 402 * Finishes an asynchronous file create operation started with 403 * g_file_create_async(). 404 * 405 * Params: 406 * res = a #GAsyncResult 407 * 408 * Returns: a #GFileOutputStream or %NULL on error. 409 * Free the returned object with g_object_unref(). 410 * 411 * Throws: GException on failure. 412 */ 413 public FileOutputStream createFinish(AsyncResultIF res); 414 415 /** 416 * Creates a new file and returns a stream for reading and 417 * writing to it. The file must not already exist. 418 * 419 * By default files created are generally readable by everyone, 420 * but if you pass #G_FILE_CREATE_PRIVATE in @flags the file 421 * will be made readable only to the current user, to the level 422 * that is supported on the target filesystem. 423 * 424 * If @cancellable is not %NULL, then the operation can be cancelled 425 * by triggering the cancellable object from another thread. If the 426 * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be 427 * returned. 428 * 429 * If a file or directory with this name already exists, the 430 * %G_IO_ERROR_EXISTS error will be returned. Some file systems don't 431 * allow all file names, and may return an %G_IO_ERROR_INVALID_FILENAME 432 * error, and if the name is too long, %G_IO_ERROR_FILENAME_TOO_LONG 433 * will be returned. Other errors are possible too, and depend on what 434 * kind of filesystem the file is on. 435 * 436 * Note that in many non-local file cases read and write streams are 437 * not supported, so make sure you really need to do read and write 438 * streaming, rather than just opening for reading or writing. 439 * 440 * Params: 441 * flags = a set of #GFileCreateFlags 442 * cancellable = optional #GCancellable object, 443 * %NULL to ignore 444 * 445 * Returns: a #GFileIOStream for the newly created 446 * file, or %NULL on error. 447 * Free the returned object with g_object_unref(). 448 * 449 * Since: 2.22 450 * 451 * Throws: GException on failure. 452 */ 453 public FileIOStream createReadwrite(GFileCreateFlags flags, Cancellable cancellable); 454 455 /** 456 * Asynchronously creates a new file and returns a stream 457 * for reading and writing to it. The file must not already exist. 458 * 459 * For more details, see g_file_create_readwrite() which is 460 * the synchronous version of this call. 461 * 462 * When the operation is finished, @callback will be called. 463 * You can then call g_file_create_readwrite_finish() to get 464 * the result of the operation. 465 * 466 * Params: 467 * flags = a set of #GFileCreateFlags 468 * ioPriority = the [I/O priority][io-priority] of the request 469 * cancellable = optional #GCancellable object, 470 * %NULL to ignore 471 * callback = a #GAsyncReadyCallback to call 472 * when the request is satisfied 473 * userData = the data to pass to callback function 474 * 475 * Since: 2.22 476 */ 477 public void createReadwriteAsync(GFileCreateFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 478 479 /** 480 * Finishes an asynchronous file create operation started with 481 * g_file_create_readwrite_async(). 482 * 483 * Params: 484 * res = a #GAsyncResult 485 * 486 * Returns: a #GFileIOStream or %NULL on error. 487 * Free the returned object with g_object_unref(). 488 * 489 * Since: 2.22 490 * 491 * Throws: GException on failure. 492 */ 493 public FileIOStream createReadwriteFinish(AsyncResultIF res); 494 495 /** 496 * Deletes a file. If the @file is a directory, it will only be 497 * deleted if it is empty. This has the same semantics as g_unlink(). 498 * 499 * If @cancellable is not %NULL, then the operation can be cancelled by 500 * triggering the cancellable object from another thread. If the operation 501 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 502 * 503 * Params: 504 * cancellable = optional #GCancellable object, 505 * %NULL to ignore 506 * 507 * Returns: %TRUE if the file was deleted. %FALSE otherwise. 508 * 509 * Throws: GException on failure. 510 */ 511 public bool delet(Cancellable cancellable); 512 513 /** 514 * Asynchronously delete a file. If the @file is a directory, it will 515 * only be deleted if it is empty. This has the same semantics as 516 * g_unlink(). 517 * 518 * Params: 519 * ioPriority = the [I/O priority][io-priority] of the request 520 * cancellable = optional #GCancellable object, 521 * %NULL to ignore 522 * callback = a #GAsyncReadyCallback to call 523 * when the request is satisfied 524 * userData = the data to pass to callback function 525 * 526 * Since: 2.34 527 */ 528 public void deleteAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 529 530 /** 531 * Finishes deleting a file started with g_file_delete_async(). 532 * 533 * Params: 534 * result = a #GAsyncResult 535 * 536 * Returns: %TRUE if the file was deleted. %FALSE otherwise. 537 * 538 * Since: 2.34 539 * 540 * Throws: GException on failure. 541 */ 542 public bool deleteFinish(AsyncResultIF result); 543 544 /** 545 * Duplicates a #GFile handle. This operation does not duplicate 546 * the actual file or directory represented by the #GFile; see 547 * g_file_copy() if attempting to copy a file. 548 * 549 * This call does no blocking I/O. 550 * 551 * Returns: a new #GFile that is a duplicate 552 * of the given #GFile. 553 */ 554 public FileIF dup(); 555 556 /** 557 * Starts an asynchronous eject on a mountable. 558 * When this operation has completed, @callback will be called with 559 * @user_user data, and the operation can be finalized with 560 * g_file_eject_mountable_finish(). 561 * 562 * If @cancellable is not %NULL, then the operation can be cancelled by 563 * triggering the cancellable object from another thread. If the operation 564 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 565 * 566 * Deprecated: Use g_file_eject_mountable_with_operation() instead. 567 * 568 * Params: 569 * flags = flags affecting the operation 570 * cancellable = optional #GCancellable object, 571 * %NULL to ignore 572 * callback = a #GAsyncReadyCallback to call 573 * when the request is satisfied, or %NULL 574 * userData = the data to pass to callback function 575 */ 576 public void ejectMountable(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 577 578 /** 579 * Finishes an asynchronous eject operation started by 580 * g_file_eject_mountable(). 581 * 582 * Deprecated: Use g_file_eject_mountable_with_operation_finish() 583 * instead. 584 * 585 * Params: 586 * result = a #GAsyncResult 587 * 588 * Returns: %TRUE if the @file was ejected successfully. 589 * %FALSE otherwise. 590 * 591 * Throws: GException on failure. 592 */ 593 public bool ejectMountableFinish(AsyncResultIF result); 594 595 /** 596 * Starts an asynchronous eject on a mountable. 597 * When this operation has completed, @callback will be called with 598 * @user_user data, and the operation can be finalized with 599 * g_file_eject_mountable_with_operation_finish(). 600 * 601 * If @cancellable is not %NULL, then the operation can be cancelled by 602 * triggering the cancellable object from another thread. If the operation 603 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 604 * 605 * Params: 606 * flags = flags affecting the operation 607 * mountOperation = a #GMountOperation, 608 * or %NULL to avoid user interaction 609 * cancellable = optional #GCancellable object, 610 * %NULL to ignore 611 * callback = a #GAsyncReadyCallback to call 612 * when the request is satisfied, or %NULL 613 * userData = the data to pass to callback function 614 * 615 * Since: 2.22 616 */ 617 public void ejectMountableWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 618 619 /** 620 * Finishes an asynchronous eject operation started by 621 * g_file_eject_mountable_with_operation(). 622 * 623 * Params: 624 * result = a #GAsyncResult 625 * 626 * Returns: %TRUE if the @file was ejected successfully. 627 * %FALSE otherwise. 628 * 629 * Since: 2.22 630 * 631 * Throws: GException on failure. 632 */ 633 public bool ejectMountableWithOperationFinish(AsyncResultIF result); 634 635 /** 636 * Gets the requested information about the files in a directory. 637 * The result is a #GFileEnumerator object that will give out 638 * #GFileInfo objects for all the files in the directory. 639 * 640 * The @attributes value is a string that specifies the file 641 * attributes that should be gathered. It is not an error if 642 * it's not possible to read a particular requested attribute 643 * from a file - it just won't be set. @attributes should 644 * be a comma-separated list of attributes or attribute wildcards. 645 * The wildcard "*" means all attributes, and a wildcard like 646 * "standard::*" means all attributes in the standard namespace. 647 * An example attribute query be "standard::*,owner::user". 648 * The standard attributes are available as defines, like 649 * #G_FILE_ATTRIBUTE_STANDARD_NAME. 650 * 651 * If @cancellable is not %NULL, then the operation can be cancelled 652 * by triggering the cancellable object from another thread. If the 653 * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be 654 * returned. 655 * 656 * If the file does not exist, the %G_IO_ERROR_NOT_FOUND error will 657 * be returned. If the file is not a directory, the %G_IO_ERROR_NOT_DIRECTORY 658 * error will be returned. Other errors are possible too. 659 * 660 * Params: 661 * attributes = an attribute query string 662 * flags = a set of #GFileQueryInfoFlags 663 * cancellable = optional #GCancellable object, 664 * %NULL to ignore 665 * 666 * Returns: A #GFileEnumerator if successful, 667 * %NULL on error. Free the returned object with g_object_unref(). 668 * 669 * Throws: GException on failure. 670 */ 671 public FileEnumerator enumerateChildren(string attributes, GFileQueryInfoFlags flags, Cancellable cancellable); 672 673 /** 674 * Asynchronously gets the requested information about the files 675 * in a directory. The result is a #GFileEnumerator object that will 676 * give out #GFileInfo objects for all the files in the directory. 677 * 678 * For more details, see g_file_enumerate_children() which is 679 * the synchronous version of this call. 680 * 681 * When the operation is finished, @callback will be called. You can 682 * then call g_file_enumerate_children_finish() to get the result of 683 * the operation. 684 * 685 * Params: 686 * attributes = an attribute query string 687 * flags = a set of #GFileQueryInfoFlags 688 * ioPriority = the [I/O priority][io-priority] of the request 689 * cancellable = optional #GCancellable object, 690 * %NULL to ignore 691 * callback = a #GAsyncReadyCallback to call when the 692 * request is satisfied 693 * userData = the data to pass to callback function 694 */ 695 public void enumerateChildrenAsync(string attributes, GFileQueryInfoFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 696 697 /** 698 * Finishes an async enumerate children operation. 699 * See g_file_enumerate_children_async(). 700 * 701 * Params: 702 * res = a #GAsyncResult 703 * 704 * Returns: a #GFileEnumerator or %NULL 705 * if an error occurred. 706 * Free the returned object with g_object_unref(). 707 * 708 * Throws: GException on failure. 709 */ 710 public FileEnumerator enumerateChildrenFinish(AsyncResultIF res); 711 712 /** 713 * Checks if the two given #GFiles refer to the same file. 714 * 715 * Note that two #GFiles that differ can still refer to the same 716 * file on the filesystem due to various forms of filename 717 * aliasing. 718 * 719 * This call does no blocking I/O. 720 * 721 * Params: 722 * file2 = the second #GFile 723 * 724 * Returns: %TRUE if @file1 and @file2 are equal. 725 */ 726 public bool equal(FileIF file2); 727 728 /** 729 * Gets a #GMount for the #GFile. 730 * 731 * If the #GFileIface for @file does not have a mount (e.g. 732 * possibly a remote share), @error will be set to %G_IO_ERROR_NOT_FOUND 733 * and %NULL will be returned. 734 * 735 * If @cancellable is not %NULL, then the operation can be cancelled by 736 * triggering the cancellable object from another thread. If the operation 737 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 738 * 739 * Params: 740 * cancellable = optional #GCancellable object, 741 * %NULL to ignore 742 * 743 * Returns: a #GMount where the @file is located 744 * or %NULL on error. 745 * Free the returned object with g_object_unref(). 746 * 747 * Throws: GException on failure. 748 */ 749 public MountIF findEnclosingMount(Cancellable cancellable); 750 751 /** 752 * Asynchronously gets the mount for the file. 753 * 754 * For more details, see g_file_find_enclosing_mount() which is 755 * the synchronous version of this call. 756 * 757 * When the operation is finished, @callback will be called. 758 * You can then call g_file_find_enclosing_mount_finish() to 759 * get the result of the operation. 760 * 761 * Params: 762 * ioPriority = the [I/O priority][io-priority] of the request 763 * cancellable = optional #GCancellable object, 764 * %NULL to ignore 765 * callback = a #GAsyncReadyCallback to call 766 * when the request is satisfied 767 * userData = the data to pass to callback function 768 */ 769 public void findEnclosingMountAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 770 771 /** 772 * Finishes an asynchronous find mount request. 773 * See g_file_find_enclosing_mount_async(). 774 * 775 * Params: 776 * res = a #GAsyncResult 777 * 778 * Returns: #GMount for given @file or %NULL on error. 779 * Free the returned object with g_object_unref(). 780 * 781 * Throws: GException on failure. 782 */ 783 public MountIF findEnclosingMountFinish(AsyncResultIF res); 784 785 /** 786 * Gets the base name (the last component of the path) for a given #GFile. 787 * 788 * If called for the top level of a system (such as the filesystem root 789 * or a uri like sftp://host/) it will return a single directory separator 790 * (and on Windows, possibly a drive letter). 791 * 792 * The base name is a byte string (not UTF-8). It has no defined encoding 793 * or rules other than it may not contain zero bytes. If you want to use 794 * filenames in a user interface you should use the display name that you 795 * can get by requesting the %G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME 796 * attribute with g_file_query_info(). 797 * 798 * This call does no blocking I/O. 799 * 800 * Returns: string containing the #GFile's 801 * base name, or %NULL if given #GFile is invalid. The returned string 802 * should be freed with g_free() when no longer needed. 803 */ 804 public string getBasename(); 805 806 /** 807 * Gets a child of @file with basename equal to @name. 808 * 809 * Note that the file with that specific name might not exist, but 810 * you can still have a #GFile that points to it. You can use this 811 * for instance to create that file. 812 * 813 * This call does no blocking I/O. 814 * 815 * Params: 816 * name = string containing the child's basename 817 * 818 * Returns: a #GFile to a child specified by @name. 819 * Free the returned object with g_object_unref(). 820 */ 821 public FileIF getChild(string name); 822 823 /** 824 * Gets the child of @file for a given @display_name (i.e. a UTF-8 825 * version of the name). If this function fails, it returns %NULL 826 * and @error will be set. This is very useful when constructing a 827 * #GFile for a new file and the user entered the filename in the 828 * user interface, for instance when you select a directory and 829 * type a filename in the file selector. 830 * 831 * This call does no blocking I/O. 832 * 833 * Params: 834 * displayName = string to a possible child 835 * 836 * Returns: a #GFile to the specified child, or 837 * %NULL if the display name couldn't be converted. 838 * Free the returned object with g_object_unref(). 839 * 840 * Throws: GException on failure. 841 */ 842 public FileIF getChildForDisplayName(string displayName); 843 844 /** 845 * Gets the parent directory for the @file. 846 * If the @file represents the root directory of the 847 * file system, then %NULL will be returned. 848 * 849 * This call does no blocking I/O. 850 * 851 * Returns: a #GFile structure to the 852 * parent of the given #GFile or %NULL if there is no parent. Free 853 * the returned object with g_object_unref(). 854 */ 855 public FileIF getParent(); 856 857 /** 858 * Gets the parse name of the @file. 859 * A parse name is a UTF-8 string that describes the 860 * file such that one can get the #GFile back using 861 * g_file_parse_name(). 862 * 863 * This is generally used to show the #GFile as a nice 864 * full-pathname kind of string in a user interface, 865 * like in a location entry. 866 * 867 * For local files with names that can safely be converted 868 * to UTF-8 the pathname is used, otherwise the IRI is used 869 * (a form of URI that allows UTF-8 characters unescaped). 870 * 871 * This call does no blocking I/O. 872 * 873 * Returns: a string containing the #GFile's parse name. 874 * The returned string should be freed with g_free() 875 * when no longer needed. 876 */ 877 public string getParseName(); 878 879 /** 880 * Gets the local pathname for #GFile, if one exists. If non-%NULL, this is 881 * guaranteed to be an absolute, canonical path. It might contain symlinks. 882 * 883 * This call does no blocking I/O. 884 * 885 * Returns: string containing the #GFile's path, 886 * or %NULL if no such path exists. The returned string should be freed 887 * with g_free() when no longer needed. 888 */ 889 public string getPath(); 890 891 /** 892 * Gets the path for @descendant relative to @parent. 893 * 894 * This call does no blocking I/O. 895 * 896 * Params: 897 * descendant = input #GFile 898 * 899 * Returns: string with the relative path from 900 * @descendant to @parent, or %NULL if @descendant doesn't have @parent as 901 * prefix. The returned string should be freed with g_free() when 902 * no longer needed. 903 */ 904 public string getRelativePath(FileIF descendant); 905 906 /** 907 * Gets the URI for the @file. 908 * 909 * This call does no blocking I/O. 910 * 911 * Returns: a string containing the #GFile's URI. 912 * The returned string should be freed with g_free() 913 * when no longer needed. 914 */ 915 public string getUri(); 916 917 /** 918 * Gets the URI scheme for a #GFile. 919 * RFC 3986 decodes the scheme as: 920 * |[ 921 * URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] 922 * ]| 923 * Common schemes include "file", "http", "ftp", etc. 924 * 925 * This call does no blocking I/O. 926 * 927 * Returns: a string containing the URI scheme for the given 928 * #GFile. The returned string should be freed with g_free() 929 * when no longer needed. 930 */ 931 public string getUriScheme(); 932 933 /** 934 * Checks if @file has a parent, and optionally, if it is @parent. 935 * 936 * If @parent is %NULL then this function returns %TRUE if @file has any 937 * parent at all. If @parent is non-%NULL then %TRUE is only returned 938 * if @file is an immediate child of @parent. 939 * 940 * Params: 941 * parent = the parent to check for, or %NULL 942 * 943 * Returns: %TRUE if @file is an immediate child of @parent (or any parent in 944 * the case that @parent is %NULL). 945 * 946 * Since: 2.24 947 */ 948 public bool hasParent(FileIF parent); 949 950 /** 951 * Checks whether @file has the prefix specified by @prefix. 952 * 953 * In other words, if the names of initial elements of @file's 954 * pathname match @prefix. Only full pathname elements are matched, 955 * so a path like /foo is not considered a prefix of /foobar, only 956 * of /foo/bar. 957 * 958 * A #GFile is not a prefix of itself. If you want to check for 959 * equality, use g_file_equal(). 960 * 961 * This call does no I/O, as it works purely on names. As such it can 962 * sometimes return %FALSE even if @file is inside a @prefix (from a 963 * filesystem point of view), because the prefix of @file is an alias 964 * of @prefix. 965 * 966 * Params: 967 * prefix = input #GFile 968 * 969 * Returns: %TRUE if the @files's parent, grandparent, etc is @prefix, 970 * %FALSE otherwise. 971 */ 972 public bool hasPrefix(FileIF prefix); 973 974 /** 975 * Checks to see if a #GFile has a given URI scheme. 976 * 977 * This call does no blocking I/O. 978 * 979 * Params: 980 * uriScheme = a string containing a URI scheme 981 * 982 * Returns: %TRUE if #GFile's backend supports the 983 * given URI scheme, %FALSE if URI scheme is %NULL, 984 * not supported, or #GFile is invalid. 985 */ 986 public bool hasUriScheme(string uriScheme); 987 988 /** 989 * Creates a hash value for a #GFile. 990 * 991 * This call does no blocking I/O. 992 * 993 * Returns: 0 if @file is not a valid #GFile, otherwise an 994 * integer that can be used as hash value for the #GFile. 995 * This function is intended for easily hashing a #GFile to 996 * add to a #GHashTable or similar data structure. 997 */ 998 public uint hash(); 999 1000 /** 1001 * Checks to see if a file is native to the platform. 1002 * 1003 * A native file s one expressed in the platform-native filename format, 1004 * e.g. "C:\Windows" or "/usr/bin/". This does not mean the file is local, 1005 * as it might be on a locally mounted remote filesystem. 1006 * 1007 * On some systems non-native files may be available using the native 1008 * filesystem via a userspace filesystem (FUSE), in these cases this call 1009 * will return %FALSE, but g_file_get_path() will still return a native path. 1010 * 1011 * This call does no blocking I/O. 1012 * 1013 * Returns: %TRUE if @file is native 1014 */ 1015 public bool isNative(); 1016 1017 /** 1018 * Loads the content of the file into memory. The data is always 1019 * zero-terminated, but this is not included in the resultant @length. 1020 * The returned @content should be freed with g_free() when no longer 1021 * needed. 1022 * 1023 * If @cancellable is not %NULL, then the operation can be cancelled by 1024 * triggering the cancellable object from another thread. If the operation 1025 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1026 * 1027 * Params: 1028 * cancellable = optional #GCancellable object, %NULL to ignore 1029 * contents = a location to place the contents of the file 1030 * etagOut = a location to place the current entity tag for the file, 1031 * or %NULL if the entity tag is not needed 1032 * 1033 * Returns: %TRUE if the @file's contents were successfully loaded. 1034 * %FALSE if there were errors. 1035 * 1036 * Throws: GException on failure. 1037 */ 1038 public bool loadContents(Cancellable cancellable, out string contents, out string etagOut); 1039 1040 /** 1041 * Starts an asynchronous load of the @file's contents. 1042 * 1043 * For more details, see g_file_load_contents() which is 1044 * the synchronous version of this call. 1045 * 1046 * When the load operation has completed, @callback will be called 1047 * with @user data. To finish the operation, call 1048 * g_file_load_contents_finish() with the #GAsyncResult returned by 1049 * the @callback. 1050 * 1051 * If @cancellable is not %NULL, then the operation can be cancelled by 1052 * triggering the cancellable object from another thread. If the operation 1053 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1054 * 1055 * Params: 1056 * cancellable = optional #GCancellable object, %NULL to ignore 1057 * callback = a #GAsyncReadyCallback to call when the request is satisfied 1058 * userData = the data to pass to callback function 1059 */ 1060 public void loadContentsAsync(Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 1061 1062 /** 1063 * Finishes an asynchronous load of the @file's contents. 1064 * The contents are placed in @contents, and @length is set to the 1065 * size of the @contents string. The @content should be freed with 1066 * g_free() when no longer needed. If @etag_out is present, it will be 1067 * set to the new entity tag for the @file. 1068 * 1069 * Params: 1070 * res = a #GAsyncResult 1071 * contents = a location to place the contents of the file 1072 * etagOut = a location to place the current entity tag for the file, 1073 * or %NULL if the entity tag is not needed 1074 * 1075 * Returns: %TRUE if the load was successful. If %FALSE and @error is 1076 * present, it will be set appropriately. 1077 * 1078 * Throws: GException on failure. 1079 */ 1080 public bool loadContentsFinish(AsyncResultIF res, out string contents, out string etagOut); 1081 1082 /** 1083 * Reads the partial contents of a file. A #GFileReadMoreCallback should 1084 * be used to stop reading from the file when appropriate, else this 1085 * function will behave exactly as g_file_load_contents_async(). This 1086 * operation can be finished by g_file_load_partial_contents_finish(). 1087 * 1088 * Users of this function should be aware that @user_data is passed to 1089 * both the @read_more_callback and the @callback. 1090 * 1091 * If @cancellable is not %NULL, then the operation can be cancelled by 1092 * triggering the cancellable object from another thread. If the operation 1093 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1094 * 1095 * Params: 1096 * cancellable = optional #GCancellable object, %NULL to ignore 1097 * readMoreCallback = a #GFileReadMoreCallback to receive partial data 1098 * and to specify whether further data should be read 1099 * callback = a #GAsyncReadyCallback to call when the request is satisfied 1100 * userData = the data to pass to the callback functions 1101 */ 1102 public void loadPartialContentsAsync(Cancellable cancellable, GFileReadMoreCallback readMoreCallback, GAsyncReadyCallback callback, void* userData); 1103 1104 /** 1105 * Finishes an asynchronous partial load operation that was started 1106 * with g_file_load_partial_contents_async(). The data is always 1107 * zero-terminated, but this is not included in the resultant @length. 1108 * The returned @content should be freed with g_free() when no longer 1109 * needed. 1110 * 1111 * Params: 1112 * res = a #GAsyncResult 1113 * contents = a location to place the contents of the file 1114 * etagOut = a location to place the current entity tag for the file, 1115 * or %NULL if the entity tag is not needed 1116 * 1117 * Returns: %TRUE if the load was successful. If %FALSE and @error is 1118 * present, it will be set appropriately. 1119 * 1120 * Throws: GException on failure. 1121 */ 1122 public bool loadPartialContentsFinish(AsyncResultIF res, out string contents, out string etagOut); 1123 1124 /** 1125 * Creates a directory. Note that this will only create a child directory 1126 * of the immediate parent directory of the path or URI given by the #GFile. 1127 * To recursively create directories, see g_file_make_directory_with_parents(). 1128 * This function will fail if the parent directory does not exist, setting 1129 * @error to %G_IO_ERROR_NOT_FOUND. If the file system doesn't support 1130 * creating directories, this function will fail, setting @error to 1131 * %G_IO_ERROR_NOT_SUPPORTED. 1132 * 1133 * For a local #GFile the newly created directory will have the default 1134 * (current) ownership and permissions of the current process. 1135 * 1136 * If @cancellable is not %NULL, then the operation can be cancelled by 1137 * triggering the cancellable object from another thread. If the operation 1138 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1139 * 1140 * Params: 1141 * cancellable = optional #GCancellable object, 1142 * %NULL to ignore 1143 * 1144 * Returns: %TRUE on successful creation, %FALSE otherwise. 1145 * 1146 * Throws: GException on failure. 1147 */ 1148 public bool makeDirectory(Cancellable cancellable); 1149 1150 /** 1151 * Asynchronously creates a directory. 1152 * 1153 * Params: 1154 * ioPriority = the [I/O priority][io-priority] of the request 1155 * cancellable = optional #GCancellable object, 1156 * %NULL to ignore 1157 * callback = a #GAsyncReadyCallback to call 1158 * when the request is satisfied 1159 * userData = the data to pass to callback function 1160 * 1161 * Since: 2.38 1162 */ 1163 public void makeDirectoryAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 1164 1165 /** 1166 * Finishes an asynchronous directory creation, started with 1167 * g_file_make_directory_async(). 1168 * 1169 * Params: 1170 * result = a #GAsyncResult 1171 * 1172 * Returns: %TRUE on successful directory creation, %FALSE otherwise. 1173 * 1174 * Since: 2.38 1175 * 1176 * Throws: GException on failure. 1177 */ 1178 public bool makeDirectoryFinish(AsyncResultIF result); 1179 1180 /** 1181 * Creates a directory and any parent directories that may not 1182 * exist similar to 'mkdir -p'. If the file system does not support 1183 * creating directories, this function will fail, setting @error to 1184 * %G_IO_ERROR_NOT_SUPPORTED. If the directory itself already exists, 1185 * this function will fail setting @error to %G_IO_ERROR_EXISTS, unlike 1186 * the similar g_mkdir_with_parents(). 1187 * 1188 * For a local #GFile the newly created directories will have the default 1189 * (current) ownership and permissions of the current process. 1190 * 1191 * If @cancellable is not %NULL, then the operation can be cancelled by 1192 * triggering the cancellable object from another thread. If the operation 1193 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1194 * 1195 * Params: 1196 * cancellable = optional #GCancellable object, 1197 * %NULL to ignore 1198 * 1199 * Returns: %TRUE if all directories have been successfully created, %FALSE 1200 * otherwise. 1201 * 1202 * Since: 2.18 1203 * 1204 * Throws: GException on failure. 1205 */ 1206 public bool makeDirectoryWithParents(Cancellable cancellable); 1207 1208 /** 1209 * Creates a symbolic link named @file which contains the string 1210 * @symlink_value. 1211 * 1212 * If @cancellable is not %NULL, then the operation can be cancelled by 1213 * triggering the cancellable object from another thread. If the operation 1214 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1215 * 1216 * Params: 1217 * symlinkValue = a string with the path for the target 1218 * of the new symlink 1219 * cancellable = optional #GCancellable object, 1220 * %NULL to ignore 1221 * 1222 * Returns: %TRUE on the creation of a new symlink, %FALSE otherwise. 1223 * 1224 * Throws: GException on failure. 1225 */ 1226 public bool makeSymbolicLink(string symlinkValue, Cancellable cancellable); 1227 1228 /** 1229 * Recursively measures the disk usage of @file. 1230 * 1231 * This is essentially an analog of the 'du' command, but it also 1232 * reports the number of directories and non-directory files encountered 1233 * (including things like symbolic links). 1234 * 1235 * By default, errors are only reported against the toplevel file 1236 * itself. Errors found while recursing are silently ignored, unless 1237 * %G_FILE_DISK_USAGE_REPORT_ALL_ERRORS is given in @flags. 1238 * 1239 * The returned size, @disk_usage, is in bytes and should be formatted 1240 * with g_format_size() in order to get something reasonable for showing 1241 * in a user interface. 1242 * 1243 * @progress_callback and @progress_data can be given to request 1244 * periodic progress updates while scanning. See the documentation for 1245 * #GFileMeasureProgressCallback for information about when and how the 1246 * callback will be invoked. 1247 * 1248 * Params: 1249 * flags = #GFileMeasureFlags 1250 * cancellable = optional #GCancellable 1251 * progressCallback = a #GFileMeasureProgressCallback 1252 * progressData = user_data for @progress_callback 1253 * diskUsage = the number of bytes of disk space used 1254 * numDirs = the number of directories encountered 1255 * numFiles = the number of non-directories encountered 1256 * 1257 * Returns: %TRUE if successful, with the out parameters set. 1258 * %FALSE otherwise, with @error set. 1259 * 1260 * Since: 2.38 1261 * 1262 * Throws: GException on failure. 1263 */ 1264 public bool measureDiskUsage(GFileMeasureFlags flags, Cancellable cancellable, GFileMeasureProgressCallback progressCallback, void* progressData, out ulong diskUsage, out ulong numDirs, out ulong numFiles); 1265 1266 /** 1267 * Recursively measures the disk usage of @file. 1268 * 1269 * This is the asynchronous version of g_file_measure_disk_usage(). See 1270 * there for more information. 1271 * 1272 * Params: 1273 * flags = #GFileMeasureFlags 1274 * ioPriority = the [I/O priority][io-priority] of the request 1275 * cancellable = optional #GCancellable 1276 * progressCallback = a #GFileMeasureProgressCallback 1277 * progressData = user_data for @progress_callback 1278 * callback = a #GAsyncReadyCallback to call when complete 1279 * userData = the data to pass to callback function 1280 * 1281 * Since: 2.38 1282 */ 1283 public void measureDiskUsageAsync(GFileMeasureFlags flags, int ioPriority, Cancellable cancellable, GFileMeasureProgressCallback progressCallback, void* progressData, GAsyncReadyCallback callback, void* userData); 1284 1285 /** 1286 * Collects the results from an earlier call to 1287 * g_file_measure_disk_usage_async(). See g_file_measure_disk_usage() for 1288 * more information. 1289 * 1290 * Params: 1291 * result = the #GAsyncResult passed to your #GAsyncReadyCallback 1292 * diskUsage = the number of bytes of disk space used 1293 * numDirs = the number of directories encountered 1294 * numFiles = the number of non-directories encountered 1295 * 1296 * Returns: %TRUE if successful, with the out parameters set. 1297 * %FALSE otherwise, with @error set. 1298 * 1299 * Since: 2.38 1300 * 1301 * Throws: GException on failure. 1302 */ 1303 public bool measureDiskUsageFinish(AsyncResultIF result, out ulong diskUsage, out ulong numDirs, out ulong numFiles); 1304 1305 /** 1306 * Obtains a file or directory monitor for the given file, 1307 * depending on the type of the file. 1308 * 1309 * If @cancellable is not %NULL, then the operation can be cancelled by 1310 * triggering the cancellable object from another thread. If the operation 1311 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1312 * 1313 * Params: 1314 * flags = a set of #GFileMonitorFlags 1315 * cancellable = optional #GCancellable object, 1316 * %NULL to ignore 1317 * 1318 * Returns: a #GFileMonitor for the given @file, 1319 * or %NULL on error. 1320 * Free the returned object with g_object_unref(). 1321 * 1322 * Since: 2.18 1323 * 1324 * Throws: GException on failure. 1325 */ 1326 public FileMonitor monitor(GFileMonitorFlags flags, Cancellable cancellable); 1327 1328 /** 1329 * Obtains a directory monitor for the given file. 1330 * This may fail if directory monitoring is not supported. 1331 * 1332 * If @cancellable is not %NULL, then the operation can be cancelled by 1333 * triggering the cancellable object from another thread. If the operation 1334 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1335 * 1336 * It does not make sense for @flags to contain 1337 * %G_FILE_MONITOR_WATCH_HARD_LINKS, since hard links can not be made to 1338 * directories. It is not possible to monitor all the files in a 1339 * directory for changes made via hard links; if you want to do this then 1340 * you must register individual watches with g_file_monitor(). 1341 * 1342 * Params: 1343 * flags = a set of #GFileMonitorFlags 1344 * cancellable = optional #GCancellable object, 1345 * %NULL to ignore 1346 * 1347 * Returns: a #GFileMonitor for the given @file, 1348 * or %NULL on error. 1349 * Free the returned object with g_object_unref(). 1350 * 1351 * Throws: GException on failure. 1352 */ 1353 public FileMonitor monitorDirectory(GFileMonitorFlags flags, Cancellable cancellable); 1354 1355 /** 1356 * Obtains a file monitor for the given file. If no file notification 1357 * mechanism exists, then regular polling of the file is used. 1358 * 1359 * If @cancellable is not %NULL, then the operation can be cancelled by 1360 * triggering the cancellable object from another thread. If the operation 1361 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1362 * 1363 * If @flags contains %G_FILE_MONITOR_WATCH_HARD_LINKS then the monitor 1364 * will also attempt to report changes made to the file via another 1365 * filename (ie, a hard link). Without this flag, you can only rely on 1366 * changes made through the filename contained in @file to be 1367 * reported. Using this flag may result in an increase in resource 1368 * usage, and may not have any effect depending on the #GFileMonitor 1369 * backend and/or filesystem type. 1370 * 1371 * Params: 1372 * flags = a set of #GFileMonitorFlags 1373 * cancellable = optional #GCancellable object, 1374 * %NULL to ignore 1375 * 1376 * Returns: a #GFileMonitor for the given @file, 1377 * or %NULL on error. 1378 * Free the returned object with g_object_unref(). 1379 * 1380 * Throws: GException on failure. 1381 */ 1382 public FileMonitor monitorFile(GFileMonitorFlags flags, Cancellable cancellable); 1383 1384 /** 1385 * Starts a @mount_operation, mounting the volume that contains 1386 * the file @location. 1387 * 1388 * When this operation has completed, @callback will be called with 1389 * @user_user data, and the operation can be finalized with 1390 * g_file_mount_enclosing_volume_finish(). 1391 * 1392 * If @cancellable is not %NULL, then the operation can be cancelled by 1393 * triggering the cancellable object from another thread. If the operation 1394 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1395 * 1396 * Params: 1397 * flags = flags affecting the operation 1398 * mountOperation = a #GMountOperation 1399 * or %NULL to avoid user interaction 1400 * cancellable = optional #GCancellable object, 1401 * %NULL to ignore 1402 * callback = a #GAsyncReadyCallback to call 1403 * when the request is satisfied, or %NULL 1404 * userData = the data to pass to callback function 1405 */ 1406 public void mountEnclosingVolume(GMountMountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 1407 1408 /** 1409 * Finishes a mount operation started by g_file_mount_enclosing_volume(). 1410 * 1411 * Params: 1412 * result = a #GAsyncResult 1413 * 1414 * Returns: %TRUE if successful. If an error has occurred, 1415 * this function will return %FALSE and set @error 1416 * appropriately if present. 1417 * 1418 * Throws: GException on failure. 1419 */ 1420 public bool mountEnclosingVolumeFinish(AsyncResultIF result); 1421 1422 /** 1423 * Mounts a file of type G_FILE_TYPE_MOUNTABLE. 1424 * Using @mount_operation, you can request callbacks when, for instance, 1425 * passwords are needed during authentication. 1426 * 1427 * If @cancellable is not %NULL, then the operation can be cancelled by 1428 * triggering the cancellable object from another thread. If the operation 1429 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1430 * 1431 * When the operation is finished, @callback will be called. 1432 * You can then call g_file_mount_mountable_finish() to get 1433 * the result of the operation. 1434 * 1435 * Params: 1436 * flags = flags affecting the operation 1437 * mountOperation = a #GMountOperation, 1438 * or %NULL to avoid user interaction 1439 * cancellable = optional #GCancellable object, 1440 * %NULL to ignore 1441 * callback = a #GAsyncReadyCallback to call 1442 * when the request is satisfied, or %NULL 1443 * userData = the data to pass to callback function 1444 */ 1445 public void mountMountable(GMountMountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 1446 1447 /** 1448 * Finishes a mount operation. See g_file_mount_mountable() for details. 1449 * 1450 * Finish an asynchronous mount operation that was started 1451 * with g_file_mount_mountable(). 1452 * 1453 * Params: 1454 * result = a #GAsyncResult 1455 * 1456 * Returns: a #GFile or %NULL on error. 1457 * Free the returned object with g_object_unref(). 1458 * 1459 * Throws: GException on failure. 1460 */ 1461 public FileIF mountMountableFinish(AsyncResultIF result); 1462 1463 /** 1464 * Tries to move the file or directory @source to the location specified 1465 * by @destination. If native move operations are supported then this is 1466 * used, otherwise a copy + delete fallback is used. The native 1467 * implementation may support moving directories (for instance on moves 1468 * inside the same filesystem), but the fallback code does not. 1469 * 1470 * If the flag #G_FILE_COPY_OVERWRITE is specified an already 1471 * existing @destination file is overwritten. 1472 * 1473 * If the flag #G_FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlinks 1474 * will be copied as symlinks, otherwise the target of the 1475 * @source symlink will be copied. 1476 * 1477 * If @cancellable is not %NULL, then the operation can be cancelled by 1478 * triggering the cancellable object from another thread. If the operation 1479 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1480 * 1481 * If @progress_callback is not %NULL, then the operation can be monitored 1482 * by setting this to a #GFileProgressCallback function. 1483 * @progress_callback_data will be passed to this function. It is 1484 * guaranteed that this callback will be called after all data has been 1485 * transferred with the total number of bytes copied during the operation. 1486 * 1487 * If the @source file does not exist, then the %G_IO_ERROR_NOT_FOUND 1488 * error is returned, independent on the status of the @destination. 1489 * 1490 * If #G_FILE_COPY_OVERWRITE is not specified and the target exists, 1491 * then the error %G_IO_ERROR_EXISTS is returned. 1492 * 1493 * If trying to overwrite a file over a directory, the %G_IO_ERROR_IS_DIRECTORY 1494 * error is returned. If trying to overwrite a directory with a directory the 1495 * %G_IO_ERROR_WOULD_MERGE error is returned. 1496 * 1497 * If the source is a directory and the target does not exist, or 1498 * #G_FILE_COPY_OVERWRITE is specified and the target is a file, then 1499 * the %G_IO_ERROR_WOULD_RECURSE error may be returned (if the native 1500 * move operation isn't available). 1501 * 1502 * Params: 1503 * destination = #GFile pointing to the destination location 1504 * flags = set of #GFileCopyFlags 1505 * cancellable = optional #GCancellable object, 1506 * %NULL to ignore 1507 * progressCallback = #GFileProgressCallback 1508 * function for updates 1509 * progressCallbackData = gpointer to user data for 1510 * the callback function 1511 * 1512 * Returns: %TRUE on successful move, %FALSE otherwise. 1513 * 1514 * Throws: GException on failure. 1515 */ 1516 public bool move(FileIF destination, GFileCopyFlags flags, Cancellable cancellable, GFileProgressCallback progressCallback, void* progressCallbackData); 1517 1518 /** 1519 * Opens an existing file for reading and writing. The result is 1520 * a #GFileIOStream that can be used to read and write the contents 1521 * of the file. 1522 * 1523 * If @cancellable is not %NULL, then the operation can be cancelled 1524 * by triggering the cancellable object from another thread. If the 1525 * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be 1526 * returned. 1527 * 1528 * If the file does not exist, the %G_IO_ERROR_NOT_FOUND error will 1529 * be returned. If the file is a directory, the %G_IO_ERROR_IS_DIRECTORY 1530 * error will be returned. Other errors are possible too, and depend on 1531 * what kind of filesystem the file is on. Note that in many non-local 1532 * file cases read and write streams are not supported, so make sure you 1533 * really need to do read and write streaming, rather than just opening 1534 * for reading or writing. 1535 * 1536 * Params: 1537 * cancellable = a #GCancellable 1538 * 1539 * Returns: #GFileIOStream or %NULL on error. 1540 * Free the returned object with g_object_unref(). 1541 * 1542 * Since: 2.22 1543 * 1544 * Throws: GException on failure. 1545 */ 1546 public FileIOStream openReadwrite(Cancellable cancellable); 1547 1548 /** 1549 * Asynchronously opens @file for reading and writing. 1550 * 1551 * For more details, see g_file_open_readwrite() which is 1552 * the synchronous version of this call. 1553 * 1554 * When the operation is finished, @callback will be called. 1555 * You can then call g_file_open_readwrite_finish() to get 1556 * the result of the operation. 1557 * 1558 * Params: 1559 * ioPriority = the [I/O priority][io-priority] of the request 1560 * cancellable = optional #GCancellable object, 1561 * %NULL to ignore 1562 * callback = a #GAsyncReadyCallback to call 1563 * when the request is satisfied 1564 * userData = the data to pass to callback function 1565 * 1566 * Since: 2.22 1567 */ 1568 public void openReadwriteAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 1569 1570 /** 1571 * Finishes an asynchronous file read operation started with 1572 * g_file_open_readwrite_async(). 1573 * 1574 * Params: 1575 * res = a #GAsyncResult 1576 * 1577 * Returns: a #GFileIOStream or %NULL on error. 1578 * Free the returned object with g_object_unref(). 1579 * 1580 * Since: 2.22 1581 * 1582 * Throws: GException on failure. 1583 */ 1584 public FileIOStream openReadwriteFinish(AsyncResultIF res); 1585 1586 /** 1587 * Polls a file of type #G_FILE_TYPE_MOUNTABLE. 1588 * 1589 * If @cancellable is not %NULL, then the operation can be cancelled by 1590 * triggering the cancellable object from another thread. If the operation 1591 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1592 * 1593 * When the operation is finished, @callback will be called. 1594 * You can then call g_file_mount_mountable_finish() to get 1595 * the result of the operation. 1596 * 1597 * Params: 1598 * cancellable = optional #GCancellable object, %NULL to ignore 1599 * callback = a #GAsyncReadyCallback to call 1600 * when the request is satisfied, or %NULL 1601 * userData = the data to pass to callback function 1602 * 1603 * Since: 2.22 1604 */ 1605 public void pollMountable(Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 1606 1607 /** 1608 * Finishes a poll operation. See g_file_poll_mountable() for details. 1609 * 1610 * Finish an asynchronous poll operation that was polled 1611 * with g_file_poll_mountable(). 1612 * 1613 * Params: 1614 * result = a #GAsyncResult 1615 * 1616 * Returns: %TRUE if the operation finished successfully. %FALSE 1617 * otherwise. 1618 * 1619 * Since: 2.22 1620 * 1621 * Throws: GException on failure. 1622 */ 1623 public bool pollMountableFinish(AsyncResultIF result); 1624 1625 /** 1626 * Returns the #GAppInfo that is registered as the default 1627 * application to handle the file specified by @file. 1628 * 1629 * If @cancellable is not %NULL, then the operation can be cancelled by 1630 * triggering the cancellable object from another thread. If the operation 1631 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1632 * 1633 * Params: 1634 * cancellable = optional #GCancellable object, %NULL to ignore 1635 * 1636 * Returns: a #GAppInfo if the handle was found, 1637 * %NULL if there were errors. 1638 * When you are done with it, release it with g_object_unref() 1639 * 1640 * Throws: GException on failure. 1641 */ 1642 public AppInfoIF queryDefaultHandler(Cancellable cancellable); 1643 1644 /** 1645 * Utility function to check if a particular file exists. This is 1646 * implemented using g_file_query_info() and as such does blocking I/O. 1647 * 1648 * Note that in many cases it is racy to first check for file existence 1649 * and then execute something based on the outcome of that, because the 1650 * file might have been created or removed in between the operations. The 1651 * general approach to handling that is to not check, but just do the 1652 * operation and handle the errors as they come. 1653 * 1654 * As an example of race-free checking, take the case of reading a file, 1655 * and if it doesn't exist, creating it. There are two racy versions: read 1656 * it, and on error create it; and: check if it exists, if not create it. 1657 * These can both result in two processes creating the file (with perhaps 1658 * a partially written file as the result). The correct approach is to 1659 * always try to create the file with g_file_create() which will either 1660 * atomically create the file or fail with a %G_IO_ERROR_EXISTS error. 1661 * 1662 * However, in many cases an existence check is useful in a user interface, 1663 * for instance to make a menu item sensitive/insensitive, so that you don't 1664 * have to fool users that something is possible and then just show an error 1665 * dialog. If you do this, you should make sure to also handle the errors 1666 * that can happen due to races when you execute the operation. 1667 * 1668 * Params: 1669 * cancellable = optional #GCancellable object, 1670 * %NULL to ignore 1671 * 1672 * Returns: %TRUE if the file exists (and can be detected without error), 1673 * %FALSE otherwise (or if cancelled). 1674 */ 1675 public bool queryExists(Cancellable cancellable); 1676 1677 /** 1678 * Utility function to inspect the #GFileType of a file. This is 1679 * implemented using g_file_query_info() and as such does blocking I/O. 1680 * 1681 * The primary use case of this method is to check if a file is 1682 * a regular file, directory, or symlink. 1683 * 1684 * Params: 1685 * flags = a set of #GFileQueryInfoFlags passed to g_file_query_info() 1686 * cancellable = optional #GCancellable object, 1687 * %NULL to ignore 1688 * 1689 * Returns: The #GFileType of the file and #G_FILE_TYPE_UNKNOWN 1690 * if the file does not exist 1691 * 1692 * Since: 2.18 1693 */ 1694 public GFileType queryFileType(GFileQueryInfoFlags flags, Cancellable cancellable); 1695 1696 /** 1697 * Similar to g_file_query_info(), but obtains information 1698 * about the filesystem the @file is on, rather than the file itself. 1699 * For instance the amount of space available and the type of 1700 * the filesystem. 1701 * 1702 * The @attributes value is a string that specifies the attributes 1703 * that should be gathered. It is not an error if it's not possible 1704 * to read a particular requested attribute from a file - it just 1705 * won't be set. @attributes should be a comma-separated list of 1706 * attributes or attribute wildcards. The wildcard "*" means all 1707 * attributes, and a wildcard like "filesystem::*" means all attributes 1708 * in the filesystem namespace. The standard namespace for filesystem 1709 * attributes is "filesystem". Common attributes of interest are 1710 * #G_FILE_ATTRIBUTE_FILESYSTEM_SIZE (the total size of the filesystem 1711 * in bytes), #G_FILE_ATTRIBUTE_FILESYSTEM_FREE (number of bytes available), 1712 * and #G_FILE_ATTRIBUTE_FILESYSTEM_TYPE (type of the filesystem). 1713 * 1714 * If @cancellable is not %NULL, then the operation can be cancelled 1715 * by triggering the cancellable object from another thread. If the 1716 * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be 1717 * returned. 1718 * 1719 * If the file does not exist, the %G_IO_ERROR_NOT_FOUND error will 1720 * be returned. Other errors are possible too, and depend on what 1721 * kind of filesystem the file is on. 1722 * 1723 * Params: 1724 * attributes = an attribute query string 1725 * cancellable = optional #GCancellable object, 1726 * %NULL to ignore 1727 * 1728 * Returns: a #GFileInfo or %NULL if there was an error. 1729 * Free the returned object with g_object_unref(). 1730 * 1731 * Throws: GException on failure. 1732 */ 1733 public FileInfo queryFilesystemInfo(string attributes, Cancellable cancellable); 1734 1735 /** 1736 * Asynchronously gets the requested information about the filesystem 1737 * that the specified @file is on. The result is a #GFileInfo object 1738 * that contains key-value attributes (such as type or size for the 1739 * file). 1740 * 1741 * For more details, see g_file_query_filesystem_info() which is the 1742 * synchronous version of this call. 1743 * 1744 * When the operation is finished, @callback will be called. You can 1745 * then call g_file_query_info_finish() to get the result of the 1746 * operation. 1747 * 1748 * Params: 1749 * attributes = an attribute query string 1750 * ioPriority = the [I/O priority][io-priority] of the request 1751 * cancellable = optional #GCancellable object, 1752 * %NULL to ignore 1753 * callback = a #GAsyncReadyCallback to call 1754 * when the request is satisfied 1755 * userData = the data to pass to callback function 1756 */ 1757 public void queryFilesystemInfoAsync(string attributes, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 1758 1759 /** 1760 * Finishes an asynchronous filesystem info query. 1761 * See g_file_query_filesystem_info_async(). 1762 * 1763 * Params: 1764 * res = a #GAsyncResult 1765 * 1766 * Returns: #GFileInfo for given @file 1767 * or %NULL on error. 1768 * Free the returned object with g_object_unref(). 1769 * 1770 * Throws: GException on failure. 1771 */ 1772 public FileInfo queryFilesystemInfoFinish(AsyncResultIF res); 1773 1774 /** 1775 * Gets the requested information about specified @file. 1776 * The result is a #GFileInfo object that contains key-value 1777 * attributes (such as the type or size of the file). 1778 * 1779 * The @attributes value is a string that specifies the file 1780 * attributes that should be gathered. It is not an error if 1781 * it's not possible to read a particular requested attribute 1782 * from a file - it just won't be set. @attributes should be a 1783 * comma-separated list of attributes or attribute wildcards. 1784 * The wildcard "*" means all attributes, and a wildcard like 1785 * "standard::*" means all attributes in the standard namespace. 1786 * An example attribute query be "standard::*,owner::user". 1787 * The standard attributes are available as defines, like 1788 * #G_FILE_ATTRIBUTE_STANDARD_NAME. 1789 * 1790 * If @cancellable is not %NULL, then the operation can be cancelled 1791 * by triggering the cancellable object from another thread. If the 1792 * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be 1793 * returned. 1794 * 1795 * For symlinks, normally the information about the target of the 1796 * symlink is returned, rather than information about the symlink 1797 * itself. However if you pass #G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS 1798 * in @flags the information about the symlink itself will be returned. 1799 * Also, for symlinks that point to non-existing files the information 1800 * about the symlink itself will be returned. 1801 * 1802 * If the file does not exist, the %G_IO_ERROR_NOT_FOUND error will be 1803 * returned. Other errors are possible too, and depend on what kind of 1804 * filesystem the file is on. 1805 * 1806 * Params: 1807 * attributes = an attribute query string 1808 * flags = a set of #GFileQueryInfoFlags 1809 * cancellable = optional #GCancellable object, 1810 * %NULL to ignore 1811 * 1812 * Returns: a #GFileInfo for the given @file, or %NULL 1813 * on error. Free the returned object with g_object_unref(). 1814 * 1815 * Throws: GException on failure. 1816 */ 1817 public FileInfo queryInfo(string attributes, GFileQueryInfoFlags flags, Cancellable cancellable); 1818 1819 /** 1820 * Asynchronously gets the requested information about specified @file. 1821 * The result is a #GFileInfo object that contains key-value attributes 1822 * (such as type or size for the file). 1823 * 1824 * For more details, see g_file_query_info() which is the synchronous 1825 * version of this call. 1826 * 1827 * When the operation is finished, @callback will be called. You can 1828 * then call g_file_query_info_finish() to get the result of the operation. 1829 * 1830 * Params: 1831 * attributes = an attribute query string 1832 * flags = a set of #GFileQueryInfoFlags 1833 * ioPriority = the [I/O priority][io-priority] of the request 1834 * cancellable = optional #GCancellable object, 1835 * %NULL to ignore 1836 * callback = a #GAsyncReadyCallback to call when the 1837 * request is satisfied 1838 * userData = the data to pass to callback function 1839 */ 1840 public void queryInfoAsync(string attributes, GFileQueryInfoFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 1841 1842 /** 1843 * Finishes an asynchronous file info query. 1844 * See g_file_query_info_async(). 1845 * 1846 * Params: 1847 * res = a #GAsyncResult 1848 * 1849 * Returns: #GFileInfo for given @file 1850 * or %NULL on error. Free the returned object with 1851 * g_object_unref(). 1852 * 1853 * Throws: GException on failure. 1854 */ 1855 public FileInfo queryInfoFinish(AsyncResultIF res); 1856 1857 /** 1858 * Obtain the list of settable attributes for the file. 1859 * 1860 * Returns the type and full attribute name of all the attributes 1861 * that can be set on this file. This doesn't mean setting it will 1862 * always succeed though, you might get an access failure, or some 1863 * specific file may not support a specific attribute. 1864 * 1865 * If @cancellable is not %NULL, then the operation can be cancelled by 1866 * triggering the cancellable object from another thread. If the operation 1867 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1868 * 1869 * Params: 1870 * cancellable = optional #GCancellable object, 1871 * %NULL to ignore 1872 * 1873 * Returns: a #GFileAttributeInfoList describing the settable attributes. 1874 * When you are done with it, release it with 1875 * g_file_attribute_info_list_unref() 1876 * 1877 * Throws: GException on failure. 1878 */ 1879 public FileAttributeInfoList querySettableAttributes(Cancellable cancellable); 1880 1881 /** 1882 * Obtain the list of attribute namespaces where new attributes 1883 * can be created by a user. An example of this is extended 1884 * attributes (in the "xattr" namespace). 1885 * 1886 * If @cancellable is not %NULL, then the operation can be cancelled by 1887 * triggering the cancellable object from another thread. If the operation 1888 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1889 * 1890 * Params: 1891 * cancellable = optional #GCancellable object, 1892 * %NULL to ignore 1893 * 1894 * Returns: a #GFileAttributeInfoList describing the writable namespaces. 1895 * When you are done with it, release it with 1896 * g_file_attribute_info_list_unref() 1897 * 1898 * Throws: GException on failure. 1899 */ 1900 public FileAttributeInfoList queryWritableNamespaces(Cancellable cancellable); 1901 1902 /** 1903 * Opens a file for reading. The result is a #GFileInputStream that 1904 * can be used to read the contents of the file. 1905 * 1906 * If @cancellable is not %NULL, then the operation can be cancelled by 1907 * triggering the cancellable object from another thread. If the operation 1908 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 1909 * 1910 * If the file does not exist, the %G_IO_ERROR_NOT_FOUND error will be 1911 * returned. If the file is a directory, the %G_IO_ERROR_IS_DIRECTORY 1912 * error will be returned. Other errors are possible too, and depend 1913 * on what kind of filesystem the file is on. 1914 * 1915 * Params: 1916 * cancellable = a #GCancellable 1917 * 1918 * Returns: #GFileInputStream or %NULL on error. 1919 * Free the returned object with g_object_unref(). 1920 * 1921 * Throws: GException on failure. 1922 */ 1923 public FileInputStream read(Cancellable cancellable); 1924 1925 /** 1926 * Asynchronously opens @file for reading. 1927 * 1928 * For more details, see g_file_read() which is 1929 * the synchronous version of this call. 1930 * 1931 * When the operation is finished, @callback will be called. 1932 * You can then call g_file_read_finish() to get the result 1933 * of the operation. 1934 * 1935 * Params: 1936 * ioPriority = the [I/O priority][io-priority] of the request 1937 * cancellable = optional #GCancellable object, 1938 * %NULL to ignore 1939 * callback = a #GAsyncReadyCallback to call 1940 * when the request is satisfied 1941 * userData = the data to pass to callback function 1942 */ 1943 public void readAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 1944 1945 /** 1946 * Finishes an asynchronous file read operation started with 1947 * g_file_read_async(). 1948 * 1949 * Params: 1950 * res = a #GAsyncResult 1951 * 1952 * Returns: a #GFileInputStream or %NULL on error. 1953 * Free the returned object with g_object_unref(). 1954 * 1955 * Throws: GException on failure. 1956 */ 1957 public FileInputStream readFinish(AsyncResultIF res); 1958 1959 /** 1960 * Returns an output stream for overwriting the file, possibly 1961 * creating a backup copy of the file first. If the file doesn't exist, 1962 * it will be created. 1963 * 1964 * This will try to replace the file in the safest way possible so 1965 * that any errors during the writing will not affect an already 1966 * existing copy of the file. For instance, for local files it 1967 * may write to a temporary file and then atomically rename over 1968 * the destination when the stream is closed. 1969 * 1970 * By default files created are generally readable by everyone, 1971 * but if you pass #G_FILE_CREATE_PRIVATE in @flags the file 1972 * will be made readable only to the current user, to the level that 1973 * is supported on the target filesystem. 1974 * 1975 * If @cancellable is not %NULL, then the operation can be cancelled 1976 * by triggering the cancellable object from another thread. If the 1977 * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be 1978 * returned. 1979 * 1980 * If you pass in a non-%NULL @etag value and @file already exists, then 1981 * this value is compared to the current entity tag of the file, and if 1982 * they differ an %G_IO_ERROR_WRONG_ETAG error is returned. This 1983 * generally means that the file has been changed since you last read 1984 * it. You can get the new etag from g_file_output_stream_get_etag() 1985 * after you've finished writing and closed the #GFileOutputStream. When 1986 * you load a new file you can use g_file_input_stream_query_info() to 1987 * get the etag of the file. 1988 * 1989 * If @make_backup is %TRUE, this function will attempt to make a 1990 * backup of the current file before overwriting it. If this fails 1991 * a %G_IO_ERROR_CANT_CREATE_BACKUP error will be returned. If you 1992 * want to replace anyway, try again with @make_backup set to %FALSE. 1993 * 1994 * If the file is a directory the %G_IO_ERROR_IS_DIRECTORY error will 1995 * be returned, and if the file is some other form of non-regular file 1996 * then a %G_IO_ERROR_NOT_REGULAR_FILE error will be returned. Some 1997 * file systems don't allow all file names, and may return an 1998 * %G_IO_ERROR_INVALID_FILENAME error, and if the name is to long 1999 * %G_IO_ERROR_FILENAME_TOO_LONG will be returned. Other errors are 2000 * possible too, and depend on what kind of filesystem the file is on. 2001 * 2002 * Params: 2003 * etag = an optional [entity tag][gfile-etag] 2004 * for the current #GFile, or #NULL to ignore 2005 * makeBackup = %TRUE if a backup should be created 2006 * flags = a set of #GFileCreateFlags 2007 * cancellable = optional #GCancellable object, 2008 * %NULL to ignore 2009 * 2010 * Returns: a #GFileOutputStream or %NULL on error. 2011 * Free the returned object with g_object_unref(). 2012 * 2013 * Throws: GException on failure. 2014 */ 2015 public FileOutputStream replace(string etag, bool makeBackup, GFileCreateFlags flags, Cancellable cancellable); 2016 2017 /** 2018 * Asynchronously overwrites the file, replacing the contents, 2019 * possibly creating a backup copy of the file first. 2020 * 2021 * For more details, see g_file_replace() which is 2022 * the synchronous version of this call. 2023 * 2024 * When the operation is finished, @callback will be called. 2025 * You can then call g_file_replace_finish() to get the result 2026 * of the operation. 2027 * 2028 * Params: 2029 * etag = an [entity tag][gfile-etag] for the current #GFile, 2030 * or %NULL to ignore 2031 * makeBackup = %TRUE if a backup should be created 2032 * flags = a set of #GFileCreateFlags 2033 * ioPriority = the [I/O priority][io-priority] of the request 2034 * cancellable = optional #GCancellable object, 2035 * %NULL to ignore 2036 * callback = a #GAsyncReadyCallback to call 2037 * when the request is satisfied 2038 * userData = the data to pass to callback function 2039 */ 2040 public void replaceAsync(string etag, bool makeBackup, GFileCreateFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 2041 2042 /** 2043 * Replaces the contents of @file with @contents of @length bytes. 2044 * 2045 * If @etag is specified (not %NULL), any existing file must have that etag, 2046 * or the error %G_IO_ERROR_WRONG_ETAG will be returned. 2047 * 2048 * If @make_backup is %TRUE, this function will attempt to make a backup 2049 * of @file. Internally, it uses g_file_replace(), so will try to replace the 2050 * file contents in the safest way possible. For example, atomic renames are 2051 * used when replacing local files’ contents. 2052 * 2053 * If @cancellable is not %NULL, then the operation can be cancelled by 2054 * triggering the cancellable object from another thread. If the operation 2055 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2056 * 2057 * The returned @new_etag can be used to verify that the file hasn't 2058 * changed the next time it is saved over. 2059 * 2060 * Params: 2061 * contents = a string containing the new contents for @file 2062 * etag = the old [entity-tag][gfile-etag] for the document, 2063 * or %NULL 2064 * makeBackup = %TRUE if a backup should be created 2065 * flags = a set of #GFileCreateFlags 2066 * newEtag = a location to a new [entity tag][gfile-etag] 2067 * for the document. This should be freed with g_free() when no longer 2068 * needed, or %NULL 2069 * cancellable = optional #GCancellable object, %NULL to ignore 2070 * 2071 * Returns: %TRUE if successful. If an error has occurred, this function 2072 * will return %FALSE and set @error appropriately if present. 2073 * 2074 * Throws: GException on failure. 2075 */ 2076 public bool replaceContents(string contents, string etag, bool makeBackup, GFileCreateFlags flags, out string newEtag, Cancellable cancellable); 2077 2078 /** 2079 * Starts an asynchronous replacement of @file with the given 2080 * @contents of @length bytes. @etag will replace the document's 2081 * current entity tag. 2082 * 2083 * When this operation has completed, @callback will be called with 2084 * @user_user data, and the operation can be finalized with 2085 * g_file_replace_contents_finish(). 2086 * 2087 * If @cancellable is not %NULL, then the operation can be cancelled by 2088 * triggering the cancellable object from another thread. If the operation 2089 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 2090 * 2091 * If @make_backup is %TRUE, this function will attempt to 2092 * make a backup of @file. 2093 * 2094 * Note that no copy of @content will be made, so it must stay valid 2095 * until @callback is called. See g_file_replace_contents_bytes_async() 2096 * for a #GBytes version that will automatically hold a reference to the 2097 * contents (without copying) for the duration of the call. 2098 * 2099 * Params: 2100 * contents = string of contents to replace the file with 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 }