[evolution/mcatanzaro/thumbnails] icon-factory: update for new gnome-desktop API




commit d3392be7255c41688f37fb35a18cffcafd92cc76
Author: Michael Catanzaro <mcatanzaro redhat com>
Date:   Mon Apr 11 17:16:58 2022 -0500

    icon-factory: update for new gnome-desktop API
    
    See gnome-desktop!132

 src/e-util/e-icon-factory.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
---
diff --git a/src/e-util/e-icon-factory.c b/src/e-util/e-icon-factory.c
index 25c2ecbbb6..fd09e506b7 100644
--- a/src/e-util/e-icon-factory.c
+++ b/src/e-util/e-icon-factory.c
@@ -170,6 +170,9 @@ e_icon_factory_create_thumbnail (const gchar *filename)
        static GnomeDesktopThumbnailFactory *thumbnail_factory = NULL;
        struct stat file_stat;
        gchar *thumbnail = NULL;
+#if defined(GNOME_DESKTOP_PLATFORM_VERSION) && GNOME_DESKTOP_PLATFORM_VERSION >= 43
+       GError *error = NULL;
+#endif
 
        g_return_val_if_fail (filename != NULL, NULL);
 
@@ -194,10 +197,26 @@ e_icon_factory_create_thumbnail (const gchar *filename)
                        if (!thumbnail && gnome_desktop_thumbnail_factory_can_thumbnail (thumbnail_factory, 
uri, mime, file_stat.st_mtime)) {
                                GdkPixbuf *pixbuf;
 
+#if defined(GNOME_DESKTOP_PLATFORM_VERSION) && GNOME_DESKTOP_PLATFORM_VERSION >= 43
+                               pixbuf = gnome_desktop_thumbnail_factory_generate_thumbnail 
(thumbnail_factory, uri, mime, NULL, &error);
+                               if (!pixbuf) {
+                                       g_warning ("Failed to generate thumbnail for %s: %s", uri, 
error->message);
+                                       g_clear_error (&error);
+                               }
+#else
                                pixbuf = gnome_desktop_thumbnail_factory_generate_thumbnail 
(thumbnail_factory, uri, mime);
+#endif
 
                                if (pixbuf) {
+#if defined(GNOME_DESKTOP_PLATFORM_VERSION) && GNOME_DESKTOP_PLATFORM_VERSION >= 43
+                                       gnome_desktop_thumbnail_factory_save_thumbnail (thumbnail_factory, 
pixbuf, uri, file_stat.st_mtime, NULL, &error);
+                                       if (error) {
+                                               g_warning ("Failed to save thumbnail for %s: %s", uri, 
error->message);
+                                               g_clear_error (&error);
+                                       }
+#else
                                        gnome_desktop_thumbnail_factory_save_thumbnail (thumbnail_factory, 
pixbuf, uri, file_stat.st_mtime);
+#endif
                                        g_object_unref (pixbuf);
 
                                        thumbnail = gnome_desktop_thumbnail_factory_lookup 
(thumbnail_factory, uri, file_stat.st_mtime);


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