[gnome-photos] base-item: Use a GCancellable when creating a thumbnail
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] base-item: Use a GCancellable when creating a thumbnail
- Date: Thu, 23 Feb 2017 09:38:34 +0000 (UTC)
commit 3a83b8fa9be0cdf41bc562b152f3b6766055606a
Author: Debarshi Ray <debarshir gnome org>
Date: Wed Feb 22 17:37:57 2017 +0100
base-item: Use a GCancellable when creating a thumbnail
Ongoing thumbnailing jobs need to be cancelled whenever the pipeline is
saved so that we can create a new one to reflect the edited state of
the item.
https://bugzilla.gnome.org/show_bug.cgi?id=763329
src/photos-base-item.c | 25 +++++++++++++++++++------
1 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 8a8112e..8d7065e 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -934,17 +934,30 @@ photos_base_item_create_thumbnail_cb (GObject *source_object, GAsyncResult *res,
PhotosBaseItemPrivate *priv;
GError *error;
GFile *file = G_FILE (user_data);
-
- priv = photos_base_item_get_instance_private (self);
+ gboolean success;
error = NULL;
- photos_base_item_create_thumbnail_finish (self, res, &error);
+ success = photos_base_item_create_thumbnail_finish (self, res, &error);
if (error != NULL)
{
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ {
+ g_error_free (error);
+ goto out;
+ }
+ else
+ {
+ g_warning ("Unable to create thumbnail: %s", error->message);
+ g_error_free (error);
+ }
+ }
+
+ priv = photos_base_item_get_instance_private (self);
+
+ if (!success)
+ {
priv->failed_thumbnailing = TRUE;
- g_warning ("Unable to create thumbnail: %s", error->message);
photos_base_item_set_failed_icon (self);
- g_error_free (error);
goto out;
}
@@ -1007,7 +1020,7 @@ photos_base_item_file_query_info (GObject *source_object, GAsyncResult *res, gpo
else
{
photos_base_item_create_thumbnail_async (self,
- NULL,
+ priv->cancellable,
photos_base_item_create_thumbnail_cb,
g_object_ref (file));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]