From 3048b4c9decd91d7c5baa0a9ec29f98a91976f1a Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Thu, 3 Jun 2004 18:02:56 +0000 Subject: Merge from release branch. svn path=/trunk/; revision=26178 --- calendar/gui/alarm-notify/alarm-notify.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 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 0c3231aaae..19e5daf15f 100644 --- a/calendar/gui/alarm-notify/alarm-notify.c +++ b/calendar/gui/alarm-notify/alarm-notify.c @@ -72,6 +72,7 @@ alarm_notify_class_init (AlarmNotifyClass *klass) typedef struct { AlarmNotify *an; ESourceList *source_list; + GList *removals; } ProcessRemovalsData; static void @@ -95,16 +96,15 @@ process_removal_in_hash (gpointer key, gpointer value, gpointer data) source_uri = e_source_get_uri (source); if (strcmp (source_uri, uri) == 0) found = TRUE; - g_free (uri); + g_free (source_uri); if (found) return; } } - /* not found, so remove it */ - g_message ("Removing %s", uri); - alarm_notify_remove_calendar (prd->an, uri); + /* not found, so list it for removal */ + prd->removals = g_list_prepend (prd->removals, uri); } static void @@ -115,6 +115,7 @@ list_changed_cb (ESourceList *source_list, gpointer data) GSList *groups, *sources, *p, *q; ECalSourceType source_type = E_CAL_SOURCE_TYPE_LAST; ProcessRemovalsData prd; + GList *l; int i; priv = an->priv; @@ -151,10 +152,16 @@ list_changed_cb (ESourceList *source_list, gpointer data) /* process the removals */ prd.an = an; prd.source_list = priv->source_lists[source_type]; + prd.removals = NULL; g_hash_table_foreach (priv->uri_client_hash, (GHFunc) process_removal_in_hash, &prd); + + for (l = prd.removals; l; l = l->next) { + g_message ("Removing %s", (char *)l->data); + alarm_notify_remove_calendar (an, l->data); + } + g_list_free (prd.removals); } -/* Loads the calendars that the alarm daemon has been told to load in the past */ static void load_calendars (AlarmNotify *an, ECalSourceType source_type) { -- cgit v1.2.3