Gio.File.prototype.set_display_name

function set_display_name(display_name: String, cancellable: Gio.Cancellable): Gio.File {
    // Gjs wrapper for g_file_set_display_name()
}
  

Renames file to the specified display name.

The display name is converted from UTF-8 to the correct encoding for the target filesystem if possible and the file is renamed to this.

If you want to implement a rename operation in the user interface the edit name (#G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME) should be used as the initial value in the rename widget, and then the result after editing should be passed to Gio.File.prototype.set_display_name.

On success the resulting converted filename is returned.

If cancellable is not null, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error Gio.IOErrorEnum.cancelled will be returned.

display_name

a string

cancellable

optional Gio.Cancellable object, null to ignore

Returns

a Gio.File specifying what file was renamed to, or null if there was an error. Free the returned object with GObject.Object.prototype.unref.