summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorApoorv Sachan <apoorv.99.sachan@gmail.com>2020-08-22 10:40:36 +0000
committerAntónio Fernandes <antoniof@gnome.org>2020-12-23 00:23:01 +0000
commit4a3f366871c1abd37c0e5658f866d37ea1ee0ff2 (patch)
tree6375963d09cdac915cddd8e90bd84962abfce074
parent3b5d184f910d11b30202483adb55040c9cf882b6 (diff)
downloadnautilus-wip/antoniof/creation-time-attr.tar.gz
properties-window: Add created row to the basic pagewip/antoniof/creation-time-attr
The NautilusFile backend now supports birth-time parameter. It is now leveraged to display the date-created for a file in properties dialogue. Closes https://gitlab.gnome.org/GNOME/nautilus/-/issues/1566
-rw-r--r--src/nautilus-properties-window.c26
-rw-r--r--src/resources/ui/nautilus-properties-window.ui44
2 files changed, 60 insertions, 10 deletions
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 0c38158f7..738b6f566 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -133,6 +133,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;
@@ -2275,6 +2278,12 @@ should_show_modified_date (NautilusPropertiesWindow *self)
}
static gboolean
+should_show_created_date (NautilusPropertiesWindow *self)
+{
+ return !is_multi_file_window (self);
+}
+
+static gboolean
should_show_trashed_on (NautilusPropertiesWindow *self)
{
GList *l;
@@ -2722,7 +2731,8 @@ setup_basic_page (NautilusPropertiesWindow *self)
}
if (should_show_accessed_date (self)
- || should_show_modified_date (self))
+ || should_show_modified_date (self)
+ || should_show_created_date (self))
{
gtk_widget_show (self->spacer_2);
}
@@ -2751,6 +2761,18 @@ setup_basic_page (NautilusPropertiesWindow *self)
self->modified_value_label);
}
+ if (should_show_created_date (self))
+ {
+ gtk_widget_show (self->created_title_label);
+ gtk_widget_show (self->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 (self->created_value_label), "file_attribute",
+ g_strdup ("date_created_full"), g_free);
+
+ self->value_fields = g_list_prepend (self->value_fields,
+ self->created_value_label);
+ }
+
if (should_show_free_space (self)
&& !should_show_volume_usage (self))
{
@@ -5391,6 +5413,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..23916f5a2 100644
--- a/src/resources/ui/nautilus-properties-window.ui
+++ b/src/resources/ui/nautilus-properties-window.ui
@@ -274,6 +274,32 @@
</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="selectable">True</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>
+ <child>
<object class="GtkLabel" id="original_folder_title_label">
<property name="can_focus">False</property>
<property name="label" translatable="yes">Original folder</property>
@@ -284,7 +310,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 +324,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 +366,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 +380,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 +446,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 +458,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 +670,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 +682,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 +726,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">13</property>
+ <property name="top_attach">14</property>
</packing>
</child>
</object>