Index: calendar/ChangeLog
===================================================================
--- calendar/ChangeLog	(revision 8040)
+++ calendar/ChangeLog	(working copy)
@@ -1,3 +1,13 @@
+2007-09-06  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #402506
+
+	* backends/weather/e-cal-backend-weather.c:
+	(struct _ECalBackendWeatherPrivate), (begin_retrieval_cb),
+	(e_cal_backend_weather_open), (e_cal_backend_weather_set_mode),
+	(e_cal_backend_weather_finalize), (e_cal_backend_weather_init):
+	Remembers idle and timeout calls and removes them when finalizing.
+
 2007-08-30  Chenthill Palanisamy  <pchenthill@novell.com>
 
 	Fixes #298095 (bnc)
Index: calendar/backends/weather/e-cal-backend-weather.c
===================================================================
--- calendar/backends/weather/e-cal-backend-weather.c	(revision 8040)
+++ calendar/backends/weather/e-cal-backend-weather.c	(working copy)
@@ -64,6 +64,8 @@
 
 	/* Weather source */
 	EWeatherSource *source;
+
+	guint begin_retrival_id;
 };
 
 static ECalBackendSyncClass *parent_class;
@@ -192,6 +194,9 @@
 
 	e_weather_source_parse (priv->source, (EWeatherSourceFinished) finished_retrieval_cb, cbw);
 
+	if (priv->begin_retrival_id)
+		priv->begin_retrival_id = 0;
+
 	return FALSE;
 }
 
@@ -465,7 +470,8 @@
 		if (priv->mode == CAL_MODE_LOCAL)
 			return GNOME_Evolution_Calendar_Success;
 
-		g_idle_add ((GSourceFunc) begin_retrieval_cb, cbw);
+		if (!priv->begin_retrival_id)
+			priv->begin_retrival_id = g_idle_add ((GSourceFunc) begin_retrieval_cb, cbw);
 	}
 
 	return GNOME_Evolution_Calendar_Success;
@@ -758,8 +764,8 @@
 		case CAL_MODE_ANY:
 			priv->mode = mode;
 			set_mode = cal_mode_to_corba (mode);
-			if (loaded)
-				g_idle_add ((GSourceFunc) begin_retrieval_cb, backend);
+			if (loaded && !priv->begin_retrival_id)
+				priv->begin_retrival_id = g_idle_add ((GSourceFunc) begin_retrieval_cb, backend);
 			break;
 		default:
 			set_mode = GNOME_Evolution_Calendar_MODE_ANY;
@@ -816,6 +822,16 @@
 	cbw = (ECalBackendWeather *) object;
 	priv = cbw->priv;
 
+	if (priv->reload_timeout_id) {
+		g_source_remove (priv->reload_timeout_id);
+		priv->reload_timeout_id = 0;
+	}
+
+	if (priv->begin_retrival_id) {
+		g_source_remove (priv->begin_retrival_id);
+		priv->begin_retrival_id = 0;
+	}
+
 	if (priv->cache) {
 		g_object_unref (priv->cache);
 		priv->cache = NULL;
@@ -852,6 +868,7 @@
 
 	priv->reload_timeout_id = 0;
 	priv->source_changed_id = 0;
+	priv->begin_retrival_id = 0;
 	priv->opened = FALSE;
 	priv->source = NULL;
 	priv->cache = NULL;
