[gnome-photos/wip/rishi/thumbnailer: 6/6] utils: foo



commit 89033832559ee8f72d1d86e5f14717828fad0cce
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Feb 9 20:32:12 2017 +0100

    utils: foo

 src/photos-utils.c |   27 +++++++++------------------
 1 files changed, 9 insertions(+), 18 deletions(-)
---
diff --git a/src/photos-utils.c b/src/photos-utils.c
index db90ea3..7be69fd 100644
--- a/src/photos-utils.c
+++ b/src/photos-utils.c
@@ -61,6 +61,7 @@
 #include "photos-share-point-google.h"
 #include "photos-share-point-online.h"
 #include "photos-source.h"
+#include "photos-thumbnail-factory.h"
 #include "photos-tool.h"
 #include "photos-tool-colors.h"
 #include "photos-tool-crop.h"
@@ -429,31 +430,21 @@ photos_utils_create_thumbnail (GFile *file,
                                GCancellable *cancellable,
                                GError **error)
 {
-  GnomeDesktopThumbnailFactory *factory = NULL;
+  PhotosThumbnailFactory *factory = NULL;
   gboolean ret_val = FALSE;
-  gchar *uri = NULL;
-  GdkPixbuf *pixbuf = NULL;
+  //gchar *uri = NULL;
 
-  uri = g_file_get_uri (file);
-  factory = gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE);
-  pixbuf = gnome_desktop_thumbnail_factory_generate_thumbnail (factory, uri, mime_type);
-  if (pixbuf == NULL)
-    {
-      /* FIXME: use proper #defines and enumerated types */
-      g_set_error (error,
-                   g_quark_from_static_string ("gnome-desktop-error"),
-                   0,
-                   "GnomeDesktopThumbnailFactory failed");
-      goto out;
-    }
+  //uri = g_file_get_uri (file);
+  factory = photos_thumbnail_factory_dup_singleton (NULL, NULL);
+  if (!photos_thumbnail_factory_generate_thumbnail (factory, file, mime_type, NULL, error))
+    goto out;
 
-  gnome_desktop_thumbnail_factory_save_thumbnail (factory, pixbuf, uri, (time_t) mtime);
+  //gnome_desktop_thumbnail_factory_save_thumbnail (factory, pixbuf, uri, (time_t) mtime);
   ret_val = TRUE;
 
  out:
-  g_clear_object (&pixbuf);
   g_clear_object (&factory);
-  g_free (uri);
+  //g_free (uri);
   return ret_val;
 }
 


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