[nautilus/wip/antoniof/properties-followup: 10/10] properties-window: Show bytes in tooltip




commit 07ae468df980c02de75e7430f0b61ca50766de46
Author: António Fernandes <antoniof gnome org>
Date:   Thu Aug 4 13:15:02 2022 +0100

    properties-window: Show bytes in tooltip
    
    G_FORMAT_SIZE_LONG_FORMAT is, well, long. And redundact.
    
    But, oh, well, in case someone really wants to know bytes,
    we keep it as a tooltip.

 src/nautilus-file.c              |  4 +++-
 src/nautilus-properties-window.c | 10 +++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index ad0855995..f5072b0da 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -6912,7 +6912,9 @@ nautilus_file_get_size_as_string_with_real_size (NautilusFile *file)
         return NULL;
     }
 
-    return g_format_size_full (file->details->size, G_FORMAT_SIZE_LONG_FORMAT);
+    return g_strdup_printf (ngettext("%lu byte",
+                                     "%lu bytes",
+                                     file->details->size), file->details->size);
 }
 
 
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index bd1197e23..3bd592db4 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -1350,6 +1350,14 @@ value_field_update (GtkLabel                 *label,
 
         gtk_widget_set_tooltip_text (GTK_WIDGET (label), mime_type);
     }
+    else if (g_str_equal (attribute_name, "size"))
+    {
+        g_autofree char *size_detail = NULL;
+
+        size_detail = file_list_get_string_attribute (file_list, "size_detail");
+
+        gtk_widget_set_tooltip_text (GTK_WIDGET (label), size_detail);
+    }
 
     gtk_label_set_text (label, attribute_value);
 }
@@ -2513,7 +2521,7 @@ setup_basic_page (NautilusPropertiesWindow *self)
     else
     {
         gtk_widget_show (self->size_value_label);
-        add_updatable_label (self, self->size_value_label, "size_detail");
+        add_updatable_label (self, self->size_value_label, "size");
     }
 
     if (should_show_location_info (self))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]