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