Commit bb9a6a1b authored by Alexander Larsson's avatar Alexander Larsson Committed by Alexander Larsson

Only change progress status string as needed when copying. This avoids a

2008-02-14  Alexander Larsson  <alexl@redhat.com>

        * libnautilus-private/nautilus-file-operations.c:
        (report_copy_progress):
	Only change progress status string as needed when
	copying. This avoids a lot of I/O ops to get the
	name.


svn path=/trunk/; revision=13751
parent 83cc27da
2008-02-14 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-file-operations.c:
(report_copy_progress):
Only change progress status string as needed when
copying. This avoids a lot of I/O ops to get the
name.
2008-02-14 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-file-operations.c:
......
......@@ -159,6 +159,7 @@ typedef struct {
goffset num_bytes;
OpKind op;
guint64 last_report_time;
int last_reported_files_left;
} TransferInfo;
#define SECONDS_NEEDED_FOR_RELIABLE_TRANSFER_RATE 15
......@@ -2519,63 +2520,69 @@ report_copy_progress (CopyMoveJob *copy_job,
files_left = 1;
}
if (source_info->num_files == 1) {
if (copy_job->destination != NULL) {
nautilus_progress_info_take_status (job->progress,
f (is_move ?
_("Moving \"%B\" to \"%B\""):
_("Copying \"%B\" to \"%B\""),
(GFile *)copy_job->files->data,
copy_job->destination));
} else {
nautilus_progress_info_take_status (job->progress,
f (_("Duplicating \"%B\""),
(GFile *)copy_job->files->data));
}
} else if (copy_job->files != NULL &&
copy_job->files->next == NULL) {
if (copy_job->destination != NULL) {
nautilus_progress_info_take_status (job->progress,
f (is_move?
ngettext ("Moving %'d file (in \"%B\") to \"%B\"",
"Moving %'d files (in \"%B\") to \"%B\"",
files_left)
:
ngettext ("Copying %'d file (in \"%B\") to \"%B\"",
"Copying %'d files (in \"%B\") to \"%B\"",
files_left),
files_left,
(GFile *)copy_job->files->data,
copy_job->destination));
} else {
nautilus_progress_info_take_status (job->progress,
f (ngettext ("Duplicating %'d file (in \"%B\")",
"Duplicating %'d files (in \"%B\")",
files_left),
files_left,
(GFile *)copy_job->files->data));
}
} else {
if (copy_job->destination != NULL) {
nautilus_progress_info_take_status (job->progress,
f (is_move?
ngettext ("Moving %'d file to \"%B\"",
"Moving %'d files to \"%B\"",
files_left)
:
ngettext ("Copying %'d file to \"%B\"",
"Copying %'d files to \"%B\"",
files_left),
files_left, copy_job->destination));
if (files_left != transfer_info->last_reported_files_left ||
transfer_info->last_reported_files_left == 0) {
/* Avoid changing this unless files_left changed since last time */
transfer_info->last_reported_files_left = files_left;
if (source_info->num_files == 1) {
if (copy_job->destination != NULL) {
nautilus_progress_info_take_status (job->progress,
f (is_move ?
_("Moving \"%B\" to \"%B\""):
_("Copying \"%B\" to \"%B\""),
(GFile *)copy_job->files->data,
copy_job->destination));
} else {
nautilus_progress_info_take_status (job->progress,
f (_("Duplicating \"%B\""),
(GFile *)copy_job->files->data));
}
} else if (copy_job->files != NULL &&
copy_job->files->next == NULL) {
if (copy_job->destination != NULL) {
nautilus_progress_info_take_status (job->progress,
f (is_move?
ngettext ("Moving %'d file (in \"%B\") to \"%B\"",
"Moving %'d files (in \"%B\") to \"%B\"",
files_left)
:
ngettext ("Copying %'d file (in \"%B\") to \"%B\"",
"Copying %'d files (in \"%B\") to \"%B\"",
files_left),
files_left,
(GFile *)copy_job->files->data,
copy_job->destination));
} else {
nautilus_progress_info_take_status (job->progress,
f (ngettext ("Duplicating %'d file (in \"%B\")",
"Duplicating %'d files (in \"%B\")",
files_left),
files_left,
(GFile *)copy_job->files->data));
}
} else {
nautilus_progress_info_take_status (job->progress,
f (ngettext ("Duplicating %'d file",
"Duplicating %'d files",
files_left),
files_left));
if (copy_job->destination != NULL) {
nautilus_progress_info_take_status (job->progress,
f (is_move?
ngettext ("Moving %'d file to \"%B\"",
"Moving %'d files to \"%B\"",
files_left)
:
ngettext ("Copying %'d file to \"%B\"",
"Copying %'d files to \"%B\"",
files_left),
files_left, copy_job->destination));
} else {
nautilus_progress_info_take_status (job->progress,
f (ngettext ("Duplicating %'d file",
"Duplicating %'d files",
files_left),
files_left));
}
}
}
total_size = MAX (source_info->num_bytes, transfer_info->num_bytes);
elapsed = g_timer_elapsed (job->time, NULL);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment