summaryrefslogtreecommitdiff
path: root/libcaja-private/caja-query.c
diff options
context:
space:
mode:
authorWu Xiaotian <[email protected]>2019-01-24 15:45:36 +0800
committerlukefromdc <[email protected]>2019-01-28 22:24:13 +0000
commit3a22d4c63d42009024830f494fe0ec3679382631 (patch)
treee00801b612568d39dca78a1d70df05bb87d95380 /libcaja-private/caja-query.c
parente8f124db938d82554f98a325dc23e9e09e195eb4 (diff)
downloadcaja-3a22d4c63d42009024830f494fe0ec3679382631.tar.bz2
caja-3a22d4c63d42009024830f494fe0ec3679382631.tar.xz
Support querying files by modification time and size
Thanks for Leslie Zhai's patch.
Diffstat (limited to 'libcaja-private/caja-query.c')
-rw-r--r--libcaja-private/caja-query.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/libcaja-private/caja-query.c b/libcaja-private/caja-query.c
index a5e783e4..465e5a45 100644
--- a/libcaja-private/caja-query.c
+++ b/libcaja-private/caja-query.c
@@ -36,6 +36,8 @@ struct CajaQueryDetails
char *location_uri;
GList *mime_types;
GList *tags;
+ gint64 duration;
+ gint64 size;
};
static void caja_query_class_init (CajaQueryClass *class);
@@ -75,6 +77,8 @@ static void
caja_query_init (CajaQuery *query)
{
query->details = g_new0 (CajaQueryDetails, 1);
+ query->details->duration = 0;
+ query->details->size = 0;
}
CajaQuery *
@@ -379,6 +383,8 @@ caja_query_to_xml (CajaQuery *query)
char *mimetype;
char *tag;
GList *l;
+ gint64 duration;
+ gint64 size;
xml = g_string_new ("");
g_string_append (xml,
@@ -420,6 +426,17 @@ caja_query_to_xml (CajaQuery *query)
g_string_append (xml, " </tags>\n");
}
+ if (query->details->duration != 0)
+ {
+ g_string_append_printf(xml, " <duration>%ld</duration>",
+ query->details->duration);
+ }
+
+ if (query->details->size != 0)
+ {
+ g_string_append_printf(xml, " <size>%ld</size>", query->details->size);
+ }
+
g_string_append (xml, "</query>\n");
return g_string_free (xml, FALSE);
@@ -445,3 +462,23 @@ caja_query_save (CajaQuery *query, char *file)
}
return res;
}
+
+void caja_query_set_duration(CajaQuery *query, gint64 sec)
+{
+ query->details->duration = sec;
+}
+
+gint64 caja_query_get_duration(CajaQuery *query)
+{
+ return query->details->duration;
+}
+
+void caja_query_set_size(CajaQuery *query, gint64 size)
+{
+ query->details->size = size;
+}
+
+gint64 caja_query_get_size(CajaQuery *query)
+{
+ return query->details->size;
+}