diff options
author | Milan Crha <mcrha@redhat.com> | 2009-09-08 17:13:38 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2009-09-08 17:13:38 +0800 |
commit | f61372d9d72e93cee5692128a24dc847fda0f9d1 (patch) | |
tree | 3701e2c6ee93a9446614e2b42d9bcf0140d3bc25 | |
parent | 932942f7600f7f3ade565053286904fe8b98f4eb (diff) | |
download | gsoc2013-evolution-f61372d9d72e93cee5692128a24dc847fda0f9d1.tar gsoc2013-evolution-f61372d9d72e93cee5692128a24dc847fda0f9d1.tar.gz gsoc2013-evolution-f61372d9d72e93cee5692128a24dc847fda0f9d1.tar.bz2 gsoc2013-evolution-f61372d9d72e93cee5692128a24dc847fda0f9d1.tar.lz gsoc2013-evolution-f61372d9d72e93cee5692128a24dc847fda0f9d1.tar.xz gsoc2013-evolution-f61372d9d72e93cee5692128a24dc847fda0f9d1.tar.zst gsoc2013-evolution-f61372d9d72e93cee5692128a24dc847fda0f9d1.zip |
Bug #581602 - Purge calendar function not working
-rw-r--r-- | calendar/gui/gnome-cal.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 576dfc81d2..cfdfb6d112 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -3979,17 +3979,23 @@ gnome_calendar_delete_selected_occurrence (GnomeCalendar *gcal) } } +struct purge_data { + gboolean remove; + time_t older_than; +}; + static gboolean check_instance_cb (ECalComponent *comp, time_t instance_start, time_t instance_end, gpointer data) { - gboolean *remove = data; + struct purge_data *pd = data; - *remove = FALSE; + if (instance_end >= pd->older_than) + pd->remove = FALSE; - return FALSE; + return pd->remove; } void @@ -4032,11 +4038,19 @@ gnome_calendar_purge (GnomeCalendar *gcal, time_t older_than) /* FIXME write occur-before and occur-after * sexp funcs so we don't have to use the max * gint */ - if (!e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_RECURRENCES_NO_MASTER)) + if (!e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_RECURRENCES_NO_MASTER)) { + struct purge_data pd; + + pd.remove = TRUE; + pd.older_than = older_than; + e_cal_generate_instances_for_object (client, m->data, older_than, G_MAXINT32, (ECalRecurInstanceFn) check_instance_cb, - &remove); + &pd); + + remove = pd.remove; + } /* FIXME Better error handling */ if (remove) { |