[totem/mcatanzaro/thumbnails] icon-helpers: adjust for gnome-desktop thumbnail API changes




commit cc3c38db9588611b2e0ac9e74f1464b975c76a89
Author: Michael Catanzaro <mcatanzaro redhat com>
Date:   Mon Apr 11 15:50:21 2022 -0500

    icon-helpers: adjust for gnome-desktop thumbnail API changes
    
    See gnome-desktop!132

 src/icon-helpers.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
---
diff --git a/src/icon-helpers.c b/src/icon-helpers.c
index f797b207e..f5ccb4ea1 100644
--- a/src/icon-helpers.c
+++ b/src/icon-helpers.c
@@ -194,6 +194,9 @@ thumbnail_media_async_thread (GTask    *task,
        const char *uri;
        GDateTime *mtime;
        gint64 unix_date;
+#if defined(GNOME_DESKTOP_PLATFORM_VERSION) && GNOME_DESKTOP_PLATFORM_VERSION >= 43
+       GError *error = NULL;
+#endif
 
        if (g_task_return_error_if_cancelled (task)) {
                g_object_unref (task);
@@ -220,6 +223,24 @@ thumbnail_media_async_thread (GTask    *task,
                return;
        }
 
+#if defined(GNOME_DESKTOP_PLATFORM_VERSION) && GNOME_DESKTOP_PLATFORM_VERSION >= 43
+       tmp_pixbuf = gnome_desktop_thumbnail_factory_generate_thumbnail (factory, uri, 
"video/x-totem-stream", NULL, &error);
+
+       if (!tmp_pixbuf) {
+               g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED, "Thumbnailing failed: %s", 
error->message);
+               g_object_unref (task);
+               g_error_free (error);
+               return;
+       }
+
+       gnome_desktop_thumbnail_factory_save_thumbnail (factory, tmp_pixbuf, uri, unix_date, NULL, &error);
+       if (error) {
+               g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED, "Thumbnailing failed: %s", 
error->message);
+               g_object_unref (task);
+               g_error_free (error);
+               return;
+       }
+#else
        tmp_pixbuf = gnome_desktop_thumbnail_factory_generate_thumbnail (factory, uri, 
"video/x-totem-stream");
 
        if (!tmp_pixbuf) {
@@ -229,6 +250,7 @@ thumbnail_media_async_thread (GTask    *task,
        }
 
        gnome_desktop_thumbnail_factory_save_thumbnail (factory, tmp_pixbuf, uri, unix_date);
+#endif
 
        /* Save the thumbnail URL for the bookmarks source */
        save_bookmark_thumbnail (media, uri);


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