summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-03-28 12:07:58 +0200
committerraveit65 <[email protected]>2022-07-21 19:33:51 +0200
commit14e4b2f88f45c6dfb8739ba6979057274d4c5408 (patch)
treea55cec8bfa249e226b82cf1572bba8f9d0b0b0c7
parent3c3ca50505fac6c93d76addf10f0eae1f7991743 (diff)
downloadcaja-14e4b2f88f45c6dfb8739ba6979057274d4c5408.tar.bz2
caja-14e4b2f88f45c6dfb8739ba6979057274d4c5408.tar.xz
Add creation time support
-rw-r--r--libcaja-private/caja-column-utilities.c8
-rw-r--r--libcaja-private/caja-file-private.h1
-rw-r--r--libcaja-private/caja-file.c33
-rw-r--r--libcaja-private/caja-file.h2
-rw-r--r--libcaja-private/caja-vfs-file.c11
-rw-r--r--libcaja-private/org.mate.caja.gschema.xml2
-rw-r--r--src/caja-file-management-properties.c1
-rw-r--r--src/caja-file-management-properties.ui3
-rw-r--r--src/file-manager/fm-icon-view.c13
-rw-r--r--src/file-manager/fm-properties-window.c4
10 files changed, 75 insertions, 3 deletions
diff --git a/libcaja-private/caja-column-utilities.c b/libcaja-private/caja-column-utilities.c
index e4aba54a..b74cfbb4 100644
--- a/libcaja-private/caja-column-utilities.c
+++ b/libcaja-private/caja-column-utilities.c
@@ -78,6 +78,14 @@ get_builtin_columns (void)
columns = g_list_append (columns,
g_object_new (CAJA_TYPE_COLUMN,
+ "name", "date_created",
+ "attribute", "date_created",
+ "label", _("Date Created"),
+ "description", _("The date the file was created."),
+ NULL));
+
+ columns = g_list_append (columns,
+ g_object_new (CAJA_TYPE_COLUMN,
"name", "date_accessed",
"attribute", "date_accessed",
"label", _("Date Accessed"),
diff --git a/libcaja-private/caja-file-private.h b/libcaja-private/caja-file-private.h
index 95556051..a5398b2d 100644
--- a/libcaja-private/caja-file-private.h
+++ b/libcaja-private/caja-file-private.h
@@ -88,6 +88,7 @@ struct _CajaFilePrivate
time_t atime; /* 0 is unknown */
time_t mtime; /* 0 is unknown */
time_t ctime; /* 0 is unknown */
+ time_t btime; /* 0 is unknown */
char *symlink_name;
diff --git a/libcaja-private/caja-file.c b/libcaja-private/caja-file.c
index afaddf20..96a6478f 100644
--- a/libcaja-private/caja-file.c
+++ b/libcaja-private/caja-file.c
@@ -120,6 +120,8 @@ static GQuark attribute_name_q,
attribute_size_q,
attribute_size_on_disk_q,
attribute_type_q,
+ attribute_creation_date_q,
+ attribute_date_created_q,
attribute_modification_date_q,
attribute_date_modified_q,
attribute_accessed_date_q,
@@ -476,6 +478,7 @@ caja_file_clear_info (CajaFile *file)
file->details->mtime = 0;
file->details->atime = 0;
file->details->ctime = 0;
+ file->details->btime = 0;
file->details->trash_time = 0;
g_free (file->details->symlink_name);
file->details->symlink_name = NULL;
@@ -2108,7 +2111,7 @@ update_info_internal (CajaFile *file,
goffset size;
goffset size_on_disk;
int sort_order;
- time_t atime, mtime, ctime;
+ time_t atime, mtime, ctime, btime;
time_t trash_time;
const char * time_string;
const char *symlink_name, *mime_type, *selinux_context, *thumbnail_path;
@@ -2404,9 +2407,11 @@ update_info_internal (CajaFile *file,
atime = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_ACCESS);
ctime = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_CHANGED);
mtime = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED);
+ btime = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_CREATED);
if (file->details->atime != atime ||
file->details->mtime != mtime ||
- file->details->ctime != ctime) {
+ file->details->ctime != ctime ||
+ file->details->btime != btime) {
if (file->details->thumbnail == NULL) {
file->details->thumbnail_is_up_to_date = FALSE;
}
@@ -2416,6 +2421,7 @@ update_info_internal (CajaFile *file,
file->details->atime = atime;
file->details->ctime = ctime;
file->details->mtime = mtime;
+ file->details->btime = btime;
if (file->details->thumbnail != NULL &&
file->details->thumbnail_mtime != 0 &&
@@ -2791,6 +2797,9 @@ get_time (CajaFile *file,
case CAJA_DATE_TYPE_ACCESSED:
time = file->details->atime;
break;
+ case CAJA_DATE_TYPE_CREATED:
+ time = file->details->btime;
+ break;
case CAJA_DATE_TYPE_TRASHED:
time = file->details->trash_time;
break;
@@ -3496,6 +3505,12 @@ caja_file_compare_for_sort (CajaFile *file_1,
result = compare_by_full_path (file_1, file_2);
}
break;
+ case CAJA_FILE_SORT_BY_BTIME:
+ result = compare_by_time (file_1, file_2, CAJA_DATE_TYPE_CREATED);
+ if (result == 0) {
+ result = compare_by_full_path (file_1, file_2);
+ }
+ break;
case CAJA_FILE_SORT_BY_ATIME:
result = compare_by_time (file_1, file_2, CAJA_DATE_TYPE_ACCESSED);
if (result == 0) {
@@ -3577,6 +3592,11 @@ caja_file_compare_for_sort_by_attribute_q (CajaFile *file_1,
CAJA_FILE_SORT_BY_MTIME,
directories_first,
reversed);
+ } else if (attribute == attribute_creation_date_q || attribute == attribute_date_created_q) {
+ return caja_file_compare_for_sort (file_1, file_2,
+ CAJA_FILE_SORT_BY_BTIME,
+ directories_first,
+ reversed);
} else if (attribute == attribute_accessed_date_q || attribute == attribute_date_accessed_q) {
return caja_file_compare_for_sort (file_1, file_2,
CAJA_FILE_SORT_BY_ATIME,
@@ -4721,6 +4741,7 @@ caja_file_get_date (CajaFile *file,
g_return_val_if_fail (date_type == CAJA_DATE_TYPE_CHANGED
|| date_type == CAJA_DATE_TYPE_ACCESSED
|| date_type == CAJA_DATE_TYPE_MODIFIED
+ || date_type == CAJA_DATE_TYPE_CREATED
|| date_type == CAJA_DATE_TYPE_TRASHED
|| date_type == CAJA_DATE_TYPE_PERMISSIONS_CHANGED, FALSE);
@@ -6558,6 +6579,10 @@ caja_file_get_string_attribute_q (CajaFile *file, GQuark attribute_q)
return caja_file_get_date_as_string (file,
CAJA_DATE_TYPE_ACCESSED);
}
+ if (attribute_q == attribute_date_created_q) {
+ return caja_file_get_date_as_string (file,
+ CAJA_DATE_TYPE_CREATED);
+ }
if (attribute_q == attribute_trashed_on_q) {
return caja_file_get_date_as_string (file,
CAJA_DATE_TYPE_TRASHED);
@@ -6724,6 +6749,8 @@ caja_file_is_date_sort_attribute_q (GQuark attribute_q)
{
if (attribute_q == attribute_modification_date_q ||
attribute_q == attribute_date_modified_q ||
+ attribute_q == attribute_creation_date_q ||
+ attribute_q == attribute_date_created_q ||
attribute_q == attribute_accessed_date_q ||
attribute_q == attribute_date_accessed_q ||
attribute_q == attribute_date_changed_q ||
@@ -8598,6 +8625,8 @@ caja_file_class_init (CajaFileClass *class)
attribute_type_q = g_quark_from_static_string ("type");
attribute_modification_date_q = g_quark_from_static_string ("modification_date");
attribute_date_modified_q = g_quark_from_static_string ("date_modified");
+ attribute_creation_date_q = g_quark_from_static_string ("creation_date");
+ attribute_date_created_q = g_quark_from_static_string ("date_created");
attribute_accessed_date_q = g_quark_from_static_string ("accessed_date");
attribute_date_accessed_q = g_quark_from_static_string ("date_accessed");
attribute_emblems_q = g_quark_from_static_string ("emblems");
diff --git a/libcaja-private/caja-file.h b/libcaja-private/caja-file.h
index eb57599c..b4498bcd 100644
--- a/libcaja-private/caja-file.h
+++ b/libcaja-private/caja-file.h
@@ -64,6 +64,7 @@ typedef enum
CAJA_FILE_SORT_BY_SIZE,
CAJA_FILE_SORT_BY_TYPE,
CAJA_FILE_SORT_BY_MTIME,
+ CAJA_FILE_SORT_BY_BTIME,
CAJA_FILE_SORT_BY_ATIME,
CAJA_FILE_SORT_BY_EMBLEMS,
CAJA_FILE_SORT_BY_TRASHED_TIME,
@@ -511,6 +512,7 @@ struct CajaFile
typedef enum
{
CAJA_DATE_TYPE_MODIFIED,
+ CAJA_DATE_TYPE_CREATED,
CAJA_DATE_TYPE_CHANGED,
CAJA_DATE_TYPE_ACCESSED,
CAJA_DATE_TYPE_PERMISSIONS_CHANGED,
diff --git a/libcaja-private/caja-vfs-file.c b/libcaja-private/caja-vfs-file.c
index f2908a26..1df1e108 100644
--- a/libcaja-private/caja-vfs-file.c
+++ b/libcaja-private/caja-vfs-file.c
@@ -354,6 +354,17 @@ vfs_file_get_date (CajaFile *file,
*date = file->details->mtime;
}
return TRUE;
+ case CAJA_DATE_TYPE_CREATED:
+ /* Before we have info on a file, the date is unknown. */
+ if (file->details->btime == 0)
+ {
+ return FALSE;
+ }
+ if (date != NULL)
+ {
+ *date = file->details->btime;
+ }
+ return TRUE;
case CAJA_DATE_TYPE_TRASHED:
/* Before we have info on a file, the date is unknown. */
if (file->details->trash_time == 0)
diff --git a/libcaja-private/org.mate.caja.gschema.xml b/libcaja-private/org.mate.caja.gschema.xml
index dee7377a..399efdc7 100644
--- a/libcaja-private/org.mate.caja.gschema.xml
+++ b/libcaja-private/org.mate.caja.gschema.xml
@@ -278,7 +278,7 @@
<description>A list of captions below an icon in the icon view and
the desktop. The actual number of captions shown depends on
the zoom level. Some possible values are:
- "size", "type", "date_modified", "date_changed", "date_accessed", "owner",
+ "size", "type", "date_modified", "date_created", "date_changed", "date_accessed", "owner",
"group", "permissions", "octal_permissions" and "mime_type".</description>
</key>
<key name="default-use-tighter-layout" type="b">
diff --git a/src/caja-file-management-properties.c b/src/caja-file-management-properties.c
index 199255be..e0d8419c 100644
--- a/src/caja-file-management-properties.c
+++ b/src/caja-file-management-properties.c
@@ -111,6 +111,7 @@ static const char * const sort_order_values[] =
"size_on_disk",
"type",
"mtime",
+ "btime",
"atime",
"emblems",
"extension",
diff --git a/src/caja-file-management-properties.ui b/src/caja-file-management-properties.ui
index 6449694a..80f6e8aa 100644
--- a/src/caja-file-management-properties.ui
+++ b/src/caja-file-management-properties.ui
@@ -93,6 +93,9 @@
<col id="0" translatable="yes">By Modification Date</col>
</row>
<row>
+ <col id="0" translatable="yes">By Creation Date</col>
+ </row>
+ <row>
<col id="0" translatable="yes">By Access Date</col>
</row>
<row>
diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c
index adeba93d..146b0a3c 100644
--- a/src/file-manager/fm-icon-view.c
+++ b/src/file-manager/fm-icon-view.c
@@ -159,6 +159,13 @@ static const SortCriterion sort_criteria[] =
N_("Keep icons sorted by modification date in rows")
},
{
+ CAJA_FILE_SORT_BY_BTIME,
+ "creation date",
+ "Sort by Creation Date",
+ N_("by _Creation Date"),
+ N_("Keep icons sorted by creation date in rows")
+ },
+ {
CAJA_FILE_SORT_BY_EMBLEMS,
"emblems",
"Sort by Emblems",
@@ -1856,6 +1863,12 @@ static const GtkRadioActionEntry arrange_radio_entries[] =
CAJA_FILE_SORT_BY_MTIME
},
{
+ "Sort by Creation Date", NULL,
+ N_("By _Creation Date"), NULL,
+ N_("Keep icons sorted by creation date in rows"),
+ CAJA_FILE_SORT_BY_BTIME
+ },
+ {
"Sort by Emblems", NULL,
N_("By _Emblems"), NULL,
N_("Keep icons sorted by emblems in rows"),
diff --git a/src/file-manager/fm-properties-window.c b/src/file-manager/fm-properties-window.c
index 69ce70d0..c654bb80 100644
--- a/src/file-manager/fm-properties-window.c
+++ b/src/file-manager/fm-properties-window.c
@@ -3362,6 +3362,10 @@ create_basic_page (FMPropertiesWindow *window)
"date_modified",
INCONSISTENT_STATE_STRING,
FALSE);
+ append_title_value_pair (window, grid, _("Created:"),
+ "date_created",
+ INCONSISTENT_STATE_STRING,
+ FALSE);
}
if (should_show_free_space (window)) {