do_set_display_name (GVfsBackend *backend,
                     GVfsJobSetDisplayName *display_name_job,
                     const char *filename,
                     const char *display_name)
{
  GVfsBackendAdmin *self = G_VFS_BACKEND_ADMIN (backend);
  GVfsJob *job = G_VFS_JOB (display_name_job);
  GError *error = NULL;
  GFile *file, *new_file;
  char *new_path;

  if (!check_permission (self, job))
    return;

  file = g_file_new_for_path (filename);
  new_file = g_file_set_display_name (file, display_name, job->cancellable, &error);
  g_object_unref (file);

  if (error != NULL)
    goto out;

  new_path = g_file_get_path (new_file);
  g_vfs_job_set_display_name_set_new_path (display_name_job, new_path);
  g_free (new_path);
  g_object_unref (new_file);

 out:
  complete_job (job, error);
}
do_set_display_name (GVfsBackend *backend,
                     GVfsJobSetDisplayName *display_name_job,
                     const char *filename,
                     const char *display_name)
{
  GVfsBackendAdmin *self = G_VFS_BACKEND_ADMIN (backend);
  GVfsJob *job = G_VFS_JOB (display_name_job);
  GError *error = NULL;
  GFile *file, *new_file;
  char *new_path;

  if (!check_permission (self, job))
    return;

  file = g_file_new_for_path (filename);
  new_file = g_file_set_display_name (file, display_name, job->cancellable, &error);
  g_object_unref (file);

  if (error != NULL)
    goto out;

  new_path = g_file_get_path (new_file);
  g_vfs_job_set_display_name_set_new_path (display_name_job, new_path);
  g_free (new_path);
  g_object_unref (new_file);

 out:
  complete_job (job, error);
}