[eog] EogJobs: Make EogJobCopy work with the new scheduler
- From: Felix Riemann <friemann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog] EogJobs: Make EogJobCopy work with the new scheduler
- Date: Sun, 16 Jun 2013 14:07:12 +0000 (UTC)
commit 0a26c8bc7b3c884a7b5a6da001fd207021a1b0ea
Author: Felix Riemann <friemann gnome org>
Date: Sun Jun 16 15:06:49 2013 +0200
EogJobs: Make EogJobCopy work with the new scheduler
Also uses the old worker code for now until job cancellation
is fully implemented.
src/eog-jobs.c | 28 +++++++++++++++++++++++++++-
src/eog-window.c | 2 --
2 files changed, 27 insertions(+), 3 deletions(-)
---
diff --git a/src/eog-jobs.c b/src/eog-jobs.c
index a2b547f..5324384 100644
--- a/src/eog-jobs.c
+++ b/src/eog-jobs.c
@@ -424,10 +424,13 @@ eog_job_copy_progress_callback (goffset current_num_bytes,
static void
eog_job_copy_run (EogJob *job)
{
+ EogJobCopy *copyjob;
+ GList *it;
+
/* initialization */
g_return_if_fail (EOG_IS_JOB_COPY (job));
- g_object_ref (job);
+ copyjob = EOG_JOB_COPY (g_object_ref (job));
/* clean previous errors */
if (job->error) {
@@ -437,7 +440,30 @@ eog_job_copy_run (EogJob *job)
/* check if the current job was previously cancelled */
if (eog_job_is_cancelled (job))
+ {
+ g_object_unref (job);
return;
+ }
+
+ copyjob->current_position = 0;
+
+ for (it = copyjob->images; it != NULL; it = g_list_next (it), copyjob->current_position++) {
+ GFile *src, *dest;
+ gchar *filename, *dest_filename;
+
+ src = (GFile *) it->data;
+ filename = g_file_get_basename (src);
+ dest_filename = g_build_filename (copyjob->destination, filename, NULL);
+ dest = g_file_new_for_path (dest_filename);
+
+ g_file_copy (src, dest,
+ G_FILE_COPY_OVERWRITE, NULL,
+ eog_job_copy_progress_callback, job,
+ &job->error);
+ g_object_unref (dest);
+ g_free (filename);
+ g_free (dest_filename);
+ }
/* --- enter critical section --- */
g_mutex_lock (job->mutex);
diff --git a/src/eog-window.c b/src/eog-window.c
index 5113e03..49bffe8 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -2924,8 +2924,6 @@ eog_job_copy_cb (EogJobCopy *job, gpointer user_data)
g_object_unref (source_file);
g_object_unref (dest_file);
- g_object_unref (G_OBJECT (job->images->data));
- g_list_free (job->images);
g_object_unref (job);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]