Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell/ev-job-queue.c
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2007-09-04 15:25:46 (GMT)
committer Carlos Garcia Campos <carlosgc@src.gnome.org>2007-09-04 15:25:46 (GMT)
commitc8c1c1382641f6d97e7dabc4d3bec6ea88103947 (patch)
tree2ad4aceca305bdef0b6dbed7ec82ae9303cacedb /shell/ev-job-queue.c
parent1ee7fd467a6bcd1edefd6fedf4b0dd7e41d8125b (diff)
Move save a copy task to its own job so that it's carried out in a thread
2007-09-04 Carlos Garcia Campos <carlosgc@gnome.org> * shell/ev-job-queue.c: (handle_job), (search_for_jobs_unlocked), (no_jobs_available_unlocked), (ev_job_queue_init), (find_queue), (ev_job_queue_remove_job): * shell/ev-jobs.[ch]: (ev_job_save_init), (ev_job_save_dispose), (ev_job_save_class_init), (ev_job_save_new), (ev_job_save_run): * shell/ev-window.c: (ev_window_clear_save_job), (ev_window_save_job_cb), (file_save_dialog_response_cb), (ev_window_dispose): Move save a copy task to its own job so that it's carried out in a thread avoiding another lock in the main thread. Use ev_xfer_uri_simple() instead of gnome_vfs_move() so that document can be saved to a pathin another file system. Fixes bug #456891. svn path=/trunk/; revision=2664
Diffstat (limited to 'shell/ev-job-queue.c')
-rw-r--r--shell/ev-job-queue.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/shell/ev-job-queue.c b/shell/ev-job-queue.c
index bd7b86c..b1b98f1 100644
--- a/shell/ev-job-queue.c
+++ b/shell/ev-job-queue.c
@@ -13,6 +13,7 @@ static GQueue *render_queue_low = NULL;
static GQueue *thumbnail_queue_high = NULL;
static GQueue *thumbnail_queue_low = NULL;
static GQueue *load_queue = NULL;
+static GQueue *save_queue = NULL;
static GQueue *fonts_queue = NULL;
static GQueue *print_queue = NULL;
@@ -129,6 +130,8 @@ handle_job (EvJob *job)
ev_job_links_run (EV_JOB_LINKS (job));
else if (EV_IS_JOB_LOAD (job))
ev_job_load_run (EV_JOB_LOAD (job));
+ else if (EV_IS_JOB_SAVE (job))
+ ev_job_save_run (EV_JOB_SAVE (job));
else if (EV_IS_JOB_RENDER (job))
ev_job_render_run (EV_JOB_RENDER (job));
else if (EV_IS_JOB_FONTS (job))
@@ -188,6 +191,10 @@ search_for_jobs_unlocked (void)
if (job)
return job;
+ job = (EvJob *) g_queue_pop_head (save_queue);
+ if (job)
+ return job;
+
job = (EvJob *) g_queue_pop_head (thumbnail_queue_low);
if (job)
return job;
@@ -219,6 +226,7 @@ no_jobs_available_unlocked (void)
&& g_queue_is_empty (render_queue_low)
&& g_queue_is_empty (links_queue)
&& g_queue_is_empty (load_queue)
+ && g_queue_is_empty (save_queue)
&& g_queue_is_empty (thumbnail_queue_high)
&& g_queue_is_empty (thumbnail_queue_low)
&& g_queue_is_empty (fonts_queue)
@@ -301,6 +309,7 @@ ev_job_queue_init (void)
links_queue = g_queue_new ();
load_queue = g_queue_new ();
+ save_queue = g_queue_new ();
render_queue_high = g_queue_new ();
render_queue_low = g_queue_new ();
async_render_queue_high = g_queue_new ();
@@ -339,6 +348,9 @@ find_queue (EvJob *job,
} else if (EV_IS_JOB_LOAD (job)) {
/* the priority doesn't effect load */
return load_queue;
+ } else if (EV_IS_JOB_SAVE (job)) {
+ /* the priority doesn't effect save */
+ return save_queue;
} else if (EV_IS_JOB_LINKS (job)) {
/* the priority doesn't effect links */
return links_queue;
@@ -485,6 +497,8 @@ ev_job_queue_remove_job (EvJob *job)
retval = remove_job_from_queue_locked (links_queue, job);
} else if (EV_IS_JOB_LOAD (job)) {
retval = remove_job_from_queue_locked (load_queue, job);
+ } else if (EV_IS_JOB_SAVE (job)) {
+ retval = remove_job_from_queue_locked (save_queue, job);
} else if (EV_IS_JOB_FONTS (job)) {
retval = remove_job_from_queue_locked (fonts_queue, job);
} else if (EV_IS_JOB_PRINT (job)) {