diff options
author | rbuj <[email protected]> | 2021-03-28 12:07:58 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2021-04-20 19:40:09 +0200 |
commit | 0eb7520d23cc4ca6cdd9b6c97d3f6cbafcdfc927 (patch) | |
tree | f65d5ff92cb5ca3f62f94881d64232f0c8f0efe0 /libcaja-private | |
parent | a940185ca0ee157b980250d7f2f5bef842e3625f (diff) | |
download | caja-0eb7520d23cc4ca6cdd9b6c97d3f6cbafcdfc927.tar.bz2 caja-0eb7520d23cc4ca6cdd9b6c97d3f6cbafcdfc927.tar.xz |
Add creation time support
Diffstat (limited to 'libcaja-private')
-rw-r--r-- | libcaja-private/caja-column-utilities.c | 8 | ||||
-rw-r--r-- | libcaja-private/caja-file-private.h | 1 | ||||
-rw-r--r-- | libcaja-private/caja-file.c | 33 | ||||
-rw-r--r-- | libcaja-private/caja-file.h | 2 | ||||
-rw-r--r-- | libcaja-private/caja-vfs-file.c | 11 | ||||
-rw-r--r-- | libcaja-private/org.mate.caja.gschema.xml | 2 |
6 files changed, 54 insertions, 3 deletions
diff --git a/libcaja-private/caja-column-utilities.c b/libcaja-private/caja-column-utilities.c index d8b6a406..0471e8b5 100644 --- a/libcaja-private/caja-column-utilities.c +++ b/libcaja-private/caja-column-utilities.c @@ -79,6 +79,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 7642029e..315b3b98 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 25660700..4d4a40d4 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 && @@ -2790,6 +2796,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; @@ -3495,6 +3504,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) { @@ -3576,6 +3591,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, @@ -4719,6 +4739,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); @@ -6556,6 +6577,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); @@ -6722,6 +6747,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 || @@ -8596,6 +8623,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 f876a402..1f64d93d 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"> |