[gimp] Issue #1725 - "Open location..." can't open internet URIs due to GLIB/GIO
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Issue #1725 - "Open location..." can't open internet URIs due to GLIB/GIO
- Date: Thu, 4 Jul 2019 10:51:13 +0000 (UTC)
commit f370596d0477b9a4e0563edcd63f0afd6837e79c
Author: Michael Natterer <mitch gimp org>
Date: Thu Jul 4 12:35:29 2019 +0200
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.
app/file/file-open.c | 36 ++++++++++++++++++++++++++++--------
app/file/file-save.c | 36 ++++++++++++++++++++++++++++--------
2 files changed, 56 insertions(+), 16 deletions(-)
---
diff --git a/app/file/file-open.c b/app/file/file-open.c
index 99f72157eb..dc800170eb 100644
--- a/app/file/file-open.c
+++ b/app/file/file-open.c
@@ -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;
+ {
+ *status = GIMP_PDB_CANCEL;
- return NULL;
+ 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;
}
- path = g_file_get_path (local_file);
+ 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)
- path = g_file_get_uri (file);
+ {
+ 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);
diff --git a/app/file/file-save.c b/app/file/file-save.c
index 419ce92095..7fc2dfdb9c 100644
--- a/app/file/file-save.c
+++ b/app/file/file-save.c
@@ -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;
+ {
+ status = GIMP_PDB_CANCEL;
- goto out;
+ 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;
}
- path = g_file_get_path (local_file);
+ 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)
- path = g_file_get_uri (file);
+ {
+ if (file_proc->handles_uri)
+ path = g_file_get_uri (file);
+ else
+ path = g_file_get_path (file);
+ }
uri = g_file_get_uri (file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]