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
This commit is contained in:
Alexander Larsson 2008-02-13 20:39:12 +00:00 committed by Alexander Larsson
parent 552127f71b
commit 6a08b24c3a
4 changed files with 56 additions and 1 deletions

View file

@ -1,3 +1,12 @@
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
2008-02-13 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-icon-dnd.c:

View file

@ -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);

View file

@ -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)
{
@ -666,6 +684,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)
{

View file

@ -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,