diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2004-02-17 01:26:10 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2004-02-17 01:26:10 +0800 |
commit | 064c9ac23dd9d4d7f1f7a2249a3bc903e4a71807 (patch) | |
tree | 46854ffdc72b45deb49d2f55af017628de2e8862 | |
parent | 16a88711a5d28bc19fa0fac6b5b7211bd8d99461 (diff) | |
download | gsoc2013-evolution-064c9ac23dd9d4d7f1f7a2249a3bc903e4a71807.tar gsoc2013-evolution-064c9ac23dd9d4d7f1f7a2249a3bc903e4a71807.tar.gz gsoc2013-evolution-064c9ac23dd9d4d7f1f7a2249a3bc903e4a71807.tar.bz2 gsoc2013-evolution-064c9ac23dd9d4d7f1f7a2249a3bc903e4a71807.tar.lz gsoc2013-evolution-064c9ac23dd9d4d7f1f7a2249a3bc903e4a71807.tar.xz gsoc2013-evolution-064c9ac23dd9d4d7f1f7a2249a3bc903e4a71807.tar.zst gsoc2013-evolution-064c9ac23dd9d4d7f1f7a2249a3bc903e4a71807.zip |
open the calendars asynchonously. (cal_opened_cb): callback for
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.
svn path=/trunk/; revision=24751
-rw-r--r-- | calendar/ChangeLog | 5 | ||||
-rw-r--r-- | calendar/gui/alarm-notify/alarm-notify.c | 30 |
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); } } |