Exemplo n.º 1
0
GFile *
file_remote_upload_image_prepare (Gimp          *gimp,
                                  GFile         *file,
                                  gboolean      *mounted,
                                  GimpProgress  *progress,
                                  GError       **error)
{
  GFile *local_file;

  g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
  g_return_val_if_fail (G_IS_FILE (file), NULL);
  g_return_val_if_fail (mounted != NULL, NULL);
  g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL);
  g_return_val_if_fail (error == NULL || *error == NULL, NULL);

  local_file = file_remote_mount_file (gimp, file, progress);

  if (local_file)
    {
      *mounted = TRUE;
    }
  else
    {
      *mounted = FALSE;

      local_file = file_remote_get_temp_file (gimp, file);
    }

  return local_file;
}
Exemplo n.º 2
0
GFile *
file_remote_upload_image_prepare (Gimp          *gimp,
                                  GFile         *file,
                                  GimpProgress  *progress,
                                  GError       **error)
{
  GFile *local_file;

  g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
  g_return_val_if_fail (G_IS_FILE (file), NULL);
  g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL);
  g_return_val_if_fail (error == NULL || *error == NULL, NULL);

  local_file = file_remote_get_temp_file (gimp, file);

  return local_file;
}
Exemplo n.º 3
0
GFile *
file_remote_download_image (Gimp          *gimp,
                            GFile         *file,
                            gboolean      *mounted,
                            GimpProgress  *progress,
                            GError       **error)
{
  GFile *local_file;

  g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
  g_return_val_if_fail (G_IS_FILE (file), NULL);
  g_return_val_if_fail (mounted != NULL, NULL);
  g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL);
  g_return_val_if_fail (error == NULL || *error == NULL, NULL);

  local_file = file_remote_mount_file (gimp, file, progress);

  if (local_file)
    {
      *mounted = TRUE;
    }
  else
    {
      *mounted = FALSE;

      local_file = file_remote_get_temp_file (gimp, file);

      if (! file_remote_copy_file (gimp, file, local_file, DOWNLOAD,
                                   progress, error))
        {
          g_object_unref (local_file);
          return NULL;
        }
    }

  return local_file;
}