[nautilus/wip/antoniof/properties-followup: 2/3] properties-window: Move size values under name




commit 7b8fa0ae54477ba885aa403cafb2c5bced7f17ad
Author: António Fernandes <antoniof gnome org>
Date:   Wed Aug 3 13:44:19 2022 +0100

    properties-window: Move size values under name
    
    Instead of list row.
    
    As proposed in mockups from https://gitlab.gnome.org/GNOME/nautilus/-/issues/2370

 src/nautilus-file.c                            |   5 +-
 src/nautilus-properties-window.c               |  42 +++++----
 src/resources/ui/nautilus-properties-window.ui | 123 ++++++++-----------------
 3 files changed, 66 insertions(+), 104 deletions(-)
---
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index e03d78f90..ad0855995 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -7814,7 +7814,10 @@ nautilus_file_get_volume_free_space (NautilusFile *file)
     res = NULL;
     if (file->details->free_space != (guint64) - 1)
     {
-        res = g_format_size (file->details->free_space);
+        g_autofree gchar *size_string = g_format_size (file->details->free_space);
+
+        /* Translators: This refers to available space in a folder; e.g.: 100 MB Free */
+        res = g_strdup_printf (_("%s Free"), size_string);
     }
 
     return res;
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 7dced1c3d..9eaef893f 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -93,6 +93,10 @@ struct _NautilusPropertiesWindow
     GtkLabel *name_value_label;
     GtkWidget *type_value_label;
     GtkLabel *type_file_system_label;
+    GtkWidget *size_value_label;
+    GtkWidget *contents_box;
+    GtkWidget *contents_value_label;
+    GtkWidget *free_space_value_label;
 
     GtkWidget *disk_list_box;
     GtkLevelBar *disk_space_level_bar;
@@ -100,12 +104,9 @@ struct _NautilusPropertiesWindow
     GtkWidget *disk_space_free_value;
     GtkWidget *disk_space_capacity_value;
 
+    GtkWidget *locations_list_box;
     GtkWidget *link_target_row;
     GtkWidget *link_target_value_label;
-    GtkWidget *size_row;
-    GtkWidget *size_value_label;
-    GtkWidget *contents_row;
-    GtkWidget *contents_value_label;
     GtkWidget *contents_spinner;
     guint update_directory_contents_timeout_id;
     guint update_files_timeout_id;
@@ -128,9 +129,6 @@ struct _NautilusPropertiesWindow
 
     GtkListBox *extension_list_box;
 
-    GtkWidget *free_space_list_box;
-    GtkWidget *free_space_value_label;
-
     /* Permissions page */
 
     GtkWidget *permissions_stack;
@@ -2004,11 +2002,11 @@ directory_contents_value_field_update (NautilusPropertiesWindow *self)
         {
             if (unreadable_directory_count == 0)
             {
-                text = g_strdup (_("nothing"));
+                text = g_strdup (_("Empty folder"));
             }
             else
             {
-                text = g_strdup (_("unreadable"));
+                text = g_strdup (_("Contents unreadable"));
             }
         }
         else
@@ -2203,6 +2201,7 @@ should_show_file_type (NautilusPropertiesWindow *self)
 
     if (!is_multi_file_window (self)
         && (nautilus_file_is_in_trash (get_target_file (self)) ||
+            nautilus_file_is_directory (get_original_file (self)) ||
             is_network_directory (get_target_file (self)) ||
             is_burn_directory (get_target_file (self)) ||
             is_volume_properties (self)))
@@ -2210,7 +2209,6 @@ should_show_file_type (NautilusPropertiesWindow *self)
         return FALSE;
     }
 
-
     return TRUE;
 }
 
