[eog] EogJobs: Make EogJobTransform work again



commit 707bf266f5166b9be64ab4f445d6dbe00a3c1ed5
Author: Felix Riemann <friemann gnome org>
Date:   Sun Jun 16 14:21:00 2013 +0200

    EogJobs: Make EogJobTransform work again
    
    This re-uses the old job code and needs to be
    extended with proper cancellation checks.

 src/eog-jobs.c |   29 ++++++++++++++++++++++++++++-
 1 files changed, 28 insertions(+), 1 deletions(-)
---
diff --git a/src/eog-jobs.c b/src/eog-jobs.c
index 430ec5f..a2b547f 100644
--- a/src/eog-jobs.c
+++ b/src/eog-jobs.c
@@ -1169,10 +1169,13 @@ eog_job_transform_image_modified (gpointer data)
 static void
 eog_job_transform_run (EogJob *job)
 {
+       EogJobTransform *transjob;
+       GList *it;
+
        /* initialization */
        g_return_if_fail (EOG_IS_JOB_TRANSFORM (job));
 
-       g_object_ref (job);
+       transjob = EOG_JOB_TRANSFORM (g_object_ref (job));
 
        /* clean previous errors */
        if (job->error) {
@@ -1182,7 +1185,31 @@ eog_job_transform_run (EogJob *job)
 
        /* check if the current job was previously cancelled */
        if (eog_job_is_cancelled (job))
+       {
+               g_object_unref (transjob);
                return;
+       }
+
+       for (it = transjob->images; it != NULL; it = it->next) {
+               EogImage *image = EOG_IMAGE (it->data);
+
+               if (transjob->transform == NULL) {
+                       eog_image_undo (image);
+               } else {
+                       eog_image_transform (image, transjob->transform, job);
+               }
+
+               if (eog_image_is_modified (image) || transjob->transform == NULL) {
+                       g_object_ref (image);
+                       g_idle_add (eog_job_transform_image_modified, image);
+               }
+
+               if (G_UNLIKELY (eog_job_is_cancelled (job)))
+               {
+                       g_object_unref (transjob);
+                       return;
+               }
+       }
 
        /* --- enter critical section --- */
        g_mutex_lock (job->mutex);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]