[nautilus] vfs-file: use API to get file times
- From: Ernestas Kulik <ernestask src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] vfs-file: use API to get file times
- Date: Fri, 1 Dec 2017 11:59:33 +0000 (UTC)
commit 3aab6e9b57008d8bf782e10ff5719fec2a638149
Author: Ernestas Kulik <ernestask gnome org>
Date: Fri Aug 25 18:20:28 2017 +0300
vfs-file: use API to get file times
Additionally this adds new API for trash times and recencies.
https://bugzilla.gnome.org/show_bug.cgi?id=786760
src/nautilus-file.c | 15 +++++++++++++++
src/nautilus-file.h | 2 ++
src/nautilus-vfs-file.c | 26 ++++++++++++++++++--------
3 files changed, 35 insertions(+), 8 deletions(-)
---
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index b252d6091..9a3d9487b 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -6139,6 +6139,21 @@ nautilus_file_get_atime (NautilusFile *file)
return file->details->atime;
}
+time_t
+nautilus_file_get_recency (NautilusFile *file)
+{
+ g_return_val_if_fail (NAUTILUS_IS_FILE (file), 0);
+
+ return file->details->recency;
+}
+
+time_t
+nautilus_file_get_trash_time (NautilusFile *file)
+{
+ g_return_val_if_fail (NAUTILUS_IS_FILE (file), 0);
+
+ return file->details->trash_time;
+}
static void
set_attributes_get_info_callback (GObject *source_object,
diff --git a/src/nautilus-file.h b/src/nautilus-file.h
index 464c66e0e..868fcce0b 100644
--- a/src/nautilus-file.h
+++ b/src/nautilus-file.h
@@ -192,6 +192,8 @@ gboolean nautilus_file_can_get_size (Nautilu
goffset nautilus_file_get_size (NautilusFile
*file);
time_t nautilus_file_get_mtime (NautilusFile
*file);
time_t nautilus_file_get_atime (NautilusFile
*file);
+time_t nautilus_file_get_recency (NautilusFile
*file);
+time_t nautilus_file_get_trash_time (NautilusFile
*file);
GFileType nautilus_file_get_file_type (NautilusFile
*file);
char * nautilus_file_get_mime_type (NautilusFile
*file);
char * nautilus_file_get_extension (NautilusFile
*file);
diff --git a/src/nautilus-vfs-file.c b/src/nautilus-vfs-file.c
index 7b8769915..5583b6e31 100644
--- a/src/nautilus-vfs-file.c
+++ b/src/nautilus-vfs-file.c
@@ -296,18 +296,28 @@ vfs_file_get_date (NautilusFile *file,
NautilusDateType date_type,
time_t *date)
{
+ time_t atime;
+ time_t mtime;
+ time_t recency;
+ time_t trash_time;
+
+ atime = nautilus_file_get_atime (file);
+ mtime = nautilus_file_get_mtime (file);
+ recency = nautilus_file_get_recency (file);
+ trash_time = nautilus_file_get_trash_time (file);
+
switch (date_type)
{
case NAUTILUS_DATE_TYPE_ACCESSED:
{
/* Before we have info on a file, the date is unknown. */
- if (file->details->atime == 0)
+ if (atime == 0)
{
return FALSE;
}
if (date != NULL)
{
- *date = file->details->atime;
+ *date = atime;
}
return TRUE;
}
@@ -315,38 +325,38 @@ vfs_file_get_date (NautilusFile *file,
case NAUTILUS_DATE_TYPE_MODIFIED:
{
/* Before we have info on a file, the date is unknown. */
- if (file->details->mtime == 0)
+ if (mtime == 0)
{
return FALSE;
}
if (date != NULL)
{
- *date = file->details->mtime;
+ *date = mtime;
}
return TRUE;
}
case NAUTILUS_DATE_TYPE_TRASHED:
/* Before we have info on a file, the date is unknown. */
- if (file->details->trash_time == 0)
+ if (trash_time == 0)
{
return FALSE;
}
if (date != NULL)
{
- *date = file->details->trash_time;
+ *date = trash_time;
}
return TRUE;
case NAUTILUS_DATE_TYPE_RECENCY:
/* Before we have info on a file, the date is unknown. */
- if (file->details->recency == 0)
+ if (recency == 0)
{
return FALSE;
}
if (date != NULL)
{
- *date = file->details->recency;
+ *date = recency;
}
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]