set_display_name_async


Description:

public virtual async File set_display_name_async (string display_name, int io_priority = DEFAULT, Cancellable? cancellable = null) throws Error

Asynchronously sets the display name for a given File.

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

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

Example: Rename a file, async:

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

MainLoop loop = new MainLoop ();

File file = File.new_for_commandline_arg (args[1]);
file.set_display_name_async.begin (args[2], Priority.DEFAULT, null, (obj, res) => {
try {
file.set_display_name_async.end (res);
} catch (Error e) {
print ("Error: %s\n", e.message);
}

loop.quit ();
});

loop.run ();
return 0;
}

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

Parameters:

this

input File

display_name

a string

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