From c72ab02f554a0e8d2204f769fef50ba0e889f366 Mon Sep 17 00:00:00 2001 From: Sivaiah Nallagatla Date: Mon, 16 Aug 2004 09:50:21 +0000 Subject: change the prototype of alarm_notify_add_calendar to take Esource instead 2004-08-16 Sivaiah Nallagatla * gui/alarm-notify/alarm-notify.h : change the prototype of alarm_notify_add_calendar to take Esource instead of uri * gui/alarm-notify/alarm-notify.c (alarm_notify_add_calendar) : use auth_new_cal_from_source instead of _from_uri to create cal client also do not try to load the cal backend which require auth and for which there is no password availble in e-password seesion (list_changed_cb) (load_calendars) : pass Esource insted of uri to alarm_notify_add_calendar svn path=/trunk/; revision=26947 --- calendar/gui/alarm-notify/alarm-notify.c | 26 ++++++++++++++++++-------- calendar/gui/alarm-notify/alarm-notify.h | 2 +- 2 files changed, 19 insertions(+), 9 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c index 19e5daf15f..4b2ec68f7c 100644 --- a/calendar/gui/alarm-notify/alarm-notify.c +++ b/calendar/gui/alarm-notify/alarm-notify.c @@ -30,7 +30,7 @@ #include "config-data.h" #include "common/authentication.h" #include "e-util/e-url.h" - +#include "e-util/e-passwords.h" /* Private part of the AlarmNotify structure */ @@ -143,7 +143,7 @@ list_changed_cb (ESourceList *source_list, gpointer data) uri = e_source_get_uri (source); if (!g_hash_table_lookup (priv->uri_client_hash, uri)) { g_message ("Adding %s", uri); - alarm_notify_add_calendar (an, source_type, uri, FALSE); + alarm_notify_add_calendar (an, source_type, source, FALSE); } g_free (uri); } @@ -189,7 +189,7 @@ load_calendars (AlarmNotify *an, ECalSourceType source_type) uri = e_source_get_uri (source); g_message ("Loading %s", uri); - alarm_notify_add_calendar (an, source_type, uri, FALSE); + alarm_notify_add_calendar (an, source_type, source, FALSE); g_free (uri); } @@ -296,22 +296,32 @@ cal_opened_cb (ECal *client, ECalendarStatus status, gpointer user_data) * that it can be loaded in the future when the alarm daemon starts up. **/ void -alarm_notify_add_calendar (AlarmNotify *an, ECalSourceType source_type, const char *str_uri, gboolean load_afterwards) +alarm_notify_add_calendar (AlarmNotify *an, ECalSourceType source_type, ESource *source, gboolean load_afterwards) { AlarmNotifyPrivate *priv; ECal *client; - + char *str_uri; g_return_if_fail (an != NULL); g_return_if_fail (IS_ALARM_NOTIFY (an)); - g_return_if_fail (str_uri != NULL); + priv = an->priv; - + str_uri = e_source_get_uri (source); /* See if we already know about this uri */ if (g_hash_table_lookup (priv->uri_client_hash, str_uri)) return; - client = auth_new_cal_from_uri (str_uri, source_type); + /* if loading of this requires password and password is not currently availble in e-password + session skip this source loading. we do not really want to prompt for auth from alarm dameon*/ + + /*** FIXME we should run an idle loop to check for availbility of passwords for these sources + and add them to the list once they are available */ + + if ((e_source_get_property (source, "auth") && + (!e_passwords_get_password (e_source_get_property(source, "auth-domain"), str_uri)))) + return; + + client = auth_new_cal_from_source (source, source_type); if (client) { g_hash_table_insert (priv->uri_client_hash, g_strdup (str_uri), client); diff --git a/calendar/gui/alarm-notify/alarm-notify.h b/calendar/gui/alarm-notify/alarm-notify.h index f64452d450..7aea798402 100644 --- a/calendar/gui/alarm-notify/alarm-notify.h +++ b/calendar/gui/alarm-notify/alarm-notify.h @@ -55,7 +55,7 @@ GType alarm_notify_get_type (void); AlarmNotify *alarm_notify_new (void); -void alarm_notify_add_calendar (AlarmNotify *an, ECalSourceType source_type, const char *str_uri, gboolean load_afterwards); +void alarm_notify_add_calendar (AlarmNotify *an, ECalSourceType source_type, ESource *source, gboolean load_afterwards); void alarm_notify_remove_calendar (AlarmNotify *an, const char *str_uri); -- cgit v1.2.3