[gnome-photos/wip/rishi/thumbnailer: 12/12] google-item: Use photos_utils_file_copy_as_thumbnail



commit 2caf72fcfc268a51874b694c2d80971fee115776
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Feb 14 15:33:49 2017 +0100

    google-item: Use photos_utils_file_copy_as_thumbnail
    
    From now on the thumbnails will actually be PNG files, instead of being
    JPEG data stored with a '*.png' extension.

 src/photos-google-item.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/src/photos-google-item.c b/src/photos-google-item.c
index 116684b..22ea168 100644
--- a/src/photos-google-item.c
+++ b/src/photos-google-item.c
@@ -160,6 +160,8 @@ photos_google_item_create_thumbnail (PhotosBaseItem *item, GCancellable *cancell
   gboolean ret_val = FALSE;
   const gchar *thumbnail_uri;
   const gchar *uri;
+  gint64 height;
+  gint64 width;
   guint max_width = 0;
   guint current_width;
 
@@ -194,14 +196,17 @@ photos_google_item_create_thumbnail (PhotosBaseItem *item, GCancellable *cancell
   local_dir = g_path_get_dirname (local_path);
   g_mkdir_with_parents (local_dir, 0700);
 
+  height = photos_base_item_get_height (item);
+  width = photos_base_item_get_width (item);
+
   photos_debug (PHOTOS_DEBUG_NETWORK, "Downloading %s from Google to %s", thumbnail_uri, local_path);
-  if (!g_file_copy (remote_file,
-                    local_file,
-                    G_FILE_COPY_ALL_METADATA | G_FILE_COPY_OVERWRITE,
-                    cancellable,
-                    NULL,
-                    NULL,
-                    error))
+  if (!photos_utils_file_copy_as_thumbnail (remote_file,
+                                            local_file,
+                                            uri,
+                                            height,
+                                            width,
+                                            cancellable,
+                                            error))
     goto out;
 
   ret_val = TRUE;


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