diff options
author | Alexander Larsson <alexl@redhat.com> | 2008-02-13 20:39:12 +0000 |
---|---|---|
committer | Alexander Larsson <alexl@src.gnome.org> | 2008-02-13 20:39:12 +0000 |
commit | 6a08b24c3aba1338490a4b3e688bd7f89cf8d48f (patch) | |
tree | 11733321a0baf79e9358677346eb7d82b28c6493 /libnautilus-private | |
parent | 552127f71b2164fdf1f87ad5c29f7f5fd8bf58d0 (diff) | |
download | nautilus-6a08b24c3aba1338490a4b3e688bd7f89cf8d48f.tar.gz |
Add paused status to progress infos and use it to avoid poping up the
2008-02-13 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-progress-info.[ch]:
* libnautilus-private/nautilus-file-operations.c:
Add paused status to progress infos and use it
to avoid poping up the progress dialog while dialogs
are up. (#512406)
Patch from Cosimo Cecchi
svn path=/trunk/; revision=13741
Diffstat (limited to 'libnautilus-private')
-rw-r--r-- | libnautilus-private/nautilus-file-operations.c | 3 | ||||
-rw-r--r-- | libnautilus-private/nautilus-progress-info.c | 42 | ||||
-rw-r--r-- | libnautilus-private/nautilus-progress-info.h | 3 |
3 files changed, 47 insertions, 1 deletions
diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c index 3b84bd06b..aed80b19e 100644 --- a/libnautilus-private/nautilus-file-operations.c +++ b/libnautilus-private/nautilus-file-operations.c @@ -950,11 +950,12 @@ run_simple_dialog_va (CommonJob *job, g_ptr_array_add (ptr_array, NULL); data->button_titles = (const char **)g_ptr_array_free (ptr_array, FALSE); + nautilus_progress_info_pause (job->progress); g_io_scheduler_job_send_to_mainloop (job->io_job, do_run_simple_dialog, data, NULL); - + nautilus_progress_info_resume (job->progress); res = data->result; g_free (data->button_titles); diff --git a/libnautilus-private/nautilus-progress-info.c b/libnautilus-private/nautilus-progress-info.c index 652a514c1..b96a64db7 100644 --- a/libnautilus-private/nautilus-progress-info.c +++ b/libnautilus-private/nautilus-progress-info.c @@ -59,6 +59,7 @@ struct _NautilusProgressInfo gboolean activity_mode; gboolean started; gboolean finished; + gboolean paused; GSource *idle_source; gboolean source_is_now; @@ -423,6 +424,9 @@ handle_new_progress_info (NautilusProgressInfo *info) static gboolean new_op_started_timeout (NautilusProgressInfo *info) { + if (nautilus_progress_info_get_is_paused (info)) { + return TRUE; + } if (!nautilus_progress_info_get_is_finished (info)) { handle_new_progress_info (info); } @@ -567,6 +571,20 @@ nautilus_progress_info_get_is_finished (NautilusProgressInfo *info) return res; } +gboolean +nautilus_progress_info_get_is_paused (NautilusProgressInfo *info) +{ + gboolean res; + + G_LOCK (progress_info); + + res = info->paused; + + G_UNLOCK (progress_info); + + return res; +} + static gboolean idle_callback (gpointer data) { @@ -667,6 +685,30 @@ queue_idle (NautilusProgressInfo *info, gboolean now) } void +nautilus_progress_info_pause (NautilusProgressInfo *info) +{ + G_LOCK (progress_info); + + if (!info->paused) { + info->paused = TRUE; + } + + G_UNLOCK (progress_info); +} + +void +nautilus_progress_info_resume (NautilusProgressInfo *info) +{ + G_LOCK (progress_info); + + if (info->paused) { + info->paused = FALSE; + } + + G_UNLOCK (progress_info); +} + +void nautilus_progress_info_start (NautilusProgressInfo *info) { G_LOCK (progress_info); diff --git a/libnautilus-private/nautilus-progress-info.h b/libnautilus-private/nautilus-progress-info.h index f4cbf712a..d017f3365 100644 --- a/libnautilus-private/nautilus-progress-info.h +++ b/libnautilus-private/nautilus-progress-info.h @@ -61,9 +61,12 @@ GCancellable *nautilus_progress_info_get_cancellable (NautilusProgressInfo *info void nautilus_progress_info_cancel (NautilusProgressInfo *info); gboolean nautilus_progress_info_get_is_started (NautilusProgressInfo *info); gboolean nautilus_progress_info_get_is_finished (NautilusProgressInfo *info); +gboolean nautilus_progress_info_get_is_paused (NautilusProgressInfo *info); void nautilus_progress_info_start (NautilusProgressInfo *info); void nautilus_progress_info_finish (NautilusProgressInfo *info); +void nautilus_progress_info_pause (NautilusProgressInfo *info); +void nautilus_progress_info_resume (NautilusProgressInfo *info); void nautilus_progress_info_set_status (NautilusProgressInfo *info, const char *status); void nautilus_progress_info_take_status (NautilusProgressInfo *info, |