[gnome-photos/wip/rishi/thumbnailer: 11/15] thumbnail-factory: Implement cancellation
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/thumbnailer: 11/15] thumbnail-factory: Implement cancellation
- Date: Wed, 22 Feb 2017 19:37:30 +0000 (UTC)
commit 6797ff9b18a88c0873341713994c03a4fc996e26
Author: Debarshi Ray <debarshir gnome org>
Date: Wed Feb 22 16:30:24 2017 +0100
thumbnail-factory: Implement cancellation
https://bugzilla.gnome.org/show_bug.cgi?id=763329
src/photos-thumbnail-factory.c | 41 +++++++++++++++++++++++++++++----------
1 files changed, 30 insertions(+), 11 deletions(-)
---
diff --git a/src/photos-thumbnail-factory.c b/src/photos-thumbnail-factory.c
index f0e56d9..88d4b49 100644
--- a/src/photos-thumbnail-factory.c
+++ b/src/photos-thumbnail-factory.c
@@ -474,17 +474,36 @@ photos_thumbnail_factory_generate_thumbnail (PhotosThumbnailFactory *self,
thumbnail_path = photos_utils_get_thumbnail_path_for_file (file);
photos_debug (PHOTOS_DEBUG_THUMBNAILER, "Calling GenerateThumbnail for %s", uri);
- ret_val = photos_thumbnailer_dbus_call_generate_thumbnail_sync (self->thumbnailer,
- uri,
- mime_type,
- orientation_str,
- original_height,
- original_width,
- pipeline_uri,
- thumbnail_path,
- thumbnail_size,
- cancellable,
- &local_error);
+ if (!photos_thumbnailer_dbus_call_generate_thumbnail_sync (self->thumbnailer,
+ uri,
+ mime_type,
+ orientation_str,
+ original_height,
+ original_width,
+ pipeline_uri,
+ thumbnail_path,
+ thumbnail_size,
+ cancellable,
+ &local_error))
+ {
+ if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ {
+ guint32 serial;
+
+ if (mutex_connection_unlocked)
+ g_mutex_lock (&self->mutex_connection);
+
+ serial = g_dbus_connection_get_last_serial (self->connection);
+ photos_thumbnailer_dbus_call_cancel_sync (self->thumbnailer, serial, NULL, NULL);
+
+ if (mutex_connection_unlocked)
+ g_mutex_unlock (&self->mutex_connection);
+ }
+ }
+ else
+ {
+ ret_val = TRUE;
+ }
g_free (thumbnail_path);
g_free (uri);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]