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