[gnome-photos/wip/rishi/thumbnailer: 13/15] 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/wip/rishi/thumbnailer: 13/15] base-item: Use a GCancellable when creating a thumbnail
- Date: Wed, 22 Feb 2017 19:20:59 +0000 (UTC)
commit 006a73107d665b7a53cb927eeb347c8392d4d93a
Author: Debarshi Ray <debarshir gnome org>
Date: Wed Feb 22 17:37:57 2017 +0100
base-item: Use a GCancellable when creating a thumbnail
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 28319c9..d0d64b1 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -939,17 +939,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;
}
@@ -1012,7 +1025,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]