summaryrefslogtreecommitdiff
path: root/libcaja-private
diff options
context:
space:
mode:
Diffstat (limited to 'libcaja-private')
-rw-r--r--libcaja-private/caja-query.c18
-rw-r--r--libcaja-private/caja-query.h4
-rw-r--r--libcaja-private/caja-search-engine-simple.c17
3 files changed, 18 insertions, 21 deletions
diff --git a/libcaja-private/caja-query.c b/libcaja-private/caja-query.c
index 465e5a45..dd0384f0 100644
--- a/libcaja-private/caja-query.c
+++ b/libcaja-private/caja-query.c
@@ -36,7 +36,7 @@ struct CajaQueryDetails
char *location_uri;
GList *mime_types;
GList *tags;
- gint64 duration;
+ gint64 timestamp;
gint64 size;
};
@@ -77,7 +77,7 @@ static void
caja_query_init (CajaQuery *query)
{
query->details = g_new0 (CajaQueryDetails, 1);
- query->details->duration = 0;
+ query->details->timestamp = 0;
query->details->size = 0;
}
@@ -383,7 +383,7 @@ caja_query_to_xml (CajaQuery *query)
char *mimetype;
char *tag;
GList *l;
- gint64 duration;
+ gint64 timestamp;
gint64 size;
xml = g_string_new ("");
@@ -426,10 +426,10 @@ caja_query_to_xml (CajaQuery *query)
g_string_append (xml, " </tags>\n");
}
- if (query->details->duration != 0)
+ if (query->details->timestamp != 0)
{
g_string_append_printf(xml, " <duration>%ld</duration>",
- query->details->duration);
+ query->details->timestamp);
}
if (query->details->size != 0)
@@ -463,14 +463,14 @@ caja_query_save (CajaQuery *query, char *file)
return res;
}
-void caja_query_set_duration(CajaQuery *query, gint64 sec)
+void caja_query_set_timestamp(CajaQuery *query, gint64 sec)
{
- query->details->duration = sec;
+ query->details->timestamp = sec;
}
-gint64 caja_query_get_duration(CajaQuery *query)
+gint64 caja_query_get_timestamp(CajaQuery *query)
{
- return query->details->duration;
+ return query->details->timestamp;
}
void caja_query_set_size(CajaQuery *query, gint64 size)
diff --git a/libcaja-private/caja-query.h b/libcaja-private/caja-query.h
index b4c5c035..a1ec2864 100644
--- a/libcaja-private/caja-query.h
+++ b/libcaja-private/caja-query.h
@@ -69,8 +69,8 @@ char * caja_query_to_readable_string (CajaQuery *query);
CajaQuery * caja_query_load (char *file);
gboolean caja_query_save (CajaQuery *query, char *file);
-gint64 caja_query_get_duration (CajaQuery *query);
-void caja_query_set_duration (CajaQuery *query, gint64 sec);
+gint64 caja_query_get_timestamp (CajaQuery *query);
+void caja_query_set_timestamp (CajaQuery *query, gint64 sec);
gint64 caja_query_get_size (CajaQuery *query);
void caja_query_set_size (CajaQuery *query, gint64 size);
diff --git a/libcaja-private/caja-search-engine-simple.c b/libcaja-private/caja-search-engine-simple.c
index 09ac0a03..9e6084a7 100644
--- a/libcaja-private/caja-search-engine-simple.c
+++ b/libcaja-private/caja-search-engine-simple.c
@@ -48,7 +48,7 @@ typedef struct
gint n_processed_files;
GList *uri_hits;
- gint64 duration;
+ gint64 timestamp;
gint64 size;
} SearchThreadData;
@@ -126,7 +126,7 @@ search_thread_data_new (CajaSearchEngineSimple *engine,
data->tags = caja_query_get_tags (query);
data->mime_types = caja_query_get_mime_types (query);
- data->duration = caja_query_get_duration (query);
+ data->timestamp = caja_query_get_timestamp (query);
data->size = caja_query_get_size (query);
data->cancellable = g_cancellable_new ();
@@ -355,7 +355,6 @@ visit_directory (GFile *dir, SearchThreadData *data)
const char *id;
gboolean visited;
GTimeVal result;
- time_t timestamp;
gchar *attributes;
GString *attr_string;
@@ -366,7 +365,7 @@ visit_directory (GFile *dir, SearchThreadData *data)
if (data->tags != NULL) {
g_string_append (attr_string, "," G_FILE_ATTRIBUTE_XATTR_XDG_TAGS);
}
- if (data->duration != 0) {
+ if (data->timestamp != 0) {
g_string_append (attr_string, "," G_FILE_ATTRIBUTE_TIME_MODIFIED ","
G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC);
}
@@ -384,8 +383,6 @@ visit_directory (GFile *dir, SearchThreadData *data)
return;
}
- timestamp = time(NULL);
-
while ((info = g_file_enumerator_next_file (enumerator, data->cancellable, NULL)) != NULL)
{
if (g_file_info_get_is_hidden (info))
@@ -434,13 +431,13 @@ visit_directory (GFile *dir, SearchThreadData *data)
hit = file_has_all_tags (info, data->tags);
}
- if (hit && data->duration != 0) {
+ if (hit && data->timestamp != 0) {
g_file_info_get_modification_time (info, &result);
- if (data->duration > 0) {
- if (timestamp - result.tv_sec < data->duration)
+ if (data->timestamp > 0) {
+ if (data->timestamp < result.tv_sec)
hit = FALSE;
} else {
- if (timestamp - result.tv_sec > ABS(data->duration))
+ if (result.tv_sec < ABS(data->timestamp))
hit = FALSE;
}
}