diff options
author | Federico Mena Quintero <federico@helixcode.com> | 2000-05-12 12:16:46 +0800 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2000-05-12 12:16:46 +0800 |
commit | 47c9fef15abc15c678e4cde60ee71d741dfe23bf (patch) | |
tree | 347e2e2ccc386409e254b6f25c4c94f98a9efafe /calendar/pcs/cal-backend-imc.c | |
parent | d55e9e0406875ffb47f40f57da3c6abaac90734a (diff) | |
download | gsoc2013-evolution-47c9fef15abc15c678e4cde60ee71d741dfe23bf.tar gsoc2013-evolution-47c9fef15abc15c678e4cde60ee71d741dfe23bf.tar.gz gsoc2013-evolution-47c9fef15abc15c678e4cde60ee71d741dfe23bf.tar.bz2 gsoc2013-evolution-47c9fef15abc15c678e4cde60ee71d741dfe23bf.tar.lz gsoc2013-evolution-47c9fef15abc15c678e4cde60ee71d741dfe23bf.tar.xz gsoc2013-evolution-47c9fef15abc15c678e4cde60ee71d741dfe23bf.tar.zst gsoc2013-evolution-47c9fef15abc15c678e4cde60ee71d741dfe23bf.zip |
New function to add today's alarms for a single object.
2000-05-11 Federico Mena Quintero <federico@helixcode.com>
* gui/gnome-cal.c (add_alarms_for_object): New function to add
today's alarms for a single object.
(gnome_calendar_object_updated_cb): Update the object's alarms.
* idl/evolution-calendar.idl (Cal): Added a
get_alarms_for_object() method.
* pcs/cal.c (Cal_get_alarms_for_object): Implemented method.
* pcs/cal-backend.c (cal_backend_get_alarms_for_object): New
function.
* pcs/cal-backend-imc.c (cal_backend_imc_get_alarms_for_object):
Implemented.
* cal-client/cal-client.c (cal_client_get_alarms_for_object): New
function.
svn path=/trunk/; revision=3003
Diffstat (limited to 'calendar/pcs/cal-backend-imc.c')
-rw-r--r-- | calendar/pcs/cal-backend-imc.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/calendar/pcs/cal-backend-imc.c b/calendar/pcs/cal-backend-imc.c index 9492ad1241..3c50078d12 100644 --- a/calendar/pcs/cal-backend-imc.c +++ b/calendar/pcs/cal-backend-imc.c @@ -78,6 +78,9 @@ static char *cal_backend_imc_get_object (CalBackend *backend, const char *uid); static GList *cal_backend_imc_get_uids (CalBackend *backend, CalObjType type); static GList *cal_backend_imc_get_events_in_range (CalBackend *backend, time_t start, time_t end); static GList *cal_backend_imc_get_alarms_in_range (CalBackend *backend, time_t start, time_t end); +static gboolean cal_backend_imc_get_alarms_for_object (CalBackend *backend, const char *uid, + time_t start, time_t end, + GList **alarms); static gboolean cal_backend_imc_update_object (CalBackend *backend, const char *uid, const char *calobj); static gboolean cal_backend_imc_remove_object (CalBackend *backend, const char *uid); @@ -138,6 +141,7 @@ cal_backend_imc_class_init (CalBackendIMCClass *class) backend_class->get_uids = cal_backend_imc_get_uids; backend_class->get_events_in_range = cal_backend_imc_get_events_in_range; backend_class->get_alarms_in_range = cal_backend_imc_get_alarms_in_range; + backend_class->get_alarms_for_object = cal_backend_imc_get_alarms_for_object; backend_class->update_object = cal_backend_imc_update_object; backend_class->remove_object = cal_backend_imc_remove_object; @@ -1147,6 +1151,42 @@ cal_backend_imc_get_alarms_in_range (CalBackend *backend, time_t start, time_t e return alarms; } +/* Get_alarms_for_object handler for the IMC backend */ +static gboolean +cal_backend_imc_get_alarms_for_object (CalBackend *backend, const char *uid, + time_t start, time_t end, + GList **alarms) +{ + CalBackendIMC *cbimc; + IMCPrivate *priv; + iCalObject *ico; + + cbimc = CAL_BACKEND_IMC (backend); + priv = cbimc->priv; + + g_return_val_if_fail (priv->loaded, FALSE); + g_return_val_if_fail (uid != NULL, FALSE); + g_return_val_if_fail (start != -1 && end != -1, FALSE); + g_return_val_if_fail (start <= end, FALSE); + g_return_val_if_fail (alarms != NULL, FALSE); + + *alarms = NULL; + + ico = lookup_object (cbimc, uid); + if (!ico) + return FALSE; + + /* Only VEVENT and VTODO components can have alarms */ + + if (ico->type != ICAL_EVENT && ico->type != ICAL_TODO) + return TRUE; + + *alarms = add_alarms_for_object (*alarms, ico, start, end); + *alarms = g_list_sort (*alarms, compare_instance_func); + + return TRUE; +} + /* Notifies a backend's clients that an object was updated */ static void notify_update (CalBackendIMC *cbimc, const char *uid) |