aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog5
-rw-r--r--calendar/gui/alarm-notify/alarm-notify.c30
2 files changed, 30 insertions, 5 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 6e74427136..bcaca29f4e 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,10 @@
2004-02-16 Rodrigo Moya <rodrigo@ximian.com>
+ * gui/alarm-notify/alarm-notify.c (alarm_notify_add_calendar): open the
+ calendars asynchonously.
+ (cal_opened_cb): callback for "cal_opened" signal. Add the calendars to
+ the alarm queue here.
+
* gui/alarm-notify/alarm-queue.c (query_objects_changed_cb): get alarms
since the last notification, only use current time when there is no
previous notification time.
diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c
index 84159e562c..53aacea4aa 100644
--- a/calendar/gui/alarm-notify/alarm-notify.c
+++ b/calendar/gui/alarm-notify/alarm-notify.c
@@ -129,6 +129,28 @@ alarm_notify_new (void)
return an;
}
+static void
+cal_opened_cb (ECal *client, ECalendarStatus status, gpointer user_data)
+{
+ AlarmNotifyPrivate *priv;
+ AlarmNotify *an = ALARM_NOTIFY (user_data);
+
+ priv = an->priv;
+
+ if (status == E_CALENDAR_STATUS_OK)
+ alarm_queue_add_client (client);
+ else {
+ gpointer orig_key, orig_value;
+
+ if (g_hash_table_lookup_extended (priv->uri_client_hash, e_cal_get_uri (client), &orig_key, &orig_value)) {
+ g_hash_table_remove (priv->uri_client_hash, orig_key);
+ g_free (orig_key);
+ }
+
+ g_object_unref (client);
+ }
+}
+
/**
* alarm_notify_add_calendar:
* @an: An alarm notification service.
@@ -159,11 +181,9 @@ alarm_notify_add_calendar (AlarmNotify *an, const char *str_uri, gboolean load_a
client = auth_new_cal_from_uri (str_uri, E_CAL_SOURCE_TYPE_EVENT);
if (client) {
- if (e_cal_open (client, FALSE, NULL)) {
- g_hash_table_insert (priv->uri_client_hash,
- g_strdup (str_uri), client);
- alarm_queue_add_client (client);
- }
+ g_hash_table_insert (priv->uri_client_hash, g_strdup (str_uri), client);
+ g_signal_connect (G_OBJECT (client), "cal_opened", G_CALLBACK (cal_opened_cb), an);
+ e_cal_open_async (client, FALSE);
}
}