aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2003-11-11 03:26:25 +0800
committerDan Winship <danw@src.gnome.org>2003-11-11 03:26:25 +0800
commit8648d27d3a1d02fe76e639f521241eae8fed679d (patch)
tree57236033946601c83bf9d1641fb0b8df4ac0e64a
parente2919e15d1880c1ef76e5a2ffdd36f428dc05946 (diff)
downloadgsoc2013-evolution-8648d27d3a1d02fe76e639f521241eae8fed679d.tar.gz
gsoc2013-evolution-8648d27d3a1d02fe76e639f521241eae8fed679d.tar.zst
gsoc2013-evolution-8648d27d3a1d02fe76e639f521241eae8fed679d.zip
Remove get-vtype check from the completed-tasks query (and don't leak the
* gui/e-tasks.c (e_tasks_delete_completed): Remove get-vtype check from the completed-tasks query (and don't leak the sexp string). * gui/e-cal-model.c (update_e_cal_view_for_client): Don't adjust the sexp to use get-vtype. * gui/gnome-cal.c (adjust_e_cal_view_sexp, gnome_calendar_purge): Remove get-vtype check from queries svn path=/trunk/; revision=23263
-rw-r--r--calendar/ChangeLog11
-rw-r--r--calendar/gui/e-cal-model.c37
-rw-r--r--calendar/gui/e-tasks.c18
-rw-r--r--calendar/gui/gnome-cal.c8
4 files changed, 18 insertions, 56 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 6ff83fb99d..57e3c5a670 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,14 @@
+2003-11-10 Dan Winship <danw@ximian.com>
+
+ * gui/e-tasks.c (e_tasks_delete_completed): Remove get-vtype check
+ from the completed-tasks query (and don't leak the sexp string).
+
+ * gui/e-cal-model.c (update_e_cal_view_for_client): Don't adjust
+ the sexp to use get-vtype.
+
+ * gui/gnome-cal.c (adjust_e_cal_view_sexp, gnome_calendar_purge):
+ Remove get-vtype check from queries
+
2003-11-07 JP Rosevear <jpr@ximian.com>
* gui/Makefile.am: remove includes for toplevel libical dir
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index 9e5dc34b2c..b6210e22f9 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -1249,42 +1249,10 @@ e_cal_view_done_cb (ECalView *query, ECalendarStatus status, gpointer user_data)
/* FIXME Clear status bar */
}
-/* Builds a complete query sexp for the calendar model by adding the predicates
- * to filter only for the type of objects that the model supports, and
- * whether we want completed tasks.
- */
-static char *
-adjust_e_cal_view_sexp (ECalModel *model, const char *sexp)
-{
- ECalModelPrivate *priv;
- char *type_sexp, *new_sexp;
-
- priv = model->priv;
-
- if (priv->kind == ICAL_NO_COMPONENT)
- type_sexp = g_strdup ("#t");
- else {
- if (priv->kind == ICAL_VEVENT_COMPONENT)
- type_sexp = g_strdup ("(or (= (get-vtype) \"VEVENT\"))");
- else if (priv->kind == ICAL_VTODO_COMPONENT)
- type_sexp = g_strdup ("(or (= (get-vtype) \"VTODO\"))");
- else if (priv->kind == ICAL_VJOURNAL_COMPONENT)
- type_sexp = g_strdup ("(or (= (get-vtype) \"VJOURNAL\"))");
- else
- type_sexp = g_strdup ("#t");
- }
-
- new_sexp = g_strdup_printf ("(and %s %s)", type_sexp, sexp);
- g_free (type_sexp);
-
- return new_sexp;
-}
-
static void
update_e_cal_view_for_client (ECalModel *model, ECalModelClient *client_data)
{
ECalModelPrivate *priv;
- gchar *real_sexp;
priv = model->priv;
@@ -1298,15 +1266,12 @@ update_e_cal_view_for_client (ECalModel *model, ECalModelClient *client_data)
/* prepare the query */
g_assert (priv->sexp != NULL);
- real_sexp = adjust_e_cal_view_sexp (model, priv->sexp);
- if (!e_cal_get_query (client_data->client, real_sexp, &client_data->query, NULL)) {
+ if (!e_cal_get_query (client_data->client, priv->sexp, &client_data->query, NULL)) {
g_warning (G_STRLOC ": Unable to get query");
- g_free (real_sexp);
return;
}
- g_free (real_sexp);
g_signal_connect (client_data->query, "objects_added", G_CALLBACK (e_cal_view_objects_added_cb), model);
g_signal_connect (client_data->query, "objects_modified", G_CALLBACK (e_cal_view_objects_modified_cb), model);
diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c
index a5b9eac4e8..6a73b14455 100644
--- a/calendar/gui/e-tasks.c
+++ b/calendar/gui/e-tasks.c
@@ -929,19 +929,6 @@ e_tasks_delete_selected (ETasks *tasks)
set_status_message (tasks, NULL);
}
-static char *
-create_sexp (void)
-{
- char *sexp;
-
- sexp = g_strdup ("(and (= (get-vtype) \"VTODO\") (is-completed?))");
-#if 0
- g_print ("Calendar model sexp:\n%s\n", sexp);
-#endif
-
- return sexp;
-}
-
/**
* e_tasks_expunge:
* @tasks: A tasks control widget
@@ -962,16 +949,17 @@ e_tasks_delete_completed (ETasks *tasks)
/* FIXME Confirm expunge */
- sexp = create_sexp ();
-
set_status_message (tasks, _("Expunging"));
+ sexp = g_strdup ("(is-completed?)");
if (!e_cal_get_object_list (priv->client, sexp, &objects, NULL)) {
set_status_message (tasks, NULL);
+ g_free (sexp);
g_warning (G_STRLOC ": Could not get the objects");
return;
}
+ g_free (sexp);
for (l = objects; l; l = l->next) {
/* FIXME Better error handling */
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index a14678f3e3..3e00a714ce 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -557,8 +557,7 @@ adjust_e_cal_view_sexp (GnomeCalendar *gcal, const char *sexp)
start = isodate_from_time_t (start_time);
end = isodate_from_time_t (end_time);
- new_sexp = g_strdup_printf ("(and (= (get-vtype) \"VEVENT\")"
- " (occur-in-time-range? (make-time \"%s\")"
+ new_sexp = g_strdup_printf ("(and (occur-in-time-range? (make-time \"%s\")"
" (make-time \"%s\"))"
" %s)",
start, end,
@@ -2894,9 +2893,8 @@ gnome_calendar_purge (GnomeCalendar *gcal, time_t older_than)
start = isodate_from_time_t (0);
end = isodate_from_time_t (older_than);
- sexp = g_strdup_printf ("(and (= (get-vtype) \"VEVENT\")"
- " (occur-in-time-range? (make-time \"%s\")"
- " (make-time \"%s\")))",
+ sexp = g_strdup_printf ("(occur-in-time-range? (make-time \"%s\")"
+ " (make-time \"%s\"))",
start, end);
e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), _("Purging"));