[nautilus/wip/gbsneto/search-popover: 8/8] search-engine-simple: implement search by access/modification time
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/gbsneto/search-popover: 8/8] search-engine-simple: implement search by access/modification time
- Date: Wed, 7 Oct 2015 12:30:51 +0000 (UTC)
commit df64332f4a70e4eebd105d0c4d32267d80ad7a4b
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Tue Oct 6 07:09:11 2015 -0300
search-engine-simple: implement search by access/modification time
The same work will happen on the Tracker search engine as well.
.../nautilus-search-engine-simple.c | 22 ++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/libnautilus-private/nautilus-search-engine-simple.c
b/libnautilus-private/nautilus-search-engine-simple.c
index f3557d6..f6ed2d0 100644
--- a/libnautilus-private/nautilus-search-engine-simple.c
+++ b/libnautilus-private/nautilus-search-engine-simple.c
@@ -195,6 +195,7 @@ send_batch (SearchThreadData *thread_data)
G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN "," \
G_FILE_ATTRIBUTE_STANDARD_TYPE "," \
G_FILE_ATTRIBUTE_TIME_MODIFIED "," \
+ G_FILE_ATTRIBUTE_TIME_ACCESS "," \
G_FILE_ATTRIBUTE_ID_FILE
static void
@@ -250,6 +251,27 @@ visit_directory (GFile *dir, SearchThreadData *data)
}
}
}
+
+ if (found && nautilus_query_get_date (data->query) != NULL) {
+ NautilusQuerySearchType type;
+ GDateTime *date;
+ guint64 last_time, query_time;
+ const gchar *attrib;
+
+ type = nautilus_query_get_search_type (data->query);
+
+ if (type & NAUTILUS_QUERY_SEARCH_TYPE_LAST_ACCESS) {
+ attrib = G_FILE_ATTRIBUTE_TIME_ACCESS;
+ } else {
+ attrib = G_FILE_ATTRIBUTE_TIME_MODIFIED;
+ }
+
+ date = nautilus_query_get_date (data->query);
+ last_time = g_date_time_to_unix (date);
+ query_time = g_file_info_get_attribute_uint64 (info, attrib);
+
+ found = last_time >= query_time;
+ }
if (found) {
NautilusSearchHit *hit;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]