[gimp] app: file_open_image(): fix opening of unknown remote files
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: file_open_image(): fix opening of unknown remote files
- Date: Mon, 7 Nov 2016 17:36:46 +0000 (UTC)
commit 5e2a61850ea8eba42264f917588691f3d0409c03
Author: Michael Natterer <mitch gimp org>
Date: Mon Nov 7 18:28:39 2016 +0100
app: file_open_image(): fix opening of unknown remote files
This got lost when dropping the file-uri plug-in and switching to
interal download using GIO. The file-uri plug-in would just download
whatever remote thing and open it locally, using local magic matching.
We now do the same internally and try the magic matching again on the
downloaded file.
app/file/file-open.c | 28 ++++++++++++++++++++++++++--
1 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/app/file/file-open.c b/app/file/file-open.c
index 764f7a8..cae912c 100644
--- a/app/file/file-open.c
+++ b/app/file/file-open.c
@@ -139,7 +139,15 @@ file_open_image (Gimp *gimp,
file, error);
if (! file_proc)
- return NULL;
+ {
+ /* don't bail out on remote files, they might need to be
+ * downloaded for magic matching
+ */
+ if (g_file_is_native (file))
+ return NULL;
+
+ g_clear_error (error);
+ }
if (! g_file_is_native (file) &&
! file_remote_mount_file (gimp, file, progress, &my_error))
@@ -152,7 +160,7 @@ file_open_image (Gimp *gimp,
return NULL;
}
- if (! file_proc->handles_uri)
+ if (! file_proc || ! file_proc->handles_uri)
{
path = g_file_get_path (file);
@@ -171,6 +179,22 @@ file_open_image (Gimp *gimp,
return NULL;
}
+ /* if we don't have a file proc yet, try again on the local
+ * file
+ */
+ if (! file_proc)
+ file_proc = gimp_plug_in_manager_file_procedure_find (gimp->plug_in_manager,
+ GIMP_FILE_PROCEDURE_GROUP_OPEN,
+ local_file, error);
+
+ if (! file_proc)
+ {
+ g_file_delete (local_file, NULL, NULL);
+ g_object_unref (local_file);
+
+ return NULL;
+ }
+
path = g_file_get_path (local_file);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]