mirror of https://github.com/GNOME/gimp.git
Issue #1725 - "Open location..." can't open internet URIs due to GLIB/GIO
When the remote volume can't be mounted by GIO, continue as if the file procedure couldn't handle URIs and try downloading/uploading the file manually.
This commit is contained in:
parent
3b6b3fc189
commit
f370596d04
|
@ -84,6 +84,7 @@ file_open_image (Gimp *gimp,
|
|||
GFile *local_file = NULL;
|
||||
gchar *path = NULL;
|
||||
gchar *entered_uri = NULL;
|
||||
gboolean mounted = TRUE;
|
||||
GError *my_error = NULL;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
|
@ -150,18 +151,27 @@ file_open_image (Gimp *gimp,
|
|||
! file_remote_mount_file (gimp, file, progress, &my_error))
|
||||
{
|
||||
if (my_error)
|
||||
g_propagate_error (error, my_error);
|
||||
{
|
||||
g_printerr ("%s: mounting remote volume failed, trying to download"
|
||||
"the file: %s\n",
|
||||
G_STRFUNC, my_error->message);
|
||||
g_clear_error (&my_error);
|
||||
|
||||
mounted = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
*status = GIMP_PDB_CANCEL;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (! file_proc || ! file_proc->handles_uri)
|
||||
if (! file_proc || ! file_proc->handles_uri || ! mounted)
|
||||
{
|
||||
path = g_file_get_path (file);
|
||||
gchar *my_path = g_file_get_path (file);
|
||||
|
||||
if (! path)
|
||||
if (! my_path)
|
||||
{
|
||||
local_file = file_remote_download_image (gimp, file, progress,
|
||||
&my_error);
|
||||
|
@ -192,12 +202,22 @@ file_open_image (Gimp *gimp,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (file_proc->handles_uri)
|
||||
path = g_file_get_uri (local_file);
|
||||
else
|
||||
path = g_file_get_path (local_file);
|
||||
}
|
||||
|
||||
g_free (my_path);
|
||||
}
|
||||
|
||||
if (! path)
|
||||
{
|
||||
if (file_proc->handles_uri)
|
||||
path = g_file_get_uri (file);
|
||||
else
|
||||
path = g_file_get_path (file);
|
||||
}
|
||||
|
||||
entered_uri = g_file_get_uri (entered_file);
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ file_save (Gimp *gimp,
|
|||
GFile *local_file = NULL;
|
||||
gchar *path = NULL;
|
||||
gchar *uri = NULL;
|
||||
gboolean mounted = TRUE;
|
||||
gint32 image_ID;
|
||||
gint32 drawable_ID;
|
||||
GError *my_error = NULL;
|
||||
|
@ -144,18 +145,27 @@ file_save (Gimp *gimp,
|
|||
! file_remote_mount_file (gimp, file, progress, &my_error))
|
||||
{
|
||||
if (my_error)
|
||||
g_propagate_error (error, my_error);
|
||||
{
|
||||
g_printerr ("%s: mounting remote volume failed, trying to upload"
|
||||
"the file: %s\n",
|
||||
G_STRFUNC, my_error->message);
|
||||
g_clear_error (&my_error);
|
||||
|
||||
mounted = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = GIMP_PDB_CANCEL;
|
||||
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
if (! file_proc->handles_uri)
|
||||
if (! file_proc->handles_uri || ! mounted)
|
||||
{
|
||||
path = g_file_get_path (file);
|
||||
gchar *my_path = g_file_get_path (file);
|
||||
|
||||
if (! path)
|
||||
if (! my_path)
|
||||
{
|
||||
local_file = file_remote_upload_image_prepare (gimp, file, progress,
|
||||
&my_error);
|
||||
|
@ -170,12 +180,22 @@ file_save (Gimp *gimp,
|
|||
goto out;
|
||||
}
|
||||
|
||||
if (file_proc->handles_uri)
|
||||
path = g_file_get_uri (local_file);
|
||||
else
|
||||
path = g_file_get_path (local_file);
|
||||
}
|
||||
|
||||
g_free (my_path);
|
||||
}
|
||||
|
||||
if (! path)
|
||||
{
|
||||
if (file_proc->handles_uri)
|
||||
path = g_file_get_uri (file);
|
||||
else
|
||||
path = g_file_get_path (file);
|
||||
}
|
||||
|
||||
uri = g_file_get_uri (file);
|
||||
|
||||
|
|
Loading…
Reference in New Issue