diff options
author | Pavel Cisler <pavel@eazel.com> | 2001-02-06 08:30:27 +0000 |
---|---|---|
committer | Pavel Cisler <pce@src.gnome.org> | 2001-02-06 08:30:27 +0000 |
commit | b8c2fe2095e90d222147085841c4d89a796cfb55 (patch) | |
tree | f6c73064310da31938b79d2b757564c03c4dbd8b | |
parent | 671bec82dd908ad2caf8572a75315f446e46eaf5 (diff) | |
download | nautilus-b8c2fe2095e90d222147085841c4d89a796cfb55.tar.gz |
reviewed by: Seth Nickel <seth@eazel.com>
2001-02-05 Pavel Cisler <pavel@eazel.com>
reviewed by: Seth Nickel <seth@eazel.com>
Fix 5930 (Copy dialog often shows "1" as total number of
fields in operation)
* libnautilus-extensions/nautilus-file-operations-progress.c:
(nautilus_file_operations_progress_update),
(nautilus_file_operations_progress_new_file):
* libnautilus-extensions/nautilus-file-operations.c:
(create_transfer_dialog):
Special case the preparing to copy/move phase -- when the
bytes_total is 0, don't display the count.
* libnautilus-extensions/nautilus-file-operations-progress.c:
(nautilus_file_operations_progress_thaw):
Formatting.
* HACKING:
Tiny tweak.
-rw-r--r-- | ChangeLog | 22 | ||||
-rw-r--r-- | HACKING | 2 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-file-operations-progress.c | 50 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-file-operations.c | 2 | ||||
-rw-r--r-- | libnautilus-private/nautilus-file-operations-progress.c | 50 | ||||
-rw-r--r-- | libnautilus-private/nautilus-file-operations.c | 2 |
6 files changed, 87 insertions, 41 deletions
@@ -1,3 +1,25 @@ +2001-02-05 Pavel Cisler <pavel@eazel.com> + + reviewed by: Seth Nickel <seth@eazel.com> + + Fix 5930 (Copy dialog often shows "1" as total number of + fields in operation) + + * libnautilus-extensions/nautilus-file-operations-progress.c: + (nautilus_file_operations_progress_update), + (nautilus_file_operations_progress_new_file): + * libnautilus-extensions/nautilus-file-operations.c: + (create_transfer_dialog): + Special case the preparing to copy/move phase -- when the + bytes_total is 0, don't display the count. + + * libnautilus-extensions/nautilus-file-operations-progress.c: + (nautilus_file_operations_progress_thaw): + Formatting. + + * HACKING: + Tiny tweak. + 2001-02-05 Eskil Heyn Olsen <eskil@eazel.com> * components/services/install/lib/eazel-install-public.h: @@ -24,7 +24,7 @@ list: <nautilus-list@lists.eazel.com> (subscriptions should be made to <nautilus-list-request@lists.eazel.com> with "subscribe" as a subject). -Patches should be made with 'cvs diff -u >patch' and should conform to +Patches should be made with 'cvs diff -pu >patch' and should conform to Nautilus coding style as described in docs/style-guide.html Please read other relevant documents in the docs directory too. diff --git a/libnautilus-extensions/nautilus-file-operations-progress.c b/libnautilus-extensions/nautilus-file-operations-progress.c index 66c18b81f..0dcce9a2b 100644 --- a/libnautilus-extensions/nautilus-file-operations-progress.c +++ b/libnautilus-extensions/nautilus-file-operations-progress.c @@ -76,6 +76,13 @@ struct NautilusFileOperationsProgressDetails { static void nautilus_file_operations_progress_update (NautilusFileOperationsProgress *dialog) { + if (dialog->details->bytes_total == 0) { + /* we haven't set up the file count yet, do not update the progress + * bar until we do + */ + return; + } + gtk_progress_configure (GTK_PROGRESS (dialog->details->progress_bar), dialog->details->total_bytes_copied, 0.0, dialog->details->bytes_total); @@ -327,24 +334,28 @@ nautilus_file_operations_progress_new_file (NautilusFileOperationsProgress *dial dialog->details->from_prefix = from_prefix; dialog->details->to_prefix = to_prefix; - progress_count = g_strdup_printf (_("%ld of %ld"), dialog->details->file_index, - dialog->details->files_total); - gtk_label_set_text (GTK_LABEL (dialog->details->progress_count_label), progress_count); - g_free (progress_count); - - - gtk_label_set_text (GTK_LABEL (dialog->details->operation_name_label), progress_verb); - set_text_unescaped_trimmed (GTK_LABEL (dialog->details->item_name), - item_name, PATH_TRIM_WIDTH); - - gtk_label_set_text (GTK_LABEL (dialog->details->from_label), from_prefix); - set_text_unescaped_trimmed (GTK_LABEL (dialog->details->from_path_label), - from_path, PATH_TRIM_WIDTH); - - if (dialog->details->to_prefix != NULL && dialog->details->to_path_label != NULL) { - gtk_label_set_text (GTK_LABEL (dialog->details->to_label), to_prefix); - set_text_unescaped_trimmed (GTK_LABEL (dialog->details->to_path_label), - to_path, PATH_TRIM_WIDTH); + if (dialog->details->bytes_total > 0) { + /* we haven't set up the file count yet, do not update the progress + * count until we do + */ + gtk_label_set_text (GTK_LABEL (dialog->details->operation_name_label), progress_verb); + set_text_unescaped_trimmed (GTK_LABEL (dialog->details->item_name), + item_name, PATH_TRIM_WIDTH); + + progress_count = g_strdup_printf (_("%ld of %ld"), dialog->details->file_index, + dialog->details->files_total); + gtk_label_set_text (GTK_LABEL (dialog->details->progress_count_label), progress_count); + g_free (progress_count); + + gtk_label_set_text (GTK_LABEL (dialog->details->from_label), from_prefix); + set_text_unescaped_trimmed (GTK_LABEL (dialog->details->from_path_label), + from_path, PATH_TRIM_WIDTH); + + if (dialog->details->to_prefix != NULL && dialog->details->to_path_label != NULL) { + gtk_label_set_text (GTK_LABEL (dialog->details->to_label), to_prefix); + set_text_unescaped_trimmed (GTK_LABEL (dialog->details->to_path_label), + to_path, PATH_TRIM_WIDTH); + } } nautilus_file_operations_progress_update (dialog); @@ -386,7 +397,8 @@ nautilus_file_operations_progress_freeze (NautilusFileOperationsProgress *dialog void nautilus_file_operations_progress_thaw (NautilusFileOperationsProgress *dialog) { - if (dialog->details->freeze_count > 0) + if (dialog->details->freeze_count > 0) { dialog->details->freeze_count--; + } } diff --git a/libnautilus-extensions/nautilus-file-operations.c b/libnautilus-extensions/nautilus-file-operations.c index 65fcecc48..ace8f445a 100644 --- a/libnautilus-extensions/nautilus-file-operations.c +++ b/libnautilus-extensions/nautilus-file-operations.c @@ -325,7 +325,7 @@ create_transfer_dialog (const GnomeVFSXferProgressInfo *progress_info, g_return_if_fail (transfer_info->progress_dialog == NULL); transfer_info->progress_dialog = nautilus_file_operations_progress_new - (transfer_info->operation_title, "", "", "", 1, 1); + (transfer_info->operation_title, "", "", "", 0, 0); gtk_signal_connect (GTK_OBJECT (transfer_info->progress_dialog), "clicked", diff --git a/libnautilus-private/nautilus-file-operations-progress.c b/libnautilus-private/nautilus-file-operations-progress.c index 66c18b81f..0dcce9a2b 100644 --- a/libnautilus-private/nautilus-file-operations-progress.c +++ b/libnautilus-private/nautilus-file-operations-progress.c @@ -76,6 +76,13 @@ struct NautilusFileOperationsProgressDetails { static void nautilus_file_operations_progress_update (NautilusFileOperationsProgress *dialog) { + if (dialog->details->bytes_total == 0) { + /* we haven't set up the file count yet, do not update the progress + * bar until we do + */ + return; + } + gtk_progress_configure (GTK_PROGRESS (dialog->details->progress_bar), dialog->details->total_bytes_copied, 0.0, dialog->details->bytes_total); @@ -327,24 +334,28 @@ nautilus_file_operations_progress_new_file (NautilusFileOperationsProgress *dial dialog->details->from_prefix = from_prefix; dialog->details->to_prefix = to_prefix; - progress_count = g_strdup_printf (_("%ld of %ld"), dialog->details->file_index, - dialog->details->files_total); - gtk_label_set_text (GTK_LABEL (dialog->details->progress_count_label), progress_count); - g_free (progress_count); - - - gtk_label_set_text (GTK_LABEL (dialog->details->operation_name_label), progress_verb); - set_text_unescaped_trimmed (GTK_LABEL (dialog->details->item_name), - item_name, PATH_TRIM_WIDTH); - - gtk_label_set_text (GTK_LABEL (dialog->details->from_label), from_prefix); - set_text_unescaped_trimmed (GTK_LABEL (dialog->details->from_path_label), - from_path, PATH_TRIM_WIDTH); - - if (dialog->details->to_prefix != NULL && dialog->details->to_path_label != NULL) { - gtk_label_set_text (GTK_LABEL (dialog->details->to_label), to_prefix); - set_text_unescaped_trimmed (GTK_LABEL (dialog->details->to_path_label), - to_path, PATH_TRIM_WIDTH); + if (dialog->details->bytes_total > 0) { + /* we haven't set up the file count yet, do not update the progress + * count until we do + */ + gtk_label_set_text (GTK_LABEL (dialog->details->operation_name_label), progress_verb); + set_text_unescaped_trimmed (GTK_LABEL (dialog->details->item_name), + item_name, PATH_TRIM_WIDTH); + + progress_count = g_strdup_printf (_("%ld of %ld"), dialog->details->file_index, + dialog->details->files_total); + gtk_label_set_text (GTK_LABEL (dialog->details->progress_count_label), progress_count); + g_free (progress_count); + + gtk_label_set_text (GTK_LABEL (dialog->details->from_label), from_prefix); + set_text_unescaped_trimmed (GTK_LABEL (dialog->details->from_path_label), + from_path, PATH_TRIM_WIDTH); + + if (dialog->details->to_prefix != NULL && dialog->details->to_path_label != NULL) { + gtk_label_set_text (GTK_LABEL (dialog->details->to_label), to_prefix); + set_text_unescaped_trimmed (GTK_LABEL (dialog->details->to_path_label), + to_path, PATH_TRIM_WIDTH); + } } nautilus_file_operations_progress_update (dialog); @@ -386,7 +397,8 @@ nautilus_file_operations_progress_freeze (NautilusFileOperationsProgress *dialog void nautilus_file_operations_progress_thaw (NautilusFileOperationsProgress *dialog) { - if (dialog->details->freeze_count > 0) + if (dialog->details->freeze_count > 0) { dialog->details->freeze_count--; + } } diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c index 65fcecc48..ace8f445a 100644 --- a/libnautilus-private/nautilus-file-operations.c +++ b/libnautilus-private/nautilus-file-operations.c @@ -325,7 +325,7 @@ create_transfer_dialog (const GnomeVFSXferProgressInfo *progress_info, g_return_if_fail (transfer_info->progress_dialog == NULL); transfer_info->progress_dialog = nautilus_file_operations_progress_new - (transfer_info->operation_title, "", "", "", 1, 1); + (transfer_info->operation_title, "", "", "", 0, 0); gtk_signal_connect (GTK_OBJECT (transfer_info->progress_dialog), "clicked", |