[evince/gnome-3-24] thumbnailer: Don't copy remote files before thumbnailing



commit 37a1f9520d532415f7afba42d22ed10949b1ede4
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 b348d43..f9a949a 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 (uri, &error);


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