From 92315fc8f7520d2fe14f164cbe5e21aec5bd5b0c Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 10 Aug 2007 08:53:56 +0000 Subject: 2007-08-10 mcrha Fix for bug #351552 svn path=/trunk/; revision=33975 --- calendar/gui/alarm-notify/alarm-notify.c | 22 ++++++++++++++-------- calendar/gui/alarm-notify/alarm-queue.c | 16 +++++++++++++--- calendar/gui/alarm-notify/alarm-queue.h | 2 +- 3 files changed, 28 insertions(+), 12 deletions(-) (limited to 'calendar/gui/alarm-notify') diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c index 3f723e1719..27fb53cfaf 100644 --- a/calendar/gui/alarm-notify/alarm-notify.c +++ b/calendar/gui/alarm-notify/alarm-notify.c @@ -257,7 +257,7 @@ dequeue_client (gpointer key, gpointer value, gpointer user_data) ECal *client = value; d (printf("%s:%d (dequeue_client) - Removing client %p\n ", __FILE__, __LINE__, client)); - alarm_queue_remove_client (client); + alarm_queue_remove_client (client, TRUE); } /* Finalize handler for the alarm notify system */ @@ -442,12 +442,18 @@ alarm_notify_add_calendar (AlarmNotify *an, ECalSourceType source_type, ESource /* 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*/ - if ((e_source_get_property (source, "auth") && - (!e_passwords_get_password (e_source_get_property(source, "auth-domain"), pass_key)))) { - g_mutex_unlock (an->priv->mutex); - g_free (str_uri); - g_free (pass_key); - return; + if (e_source_get_property (source, "auth")) { + const gchar *name = e_source_get_property (source, "auth-domain"); + + if (!name) + name = e_source_peek_name (source); + + if (!e_passwords_get_password (name, pass_key)) { + g_mutex_unlock (an->priv->mutex); + g_free (str_uri); + g_free (pass_key); + return; + } } client = auth_new_cal_from_source (source, source_type); @@ -474,7 +480,7 @@ alarm_notify_remove_calendar (AlarmNotify *an, ECalSourceType source_type, const client = g_hash_table_lookup (priv->uri_client_hash[source_type], str_uri); if (client) { d (printf("%s:%d (alarm_notify_remove_calendar) - Removing Client %p\n", __FILE__, __LINE__, client)); - alarm_queue_remove_client (client); + alarm_queue_remove_client (client, FALSE); g_hash_table_remove (priv->uri_client_hash[source_type], str_uri); } } diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c index 06d1d3b4cd..08dda9ad66 100644 --- a/calendar/gui/alarm-notify/alarm-queue.c +++ b/calendar/gui/alarm-notify/alarm-queue.c @@ -77,7 +77,7 @@ static AlarmNotificationsDialog *alarm_notifications_dialog = NULL; /* Whether the queueing system has been initialized */ -static gboolean alarm_queue_inited; +static gboolean alarm_queue_inited = FALSE; /* When the alarm queue system is inited, this gets set to the last time an * alarm notification was issued. This lets us present any notifications that @@ -2146,8 +2146,15 @@ alarm_queue_remove_async (EThread *e, AlarmMsg *msg, void *data) g_hash_table_remove (client_alarms_hash, client); } +/** alarm_queue_remove_client + * + * asynchronously remove client from alarm queue. + * @param client Client to remove. + * @param immediately Indicates whether use thread or do it right now. + */ + void -alarm_queue_remove_client (ECal *client) +alarm_queue_remove_client (ECal *client, gboolean immediately) { AlarmMsg *msg; struct _alarm_client_msg *list; @@ -2161,7 +2168,10 @@ alarm_queue_remove_client (ECal *client) msg->data = list; d(printf("%s:%d (alarm_queue_remove_client) - Posting a task\n",__FILE__, __LINE__)); - e_thread_put(alarm_operation_thread, (EMsg *)msg); + if (immediately) + alarm_queue_remove_async (NULL, msg, NULL); + else + e_thread_put(alarm_operation_thread, (EMsg *)msg); } /* Update non-time related variables for various structures on modification of an existing component diff --git a/calendar/gui/alarm-notify/alarm-queue.h b/calendar/gui/alarm-notify/alarm-queue.h index 60e1abde46..25638e4333 100644 --- a/calendar/gui/alarm-notify/alarm-queue.h +++ b/calendar/gui/alarm-notify/alarm-queue.h @@ -28,7 +28,7 @@ void alarm_queue_init (gpointer); void alarm_queue_done (void); void alarm_queue_add_client (ECal *client); -void alarm_queue_remove_client (ECal *client); +void alarm_queue_remove_client (ECal *client, gboolean immediately); #endif -- cgit v1.2.3