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