From 1141e231478410ecd83c78507612e57f58f2ccf1 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 12 Apr 2013 14:21:48 -0400 Subject: Add e_cal_model_list_clients(). Replaces e_cal_model_get_client_list(). Does the same thing, except the returned ECalClient instances are referenced for thread-safety. --- modules/calendar/e-cal-shell-view-private.c | 15 +++++++-------- modules/calendar/e-task-shell-view-private.c | 10 +++++----- 2 files changed, 12 insertions(+), 13 deletions(-) (limited to 'modules') diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c index 68b26942ce..8cafe21c49 100644 --- a/modules/calendar/e-cal-shell-view-private.c +++ b/modules/calendar/e-cal-shell-view-private.c @@ -1432,7 +1432,7 @@ static void cal_iterate_searching (ECalShellView *cal_shell_view) { ECalShellViewPrivate *priv; - GList *clients, *iter; + GList *list, *link; ECalModel *model; time_t new_time, range1, range2; icaltimezone *timezone; @@ -1517,9 +1517,9 @@ cal_iterate_searching (ECalShellView *cal_shell_view) model = gnome_calendar_get_model ( e_cal_shell_content_get_calendar ( cal_shell_view->priv->cal_shell_content)); - clients = e_cal_model_get_client_list (model); + list = e_cal_model_list_clients (model); - if (!clients) { + if (list == NULL) { e_activity_set_state ( priv->searching_activity, E_ACTIVITY_COMPLETED); g_object_unref (priv->searching_activity); @@ -1560,19 +1560,18 @@ cal_iterate_searching (ECalShellView *cal_shell_view) g_free (end); cancellable = e_activity_get_cancellable (priv->searching_activity); - g_list_foreach (clients, (GFunc) g_object_ref, NULL); - priv->search_pending_count = g_list_length (clients); + priv->search_pending_count = g_list_length (list); priv->search_time = new_time; - for (iter = clients; iter; iter = iter->next) { - ECalClient *client = iter->data; + for (link = list; link != NULL; link = g_list_next (link)) { + ECalClient *client = E_CAL_CLIENT (link); e_cal_client_get_object_list ( client, sexp, cancellable, cal_search_get_object_list_cb, cal_shell_view); } - g_list_free_full (clients, g_object_unref); + g_list_free_full (list, (GDestroyNotify) g_object_unref); g_free (sexp); } diff --git a/modules/calendar/e-task-shell-view-private.c b/modules/calendar/e-task-shell-view-private.c index b204711977..bc538c6e75 100644 --- a/modules/calendar/e-task-shell-view-private.c +++ b/modules/calendar/e-task-shell-view-private.c @@ -544,7 +544,7 @@ e_task_shell_view_delete_completed (ETaskShellView *task_shell_view) { ETaskShellContent *task_shell_content; ECalModel *model; - GList *list, *iter; + GList *list, *link; const gchar *sexp; g_return_if_fail (E_IS_TASK_SHELL_VIEW (task_shell_view)); @@ -557,10 +557,10 @@ e_task_shell_view_delete_completed (ETaskShellView *task_shell_view) e_task_shell_view_set_status_message ( task_shell_view, _("Expunging"), -1.0); - list = e_cal_model_get_client_list (model); + list = e_cal_model_list_clients (model); - for (iter = list; iter != NULL; iter = iter->next) { - ECalClient *client = E_CAL_CLIENT (iter->data); + for (link = list; link != NULL; link = g_list_next (link)) { + ECalClient *client = E_CAL_CLIENT (link->data); GSList *objects, *obj; GError *error = NULL; @@ -599,7 +599,7 @@ e_task_shell_view_delete_completed (ETaskShellView *task_shell_view) e_cal_client_free_icalcomp_slist (objects); } - g_list_free (list); + g_list_free_full (list, (GDestroyNotify) g_object_unref); e_task_shell_view_set_status_message (task_shell_view, NULL, -1.0); } -- cgit v1.2.3