[nautilus/wip/antoniof/creation-time-attr] properties-window: add created row to the basic page



commit de2ecdaf4e4e6beff1c411436cfc83399f085302
Author: Apoorv Sachan <apoorv 99 sachan gmail com>
Date:   Sat Aug 22 10:40:36 2020 +0000

    properties-window: add created row to the basic page
    
    The NautilusFile backend now supports birth-time
    parameter, It is now leveraged to display the
    date-created for a file in properties dialogue
    
    
    (cherry picked from commit 725074e9e3962377b3bcfbcb8f74416d0829d77a)

 src/nautilus-properties-window.c               | 35 ++++++++++++++++++++-
 src/resources/ui/nautilus-properties-window.ui | 43 ++++++++++++++++++++------
 2 files changed, 68 insertions(+), 10 deletions(-)
---
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index c83ef30e4..fa245ccf7 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -135,6 +135,9 @@ struct _NautilusPropertiesWindow
     GtkWidget *modified_title_label;
     GtkWidget *modified_value_label;
 
+    GtkWidget *created_title_label;
+    GtkWidget *created_value_label;
+
     GtkWidget *spacer_3;
 
     GtkWidget *free_space_title_label;
@@ -2382,6 +2385,21 @@ should_show_modified_date (NautilusPropertiesWindow *window)
     return !is_multi_file_window (window);
 }
 
+static gboolean
+should_show_created_date (NautilusPropertiesWindow *window)
+{
+    if (!is_multi_file_window (window))
+    {
+        if (!nautilus_file_is_in_trash (get_original_file (window))
+             && !nautilus_file_is_in_recent (get_original_file (window)))
+        {
+            return TRUE;
+        }
+
+    }
+    return FALSE;
+}
+
 static gboolean
 should_show_trashed_on (NautilusPropertiesWindow *window)
 {
@@ -2842,7 +2860,8 @@ setup_basic_page (NautilusPropertiesWindow *window)
     }
 
     if (should_show_accessed_date (window)
-        || should_show_modified_date (window))
+        || should_show_modified_date (window)
+        || should_show_created_date (window))
     {
         gtk_widget_show (window->spacer_2);
     }
@@ -2871,6 +2890,18 @@ setup_basic_page (NautilusPropertiesWindow *window)
                                                window->modified_value_label);
     }
 
+    if (should_show_created_date (window))
+    {
+        gtk_widget_show (window->created_title_label);
+        gtk_widget_show (window->created_value_label);
+        /* Stash a copy of the file attribute name in this field for the callback's sake. */
+        g_object_set_data_full (G_OBJECT (window->created_value_label), "file_attribute",
+                                g_strdup ("date_created_full"), g_free);
+
+        window->value_fields = g_list_prepend (window->value_fields,
+                                               window->created_value_label);
+    }
+
     if (should_show_free_space (window)
         && !should_show_volume_usage (window))
     {
@@ -5608,6 +5639,8 @@ nautilus_properties_window_class_init (NautilusPropertiesWindowClass *klass)
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, spacer_2);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, modified_title_label);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, modified_value_label);
+    gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, created_title_label);
+    gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, created_value_label);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, spacer_3);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, free_space_title_label);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, free_space_value_label);
diff --git a/src/resources/ui/nautilus-properties-window.ui b/src/resources/ui/nautilus-properties-window.ui
index d9cac49bc..247f95aba 100644
--- a/src/resources/ui/nautilus-properties-window.ui
+++ b/src/resources/ui/nautilus-properties-window.ui
@@ -284,7 +284,7 @@
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
-                            <property name="top_attach">11</property>
+                            <property name="top_attach">12</property>
                           </packing>
                         </child>
                         <child>
@@ -298,7 +298,7 @@
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
-                            <property name="top_attach">11</property>
+                            <property name="top_attach">12</property>
                           </packing>
                         </child>
                         <child>
@@ -340,7 +340,7 @@
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
-                            <property name="top_attach">12</property>
+                            <property name="top_attach">13</property>
                           </packing>
                         </child>
                         <child>
@@ -354,7 +354,7 @@
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
-                            <property name="top_attach">12</property>
+                            <property name="top_attach">13</property>
                           </packing>
                         </child>
                         <child>
@@ -420,7 +420,7 @@
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
-                            <property name="top_attach">14</property>
+                            <property name="top_attach">15</property>
                           </packing>
                         </child>
                         <child>
@@ -432,7 +432,7 @@
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
-                            <property name="top_attach">14</property>
+                            <property name="top_attach">15</property>
                           </packing>
                         </child>
                         <child>
@@ -644,7 +644,7 @@
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
-                            <property name="top_attach">15</property>
+                            <property name="top_attach">16</property>
                             <property name="width">3</property>
                           </packing>
                         </child>
@@ -656,7 +656,7 @@
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
-                            <property name="top_attach">16</property>
+                            <property name="top_attach">17</property>
                             <property name="width">3</property>
                           </packing>
                         </child>
@@ -700,7 +700,32 @@
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
-                            <property name="top_attach">13</property>
+                            <property name="top_attach">14</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="created_title_label">
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">Created</property>
+                            <property name="xalign">1</property>
+                            <style>
+                              <class name="dim-label"/>
+                            </style>
+                          </object>
+                          <packing>
+                            <property name="left_attach">0</property>
+                            <property name="top_attach">11</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="created_value_label">
+                            <property name="can_focus">False</property>
+                            <property name="max_width_chars">24</property>
+                            <property name="xalign">0</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="top_attach">11</property>
                           </packing>
                         </child>
                       </object>


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