diff options
author | Bastien Nocera <hadess@hadess.net> | 2020-08-27 10:38:04 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2020-08-27 10:50:18 +0200 |
commit | b37fe9b5e9bb23270f895a9fcb7aeeb4aa2e5534 (patch) | |
tree | 52d28f8c6225af2bb68fca96e85a9ec9adc1f122 | |
parent | cd2c39e14af1e9a411edc18729446f8810f84c4e (diff) | |
download | totem-b37fe9b5e9bb23270f895a9fcb7aeeb4aa2e5534.tar.gz |
icon-helpers: Show icons even if mtime is missing
We really need thumbnails, so make sure we show something even if it's
not up-to-date.
-rw-r--r-- | src/icon-helpers.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/icon-helpers.c b/src/icon-helpers.c index d56d9d047..bdeb0fa32 100644 --- a/src/icon-helpers.c +++ b/src/icon-helpers.c @@ -193,6 +193,7 @@ thumbnail_media_async_thread (GTask *task, GdkPixbuf *pixbuf, *tmp_pixbuf; const char *uri; GDateTime *mtime; + gint64 unix_date; if (g_task_return_error_if_cancelled (task)) { g_object_unref (task); @@ -211,14 +212,10 @@ thumbnail_media_async_thread (GTask *task, key_id = grl_registry_lookup_metadata_key (registry, "bookmark-date"); mtime = grl_data_get_boxed (GRL_DATA (media), key_id); } + unix_date = mtime ? g_date_time_to_unix (mtime) : g_get_real_time () / 1000000; - if (!uri || !mtime) { - if (!uri && !mtime) - g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED, "URI and mtime missing"); - else if (!uri) - g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED, "URI missing"); - else - g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED, "mtime missing"); + if (!uri) { + g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED, "URI missing"); g_object_unref (task); return; } @@ -231,7 +228,7 @@ thumbnail_media_async_thread (GTask *task, return; } - gnome_desktop_thumbnail_factory_save_thumbnail (factory, tmp_pixbuf, uri, g_date_time_to_unix (mtime)); + gnome_desktop_thumbnail_factory_save_thumbnail (factory, tmp_pixbuf, uri, unix_date); /* Save the thumbnail URL for the bookmarks source */ save_bookmark_thumbnail (media, uri); |