query_info_async


Description:

public virtual async FileInfo query_info_async (string attributes, FileQueryInfoFlags flags, int io_priority = DEFAULT, Cancellable? cancellable = null) throws Error

Asynchronously gets the requested information about specified this.

The result is a FileInfo object that contains key-value attributes (such as type or size for the file).

For more details, see query_info which is the synchronous version of this call.

When the operation is finished, callback will be called. You can then call query_info_async.end to get the result of the operation.

Example: FileInfo, async:

public static int main (string[] args) {
if (args.length != 2) {
print ("%s FILE\n", args[0]);
return 0;
}

MainLoop loop = new MainLoop ();

File file = File.new_for_commandline_arg (args[1]);
file.query_info_async.begin ("standard::icon", 0, Priority.DEFAULT, null, (obj, res) => {
try {
FileInfo info = file.query_info_async.end (res);
Icon icon = info.get_icon ();
print ("%s\n", icon.to_string ());
} catch (Error e) {
print ("Error: %s\n", e.message);
}

loop.quit ();
});

loop.run ();
return 0;
}

valac --pkg gio-2.0 GLib.File.query_info_async.vala

Parameters:

this

input File

attributes

an attribute query string

flags

a set of FileQueryInfoFlags

io_priority

the I/O priority of the request

cancellable

optional Cancellable object, null to ignore

callback

a TaskReadyCallback to call when the request is satisfied

user_data

the data to pass to callback function




2022 vala-language.org