@@ -2486,16 +2484,21 @@ setup_basic_page (NautilusPropertiesWindow *self)
         /* We have a more efficient way to measure used space in volumes. */
         if (!is_volume_properties (self))
         {
-            gtk_widget_show (self->contents_row);
+            gtk_widget_show (self->contents_box);
             setup_contents_field (self);
         }
     }
     else
     {
-        gtk_widget_show (self->size_row);
+        gtk_widget_show (self->size_value_label);
         add_updatable_label (self, self->size_value_label, "size_detail");
     }
 
+    if (is_root_directory (get_original_file (self)))
+    {
+        gtk_widget_hide (self->locations_list_box);
+    }
+
     if (should_show_location_info (self))
     {
         gtk_widget_show (self->parent_folder_row);
@@ -2535,7 +2538,7 @@ setup_basic_page (NautilusPropertiesWindow *self)
         /* We have a more efficient way to measure free space in volumes. */
         if (!is_volume_properties (self))
         {
-            gtk_widget_show (self->free_space_list_box);
+            gtk_widget_show (self->free_space_value_label);
             add_updatable_label (self, self->free_space_value_label, "free_space");
         }
     }
@@ -4213,18 +4216,19 @@ nautilus_properties_window_class_init (NautilusPropertiesWindowClass *klass)
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, name_value_label);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, type_value_label);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, type_file_system_label);
+    gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, size_value_label);
+    gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, contents_box);
+    gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, contents_value_label);
+    gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, contents_spinner);
+    gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, bottom_prompt_seperator);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, disk_list_box);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, disk_space_level_bar);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, disk_space_used_value);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, disk_space_free_value);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, disk_space_capacity_value);
+    gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, locations_list_box);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, link_target_row);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, link_target_value_label);
-    gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, size_row);
-    gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, size_value_label);
-    gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, contents_row);
-    gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, contents_value_label);
-    gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, contents_spinner);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, parent_folder_row);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, parent_folder_value_label);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, trashed_list_box);
@@ -4239,10 +4243,8 @@ nautilus_properties_window_class_init (NautilusPropertiesWindowClass *klass)
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, accessed_value_label);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, 
permissions_navigation_row);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, extension_list_box);
-    gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, free_space_list_box);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, free_space_value_label);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, permissions_stack);
-    gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, bottom_prompt_seperator);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, not_the_owner_label);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, unknown_permissions_page);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, owner_row);
diff --git a/src/resources/ui/nautilus-properties-window.ui b/src/resources/ui/nautilus-properties-window.ui
index 95057111c..98857ea03 100644
--- a/src/resources/ui/nautilus-properties-window.ui
+++ b/src/resources/ui/nautilus-properties-window.ui
@@ -92,9 +92,6 @@
                                     <property name="max-width-chars">24</property>
                                     <property name="selectable">True</property>
                                     <property name="visible">False</property>
-                                    <style>
-                                      <class name="dim-label"/>
-                                    </style>
                                     <attributes>
                                       <attribute name="text-transform"
                                                  value="PANGO_TEXT_TRANSFORM_UPPERCASE"
@@ -109,8 +106,46 @@
                                     <property name="max-width-chars">24</property>
                                     <property name="selectable">True</property>
                                     <property name="visible">False</property>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkLabel" id="size_value_label">
+                                    <property name="visible">False</property>
+                                    <property name="selectable">True</property>
+                                    <property name="ellipsize">end</property>
+                                    <property name="max-width-chars">40</property>
+                                    <style>
+                                      <class name="caption"/>
+                                    </style>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkBox" id="contents_box">
+                                    <property name="halign">center</property>
+                                    <property name="visible">False</property>
+                                    <property name="spacing">12</property>
+                                    <child>
+                                      <object class="GtkLabel" id="contents_value_label">
+                                        <property name="selectable">True</property>
+                                        <property name="ellipsize">end</property>
+                                        <property name="justify">center</property>
+                                        <property name="max-width-chars">40</property>
+                                      </object>
+                                    </child>
+                                    <child>
+                                      <object class="GtkSpinner" id="contents_spinner">
+                                        <property name="visible">False</property>
+                                      </object>
+                                    </child>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkLabel" id="free_space_value_label">
+                                    <property name="selectable">True</property>
+                                    <property name="ellipsize">end</property>
+                                    <property name="max-width-chars">24</property>
                                     <style>
