[evince] thumbnailer: Don't copy remote files before thumbnailing



commit f6f98914dc3d09cf98b8469a3ab317b6682878b5
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Mar 21 14:01:18 2017 +0100

    thumbnailer: Don't copy remote files before thumbnailing
    
    There's no need to copy the file locally when we can read it directly
    through FUSE.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=780351

 thumbnailer/evince-thumbnailer.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/thumbnailer/evince-thumbnailer.c b/thumbnailer/evince-thumbnailer.c
index 6fce735..89e4b78 100644
--- a/thumbnailer/evince-thumbnailer.c
+++ b/thumbnailer/evince-thumbnailer.c
@@ -105,11 +105,13 @@ static EvDocument *
 evince_thumbnailer_get_document (GFile *file)
 {
        EvDocument *document = NULL;
-       gchar      *uri;
+       gchar      *uri, *path;
        GFile      *tmp_file = NULL;
        GError     *error = NULL;
 
-       if (!g_file_is_native (file)) {
+       path = g_file_get_path (file);
+
+       if (!path) {
                gchar *base_name, *template;
 
                base_name = g_file_get_basename (file);
@@ -136,7 +138,8 @@ evince_thumbnailer_get_document (GFile *file)
                }
                uri = g_file_get_uri (tmp_file);
        } else {
-               uri = g_file_get_uri (file);
+               uri = g_filename_to_uri (path, NULL, NULL);
+               g_free (path);
        }
 
        document = ev_document_factory_get_document_full (uri, EV_DOCUMENT_LOAD_FLAG_NO_CACHE, &error);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]