aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@helixcode.com>2000-05-12 12:16:46 +0800
committerFederico Mena Quintero <federico@src.gnome.org>2000-05-12 12:16:46 +0800
commit47c9fef15abc15c678e4cde60ee71d741dfe23bf (patch)
tree347e2e2ccc386409e254b6f25c4c94f98a9efafe /calendar/gui
parentd55e9e0406875ffb47f40f57da3c6abaac90734a (diff)
downloadgsoc2013-evolution-47c9fef15abc15c678e4cde60ee71d741dfe23bf.tar.gz
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/gui')
-rw-r--r--calendar/gui/gnome-cal.c41
1 files changed, 33 insertions, 8 deletions
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 4c90414f16..3041d80d07 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -683,7 +683,7 @@ midnight_refresh_cb (gpointer alarm_id, time_t trigger, gpointer data)
/* Loads and queues the alarms from the current time up to midnight. */
static void
-load_alarms (GnomeCalendar *cal)
+load_alarms (GnomeCalendar *gcal)
{
time_t now;
time_t end_of_day;
@@ -694,17 +694,17 @@ load_alarms (GnomeCalendar *cal)
/* Queue alarms */
- alarms = cal_client_get_alarms_in_range (cal->client, now, end_of_day);
+ alarms = cal_client_get_alarms_in_range (gcal->client, now, end_of_day);
for (l = alarms; l; l = l->next)
- setup_alarm (cal, l->data);
+ setup_alarm (gcal, l->data);
cal_alarm_instance_list_free (alarms);
/* Queue the midnight alarm refresh */
- cal->midnight_alarm_refresh_id = alarm_add (end_of_day, midnight_refresh_cb, cal, NULL);
- if (!cal->midnight_alarm_refresh_id) {
+ gcal->midnight_alarm_refresh_id = alarm_add (end_of_day, midnight_refresh_cb, gcal, NULL);
+ if (!gcal->midnight_alarm_refresh_id) {
g_message ("load_alarms(): Could not set up the midnight refresh alarm!");
/* FIXME: what to do? */
}
@@ -754,6 +754,32 @@ remove_alarms_for_object (GnomeCalendar *gcal, const char *uid)
g_free (oa);
}
+/* Adds today's alarms for the specified object */
+static void
+add_alarms_for_object (GnomeCalendar *gcal, const char *uid)
+{
+ GList *alarms;
+ gboolean result;
+ time_t now, end_of_day;
+ GList *l;
+
+ now = time (NULL);
+ end_of_day = time_day_end (now);
+
+ result = cal_client_get_alarms_for_object (gcal->client, uid, now, end_of_day, &alarms);
+ if (!result) {
+ /* FIXME: should we warn here, or is it OK if the object
+ * disappeared in the meantime?
+ */
+ return;
+ }
+
+ for (l = alarms; l; l = l->next)
+ setup_alarm (gcal, l->data);
+
+ cal_alarm_instance_list_free (alarms);
+}
+
static void
gnome_calendar_object_updated_cb (GtkWidget *cal_client,
const char *uid,
@@ -763,7 +789,7 @@ gnome_calendar_object_updated_cb (GtkWidget *cal_client,
uid?uid:"<NULL>");
remove_alarms_for_object (gcal, uid);
- /* FIXME: put in new alarms */
+ add_alarms_for_object (gcal, uid);
/* FIXME: do we really want each view to reload the event itself?
Maybe we should keep track of events globally, maybe with ref
@@ -818,8 +844,7 @@ gnome_calendar_new (char *title)
gcal = GNOME_CALENDAR (retval);
gcal->selection_start_time = time_day_begin (time (NULL));
- gcal->selection_end_time = time_add_day (gcal->selection_start_time,
- 1);
+ gcal->selection_end_time = time_add_day (gcal->selection_start_time, 1);
gcal->client = cal_client_new ();
setup_widgets (gcal);