summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Catanzaro <mcatanzaro@redhat.com>2022-04-11 15:50:21 -0500
committerMichael Catanzaro <mcatanzaro@redhat.com>2022-04-11 15:50:21 -0500
commitcc3c38db9588611b2e0ac9e74f1464b975c76a89 (patch)
treea0c9069323b145cc7d3eda7eaecabd55f7a9a6b0
parent546fca8d42289b27bf405d82957518ab6b4697a7 (diff)
downloadtotem-cc3c38db9588611b2e0ac9e74f1464b975c76a89.tar.gz
icon-helpers: adjust for gnome-desktop thumbnail API changes
See gnome-desktop!132
-rw-r--r--src/icon-helpers.c22
1 files changed, 22 insertions, 0 deletions
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);