### Method

# Gio File set_display_name

#### Declaration

    GFile*
    g_file_set_display_name (
      GFile* file,
      const char* display_name,
      GCancellable* cancellable,
      GError** error
    )

#### Description

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 g_file_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 `G_IO_ERROR_CANCELLED` will be returned.

#### Parameters

`display_name`

  Type: `const char*`

  A string.

  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

`cancellable`

  Type: `GCancellable`

  Optional `GCancellable` object, `NULL` to ignore.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the method if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `GFile`

A `GFile` specifying what `file` was renamed to, or `NULL` if there was an error. Free the returned object with g_object_unref().

The caller of the method takes ownership of the returned data, and is responsible for freeing it.