search-view: subscribe on demand
To avoid filling up the list with all events, subscribe only when the first search happens.
This commit is contained in:
committed by
Erick Pérez Castellanos
parent
c9047c102f
commit
ddb93d8d72
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user