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




commit acb6af7c84369069953d6e398d3c1ea184f5339b
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              |  5 ++++-
 src/nautilus-properties-window.c | 10 +++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index cbab57a8e..3ad25dc99 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -6946,7 +6946,10 @@ 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 7e5ccb191..97ad5036b 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -1385,6 +1385,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);
 }
@@ -2548,7 +2556,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]