summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Montalbano <namontalbano@email.neit.edu>2021-07-10 17:48:08 -0400
committerOndrej Holy <oholy@redhat.com>2021-07-12 08:02:09 +0000
commit0c103a20b75e2e0fbcd8fd722e3615cedb7381a3 (patch)
tree0308c9bb9226f26b2d6905d0870f371f4d1fb334
parent3ad2de33daa5a5df7f1e90acc593b6b246dfb450 (diff)
downloadnautilus-0c103a20b75e2e0fbcd8fd722e3615cedb7381a3.tar.gz
files-view: Fix comma placement in a floating bar
When files are selected the floating bar appears with info about their types, count, and size. In certain cases, there is an extra space character before the comma when the folder item count is not known. Also, there is an extra space character at the end when the size for other files is not known. To fix those issues, let's handle those cases differently. Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/1867
-rw-r--r--src/nautilus-files-view.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 91212262c..c8863bee6 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -3372,8 +3372,10 @@ nautilus_files_view_display_selection_info (NautilusFilesView *view)
char *first_item_name;
char *non_folder_count_str;
char *non_folder_item_count_str;
+ char *non_folder_counts_str;
char *folder_count_str;
char *folder_item_count_str;
+ char *folder_counts_str;
char *primary_status;
char *detail_status;
NautilusFile *file;
@@ -3391,8 +3393,10 @@ nautilus_files_view_display_selection_info (NautilusFilesView *view)
first_item_name = NULL;
folder_count_str = NULL;
folder_item_count_str = NULL;
+ folder_counts_str = NULL;
non_folder_count_str = NULL;
non_folder_item_count_str = NULL;
+ non_folder_counts_str = NULL;
for (p = selection; p != NULL; p = p->next)
{
@@ -3535,6 +3539,23 @@ nautilus_files_view_display_selection_info (NautilusFilesView *view)
}
else
{
+ if (folder_item_count_known)
+ {
+ folder_counts_str = g_strconcat (folder_count_str, " ", folder_item_count_str, NULL);
+ }
+ else
+ {
+ folder_counts_str = g_strdup (folder_count_str);
+ }
+
+ if (non_folder_size_known)
+ {
+ non_folder_counts_str = g_strconcat (non_folder_count_str, " ", non_folder_item_count_str, NULL);
+ }
+ else
+ {
+ non_folder_counts_str = g_strdup (non_folder_count_str);
+ }
/* This is marked for translation in case a localizer
* needs to change ", " to something else. The comma
* is between the message about the number of folders
@@ -3542,19 +3563,19 @@ nautilus_files_view_display_selection_info (NautilusFilesView *view)
* message about the number of other items and the
* total size of those items.
*/
- primary_status = g_strdup_printf (_("%s %s, %s %s"),
- folder_count_str,
- folder_item_count_str,
- non_folder_count_str,
- non_folder_item_count_str);
+ primary_status = g_strdup_printf (_("%s, %s"),
+ folder_counts_str,
+ non_folder_counts_str);
detail_status = NULL;
}
g_free (first_item_name);
g_free (folder_count_str);
g_free (folder_item_count_str);
+ g_free (folder_counts_str);
g_free (non_folder_count_str);
g_free (non_folder_item_count_str);
+ g_free (non_folder_counts_str);
set_floating_bar_status (view, primary_status, detail_status);