From a7666d0dbe10b0ea5210b8133ead48da0ebc0b0e Mon Sep 17 00:00:00 2001 From: emanuele-f Date: Sat, 11 Jun 2016 21:05:20 +0200 Subject: extend to all the operations --- libcaja-private/caja-file-operations.c | 14 ++++++++++++++ libcaja-private/caja-progress-info.c | 24 ++++++++++++------------ 2 files changed, 26 insertions(+), 12 deletions(-) (limited to 'libcaja-private') diff --git a/libcaja-private/caja-file-operations.c b/libcaja-private/caja-file-operations.c index 821c0ce8..d01233e8 100644 --- a/libcaja-private/caja-file-operations.c +++ b/libcaja-private/caja-file-operations.c @@ -1779,6 +1779,8 @@ trash_files (CommonJob *job, GList *files, int *files_skipped) for (l = files; l != NULL && !job_aborted (job); l = l->next) { + caja_progress_info_wait_unpaused(job->progress); + file = l->data; error = NULL; @@ -4708,6 +4710,7 @@ move_file_prepare (CopyMoveJob *move_job, } retry: + caja_progress_info_wait_unpaused(job->progress); flags = G_FILE_COPY_NOFOLLOW_SYMLINKS | G_FILE_COPY_NO_FALLBACK_FOR_MOVE; if (overwrite) { @@ -4941,6 +4944,8 @@ common = &job->common; for (l = fallbacks; l != NULL && !job_aborted (common); l = l->next) { + caja_progress_info_wait_unpaused(common->progress); + fallback = l->data; src = fallback->file; @@ -5361,6 +5366,8 @@ link_job (GIOSchedulerJob *io_job, for (l = job->files; l != NULL && !job_aborted (common); l = l->next) { + caja_progress_info_wait_unpaused(common->progress); + src = l->data; if (i < job->n_icon_positions) { @@ -5505,6 +5512,8 @@ set_permissions_file (SetPermissionsJob *job, common = (CommonJob *)job; caja_progress_info_pulse_progress (common->progress); + + caja_progress_info_wait_unpaused(common->progress); free_info = FALSE; if (info == NULL) { @@ -5866,6 +5875,7 @@ create_job (GIOSchedulerJob *io_job, count = 1; retry: + caja_progress_info_wait_unpaused(common->progress); error = NULL; if (job->make_dir) { @@ -6198,6 +6208,8 @@ delete_trash_file (CommonJob *job, GFileInfo *info; GFile *child; GFileEnumerator *enumerator; + + caja_progress_info_wait_unpaused (job->progress); if (job_aborted (job)) { return; @@ -6341,6 +6353,8 @@ mark_desktop_file_trusted (CommonJob *common, GFileInfo *info; retry: + caja_progress_info_wait_unpaused (common->progress); + error = NULL; if (!g_file_load_contents (file, cancellable, diff --git a/libcaja-private/caja-progress-info.c b/libcaja-private/caja-progress-info.c index c8010a71..8b0aeb43 100644 --- a/libcaja-private/caja-progress-info.c +++ b/libcaja-private/caja-progress-info.c @@ -744,10 +744,10 @@ progress_widget_new (CajaProgressInfo *info) { ProgressWidgetData *data; GtkWidget *label, *progress_bar, *hbox, *vbox, *box, *btcancel, *imgcancel; - GtkWidget *container; data = g_new0 (ProgressWidgetData, 1); data->info = g_object_ref (info); + data->state = STATE_INITIALIZED; vbox = gtk_vbox_new (FALSE, 0); gtk_box_set_spacing (GTK_BOX (vbox), 5); @@ -830,16 +830,6 @@ progress_widget_new (CajaProgressInfo *info) data->details = GTK_LABEL (label); gtk_widget_show_all (data->widget); - - // TODO make different policies - data->state = STATE_INITIALIZED; - container = get_widgets_container(); - if (container != NULL) { - if (get_running_operations (container) > 0) - widget_state_transit_to (data, STATE_QUEUED); - else - widget_state_transit_to (data, STATE_RUNNING); - } update_data (data); update_progress (data); @@ -861,7 +851,7 @@ progress_widget_new (CajaProgressInfo *info) static void handle_new_progress_info (CajaProgressInfo *info) { - GtkWidget *window, *progress; + GtkWidget *window, *progress, *container;; window = get_progress_window (TRUE); @@ -873,6 +863,16 @@ handle_new_progress_info (CajaProgressInfo *info) gtk_window_present (GTK_WINDOW (window)); n_progress_ops++; + + // TODO use different policies + container = get_widgets_container(); + if (container != NULL) { + if (get_running_operations (container) > 0) + widget_state_transit_to (info->widget, STATE_QUEUED); + else + widget_state_transit_to (info->widget, STATE_RUNNING); + } + update_status_icon_and_window (); } -- cgit v1.2.1