[nautilus/wip/csoriano/search-popover] search: use full name in variables
- From: Carlos Soriano Sánchez <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/csoriano/search-popover] search: use full name in variables
- Date: Thu, 28 Jan 2016 11:57:17 +0000 (UTC)
commit ee2d5a6989e569903b96a5c75f15284104c6089e
Author: Carlos Soriano <csoriano gnome org>
Date: Thu Jan 28 10:17:38 2016 +0100
search: use full name in variables
Using dt instead of date can be confusing
libnautilus-private/nautilus-search-engine-model.c | 11 ++++---
.../nautilus-search-engine-simple.c | 8 ++--
.../nautilus-search-engine-tracker.c | 32 ++++++++++----------
3 files changed, 26 insertions(+), 25 deletions(-)
---
diff --git a/libnautilus-private/nautilus-search-engine-model.c
b/libnautilus-private/nautilus-search-engine-model.c
index a6542af..5ae59c5 100644
--- a/libnautilus-private/nautilus-search-engine-model.c
+++ b/libnautilus-private/nautilus-search-engine-model.c
@@ -129,11 +129,11 @@ model_directory_ready_cb (NautilusDirectory *directory,
gdouble match;
gboolean found;
NautilusSearchHit *hit;
- GDateTime *dt;
+ GDateTime *date;
files = nautilus_directory_get_file_list (directory);
mime_types = nautilus_query_get_mime_types (model->details->query);
- dt = nautilus_query_get_date (model->details->query);
+ date = nautilus_query_get_date (model->details->query);
hits = NULL;
for (l = files; l != NULL; l = l->next) {
@@ -148,13 +148,14 @@ model_directory_ready_cb (NautilusDirectory *directory,
for (m = mime_types; m != NULL; m = m->next) {
if (nautilus_file_is_mime_type (file, m->data)) {
+ g_print ("Mime type matched %s\n", m->data);
found = TRUE;
break;
}
}
}
- if (found && dt != NULL) {
+ if (found && date != NULL) {
NautilusQuerySearchType type;
guint64 query_time, current_file_time;
const gchar *attrib;
@@ -162,7 +163,7 @@ model_directory_ready_cb (NautilusDirectory *directory,
GError *error;
GFile *location;
- g_message ("searching for date %s", g_date_time_format (dt, "%X"));
+ g_message ("searching for date %s", g_date_time_format (date, "%X"));
type = nautilus_query_get_search_type (model->details->query);
location = nautilus_file_get_location (file);
@@ -174,7 +175,7 @@ model_directory_ready_cb (NautilusDirectory *directory,
attrib = G_FILE_ATTRIBUTE_TIME_MODIFIED;
}
- query_time = g_date_time_to_unix (dt);
+ query_time = g_date_time_to_unix (date);
/* Query current file's attribute */
info = g_file_query_info (location,
diff --git a/libnautilus-private/nautilus-search-engine-simple.c
b/libnautilus-private/nautilus-search-engine-simple.c
index 35912ae..9468269 100644
--- a/libnautilus-private/nautilus-search-engine-simple.c
+++ b/libnautilus-private/nautilus-search-engine-simple.c
@@ -277,7 +277,7 @@ visit_directory (GFile *dir, SearchThreadData *data)
if (found) {
NautilusSearchHit *hit;
GTimeVal tv;
- GDateTime *dt;
+ GDateTime *date;
char *uri;
uri = g_file_get_uri (child);
@@ -285,9 +285,9 @@ visit_directory (GFile *dir, SearchThreadData *data)
g_free (uri);
nautilus_search_hit_set_fts_rank (hit, match);
g_file_info_get_modification_time (info, &tv);
- dt = g_date_time_new_from_timeval_local (&tv);
- nautilus_search_hit_set_modification_time (hit, dt);
- g_date_time_unref (dt);
+ date = g_date_time_new_from_timeval_local (&tv);
+ nautilus_search_hit_set_modification_time (hit, date);
+ g_date_time_unref (date);
data->hits = g_list_prepend (data->hits, hit);
}
diff --git a/libnautilus-private/nautilus-search-engine-tracker.c
b/libnautilus-private/nautilus-search-engine-tracker.c
index ec5ebdf..5f5d80b 100644
--- a/libnautilus-private/nautilus-search-engine-tracker.c
+++ b/libnautilus-private/nautilus-search-engine-tracker.c
@@ -193,18 +193,18 @@ cursor_callback (GObject *object,
g_free (basename);
if (g_time_val_from_iso8601 (mtime_str, &tv)) {
- GDateTime *dt;
- dt = g_date_time_new_from_timeval_local (&tv);
- nautilus_search_hit_set_modification_time (hit, dt);
- g_date_time_unref (dt);
+ GDateTime *date;
+ date = g_date_time_new_from_timeval_local (&tv);
+ nautilus_search_hit_set_modification_time (hit, date);
+ g_date_time_unref (date);
} else {
g_warning ("unable to parse mtime: %s", mtime_str);
}
if (g_time_val_from_iso8601 (atime_str, &tv)) {
- GDateTime *dt;
- dt = g_date_time_new_from_timeval_local (&tv);
- nautilus_search_hit_set_access_time (hit, dt);
- g_date_time_unref (dt);
+ GDateTime *date;
+ date = g_date_time_new_from_timeval_local (&tv);
+ nautilus_search_hit_set_access_time (hit, date);
+ g_date_time_unref (date);
} else {
g_warning ("unable to parse atime: %s", atime_str);
}
@@ -263,7 +263,7 @@ nautilus_search_engine_tracker_start (NautilusSearchProvider *provider)
GList *mimetypes, *l;
gint mime_count;
gboolean recursive;
- GDateTime *dt;
+ GDateTime *date;
tracker = NAUTILUS_SEARCH_ENGINE_TRACKER (provider);
@@ -294,7 +294,7 @@ nautilus_search_engine_tracker_start (NautilusSearchProvider *provider)
location = nautilus_query_get_location (tracker->details->query);
location_uri = location ? g_file_get_uri (location) : NULL;
mimetypes = nautilus_query_get_mime_types (tracker->details->query);
- dt = nautilus_query_get_date (tracker->details->query);
+ date = nautilus_query_get_date (tracker->details->query);
mime_count = g_list_length (mimetypes);
@@ -317,22 +317,22 @@ nautilus_search_engine_tracker_start (NautilusSearchProvider *provider)
g_string_append_printf (sparql, "fn:contains(fn:lower-case(nfo:fileName(?urn)), '%s')", search_text);
- if (dt != NULL) {
+ if (date != NULL) {
NautilusQuerySearchType type;
- gchar *dt_format;
+ gchar *date_format;
type = nautilus_query_get_search_type (tracker->details->query);
- dt_format = g_date_time_format (dt, "%Y-%m-%dT%H:%M:%S");
+ date_format = g_date_time_format (date, "%Y-%m-%dT%H:%M:%S");
g_string_append (sparql, " && ");
if (type == NAUTILUS_QUERY_SEARCH_TYPE_LAST_ACCESS) {
- g_string_append_printf (sparql, "?atime <= \"%s\"^^xsd:dateTime", dt_format);
+ g_string_append_printf (sparql, "?atime <= \"%s\"^^xsd:dateTime", date_format);
} else {
- g_string_append_printf (sparql, "?mtime <= \"%s\"^^xsd:dateTime", dt_format);
+ g_string_append_printf (sparql, "?mtime <= \"%s\"^^xsd:dateTime", date_format);
}
- g_free (dt_format);
+ g_free (date_format);
}
if (mime_count > 0) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]