Home | History | Annotate | Download | only in gio

Lines Matching full:file

1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
50 * @short_description: File and Directory Handling
55 * virtual file system. #GFile<!-- -->s are lightweight, immutable
57 * #GFile objects do not represent files, merely an identifier for a file. All
58 * file content I/O is implemented as streaming operations (see #GInputStream and
73 * files on a filesystem. You can move through the file system with #GFile using
81 * are byte strings that are used to identify the file on the filesystem (relative to
87 * store the real basename or the #GFile to use to actually access the file, because
91 * there may be multiple aliases for the same file. For instance, hard or
92 * soft links may cause two different #GFile<!-- -->s to refer to the same file.
95 * two #GFile<!-- -->s point to the same file you can query for the
111 * g_file_mount_mountable() to mount a mountable file.
112 * g_file_unmount_mountable() to unmount a mountable file.
113 * g_file_eject_mountable() to eject a mountable file.
118 * traditional mtime, and can be used to quickly determine if the file has
119 * been modified from the version on the file system. See the HTTP 1.1
129 static void g_file_real_query_info_async (GFile *file,
136 static GFileInfo * g_file_real_query_info_finish (GFile *file,
139 static void g_file_real_query_filesystem_info_async (GFile *file,
145 static GFileInfo * g_file_real_query_filesystem_info_finish (GFile *file,
148 static void g_file_real_enumerate_children_async (GFile *file,
155 static GFileEnumerator * g_file_real_enumerate_children_finish (GFile *file,
158 static void g_file_real_read_async (GFile *file,
163 static GFileInputStream * g_file_real_read_finish (GFile *file,
166 static void g_file_real_append_to_async (GFile *file,
172 static GFileOutputStream *g_file_real_append_to_finish (GFile *file,
175 static void g_file_real_create_async (GFile *file,
181 static GFileOutputStream *g_file_real_create_finish (GFile *file,
184 static void g_file_real_replace_async (GFile *file,
192 static GFileOutputStream *g_file_real_replace_finish (GFile *file,
195 static gboolean g_file_real_set_attributes_from_info (GFile *file,
200 static void g_file_real_set_display_name_async (GFile *file,
206 static GFile * g_file_real_set_display_name_finish (GFile *file,
209 static void g_file_real_set_attributes_async (GFile *file,
216 static gboolean g_file_real_set_attributes_finish (GFile *file,
220 static void g_file_real_find_enclosing_mount_async (GFile *file,
225 static GMount * g_file_real_find_enclosing_mount_finish (GFile *file,
237 static gboolean g_file_real_copy_finish (GFile *file,
311 * @file: input #GFile.
313 * Checks to see if a file is native to the platform.
315 * A native file s one expressed in the platform-native filename format,
316 * e.g. "C:\Windows" or "/usr/bin/". This does not mean the file is local,
326 * Returns: %TRUE if file is native.
329 g_file_is_native (GFile *file)
333 g_return_val_if_fail (G_IS_FILE (file), FALSE);
335 iface = G_FILE_GET_IFACE (file);
337 return (* iface->is_native) (file);
343 * @file: input #GFile.
355 g_file_has_uri_scheme (GFile *file,
360 g_return_val_if_fail (G_IS_FILE (file), FALSE);
363 iface = G_FILE_GET_IFACE (file);
365 return (* iface->has_uri_scheme) (file, uri_scheme);
371 * @file: input #GFile.
378 * Common schemes include "file
387 g_file_get_uri_scheme (GFile *file)
391 g_return_val_if_fail (G_IS_FILE (file), NULL);
393 iface = G_FILE_GET_IFACE (file);
395 return (* iface->get_uri_scheme) (file);
401 * @file: input #GFile.
422 g_file_get_basename (GFile *file)
426 g_return_val_if_fail (G_IS_FILE (file), NULL);
428 iface = G_FILE_GET_IFACE (file);
430 return (* iface->get_basename) (file);
435 * @file: input #GFile.
446 g_file_get_path (GFile *file)
450 g_return_val_if_fail (G_IS_FILE (file), NULL);
452 iface = G_FILE_GET_IFACE (file);
454 return (* iface->get_path) (file);
459 * @file: input #GFile.
461 * Gets the URI for the @file.
469 g_file_get_uri (GFile *file)
473 g_return_val_if_fail (G_IS_FILE (file), NULL);
475 iface = G_FILE_GET_IFACE (file);
477 return (* iface->get_uri) (file);
482 * @file: input #GFile.
484 * Gets the parse name of the @file.
486 * file such that one can get the #GFile back using
503 g_file_get_parse_name (GFile *file)
507 g_return_val_if_fail (G_IS_FILE (file), NULL);
509 iface = G_FILE_GET_IFACE (file);
511 return (* iface->get_parse_name) (file);
516 * @file: input #GFile.
519 * the actual file or directory represented by the #GFile; see
520 * g_file_copy() if attempting to copy a file.
527 g_file_dup (GFile *file)
531 g_return_val_if_fail (G_IS_FILE (file), NULL);
533 iface = G_FILE_GET_IFACE (file);
535 return (* iface->dup) (file);
540 * @file: #gconstpointer to a #GFile.
546 * Returns: 0 if @file is not a valid #GFile, otherwise an
552 g_file_hash (gconstpointer file)
556 g_return_val_if_fail (G_IS_FILE (file), 0);
558 iface = G_FILE_GET_IFACE (file);
560 return (* iface->hash) ((GFile *)file);
570 * file on the filesystem due to various forms of filename
598 * @file: input #GFile.
600 * Gets the parent directory for the @file.
601 * If the @file represents the root directory of the
602 * file system, then %NULL will be returned.
611 g_file_get_parent (GFile *file)
615 g_return_val_if_fail (G_IS_FILE (file), NULL);
617 iface = G_FILE_GET_IFACE (file);
619 return (* iface->get_parent) (file);
624 * @file: input #GFile.
627 * Gets a child of @file with basename equal to @name.
629 * Note that the file with that specific name might not exist, but
631 * for instance to create that file.
639 g_file_get_child (GFile *file,
642 g_return_val_if_fail (G_IS_FILE (file), NULL);
645 return g_file_resolve_relative_path (file, name);
650 * @file: input #GFile.
654 * Gets the child of @file for a given @display_name (i.e. a UTF8
656 * set. This is very useful when constructing a GFile for a new file
658 * when you select a directory and type a filename in the file selector.
667 g_file_get_child_for_display_name (GFile *file,
673 g_return_val_if_fail (G_IS_FILE (file), NULL);
676 iface = G_FILE_GET_IFACE (file);
678 return (* iface->get_child_for_display_name) (file, display_name, error);
683 * @file: input #GFile.
686 * Checks whether @file has the prefix specified by @prefix. In other word,
687 * if the names of inital elements of @file<!-- -->s pathname match @prefix.
692 * sometimes return %FALSE even if @file is inside a @prefix (from a
693 * filesystem point of view), because the prefix of @file is an alias
700 g_file_has_prefix (GFile *file,
705 g_return_val_if_fail (G_IS_FILE (file), FALSE);
708 if (G_TYPE_FROM_INSTANCE (file) != G_TYPE_FROM_INSTANCE (prefix))
711 iface = G_FILE_GET_IFACE (file);
715 return (* iface->prefix_matches) (prefix, file);
750 * @file: input #GFile.
753 * Resolves a relative path for @file to an absolute path.
758 * is %NULL or if @file is invalid.
762 g_file_resolve_relative_path (GFile *file,
767 g_return_val_if_fail (G_IS_FILE (file), NULL);
770 iface = G_FILE_GET_IFACE (file);
772 return (* iface->resolve_relative_path) (file, relative_path);
777 * @file: input #GFile.
787 * The @attribute value is a string that specifies the file attributes that
789 * requested attribute from a file - it just won't be set. @attribute should
799 * If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned.
800 * If the file is not a directory, the G_FILE_ERROR_NOTDIR error will be returned.
807 g_file_enumerate_children (GFile *file,
816 g_return_val_if_fail (G_IS_FILE (file), NULL);
821 iface = G_FILE_GET_IFACE (file);
831 return (* iface->enumerate_children) (file, attributes, flags,
837 * @file: input #GFile.
857 g_file_enumerate_children_async (GFile *file,
867 g_return_if_fail (G_IS_FILE (file));
869 iface = G_FILE_GET_IFACE (file);
870 (* iface->enumerate_children_async) (file,
881 * @file: input #GFile.
892 g_file_enumerate_children_finish (GFile *file,
898 g_return_val_if_fail (G_IS_FILE (file), NULL);
908 iface = G_FILE_GET_IFACE (file);
909 return (* iface->enumerate_children_finish) (file, res, error);
914 * @file: input #GFile.
917 * Utility function to check if a particular file exists. This is
920 * Note that in many cases it is racy to first check for file existence
922 * file might have been created or removed in between the operations. The
926 * As an example of race-free checking, take the case of reading a file, and
929 * can both result in two processes creating the file (with perhaps a partially
930 * written file as the result). The correct approach is to always try to create
931 * the file with g_file_create() which will either atomically create the file
940 * Returns: %TRUE if the file exists (and can be detected without error), %FALSE otherwise (or if cancelled).
943 g_file_query_exists (GFile *file,
948 g_return_val_if_fail (G_IS_FILE(file), FALSE);
950 info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_TYPE,
963 * @file: input #GFile.
967 * Utility function to inspect the #GFileType of a file. This is
970 * The primary use case of this method is to check if a file is a regular file,
973 * Returns: The #GFileType of the file and #G_FILE_TYPE_UNKNOWN if the file
979 g_file_query_file_type (GFile *file,
986 g_return_val_if_fail (G_IS_FILE(file), G_FILE_TYPE_UNKNOWN);
987 info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_TYPE, flags,
1002 * @file: input #GFile.
1008 * Gets the requested information about specified @file. The result
1010 * the type or size of the file).
1012 * The @attribute value is a string that specifies the file attributes that
1014 * requested attribute from a file - it just won't be set. @attribute should
1031 * If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned.
1032 * Other errors are possible too, and depend on what kind of filesystem the file is on.
1034 * Returns: a #GFileInfo for the given @file, or %NULL on error.
1038 g_file_query_info (GFile *file,
1046 g_return_val_if_fail (G_IS_FILE (file), NULL);
1051 iface = G_FILE_GET_IFACE (file);
1061 return (* iface->query_info) (file, attributes, flags, cancellable, error);
1066 * @file: input #GFile.
1075 * Asynchronously gets the requested information about specified @file. The result
1077 * for the file).
1086 g_file_query_info_async (GFile *file,
1096 g_return_if_fail (G_IS_FILE (file));
1098 iface = G_FILE_GET_IFACE (file);
1099 (* iface->query_info_async) (file,
1110 * @file: input #GFile.
1114 * Finishes an asynchronous file info query.
1117 * Returns: #GFileInfo for given @file or %NULL on error.
1121 g_file_query_info_finish (GFile *file,
1127 g_return_val_if_fail (G_IS_FILE (file), NULL);
1137 iface = G_FILE_GET_IFACE (file);
1138 return (* iface->query_info_finish) (file, res, error);
1143 * @file: input #GFile.
1149 * about the filesystem the @file is on, rather than the file itself.
1153 * The @attribute value is a string that specifies the file attributes that
1155 * requested attribute from a file - it just won't be set. @attribute should
1167 * If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned.
1168 * Other errors are possible too, and depend on what kind of filesystem the file is on.
1174 g_file_query_filesystem_info (GFile *file,
1181 g_return_val_if_fail (G_IS_FILE (file), NULL);
1186 iface = G_FILE_GET_IFACE (file);
1196 return (* iface->query_filesystem_info) (file, attributes, cancellable, error);
1201 * @file: input #GFile.
1210 * that the specified @file is on. The result is a #GFileInfo object
1212 * file).
1222 g_file_query_filesystem_info_async (GFile *file,
1231 g_return_if_fail (G_IS_FILE (file));
1233 iface = G_FILE_GET_IFACE (file);
1234 (* iface->query_filesystem_info_async) (file,
1244 * @file: input #GFile.
1251 * Returns: #GFileInfo for given @file or %NULL on error.
1255 g_file_query_filesystem_info_finish (GFile *file,
1261 g_return_val_if_fail (G_IS_FILE (file), NULL);
1271 iface = G_FILE_GET_IFACE (file);
1272 return (* iface->query_filesystem_info_finish) (file, res, error);
1277 * @file: input #GFile.
1283 * If the #GFileIface for @file does not have a mount (e.g. possibly a
1291 * Returns: a #GMount where the @file is located or %NULL on error.
1295 g_file_find_enclosing_mount (GFile *file,
1301 g_return_val_if_fail (G_IS_FILE (file), NULL);
1306 iface = G_FILE_GET_IFACE (file);
1312 * enclosing (user visible) mount of a file, but none exists. */
1317 return (* iface->find_enclosing_mount) (file, cancellable, error);
1322 * @file: a #GFile
1329 * Asynchronously gets the mount for the file.
1338 g_file_find_enclosing_mount_async (GFile *file,
1346 g_return_if_fail (G_IS_FILE (file));
1348 iface = G_FILE_GET_IFACE (file);
1349 (* iface->find_enclosing_mount_async) (file,
1358 * @file: a #GFile
1365 * Returns: #GMount for given @file or %NULL on error.
1369 g_file_find_enclosing_mount_finish (GFile *file,
1375 g_return_val_if_fail (G_IS_FILE (file), NULL);
1385 iface = G_FILE_GET_IFACE (file);
1386 return (* iface->find_enclosing_mount_finish) (file, res, error);
1392 * @file: #GFile to read.
1396 * Opens a file for reading. The result is a #GFileInputStream that
1397 * can be used to read the contents of the file.
1403 * If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned.
1404 * If the file is a directory, the G_IO_ERROR_IS_DIRECTORY error will be returned.
1405 * Other errors are possible too, and depend on what kind of filesystem the file is on.
1411 g_file_read (GFile *file,
1417 g_return_val_if_fail (G_IS_FILE (file), NULL);
1422 iface = G_FILE_GET_IFACE (file);
1432 return (* iface->read_fn) (file, cancellable, error);
1437 file: input #GFile.
1442 * Gets an output stream for appending data to the file. If
1443 * the file doesn't already exist it is created.
1446 * but if you pass #G_FILE_CREATE_PRIVATE in @flags the file
1454 * Some file systems don't allow all file names, and may
1456 * If the file is a directory the %G_IO_ERROR_IS_DIRECTORY error will be
1458 * filesystem the file is on.
1464 g_file_append_to (GFile *file,
1471 g_return_val_if_fail (G_IS_FILE (file), NULL);
1476 iface = G_FILE_GET_IFACE (file);
1486 return (* iface->append_to) (file, flags, cancellable, error);
1491 * @file: input #GFile.
1496 * Creates a new file and returns an output stream for writing to it.
1497 * The file must not already exist.
1500 * but if you pass #G_FILE_CREATE_PRIVATE in @flags the file
1508 * If a file or directory with this name already exists the G_IO_ERROR_EXISTS
1510 * Some file systems don't allow all file names, and may
1514 * filesystem the file is on.
1516 * Returns: a #GFileOutputStream for the newly created file, or
1521 g_file_create (GFile *file,
1528 g_return_val_if_fail (G_IS_FILE (file), NULL);
1533 iface = G_FILE_GET_IFACE (file);
1543 return (* iface->create) (file, flags, cancellable, error);
1548 * @file: input #GFile.
1556 * Returns an output stream for overwriting the file, possibly
1557 * creating a backup copy of the file first. If the file doesn't exist,
1560 * This will try to replace the file in the safest way possible so
1562 * existing copy of the file. For instance, for local files it
1563 * may write to a temporary file and then atomically rename over
1567 * but if you pass #G_FILE_CREATE_PRIVATE in @flags the file
1576 * compared to the current entity tag of the file, and if they differ
1578 * that the file has been changed since you last read it. You can get
1581 * a new file you can use g_file_input_stream_query_info() to get
1582 * the etag of the file.
1585 * of the current file before overwriting it. If this fails a G_IO_ERROR_CANT_CREATE_BACKUP
1589 * If the file is a directory the G_IO_ERROR_IS_DIRECTORY error will be returned,
1590 * and if the file is some other form of non-regular file then a
1592 * Some file systems don't allow all file names, and may
1596 * filesystem the file is on.
1602 g_file_replace (GFile *file,
1611 g_return_val_if_fail (G_IS_FILE (file), NULL);
1616 iface = G_FILE_GET_IFACE (file);
1631 return (* iface->replace) (file, etag, make_backup, flags, cancellable, error);
1636 * @file: input #GFile.
1643 * Asynchronously opens @file for reading.
1652 g_file_read_async (GFile *file,
1660 g_return_if_fail (G_IS_FILE (file));
1662 iface = G_FILE_GET_IFACE (file);
1663 (* iface->read_async) (file,
1672 * @file: input #GFile.
1676 * Finishes an asynchronous file read operation started with
1683 g_file_read_finish (GFile *file,
1689 g_return_val_if_fail (G_IS_FILE (file), NULL);
1699 iface = G_FILE_GET_IFACE (file);
1700 return (* iface->read_finish) (file, res, error);
1705 * @file: input #GFile.
1713 * Asynchronously opens @file for appending.
1722 g_file_append_to_async (GFile *file,
1731 g_return_if_fail (G_IS_FILE (file));
1733 iface = G_FILE_GET_IFACE (file);
1734 (* iface->append_to_async) (file,
1744 * @file: input #GFile.
1748 * Finishes an asynchronous file append operation started with
1755 g_file_append_to_finish (GFile *file,
1761 g_return_val_if_fail (G_IS_FILE (file), NULL);
1771 iface = G_FILE_GET_IFACE (file);
1772 return (* iface->append_to_finish) (file, res, error);
1777 * @file: input #GFile.
1785 * Asynchronously creates a new file and returns an output stream for writing to it.
1786 * The file must not already exist.
1795 g_file_create_async (GFile *file,
1804 g_return_if_fail (G_IS_FILE (file));
1806 iface = G_FILE_GET_IFACE (file);
1807 (* iface->create_async) (file,
1817 * @file: input #GFile.
1821 * Finishes an asynchronous file create operation started with
1828 g_file_create_finish (GFile *file,
1834 g_return_val_if_fail (G_IS_FILE (file), NULL);
1844 iface = G_FILE_GET_IFACE (file);
1845 return (* iface->create_finish) (file, res, error);
1850 * @file: input #GFile.
1861 * Asynchronously overwrites the file, replacing the contents, possibly
1862 * creating a backup copy of the file first.
1871 g_file_replace_async (GFile *file,
1882 g_return_if_fail (G_IS_FILE (file));
1884 iface = G_FILE_GET_IFACE (file);
1885 (* iface->replace_async) (file,
1897 * @file: input #GFile.
1901 * Finishes an asynchronous file replace operation started with
1908 g_file_replace_finish (GFile *file,
1914 g_return_val_if_fail (G_IS_FILE (file), NULL);
1924 iface = G_FILE_GET_IFACE (file);
1925 return (* iface->replace_finish) (file, res, error);
2033 _("Target file exists"));
2129 * Copies the file attributes from @source to @destination.
2131 * Normally only a subset of the file attributes are copied,
2132 * those that are copies in a normal file copy operation
2311 /* need to know the file type */
2337 /* ... else fall back on a regular file copy */
2346 _("Can't copy special file"));
2401 * Copies the file @source to the location specified by @destination.
2405 * existing @destination file is overwritten.
2421 * If the @source file does not exist then the G_IO_ERROR_NOT_FOUND
2427 * If trying to overwrite a file over a directory the G_IO_ERROR_IS_DIRECTORY
2432 * specified and the target is a file, then the G_IO_ERROR_WOULD_RECURSE error
2436 * file), see g_file_dup().
2525 * Copies the file @source to the location specified by @destination
2565 * @file: input #GFile.
2569 * Finishes copying the file started with
2575 g_file_copy_finish (GFile *file,
2581 g_return_val_if_fail (G_IS_FILE (file), FALSE);
2592 iface = G_FILE_GET_IFACE (file);
2593 return (* iface->copy_finish) (file, res, error);
2607 * Tries to move the file or directory @source to the location specified by @destination.
2613 * existing @destination file is overwritten.
2629 * If the @source file does not exist then the G_IO_ERROR_NOT_FOUND
2635 * If trying to overwrite a file over a directory the G_IO_ERROR_IS_DIRECTORY
2640 * specified and the target is a file, then the G_IO_ERROR_WOULD_RECURSE error
2727 * @file: input #GFile.
2735 * @error to %G_IO_ERROR_NOT_FOUND. If the file system doesn't support creating
2749 g_file_make_directory (GFile *file,
2755 g_return_val_if_fail (G_IS_FILE (file), FALSE);
2760 iface = G_FILE_GET_IFACE (file);
2770 return (* iface->make_directory) (file, cancellable, error);
2775 * @file: input #GFile.
2780 * 'mkdir -p'. If the file system does not support creating directories, this
2796 g_file_make_directory_with_parents (GFile *file,
2808 result = g_file_make_directory (file, cancellable, &my_error);
2816 work_file = file;
2851 return g_file_make_directory (file, cancellable, error);
2856 * @file: input #GFile.
2870 g_file_make_symbolic_link (GFile *file,
2877 g_return_val_if_fail (G_IS_FILE (file), FALSE);
2891 iface = G_FILE_GET_IFACE (file);
2901 return (* iface->make_symbolic_link) (file, symlink_value, cancellable, error);
2906 * @file: input #GFile.
2910 * Deletes a file. If the @file is a directory, it will only be deleted if it
2917 * Returns: %TRUE if the file was deleted. %FALSE otherwise.
2920 g_file_delete (GFile *file,
2926 g_return_val_if_fail (G_IS_FILE (file), FALSE);
2931 iface = G_FILE_GET_IFACE (file);
2941 return (* iface->delete_file) (file, cancellable, error);
2946 * @file: #GFile to send to trash.
2950 * Sends @file to the "Trashcan", if possible. This is similar to
2952 * Not all file systems support trashing, so this call can return the
2963 g_file_trash (GFile *file,
2969 g_return_val_if_fail (G_IS_FILE (file), FALSE);
2974 iface = G_FILE_GET_IFACE (file);
2984 return (* iface->trash) (file, cancellable, error);
2989 * @file: input #GFile.
2994 * Renames @file to the specified display name.
2997 * filesystem if possible and the @file is renamed to this.
3009 * Returns: a #GFile specifying what @file was renamed to, or %NULL
3014 g_file_set_display_name (GFile *file,
3021 g_return_val_if_fail (G_IS_FILE (file), NULL);
3029 _("File names cannot contain '%c'"), G_DIR_SEPARATOR);
3036 iface = G_FILE_GET_IFACE (file);
3038 return (* iface->set_display_name) (file, display_name, cancellable, error);
3043 * @file: input #GFile.
3060 g_file_set_display_name_async (GFile *file,
3069 g_return_if_fail (G_IS_FILE (file));
3072 iface = G_FILE_GET_IFACE (file);
3073 (* iface->set_display_name_async) (file,
3083 * @file: input #GFile.
3094 g_file_set_display_name_finish (GFile *file,
3100 g_return_val_if_fail (G_IS_FILE (file), NULL);
3110 iface = G_FILE_GET_IFACE (file);
3111 return (* iface->set_display_name_finish) (file, res, error);
3116 * @file: input #GFile.
3120 * Obtain the list of settable attributes for the file.
3123 * that can be set on this file. This doesn't mean setting it will always
3125 * file may not support a specific attribute.
3135 g_file_query_settable_attributes (GFile *file,
3143 g_return_val_if_fail (G_IS_FILE (file), NULL);
3148 iface = G_FILE_GET_IFACE (file);
3154 list = (* iface->query_settable_attributes) (file, cancellable, &my_error);
3172 * @file: input #GFile.
3188 g_file_query_writable_namespaces (GFile *file,
3196 g_return_val_if_fail (G_IS_FILE (file), NULL);
3201 iface = G_FILE_GET_IFACE (file);
3207 list = (* iface->query_writable_namespaces) (file, cancellable, &my_error);
3225 * @file: input #GFile.
3233 * Sets an attribute in the file with attribute name @attribute to @value.
3242 g_file_set_attribute (GFile *file,
3252 g_return_val_if_fail (G_IS_FILE (file), FALSE);
3258 iface = G_FILE_GET_IFACE (file);
3268 return (* iface->set_attribute) (file, attribute, type, value_p, flags, cancellable, error);
3273 * @file: input #GFile.
3295 g_file_set_attributes_from_info (GFile *file,
3303 g_return_val_if_fail (G_IS_FILE (file), FALSE);
3311 iface = G_FILE_GET_IFACE (file);
3313 return (* iface->set_attributes_from_info) (file,
3322 g_file_real_set_attributes_from_info (GFile *file,
3344 if (!g_file_set_attribute (file, attributes[i],
3364 * @file: input #GFile.
3373 * Asynchronously sets the attributes of @file with @info.
3382 g_file_set_attributes_async (GFile *file,
3392 g_return_if_fail (G_IS_FILE (file));
3395 iface = G_FILE_GET_IFACE (file);
3396 (* iface->set_attributes_async) (file,
3407 * @file: input #GFile.
3417 g_file_set_attributes_finish (GFile *file,
3424 g_return_val_if_fail (G_IS_FILE (file), FALSE);
3430 iface = G_FILE_GET_IFACE (file);
3431 return (* iface->set_attributes_finish) (file, result, info, error);
3436 * @file: input #GFile.
3453 g_file_set_attribute_string (GFile *file,
3460 return g_file_set_attribute (file, attribute,
3467 * @file: input #GFile.
3483 * in the @file, %FALSE otherwise.
3486 g_file_set_attribute_byte_string (GFile *file,
3493 return g_file_set_attribute (file, attribute,
3500 * @file: input #GFile.
3515 * in the @file, %FALSE otherwise.
3518 g_file_set_attribute_uint32 (GFile *file,
3525 return g_file_set_attribute (file, attribute,
3532 * @file: input #GFile.
3547 * in the @file, %FALSE otherwise.
3550 g_file_set_attribute_int32 (GFile *file,
3557 return g_file_set_attribute (file, attribute,
3564 * @file: input #GFile.
3579 * in the @file, %FALSE otherwise.
3582 g_file_set_attribute_uint64 (GFile *file,
3589 return g_file_set_attribute (file, attribute,
3596 * @file: input #GFile.
3613 g_file_set_attribute_int64 (GFile *file,
3620 return g_file_set_attribute (file, attribute,
3627 * @file: input #GFile.
3634 * Mounts a file of type G_FILE_TYPE_MOUNTABLE.
3646 g_file_mount_mountable (GFile *file,
3655 g_return_if_fail (G_IS_FILE (file));
3657 iface = G_FILE_GET_IFACE (file);
3661 g_simple_async_report_error_in_idle (G_OBJECT (file),
3670 (* iface->mount_mountable) (file,
3680 * @file: input #GFile.
3693 g_file_mount_mountable_finish (GFile *file,
3699 g_return_val_if_fail (G_IS_FILE (file), NULL);
3709 iface = G_FILE_GET_IFACE (file);
3710 return (* iface->mount_mountable_finish) (file, result, error);
3715 * @file: input #GFile.
3721 * Unmounts a file of type G_FILE_TYPE_MOUNTABLE.
3731 g_file_unmount_mountable (GFile *file,
3739 g_return_if_fail (G_IS_FILE (file));
3741 iface = G_FILE_GET_IFACE (file);
3745 g_simple_async_report_error_in_idle (G_OBJECT (file),
3754 (* iface->unmount_mountable) (file,
3763 * @file: input #GFile.
3776 g_file_unmount_mountable_finish (GFile *file,
3782 g_return_val_if_fail (G_IS_FILE (file), FALSE);
3792 iface = G_FILE_GET_IFACE (file);
3793 return (* iface->unmount_mountable_finish) (file, result, error);
3798 * @file: input #GFile.
3814 g_file_eject_mountable (GFile *file,
3822 g_return_if_fail (G_IS_FILE (file));
3824 iface = G_FILE_GET_IFACE (file);
3828 g_simple_async_report_error_in_idle (G_OBJECT (file),
3837 (* iface->eject_mountable) (file,
3846 * @file: input #GFile.
3853 * Returns: %TRUE if the @file was ejected successfully. %FALSE
3857 g_file_eject_mountable_finish (GFile *file,
3863 g_return_val_if_fail (G_IS_FILE (file), FALSE);
3873 iface = G_FILE_GET_IFACE (file);
3874 return (* iface->eject_mountable_finish) (file, result, error);
3879 * @file: input #GFile.
3884 * Obtains a directory monitor for the given file.
3891 * Returns: a #GFileMonitor for the given @file, or %NULL on error.
3895 g_file_monitor_directory (GFile *file,
3902 g_return_val_if_fail (G_IS_FILE (file), NULL);
3907 iface = G_FILE_GET_IFACE (file);
3917 return (* iface->monitor_dir) (file, flags, cancellable, error);
3922 * @file: input #GFile.
3927 * Obtains a file monitor for the given file. If no file notification
3928 * mechanism exists, then regular polling of the file is used.
3934 * Returns: a #GFileMonitor for the given @file, or %NULL on error.
3938 g_file_monitor_file (GFile *file,
3946 g_return_val_if_fail (G_IS_FILE (file), NULL);
3951 iface = G_FILE_GET_IFACE (file);
3956 monitor = (* iface->monitor_file) (file, flags, cancellable, NULL);
3960 monitor = _g_poll_file_monitor_new (file);
3967 * @file: input #GFile
3972 * Obtains a file or directory monitor for the given file, depending
3973 * on the type of the file.
3979 * Returns: a #GFileMonitor for the given @file, or %NULL on error.
3985 g_file_monitor (GFile *file,
3990 if (g_file_query_file_type (file, 0, cancellable) == G_FILE_TYPE_DIRECTORY)
3991 return g_file_monitor_directory (file, flags, cancellable, error);
3993 return g_file_monitor_file (file, flags, cancellable, error);
4038 g_file_real_query_info_async (GFile *file,
4053 res = g_simple_async_result_new (G_OBJECT (file), callback, user_data, g_file_real_query_info_async);
4061 g_file_real_query_info_finish (GFile *file,
4114 g_file_real_query_filesystem_info_async (GFile *file,
4127 res = g_simple_async_result_new (G_OBJECT (file), callback, user_data, g_file_real_query_filesystem_info_async);
4135 g_file_real_query_filesystem_info_finish (GFile *file,
4189 g_file_real_enumerate_children_async (GFile *file,
4204 res = g_simple_async_result_new (G_OBJECT (file), callback, user_data, g_file_real_enumerate_children_async);
4212 g_file_real_enumerate_children_finish (GFile *file,
4263 g_file_real_read_async (GFile *file,
4271 res = g_simple_async_result_new (G_OBJECT (file), callback, user_data, g_file_real_read_async);
4278 g_file_real_read_finish (GFile *file,
4320 g_file_real_append_to_async (GFile *file,
4333 res = g_simple_async_result_new (G_OBJECT (file), callback, user_data, g_file_real_append_to_async);
4341 g_file_real_append_to_finish (GFile *file,
4383 g_file_real_create_async (GFile *file,
4396 res = g_simple_async_result_new (G_OBJECT (file), callback, user_data, g_file_real_create_async);
4404 g_file_real_create_finish (GFile *file,
4467 g_file_real_replace_async (GFile *file,
4484 res = g_simple_async_result_new (G_OBJECT (file), callback, user_data, g_file_real_replace_async);
4492 g_file_real_replace_finish (GFile *file,
4510 GFile *file;
4517 if (data->file)
4518 g_object_unref (data->file);
4529 GFile *file;
4533 file = g_file_set_display_name (G_FILE (object), data->name, cancellable, &error);
4535 if (file == NULL)
4541 data->file = file;
4545 g_file_real_set_display_name_async (GFile *file,
4558 res = g_simple_async_result_new (G_OBJECT (file), callback, user_data, g_file_real_set_display_name_async);
4566 g_file_real_set_display_name_finish (GFile *file,
4576 if (data->file)
4577 return g_object_ref (data->file);
4617 g_file_real_set_attributes_async (GFile *file,
4632 res = g_simple_async_result_new (G_OBJECT (file), callback, user_data, g_file_real_set_attributes_async);
4640 g_file_real_set_attributes_finish (GFile *file,
4681 g_file_real_find_enclosing_mount_async (GFile *file,
4689 res = g_simple_async_result_new (G_OBJECT (file), callback, user_data, g_file_real_find_enclosing_mount_async);
4696 g_file_real_find_enclosing_mount_finish (GFile *file,
4842 g_file_real_copy_finish (GFile *file,
4894 * @parse_name: a file name or path to be parsed.
4951 GFile *file;
4967 file = g_file_new_for_path (filename);
4970 return file;
4982 * Starts a @mount_operation, mounting the volume that contains the file @location.
5060 * @file: a #GFile to open.
5065 * application to handle the file specified by @file.
5075 g_file_query_default_handler (GFile *file,
5085 uri_scheme = g_file_get_uri_scheme (file);
5092 info = g_file_query_info (file,
5106 path = g_file_get_path (file);
5119 _("No application is registered as handling this file"));
5129 * @file: input #GFile.
5131 * @contents: a location to place the contents of the file.
5132 * @length: a location to place the length of the contents of the file,
5134 * @etag_out: a location to place the current entity tag for the file,
5138 * Loads the content of the file into memory. The data is always
5147 * Returns: %TRUE if the @file's contents were successfully loaded.
5151 g_file_load_contents (GFile *file,
5164 g_return_val_if_fail (G_IS_FILE (file), FALSE);
5167 in = g_file_read (file, cancellable, error);
5222 GFile *file;
5244 g_object_unref (data->file);
5261 res = g_simple_async_result_new (G_OBJECT (data->file),
5306 /* Error or EOF, close the file */
5353 GFile *file = G_FILE (obj);
5359 stream = g_file_read_finish (file, open_res, &error);
5376 res = g_simple_async_result_new_from_error (G_OBJECT (data->file),
5389 * @file: input #GFile.
5395 * Reads the partial contents of a file. A #GFileReadMoreCallback should be
5396 * used to stop reading from the file when appropriate, else this function
5408 g_file_load_partial_contents_async (GFile *file,
5416 g_return_if_fail (G_IS_FILE (file));
5426 data->file = g_object_ref (file);
5428 g_file_read_async (file,
5437 * @file: input #GFile.
5439 * @contents: a location to place the contents of the file.
5440 * @length: a location to place the length of the contents of the file,
5442 * @etag_out: a location to place the current entity tag for the file,
5456 g_file_load_partial_contents_finish (GFile *file,
5466 g_return_val_if_fail (G_IS_FILE (file), FALSE);
5510 * @file: input #GFile.
5515 * Starts an asynchronous load of the @file's contents.
5530 g_file_load_contents_async (GFile *file,
5535 g_file_load_partial_contents_async (file,
5543 * @file: input #GFile.
5545 * @contents: a location to place the contents of the file.
5546 * @length: a location to place the length of the contents of the file,
5548 * @etag_out: a location to place the current entity tag for the file,
5552 * Finishes an asynchronous load of the @file's contents.
5556 * set to the new entity tag for the @file.
5562 g_file_load_contents_finish (GFile *file,
5569 return g_file_load_partial_contents_finish (file,
5579 * @file: input #GFile.
5580 * @contents: a string containing the new contents for @file.
5592 * Replaces the contents of @file with @contents of @length bytes.
5594 * If @etag is specified (not %NULL) any existing file must have that etag, or
5597 * If @make_backup is %TRUE, this function will attempt to make a backup of @file.
5603 * The returned @new_etag can be used to verify that the file hasn't changed the
5611 g_file_replace_contents (GFile *file,
5626 g_return_val_if_fail (G_IS_FILE (file), FALSE);
5629 out = g_file_replace (file, etag, make_backup, flags, cancellable, error);
5667 GFile *file;
5685 g_object_unref (data->file);
5705 res = g_simple_async_result_new (G_OBJECT (data->file),
5728 /* Error or EOF, close the file */
5759 GFile *file = G_FILE (obj);
5765 stream = g_file_replace_finish (file, open_res, &error);
5780 res = g_simple_async_result_new_from_error (G_OBJECT (data->file),
5793 * @file: input #GFile.
5794 * @contents: string of contents to replace the file with.
5796 * @etag: a new <link linkend="gfile-etag">entity tag</link> for the @file, or %NULL
5803 * Starts an asynchronous replacement of @file with the given
5816 * make a backup of @file.
5819 g_file_replace_contents_async (GFile *file,
5831 g_return_if_fail (G_IS_FILE (file));
5843 data->file = g_object_ref (file);
5845 g_file_replace_async (file,
5857 * @file: input #GFile.
5864 * Finishes an asynchronous replace of the given @file. See
5871 file,
5879 g_return_val_if_fail (G_IS_FILE (file), FALSE);