-                                      <class name="dim-label"/>
+                                      <class name="caption"/>
                                     </style>
                                   </object>
                                 </child>
@@ -260,7 +295,7 @@
                               </object>
                             </child>
                             <child>
-                              <object class="GtkListBox" id="file_data_list_box">
+                              <object class="GtkListBox" id="locations_list_box">
                                 <property name="selection-mode">none</property>
                                 <child>
                                   <object class="AdwActionRow" id="link_target_row">
@@ -282,56 +317,6 @@
                                     </child>
                                   </object>
                                 </child>
-                                <child>
-                                  <object class="AdwActionRow" id="size_row">
-                                    <property name="visible">False</property>
-                                    <property name="activatable">False</property>
-                                    <property name="selectable">False</property>
-                                    <property name="title" translatable="yes">Size</property>
-                                    <child>
-                                      <object class="GtkLabel" id="size_value_label">
-                                        <property name="hexpand">True</property>
-                                        <property name="selectable">True</property>
-                                        <property name="ellipsize">end</property>
-                                        <property name="max-width-chars">24</property>
-                                        <property name="xalign">1</property>
-                                        <style>
-                                          <class name="dim-label"/>
-                                        </style>
-                                      </object>
-                                    </child>
-                                  </object>
-                                </child>
-                                <child>
-                                  <object class="AdwActionRow" id="contents_row">
-                                    <property name="visible">False</property>
-                                    <property name="activatable">False</property>
-                                    <property name="selectable">False</property>
-                                    <property name="title" translatable="yes">Contents</property>
-                                    <child>
-                                      <object class="GtkBox">
-                                        <property name="spacing">12</property>
-                                        <child>
-                                          <object class="GtkLabel" id="contents_value_label">
-                                            <property name="hexpand">True</property>
-                                            <property name="selectable">True</property>
-                                            <property name="ellipsize">end</property>
-                                            <property name="max-width-chars">24</property>
-                                            <property name="xalign">1</property>
-                                            <style>
-                                              <class name="dim-label"/>
-                                            </style>
-                                          </object>
-                                        </child>
-                                        <child>
-                                          <object class="GtkSpinner" id="contents_spinner">
-                                            <property name="visible">False</property>
-                                          </object>
-                                        </child>
-                                       </object>
-                                    </child>
-                                  </object>
-                                </child>
                                 <child>
                                   <object class="AdwActionRow" id="parent_folder_row">
                                     <property name="visible">False</property>
@@ -601,34 +586,6 @@
                                 </style>
                               </object>
                             </child>
-                            <child>
-                              <object class="GtkListBox" id="free_space_list_box">
-                                <property name="visible">False</property>
-                                <property name="selection-mode">none</property>
-                                <child>
-                                  <object class="AdwActionRow">
-                                    <property name="activatable">False</property>
-                                    <property name="selectable">False</property>
-                                    <property name="title" translatable="yes">Free Space</property>
-                                    <child>
-                                      <object class="GtkLabel" id="free_space_value_label">
-                                        <property name="hexpand">True</property>
-                                        <property name="selectable">True</property>
-                                        <property name="ellipsize">end</property>
-                                        <property name="max-width-chars">24</property>
-                                        <property name="xalign">1</property>
-                                        <style>
-                                          <class name="dim-label"/>
-                                        </style>
-                                      </object>
-                                    </child>
-                                  </object>
-                                </child>
-                                <style>
-                                  <class name="boxed-list"/>
-                                </style>
-                              </object>
-                            </child>
                             <child>
                               <object class="GtkBox" id="volume_widget_box">
                                 <property name="visible">False</property>


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