[gnome-calendar] search-view: various fixes
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] search-view: various fixes
- Date: Tue, 24 Jan 2017 11:23:18 +0000 (UTC)
commit e4555ea2924d3cfe3269bb8e67f3507d6f6d29e9
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Tue Jan 24 09:22:57 2017 -0200
search-view: various fixes
src/gcal-search-view.c | 38 ++++++++++++++++++--------------------
1 files changed, 18 insertions(+), 20 deletions(-)
---
diff --git a/src/gcal-search-view.c b/src/gcal-search-view.c
index f5ad356..cbd1f3b 100644
--- a/src/gcal-search-view.c
+++ b/src/gcal-search-view.c
@@ -737,34 +737,31 @@ gcal_search_view_search (GcalSearchView *view,
g_clear_pointer (&view->query, g_free);
g_clear_pointer (&view->field, g_free);
- view->query = g_strdup (query);
- view->field = g_strdup (field);
-
/* Only perform search on valid non-empty strings */
if (query && g_utf8_strlen (query, -1) > 0)
{
- gchar *search_query = g_strdup_printf ("(contains? \"%s\" \"%s\")", field != NULL? field : "summary",
- query != NULL? query : "");
+ gchar *search_query = g_strdup_printf ("(contains? \"%s\" \"%s\")",
+ field ? field : "summary",
+ query ? query : "");
- if (!view->subscribed)
- {
- GDateTime *now, *start, *end;
+ view->query = g_strdup (query);
+ view->field = g_strdup (field);
- now = g_date_time_new_now_local ();
- start = g_date_time_add_years (now, -5);
- end = g_date_time_add_years (now, 5);
+ if (!view->subscribed)
+ {
+ g_autoptr (GDateTime) now, start, end;
- gcal_manager_set_search_subscriber (view->manager, E_CAL_DATA_MODEL_SUBSCRIBER (view),
- g_date_time_to_unix (start),
- g_date_time_to_unix (end));
+ now = g_date_time_new_now_local ();
+ start = g_date_time_add_years (now, -5);
+ end = g_date_time_add_years (now, 5);
- /* Mark the view as subscribed */
- view->subscribed = TRUE;
+ gcal_manager_set_search_subscriber (view->manager, E_CAL_DATA_MODEL_SUBSCRIBER (view),
+ g_date_time_to_unix (start),
+ g_date_time_to_unix (end));
- g_clear_pointer (&start, g_date_time_unref);
- g_clear_pointer (&end, g_date_time_unref);
- g_clear_pointer (&now, g_date_time_unref);
- }
+ /* Mark the view as subscribed */
+ view->subscribed = TRUE;
+ }
/* update internal current time_t */
view->current_utc_date = time (NULL);
@@ -776,6 +773,7 @@ gcal_search_view_search (GcalSearchView *view,
else
{
g_hash_table_remove_all (view->uuid_to_event);
+ view->num_results = 0;
}
update_view (view);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]