[gnome-calendar] search-view: subscribe on demand
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] search-view: subscribe on demand
- Date: Fri, 9 Jan 2015 14:32:44 +0000 (UTC)
commit ddb93d8d72d234b859e914cefb02f9b7aa447ce5
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Jan 7 15:46:14 2015 -0200
search-view: subscribe on demand
To avoid filling up the list with all events, subscribe only when the first search happens.
src/gcal-search-view.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/gcal-search-view.c b/src/gcal-search-view.c
index 2ef83e8..235f419 100644
--- a/src/gcal-search-view.c
+++ b/src/gcal-search-view.c
@@ -48,7 +48,10 @@ typedef struct
/* property */
icaltimetype *date;
GcalManager *manager; /* weak reference */
+
+ /* flags */
gboolean format_24h;
+ gboolean subscribed;
} GcalSearchViewPrivate;
enum
@@ -495,8 +498,6 @@ gcal_search_view_constructed (GObject *object)
/* make the listbox sorted */
gtk_list_box_set_sort_func (GTK_LIST_BOX (priv->listbox), (GtkListBoxSortFunc) sort_by_event, object,
NULL);
- gcal_manager_set_search_subscriber (priv->manager, E_CAL_DATA_MODEL_SUBSCRIBER (object), 0, 0);
-
/* don't fill the list with all events on startup */
gcal_search_view_search (GCAL_SEARCH_VIEW (object), NULL, NULL);
}
@@ -724,6 +725,12 @@ gcal_search_view_search (GcalSearchView *view,
search_query = g_strdup_printf ("(contains? \"%s\" \"%s\")", field != NULL? field : "summary",
query != NULL? query : "");
+ if (!priv->subscribed)
+ {
+ gcal_manager_set_search_subscriber (priv->manager, E_CAL_DATA_MODEL_SUBSCRIBER (view), 0, 0);
+ priv->subscribed = TRUE;
+ }
+
gcal_manager_set_query (priv->manager, search_query);
g_free (search_query);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]