### ----------------------------------------------------
### -- Gnome::Gio
### -- Licenses: Artistic-2.0
### -- Authors: Marcel Timmerman
### -- File: lib/Gnome/Gio/File.rakumod
### ----------------------------------------------------
### -- Chunk 4 of 6
 );
}

sub g_file_mount_enclosing_volume (
  N-GFile $location, GMountMountFlags $flags, GMountOperation $mount_operation, GCancellable $cancellable, GAsyncReadyCallback $callback, gpointer $user_data
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
# TM:0:mount-enclosing-volume-finish:
=begin pod
=head2 mount-enclosing-volume-finish

Finishes a mount operation started by C<mount-enclosing-volume()>.

Returns: C<True> if successful. If an error has occurred, this function will return C<False> and set I<error> appropriately if present.

  method mount-enclosing-volume-finish ( GAsyncResult $result, N-GError $error --> Bool )

=item $result; a B<Gnome::Gio::AsyncResult>
=item $error; a B<Gnome::Gio::Error>, or C<undefined>
=end pod

method mount-enclosing-volume-finish ( GAsyncResult $result, $error is copy --> Bool ) {
  $error .= _get-native-object-no-reffing unless $error ~~ N-GError;

  g_file_mount_enclosing_volume_finish(
    self._get-native-object-no-reffing, $result, $error
  ).Bool
}

sub g_file_mount_enclosing_volume_finish (
  N-GFile $location, GAsyncResult $result, N-GError $error --> gboolean
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
# TM:0:mount-mountable:
=begin pod
=head2 mount-mountable

Mounts a file of type G-FILE-TYPE-MOUNTABLE. Using I<mount-operation>, you can request callbacks when, for instance, passwords are needed during authentication.

If I<cancellable> is not C<undefined>, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error C<G-IO-ERROR-CANCELLED> will be returned.

When the operation is finished, I<callback> will be called. You can then call C<mount-mountable-finish()> to get the result of the operation.

  method mount-mountable ( GMountMountFlags $flags, GMountOperation $mount_operation, GCancellable $cancellable, GAsyncReadyCallback $callback, Pointer $user_data )

=item $flags; flags affecting the operation
=item $mount_operation; a B<Gnome::Gio::MountOperation>, or C<undefined> to avoid user interaction
=item $cancellable; optional B<Gnome::Gio::Cancellable> object, C<undefined> to ignore
=item $callback; (scope async) : a B<Gnome::Gio::AsyncReadyCallback> to call when the request is satisfied, or C<undefined>
=item $user_data; (closure): the data to pass to callback function
=end pod

method mount-mountable ( GMountMountFlags $flags, GMountOperation $mount_operation, GCancellable $cancellable, GAsyncReadyCallback $callback, Pointer $user_data ) {

  g_file_mount_mountable(
    self._get-native-object-no-reffing, $flags, $mount_operation, $cancellable, $callback, $user_data
  );
}

sub g_file_mount_mountable (
  N-GFile $file, GMountMountFlags $flags, GMountOperation $mount_operation, GCancellable $cancellable, GAsyncReadyCallback $callback, gpointer $user_data
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
# TM:0:mount-mountable-finish:
=begin pod
=head2 mount-mountable-finish

Finishes a mount operation. See C<mount-mountable()> for details.

Finish an asynchronous mount operation that was started with C<g-file-mount-mountable()>.

Returns: a B<Gnome::Gio::File> or C<undefined> on error. Free the returned object with C<clear-object()>.

  method mount-mountable-finish ( GAsyncResult $result, N-GError $error --> N-GFile )

=item $result; a B<Gnome::Gio::AsyncResult>
=item $error; a B<Gnome::Gio::Error>, or C<undefined>
=end pod

method mount-mountable-finish ( GAsyncResult $result, $error is copy --> N-GFile ) {
  $error .= _get-native-object-no-reffing unless $error ~~ N-GError;

  g_file_mount_mountable_finish(
    self._get-native-object-no-reffing, $result, $error
  )
}

sub g_file_mount_mountable_finish (
  N-GFile $file, GAsyncResult $result, N-GError $error --> N-GFile
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
# TM:0:move:
=begin pod
=head2 move

Tries to move the file or directory I<source> to the location specified by I<destination>. If native move operations are supported then this is used, otherwise a copy + delete fallback is used. The native implementation may support moving directories (for instance on moves inside the same filesystem), but the fallback code does not.

If the flag B<Gnome::Gio::-FILE-COPY-OVERWRITE> is specified an already existing I<destination> file is overwritten.

If the flag B<Gnome::Gio::-FILE-COPY-NOFOLLOW-SYMLINKS> is specified then symlinks will be copied as symlinks, otherwise the target of the I<source> symlink will be copied.

If I<cancellable> is not C<undefined>, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error C<G-IO-ERROR-CANCELLED> will be returned.

If I<progress-callback> is not C<undefined>, then the operation can be monitored by setting this to a B<Gnome::Gio::FileProgressCallback> function. I<progress-callback-data> will be passed to this function. It is guaranteed that this callback will be called after all data has been transferred with the total number of bytes copied during the operation.

If the I<source> file does not exist, then the C<G-IO-ERROR-NOT-FOUND> error is returned, independent on the status of the I<destination>.

If B<Gnome::Gio::-FILE-COPY-OVERWRITE> is not specified and the target exists, then the error C<G-IO-ERROR-EXISTS> is returned.

If trying to overwrite a file over a directory, the C<G-IO-ERROR-IS-DIRECTORY> error is returned. If trying to overwrite a directory with a directory the C<G-IO-ERROR-WOULD-MERGE> error is returned.

If the source is a directory and the target does not exist, or B<Gnome::Gio::-FILE-COPY-OVERWRITE> is specified and the target is a file, then the C<G-IO-ERROR-WOULD-RECURSE> error may be returned (if the native move operation isn't available).

Returns: C<True> on successful move, C<False> otherwise.

  method move ( N-GFile $destination, UInt $flags, GCancellable $cancellable, GFileProgressCallback $progress_callback, Pointer $progress_callback_data, N-GError $error --> Bool )

=item $destination; B<Gnome::Gio::File> pointing to the destination location
=item $flags; set of B<Gnome::Gio::FileCopyFlags>
=item $cancellable; optional B<Gnome::Gio::Cancellable> object, C<undefined> to ignore
=item $progress_callback;  (scope call): B<Gnome::Gio::FileProgressCallback> function for updates
=item $progress_callback_data; (closure): gpointer to user data for the callback function
=item $error; B<Gnome::Gio::Error> for returning error conditions, or C<undefined>
=end pod

method move ( N-GFile $destination, UInt $flags, GCancellable $cancellable, GFileProgressCallback $progress_callback, Pointer $progress_callback_data, $error is copy --> Bool ) {
  $error .= _get-native-object-no-reffing unless $error ~~ N-GError;

  g_file_move(
    self._get-native-object-no-reffing, $destination, $flags, $cancellable, $progress_callback, $progress_callback_data, $error
  ).Bool
}

sub g_file_move (
  N-GFile $source, N-GFile $destination, GFlag $flags, GCancellable $cancellable, GFileProgressCallback $progress_callback, gpointer $progress_callback_data, N-GError $error --> gboolean
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
# TM:0:open-readwrite:
=begin pod
=head2 open-readwrite

Opens an existing file for reading and writing. The result is a B<Gnome::Gio::FileIOStream> that can be used to read and write the contents of the file.

If I<cancellable> is not C<undefined>, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error C<G-IO-ERROR-CANCELLED> will be returned.

If the file does not exist, the C<G-IO-ERROR-NOT-FOUND> error will be returned. If the file is a directory, the C<G-IO-ERROR-IS-DIRECTORY> error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on. Note that in many non-local file cases read and write streams are not supported, so make sure you really need to do read and write streaming, rather than just opening for reading or writing.

Returns: B<Gnome::Gio::FileIOStream> or C<undefined> on error. Free the returned object with C<clear-object()>.

  method open-readwrite ( GCancellable $cancellable, N-GError $error --> GFileIOStream )

=item $cancellable; a B<Gnome::Gio::Cancellable>
=item $error; a B<Gnome::Gio::Error>, or C<undefined>
=end pod

method open-readwrite ( GCancellable $cancellable, $error is copy --> GFileIOStream ) {
  $error .= _get-native-object-no-reffing unless $error ~~ N-GError;

  g_file_open_readwrite(
    self._get-native-object-no-reffing, $cancellable, $error
  )
}

sub g_file_open_readwrite (
  N-GFile $file, GCancellable $cancellable, N-GError $error --> GFileIOStream
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
# TM:0:open-readwrite-async:
=begin pod
=head2 open-readwrite-async



  method open-readwrite-async ( Int() $io_priority, GCancellable $cancellable, GAsyncReadyCallback $callback, Pointer $user_data )

=item $io_priority;
=item $cancellable;
=item $callback;
=item $user_data;
=end pod

method open-readwrite-async ( Int() $io_priority, GCancellable $cancellable, GAsyncReadyCallback $callback, Pointer $user_data ) {

  g_file_open_readwrite_async(
    self._get-native-object-no-reffing, $io_priority, $cancellable, $callback, $user_data
  );
}

sub g_file_open_readwrite_async (
  N-GFile $file, int $io_priority, GCancellable $cancellable, GAsyncReadyCallback $callback, gpointer $user_data
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
# TM:0:open-readwrite-finish:
=begin pod
=head2 open-readwrite-finish

Finishes an asynchronous file read operation started with C<open-readwrite-async()>.

Returns: a B<Gnome::Gio::FileIOStream> or C<undefined> on error. Free the returned object with C<clear-object()>.

  method open-readwrite-finish ( GAsyncResult $res, N-GError $error --> GFileIOStream )

=item $res; a B<Gnome::Gio::AsyncResult>
=item $error; a B<Gnome::Gio::Error>, or C<undefined>
=end pod

method open-readwrite-finish ( GAsyncResult $res, $error is copy --> GFileIOStream ) {
  $error .= _get-native-object-no-reffing unless $error ~~ N-GError;

  g_file_open_readwrite_finish(
    self._get-native-object-no-reffing, $res, $error
  )
}

sub g_file_open_readwrite_finish (
  N-GFile $file, GAsyncResult $res, N-GError $error --> GFileIOStream
) is native(&gio-lib)
  { * }
}}

#`{{
#-------------------------------------------------------------------------------
# TM:0:parse-name:
=begin pod
=head2 parse-name

Constructs a B<Gnome::Gio::File> with the given I<parse-name> (i.e. something given by C<get-parse-name()>). This operation never fails, but the returned object might not support any I/O operation if the I<parse-name> cannot be parsed.

Returns: a new B<Gnome::Gio::File>.

  method parse-name ( Str $parse_name --> N-GFile )

=item $parse_name; a file name or path to be parsed
=end pod

method parse-name ( Str $parse_name --> N-GFile ) {

  g_file_parse_name(
    self._get-native-object-no-reffing, $parse_name
  )
}

sub g_file_parse_name (
  gchar-ptr $parse_name --> N-GFile
) is native(&gio-lib)
  { * }
}}

#`{{
#-------------------------------------------------------------------------------
# TM:0:peek-path:
=begin pod
=head2 peek-path

Exactly like C<get-path()>, but caches the result via C<g-object-set-qdata-full()>. This is useful for example in C applications which mix `g-file-*` APIs with native ones. It also avoids an extra duplicated string when possible, so will be generally more efficient.

This call does no blocking I/O.

Returns: (type filename) : string containing the B<Gnome::Gio::File>'s path, or C<undefined> if no such path exists. The returned string is owned by I<file>.

  method peek-path ( --> Str )

=end pod

method peek-path ( --> Str ) {

  g_file_peek_path(
    self._get-native-object-no-reffing,
  )
}

sub g_file_peek_path (
  N-GFile $file --> gchar-ptr
) is native(&gio-lib)
  { * }
}}
#`{{
#-------------------------------------------------------------------------------
# TM:0:poll-mountable:
=begin pod
=head2 poll-mountable

Polls a file of type B<Gnome::Gio::-FILE-TYPE-MOUNTABLE>.

If I<cancellable> is not C<undefined>, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error C<G-IO-ERROR-CANCELLED> will be returned.

When the operation is finished, I<callback> will be called. You can then call C<mount-mountable-finish()> to get the result of the operation.

  method poll-mountable ( GCancellable $cancellable, GAsyncReadyCallback $callback, Pointer $user_data )

=item $cancellable; optional B<Gnome::Gio::Cancellable> object, C<undefined> to ignore
=item $callback; a B<Gnome::Gio::AsyncReadyCallback> to call when the request is satisfied, or C<undefined>
=item $user_data; the data to pass to callback function
=end pod

method poll-mountable ( GCancellable $cancellable, GAsyncReadyCallback $callback, Pointer $user_data ) {

  g_file_poll_mountable(
    self._get-native-object-no-reffing, $cancellable, $callback, $user_data
  );
}

sub g_file_poll_mountable (
  N-GFile $file, GCancellable $cancellable, GAsyncReadyCallback $callback, gpointer $user_data
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
# TM:0:poll-mountable-finish:
=begin pod
=head2 poll-mountable-finish

Finishes a poll operation. See C<poll-mountable()> for details.

Finish an asynchronous poll operation that was polled with C<g-file-poll-mountable()>.

Returns: C<True> if the operation finished successfully. C<False> otherwise.

  method poll-mountable-finish ( GAsyncResult $result, N-GError $error --> Bool )

=item $result; a B<Gnome::Gio::AsyncResult>
=item $error; a B<Gnome::Gio::Error>, or C<undefined>
=end pod

method poll-mountable-finish ( GAsyncResult $result, $error is copy --> Bool ) {
  $error .= _get-native-object-no-reffing unless $error ~~ N-GError;

  g_file_poll_mountable_finish(
    self._get-native-object-no-reffing, $result, $error
  ).Bool
}

sub g_file_poll_mountable_finish (
  N-GFile $file, GAsyncResult $result, N-GError $error --> gboolean
) is native(&gio-lib)
  { * }
}}

#-------------------------------------------------------------------------------
#TM:1:query-default-handler:
=begin pod
=head2 query-default-handler

Returns the B<Gnome::Gio::AppInfo> that is registered as the default application to handle the file specified by I<file>.

If I<cancellable> is not C<undefined>, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error C<G-IO-ERROR-CANCELLED> will be returned.

Returns: a B<Gnome::Gio::AppInfo> if the handle was found, C<undefined> if there were errors and C<$.last-error> becomes valid. When you are done with it, release it with C<clear-object()>

  method query-default-handler (
    N-GObject $cancellable --> Gnome::Gio::AppInfo
  )

=item $cancellable; optional B<Gnome::Gio::Cancellable> object, C<undefined> to ignore. (TODO: Cancellable not defined yet)
=end pod

method query-default-handler (
  $cancellable is copy --> Gnome::GObject::Object
) {
  $cancellable .= _get-native-object-no-reffing unless $cancellable ~~ N-GObject;
  my CArray[N-GError] $error .= new(N-GError);

  my N-GObject $no = g_file_query_default_handler(
    self._get-native-object-no-reffing, $cancellable, $error
  );

  $!last-error.clear-object;
  $!last-error .= new(:native-object(?$no ?? N-GError !! $error[0]));
  self._wrap-native-type-from-no( $no, :child-type<Gnome::Gio::AppInfo>)
}

sub g_file_query_default_handler (
  N-GFile $file, N-GObject $cancellable, CArray[N-GError] $error --> N-GObject
) is native(&gio-lib)
  { * }

#`{{
#-------------------------------------------------------------------------------
# TM:0:query-default-handler-async:
=begin pod
=head2 query-default-handler-async

Async version of C<query-default-handler()>.

  method query-default-handler-async ( Int() $io_priority, GCancellable $cancellable, GAsyncReadyCallback $callback, Pointer $user_data )

=item $io_priority; optional B<Gnome::Gio::Cancellable> object, C<undefined> to ignore
=item $cancellable; a B<Gnome::Gio::AsyncReadyCallback> to call when the request is done
=item $callback; data to pass to I<callback>
=item $user_data;
=end pod

method query-default-handler-async ( Int() $io_priority, GCancellable $cancellable, GAsyncReadyCallback $callback, Pointer $user_data ) {

  g_file_query_default_handler_async(
    self._get-native-object-no-reffing, $io_priority, $cancellable, $callback, $user_data
  );
}

sub g_file_query_default_handler_async (
  N-GFile $file, int $io_priority, GCancellable $cancellable, GAsyncReadyCallback $callback, gpointer $user_data
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
# TM:0:query-default-handler-finish:
=begin pod
=head2 query-default-handler-finish

Finishes a C<query-default-handler-async()> operation.

Returns: a B<Gnome::Gio::AppInfo> if the handle was found, C<undefined> if there were errors. When you are done with it, release it with C<clear-object()>

  method query-default-handler-finish ( GAsyncResult $result, N-GError $error --> GAppInfo )

=item $result; a B<Gnome::Gio::AsyncResult>
=item $error; a B<Gnome::Gio::Error>
=end pod

method query-default-handler-finish ( GAsyncResult $result, $error is copy --> GAppInfo ) {
  $error .= _get-native-object-no-reffing unless $error ~~ N-GError;

  g_file_query_default_handler_finish(
    self._get-native-object-no-reffing, $result, $error
  )
}

sub g_file_query_default_handler_finish (
  N-GFile $file, GAsyncResult $result, N-GError $error --> GAppInfo
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
# TM:0:query-exists:
=begin pod
=head2 query-exists

Utility function to check if a particular file exists. This is implemented using C<query-info()> and as such does blocking I/O.

Note that in many cases it is [racy to first check for file existence](https://en.wikipedia.org/wiki/Time-of-check-to-time-of-use) and then execute something based on the outcome of that, because the file might have been created or removed in between the operations. The general approach to handling that is to not check, but just do the operation and handle the errors as they come.

As an example of race-free checking, take the case of reading a file, and if it doesn't exist, creating it. There are two racy versions: read it, and on error create it; and: check if it exists, if not create it. These can both result in two processes creating the file (with perhaps a partially written file as the result). The correct approach is to always try to create the file with C<g-file-create()> which will either atomically create the file or fail with a C<G-IO-ERROR-EXISTS> error.

However, in many cases an existence check is useful in a user interface, for instance to make a menu item sensitive/insensitive, so that you don't have to fool users that something is possible and then just show an error dialog. If you do this, you should make sure to also handle the errors that can happen due to races when you execute the operation.

Returns: C<True> if the file exists (and can be detected without error), C<False> otherwise (or if cancelled).

  method query-exists ( GCancellable $cancellable --> Bool )

=item $cancellable; optional B<Gnome::Gio::Cancellable> object, C<undefined> to ignore
=end pod

method query-exists ( GCancellable $cancellable --> Bool ) {

  g_file_query_exists(
    self._get-native-object-no-reffing, $cancellable
  ).Bool
}

sub g_file_query_exists (
  N-GFile $file, GCancellable $cancellable --> gboolean
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
# TM:0:query-file-type:
=begin pod
=head2 query-file-type

Utility function to inspect the B<Gnome::Gio::FileType> of a file. This is implemented using C<query-info()> and as such does blocking I/O.

The primary use case of this method is to check if a file is a regular file, directory, or symlink.

Returns: The B<Gnome::Gio::FileType> of the file and B<Gnome::Gio::-FILE-TYPE-UNKNOWN> if the file does not exist

  method query-file-type ( GFileQueryInfoFlags $flags, GCancellable $cancellable --> GFileType )

=item $flags; a set of B<Gnome::Gio::FileQueryInfoFlags> passed to C<query-info()>
=item $cancellable; optional B<Gnome::Gio::Cancellable> object, C<undefined> to ignore
=end pod

method query-file-type ( GFileQueryInfoFlags $flags, GCancellable $cancellable --> GFileType ) {

  g_file_query_file_type(
    self._get-native-object-no-reffing, $flags, $cancellable
  )
}

sub g_file_query_file_type (
  N-GFile $file, GFlag $flags, GCancellable $cancellable --> GEnum
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
# TM:0:query-filesystem-info:
=begin pod
=head2 query-filesystem-info

Similar to C<query-info()>, but obtains information about the filesystem the I<file> is on, rather than the file itself. For instance the amount of space available and the type of the filesystem.

The I<attributes> value is a string that specifies the attributes that should be gathered. It is not an error if it's not possible to read a particular requested attribute from a file - it just won't be set. I<attributes> should be a comma-separated list of attributes or attribute wildcards. The wildcard "*" means all attributes, and a wildcard like "filesystem::*" means all attributes in the filesystem namespace. The standard namespace for filesystem attributes is "filesystem". Common attributes of interest are B<Gnome::Gio::-FILE-ATTRIBUTE-FILESYSTEM-SIZE> (the total size of the filesystem in bytes), B<Gnome::Gio::-FILE-ATTRIBUTE-FILESYSTEM-FREE> (number of bytes available), and B<Gnome::Gio::-FILE-ATTRIBUTE-FILESYSTEM-TYPE> (type of the filesystem).

If I<cancellable> is not C<undefined>, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error C<G-IO-ERROR-CANCELLED> will be returned.

If the file does not exist, the C<G-IO-ERROR-NOT-FOUND> error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.

Returns: a B<Gnome::Gio::FileInfo> or C<undefined> if there was an error. Free the returned object with C<clear-object()>.

  method query-filesystem-info ( Str $attributes, GCancellable $cancellable, N-GError $error --> GFileInfo )

=item $attributes; an attribute query string
=item $cancellable; optional B<Gnome::Gio::Cancellable> object, C<undefined> to ignore
=item $error; a B<Gnome::Gio::Error>
=end pod

method query-filesystem-info ( Str $attributes, GCancellable $cancellable, $error is copy --> GFileInfo ) {
  $error .= _get-native-object-no-reffing unless $error ~~ N-GError;

  g_file_query_filesystem_info(
    self._get-native-object-no-reffing, $attributes, $cancellable, $error
  )
}

sub g_file_query_filesystem_info (
  N-GFile $file, gchar-ptr $attributes, GCancellable $cancellable, N-GError $error --> GFileInfo
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
# TM:0:query-filesystem-info-async:
=begin pod
=head2 query-filesystem-info-async

Asynchronously gets the requested information about the filesystem that the specified I<file> is on. The result is a B<Gnome::Gio::FileInfo> object that contains key-value attributes (such as type or size for the file).

For more details, see C<query-filesystem-info()> which is the synchronous version of this call.

When the operation is finished, I<callback> will be called. You can then call C<g-file-query-info-finish()> to get the result of the operation.

  method query-filesystem-info-async ( Str $attributes, Int() $io_priority, GCancellable $cancellable, GAsyncReadyCallback $callback, Pointer $user_data )

=item $attributes; an attribute query string
=item $io_priority; the [I/O priority][io-priority] of the request
=item $cancellable; optional B<Gnome::Gio::Cancellable> object, C<undefined> to ignore
=item $callback; (scope async): a B<Gnome::Gio::AsyncReadyCallback> to call when the request is satisfied
=item $user_data; (closure): the data to pass to callback function
=end pod

method query-filesystem-info-async ( Str $attributes, Int() $io_priority, GCancellable $cancellable, GAsyncReadyCallback $callback, Pointer $user_data ) {

  g_file_query_filesystem_info_async(
    self._get-native-object-no-reffing, $attributes, $io_priority, $cancellable, $callback, $user_data
  );
}

sub g_file_query_filesystem_info_async (
  N-GFile $file, gchar-ptr $attributes, int $io_priority, GCancellable $cancellable, GAsyncReadyCallback $callback, gpointer $user_data
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
# TM:0:query-filesystem-info-finish:
=begin pod
=head2 query-filesystem-info-finish

Finishes an asynchronous filesystem info query. See C<query-filesystem-info-async()>.

Returns: B<Gnome::Gio::FileInfo> for given I<file> or C<undefined> on error. Free the returned object with C<clear-object()>.

  method query-filesystem-info-finish ( GAsyncResult $res, N-GError $error --> GFileInfo )

=item $res; a B<Gnome::Gio::AsyncResult>
=item $error; a B<Gnome::Gio::Error>
=end pod

method query-filesystem-info-finish ( GAsyncResult $res, $error is copy --> GFileInfo ) {
  $error .= _get-native-object-no-reffing unless $error ~~ N-GError;

  g_file_query_filesystem_info_finish(
    self._get-native-object-no-reffing, $res, $error
  )
}

sub g_file_query_filesystem_info_finish (
  N-GFile $file, GAsyncResult $res, N-GError $error --> GFileInfo
) is native(&gio-lib)
  { * }
}}

#`{{
#-------------------------------------------------------------------------------
# TM:1:query-info:

# Works but not usefull because the FileInfo will not be implemented. The
# reason is that Raku has proper tools to get all necessary information of a
# file as well as change them.

=begin pod
=head2 query-info

Gets the requested information about specified I<file>. The result is a B<Gnome::Gio::FileInfo> object that contains key-value attributes (such as the type or size of the file).

The I<attributes> value is a string that specifies the file attributes that should be gathered. It is not an error if it's not possible to read a particular requested attribute from a file - it just won't be set. I<attributes> should be a comma-separated list of attributes or attribute wildcards. The wildcard "*" means all attributes, and a wildcard like "standard::*" means all attributes in the standard namespace. An example attribute query be "standard::*,owner::user". The standard attributes are available as defines, like B<Gnome::Gio::-FILE-ATTRIBUTE-STANDARD-NAME>.

If I<cancellable> is not C<undefined>, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error C<G-IO-ERROR-CANCELLED> will be returned.

For symlinks, normally the information about the target of the symlink is returned, rather than information about the symlink itself. However if you pass B<Gnome::Gio::-FILE-QUERY-INFO-NOFOLLOW-SYMLINKS> in I<flags> the information about the symlink itself will be returned. Also, for symlinks that point to non-existing files the information about the symlink itself will be returned.

If the file does not exist, the C<G-IO-ERROR-NOT-FOUND> error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.

Returns: a B<Gnome::Gio::FileInfo> for the given I<file>, or C<undefined> on error. Free the returned object with C<clear-object()>.

  method query-info ( Str $attributes, GFileQueryInfoFlags $flags, GCancellable $cancellable, N-GError $error --> GFileInfo )

=item $attributes; an attribute query string
=item $flags; a set of GFileQueryInfoFlags
=item $cancellable; optional B<Gnome::Gio::Cancellable> object, C<undefined> to ignore

=end pod

method query-info (
  Str $attributes, GFlag $flags, N-GObject $cancellable is copy
  --> N-GObject
) {
  $cancellable .= _get-native-object-no-reffing unless $cancellable ~~ N-GObject;
  my CArray[N-GError] $error .= new(N-GError);

  my N-GObject $no = g_file_query_info(
    self._get-native-object-no-reffing, $attributes, $flags, $cancellable, $error
  );

  $!last-error.clear-object;
  $!last-error .= new(:native-object(?$no ?? N-GError !! $error[0]));

  $no
}

sub g_file_query_info (
  N-GFile $file, gchar-ptr $attributes, GFlag $flags, N-GObject $cancellable,
  CArray[N-GError] $error --> N-GObject
) is native(&gio-lib)
  { * }
}}

#`{{
#-------------------------------------------------------------------------------
# TM:0:query-info-async:
=begin pod
=head2 query-info-async

Asynchronously gets the requested information about specified I<file>. The result is a B<Gnome::Gio::FileInfo> object that contains key-value attributes (such as type or size for the file).

For more details, see C<query-info()> which is the synchronous version of this call.

When the operation is finished, I<callback> will be called. You can then call C<g-file-query-info-finish()> to get the result of the operation.

  method query-info-async ( Str $attributes, GFileQueryInfoFlags $flags, Int() $io_priority, GCancellable $cancellable, GAsyncReadyCallback $callback, Pointer $user_data )

=item $attributes; an attribute query string
=item $flags; a set of B<Gnome::Gio::FileQueryInfoFlags>
=item $io_priority; the [I/O priority][io-priority] of the request
=item $cancellable; optional B<Gnome::Gio::Cancellable> object, C<undefined> to ignore
=item $callback; (scope async): a B<Gnome::Gio::AsyncReadyCallback> to call when the request is satisfied
=item $user_data; (closure): the data to pass to callback function
=end pod

method query-info-async ( Str $attributes, GFileQueryInfoFlags $flags, Int() $io_priority, GCancellable $cancellable, GAsyncReadyCallback $callback, Pointer $user_data ) {

  g_file_query_info_async(
    self._get-native-object-no-reffing, $attributes, $flags, $io_priority, $cancellable, $callback, $user_data
  );
}

sub g_file_query_info_async (
  N-GFile $file, gchar-ptr $attributes, GFlag $flags, int $io_priority, GCancellable $cancellable, GAsyncReadyCallback $callback, gpointer $user_data
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
# TM:0:query-info-finish:
=begin pod
=head2 query-info-finish

Finishes an asynchronous file info query. See C<query-info-async()>.

Returns: B<Gnome::Gio::FileInfo> for given I<file> or C<undefined> on error. Free the returned object with C<clear-object()>.

  method query-info-finish ( GAsyncResult $res, N-GError $error --> GFileInfo )

=item $res; a B<Gnome::Gio::AsyncResult>
=item $error; a B<Gnome::Gio::Error>
=end pod

method query-info-finish ( GAsyncResult $res, $error is copy --> GFileInfo ) {
  $error .= _get-native-object-no-reffing unless $error ~~ N-GError;

  g_file_query_info_finish(
    self._get-native-object-no-reffing, $res, $error
  )
}

sub g_file_query_info_finish (
  N-GFile $file, GAsyncResult $res, N-GError $error --> GFileInfo
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
# TM:0:query-settable-attributes:
=begin pod
=head2 query-settable-attributes

Obtain the list of settable attributes for the file.

Returns the type and full attribute name of all the attributes that can be set on this file. This doesn't mean setting it will always succeed though, you might get an access failure, or some specific file may not support a specific attribute.

If I<cancellable> is not C<undefined>, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error C<G-IO-ERROR-CANCELLED> will be returned.

Returns: a B<Gnome::Gio::FileAttributeInfoList> describing the settable attributes. When you are done with it, release it with C<attribute-info-list-unref()>

  method query-settable-attributes ( GCancellable $cancellable, N-GError $error --> GFileAttributeInfoList )

=item $cancellable; optional B<Gnome::Gio::Cancellable> object, C