Index: addressbook/gui/component/addressbook-component.c
===================================================================
--- addressbook/gui/component/addressbook-component.c	(revision 37191)
+++ addressbook/gui/component/addressbook-component.c	(working copy)
@@ -68,17 +68,12 @@ struct _AddressbookComponentPrivate {
 static void
 ensure_sources (AddressbookComponent *component)
 {
-	GSList *groups;
 	ESourceList *source_list;
-	ESourceGroup *group;
 	ESourceGroup *on_this_computer;
-	ESourceGroup *on_ldap_servers;
 	ESource *personal_source;
-	char *base_uri, *base_uri_proto;
+	char *base_uri, *base_uri_proto, base_uri_proto_seventh;
 	const gchar *base_dir;
 
-	on_this_computer = NULL;
-	on_ldap_servers = NULL;
 	personal_source = NULL;
 
 	if (!e_book_get_addressbooks (&source_list, NULL)) {
@@ -90,24 +85,20 @@ ensure_sources (AddressbookComponent *co
 	base_uri = g_build_filename (base_dir, "local", NULL);
 
 	base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
+	if (strlen (base_uri_proto) >= 7) {
+		/* compare only file:// part. If user home dir name changes we do not want to create
+		   one more group  */
+		base_uri_proto_seventh = base_uri_proto[7];
+		base_uri_proto[7] = 0;
+	} else {
+		base_uri_proto_seventh = -1;
+	}
 
-	groups = e_source_list_peek_groups (source_list);
-	if (groups) {
-		/* groups are already there, we need to search for things... */
-		GSList *g;
-
-		for (g = groups; g; g = g->next) {
-
-			group = E_SOURCE_GROUP (g->data);
-
-			/* compare only file:// part. If user home dir name changes we do not want to create
-			   one more group  */
-
-			if (!on_this_computer && !strncmp (base_uri_proto, e_source_group_peek_base_uri (group), 7))
-				on_this_computer = group;
-			else if (!on_ldap_servers && !strcmp (LDAP_BASE_URI, e_source_group_peek_base_uri (group)))
-				on_ldap_servers = group;
-		}
+	on_this_computer = e_source_list_ensure_group (source_list, _("On This Computer"), base_uri_proto, TRUE);
+	e_source_list_ensure_group (source_list, _("On LDAP Servers"), LDAP_BASE_URI, FALSE);
+
+	if (base_uri_proto_seventh != -1) {
+		base_uri_proto[7] = base_uri_proto_seventh;
 	}
 
 	if (on_this_computer) {
@@ -137,16 +128,6 @@ ensure_sources (AddressbookComponent *co
 		       and too late to prevent user seeing "Can not Open ... because of invalid uri" error.*/
 		    e_source_list_sync (source_list,NULL);
 		}
-
-		/* ensure the group name is in current locale, not read from configuration */
-		e_source_group_set_name (on_this_computer, _("On This Computer"));
-	}
-	else {
-		/* create the local source group */
-		group = e_source_group_new (_("On This Computer"), base_uri_proto);
-		e_source_list_add_group (source_list, group, -1);
-
-		on_this_computer = group;
 	}
 
 	if (personal_source) {
@@ -163,17 +144,7 @@ ensure_sources (AddressbookComponent *co
 		personal_source = source;
 	}
 
-	if (on_ldap_servers) {
-		/* ensure the group name is in current locale, not read from configuration */
-		e_source_group_set_name (on_ldap_servers, _("On LDAP Servers"));
-	} else {
-		/* Create the LDAP source group */
-		group = e_source_group_new (_("On LDAP Servers"), LDAP_BASE_URI);
-		e_source_list_add_group (source_list, group, -1);
-
-		on_ldap_servers = group;
-	}
-
+	g_object_unref (on_this_computer);
 	g_free (base_uri_proto);
 	g_free (base_uri);
 }
Index: addressbook/ChangeLog
===================================================================
--- addressbook/ChangeLog	(revision 37191)
+++ addressbook/ChangeLog	(working copy)
@@ -1,3 +1,10 @@
+2009-02-02  Milan Crha  <mcrha@redhat.com>
+
+	** Part of fix for bug #569652
+
+	* gui/component/addressbook-component.c: (ensure_sources):
+	Use new ESourceList API (simplifies code).
+
 2009-01-26  Matthew Barnes  <mbarnes@redhat.com>
 
 	* printing/test-print.c:
Index: plugins/caldav/ChangeLog
===================================================================
--- plugins/caldav/ChangeLog	(revision 37191)
+++ plugins/caldav/ChangeLog	(working copy)
@@ -1,3 +1,10 @@
+2009-02-02  Milan Crha  <mcrha@redhat.com>
+
+	** Part of fix for bug #569652
+
+	* caldav-source.c: (ensure_caldav_source_group):
+	Use new ESourceList API (simplifies code).
+
 2008-12-08  Milan Crha  <mcrha@redhat.com>
 
 	** Fix for bug #562990
Index: plugins/caldav/caldav-source.c
===================================================================
--- plugins/caldav/caldav-source.c	(revision 37191)
+++ plugins/caldav/caldav-source.c	(working copy)
@@ -55,43 +55,13 @@ static void
 ensure_caldav_source_group (ECalSourceType source_type)
 {
 	ESourceList  *slist;
-	GSList *groups, *g;
-	ESourceGroup *group = NULL;
 
 	if (!e_cal_get_sources (&slist, source_type, NULL)) {
 		g_warning ("Could not get calendar source list from GConf!");
 		return;
 	}
 
-	groups = e_source_list_peek_groups (slist);
-	for (g = groups; g; g = g->next) {
-		group = E_SOURCE_GROUP (g->data);
-
-		if (group && e_source_group_peek_base_uri (group) && strncmp ("caldav://", e_source_group_peek_base_uri (group), 9) == 0)
-			break;
-
-		group = NULL;
-	}
-
-	if (group == NULL) {
-		/* no such group has been found, create it */
-		gboolean res;
-
-		group = e_source_group_new (_("CalDAV"), "caldav://");
-		res = e_source_list_add_group (slist, group, -1);
-
-		if (res == FALSE) {
-			g_warning ("Could not add CalDAV source group!");
-		} else {
-			e_source_list_sync (slist, NULL);
-		}
-
-		g_object_unref (group);
-	} else {
-		/* we found the group, change the name based on the actual language */
-		e_source_group_set_name (group, _("CalDAV"));
-	}
-
+	e_source_list_ensure_group (slist, _("CalDAV"), "caldav://", FALSE);
 	g_object_unref (slist);
 }
 
Index: plugins/webdav-account-setup/webdav-contacts-source.c
===================================================================
--- plugins/webdav-account-setup/webdav-contacts-source.c	(revision 37191)
+++ plugins/webdav-account-setup/webdav-contacts-source.c	(working copy)
@@ -54,33 +54,10 @@ plugin_webdav_contacts(EPlugin *epl, ECo
 int
 e_plugin_lib_enable(EPluginLib *ep, int enable);
 
-static ESourceGroup *
-find_webdav_group (ESourceList *slist)
-{
-	GSList *groups, *g;
-	ESourceGroup *group = NULL;
-
-	g_return_val_if_fail (slist != NULL, NULL);
-
-	groups = e_source_list_peek_groups (slist);
-	for (g = groups; g; g = g->next) {
-		group = E_SOURCE_GROUP (g->data);
-
-		if (group && e_source_group_peek_base_uri (group) &&
-		    g_ascii_strncasecmp (BASE_URI, e_source_group_peek_base_uri (group), strlen (BASE_URI)) == 0)
-			break;
-
-		group = NULL;
-	}
-
-	return group;
-}
-
 static void
 ensure_webdav_contacts_source_group(void)
 {
 	ESourceList  *source_list;
-	ESourceGroup *group;
 
 	source_list = e_source_list_new_for_gconf_default("/apps/evolution/addressbook/sources");
 
@@ -88,26 +65,8 @@ ensure_webdav_contacts_source_group(void
 		return;
 	}
 
-	group = find_webdav_group (source_list);
-
-	if (group == NULL) {
-		gboolean res;
-
-		group = e_source_group_new(_("WebDAV"), BASE_URI);
-		res = e_source_list_add_group(source_list, group, -1);
-
-		if (res == FALSE) {
-			g_warning("Could not add WebDAV source group!");
-		} else {
-			e_source_list_sync(source_list, NULL);
-		}
-
-		g_object_unref(group);
-	} else {
-		e_source_group_set_name (group, _("WebDAV"));
-	}
-
-	g_object_unref(source_list);
+	e_source_list_ensure_group (source_list, _("WebDAV"), BASE_URI, FALSE);
+	g_object_unref (source_list);
 }
 
 static void
@@ -122,7 +81,7 @@ remove_webdav_contacts_source_group(void
 		return;
 	}
 
-	group = find_webdav_group (source_list);
+	group = e_source_list_peek_group_by_base_uri (source_list, BASE_URI);
 
 	if (group) {
 		GSList *sources;
Index: plugins/webdav-account-setup/ChangeLog
===================================================================
--- plugins/webdav-account-setup/ChangeLog	(revision 37191)
+++ plugins/webdav-account-setup/ChangeLog	(working copy)
@@ -1,3 +1,12 @@
+2009-02-02  Milan Crha  <mcrha@redhat.com>
+
+	** Part of fix for bug #569652
+
+	* webdav-contacts-source.c: (find_webdav_group): Removed.
+	* webdav-contacts-source.c: (ensure_webdav_contacts_source_group),
+	(remove_webdav_contacts_source_group):
+	Use new ESourceList API (simplifies code).
+
 2009-01-29  Milan Crha  <mcrha@redhat.com>
 
 	** Fix for bug #539467
Index: plugins/google-account-setup/ChangeLog
===================================================================
--- plugins/google-account-setup/ChangeLog	(revision 37191)
+++ plugins/google-account-setup/ChangeLog	(working copy)
@@ -1,3 +1,16 @@
+2009-02-02  Milan Crha  <mcrha@redhat.com>
+
+	** Part of fix for bug #569652
+
+	* google-contacts-source.h: (manage_google_group):
+	* google-contacts-source.c: (manage_google_group):
+	Removed.
+
+	* google-contacts-source.c: (ensure_google_contacts_source_group),
+	(remove_google_contacts_source_group):
+	* google-source.c: (ensure_google_source_group):
+	Use new ESourceList API (simplifies code).
+
 2009-01-29  Milan Crha  <mcrha@redhat.com>
 
 	** Fix for bug #539467
Index: plugins/google-account-setup/google-contacts-source.c
===================================================================
--- plugins/google-account-setup/google-contacts-source.c	(revision 37191)
+++ plugins/google-account-setup/google-contacts-source.c	(working copy)
@@ -37,51 +37,6 @@
 
 #include "google-contacts-source.h"
 
-/**
- * manage_google_group:
- * Searches for a 'Google' source group and ensures it has the correct
- * name. If only_return is set to true, then only returns found group.
- * Otherwise returns NULL.
- **/
-ESourceGroup *
-manage_google_group (ESourceList *slist, gboolean only_return)
-{
-	GSList *groups, *g;
-	ESourceGroup *group = NULL;
-
-	g_return_val_if_fail (slist != NULL, NULL);
-
-	groups = e_source_list_peek_groups (slist);
-	for (g = groups; g; g = g->next) {
-		group = E_SOURCE_GROUP (g->data);
-
-		if (group && e_source_group_peek_base_uri (group) &&
-		    g_ascii_strncasecmp ("google://", e_source_group_peek_base_uri (group), 9) == 0)
-			break;
-
-		group = NULL;
-	}
-
-	if (only_return)
-		return group;
-
-	if (group) {
-		e_source_group_set_name (group, _("Google"));
-	} else {
-		group = e_source_group_new (_("Google"), "google://");
-
-		if (!e_source_list_add_group (slist, group, -1)) {
-			g_warning ("Could not add Google source group!");
-		} else {
-			e_source_list_sync (slist, NULL);
-		}
-
-		g_object_unref (group);
-	}
-
-	return NULL;
-}
-
 void
 ensure_google_contacts_source_group (void)
 {
@@ -93,7 +48,7 @@ ensure_google_contacts_source_group (voi
 		return;
 	}
 
-	manage_google_group (source_list, FALSE);
+	e_source_list_ensure_group (source_list, _("Google"), "google://", FALSE);
 	g_object_unref (source_list);
 }
 
@@ -109,7 +64,7 @@ remove_google_contacts_source_group (voi
         return;
     }
 
-    group = manage_google_group (source_list, TRUE);
+    group = e_source_list_peek_group_by_base_uri (source_list, "google://");
 
     if (group) {
         GSList *sources;
Index: plugins/google-account-setup/google-source.c
===================================================================
--- plugins/google-account-setup/google-source.c	(revision 37191)
+++ plugins/google-account-setup/google-source.c	(working copy)
@@ -78,7 +78,7 @@ ensure_google_source_group (void)
 		return;
 	}
 
-	manage_google_group (slist, FALSE);
+	e_source_list_ensure_group (slist, _("Google"), "google://", FALSE);
 	g_object_unref (slist);
 }
 
Index: plugins/google-account-setup/google-contacts-source.h
===================================================================
--- plugins/google-account-setup/google-contacts-source.h	(revision 37191)
+++ plugins/google-account-setup/google-contacts-source.h	(working copy)
@@ -28,6 +28,4 @@ void       ensure_google_contacts_source
 
 void       remove_google_contacts_source_group (void);
 
-ESourceGroup *manage_google_group (ESourceList *slist, gboolean only_return);
-
 #endif
Index: calendar/gui/tasks-component.c
===================================================================
--- calendar/gui/tasks-component.c	(revision 37191)
+++ calendar/gui/tasks-component.c	(working copy)
@@ -120,17 +120,12 @@ struct _TasksComponentPrivate {
 static void
 ensure_sources (TasksComponent *component)
 {
-	GSList *groups;
 	ESourceList *source_list;
-	ESourceGroup *group;
 	ESourceGroup *on_this_computer;
-	ESourceGroup *on_the_web;
 	ESource *personal_source;
-	char *base_uri, *base_uri_proto;
+	char *base_uri, *base_uri_proto, base_uri_proto_seventh;
 	const gchar *base_dir;
 
-	on_this_computer = NULL;
-	on_the_web = NULL;
 	personal_source = NULL;
 
 	if (!e_cal_get_sources (&source_list, E_CAL_SOURCE_TYPE_TODO, NULL)) {
@@ -142,24 +137,20 @@ ensure_sources (TasksComponent *componen
 	base_uri = g_build_filename (base_dir, "local", NULL);
 
 	base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
+	if (strlen (base_uri_proto) > 7) {
+		/* compare only file:// part. If user home dir name changes we do not want to create
+		   one more group  */
+		base_uri_proto_seventh = base_uri_proto[7];
+		base_uri_proto[7] = 0;
+	} else {
+		base_uri_proto_seventh = -1;
+	}
 
-	groups = e_source_list_peek_groups (source_list);
-	if (groups) {
-		/* groups are already there, we need to search for things... */
-		GSList *g;
-
-		for (g = groups; g; g = g->next) {
-
-			group = E_SOURCE_GROUP (g->data);
-
-			/* compare only file:// part. If user home dir name changes we do not want to create
-			   one more group  */
-
-			if (!on_this_computer && !strncmp (base_uri_proto, e_source_group_peek_base_uri (group), 7))
-				on_this_computer = group;
-			else if (!on_the_web && !strcmp (WEB_BASE_URI, e_source_group_peek_base_uri (group)))
-				on_the_web = group;
-		}
+	on_this_computer = e_source_list_ensure_group (source_list, _("On This Computer"), base_uri_proto, TRUE);
+	e_source_list_ensure_group (source_list, _("On The Web"), WEB_BASE_URI, FALSE);
+
+	if (base_uri_proto_seventh != -1) {
+		base_uri_proto[7] = base_uri_proto_seventh;
 	}
 
 	if (on_this_computer) {
@@ -189,16 +180,6 @@ ensure_sources (TasksComponent *componen
 		       and too late to prevent user seeing "Can not Open ... because of invalid uri" error.*/
 		    e_source_list_sync (source_list,NULL);
 		}
-
-		/* ensure the group name is in current locale, not read from configuration */
-		e_source_group_set_name (on_this_computer, _("On This Computer"));
-	}
-	else {
-		/* create the local source group */
-		group = e_source_group_new (_("On This Computer"), base_uri_proto);
-		e_source_list_add_group (source_list, group, -1);
-
-		on_this_computer = group;
 	}
 
 	if (personal_source) {
@@ -232,18 +213,9 @@ ensure_sources (TasksComponent *componen
 		personal_source = source;
 	}
 
-	if (!on_the_web) {
-		/* Create the LDAP source group */
-		group = e_source_group_new (_("On The Web"), WEB_BASE_URI);
-		e_source_list_add_group (source_list, group, -1);
-
-		on_the_web = group;
-	} else {
-		/* ensure the group name is in current locale, not read from configuration */
-		e_source_group_set_name (on_the_web, _("On The Web"));
-	}
-
 	component->priv->source_list = source_list;
+
+	g_object_unref (on_this_computer);
 	g_free (base_uri_proto);
 	g_free (base_uri);
 }
Index: calendar/gui/calendar-component.c
===================================================================
--- calendar/gui/calendar-component.c	(revision 37191)
+++ calendar/gui/calendar-component.c	(working copy)
@@ -158,23 +158,15 @@ calcomp_vpane_resized (GtkWidget *vpane,
 static void
 ensure_sources (CalendarComponent *component)
 {
-	GSList *groups;
 	ESourceList *source_list;
-	ESourceGroup *group;
 	ESourceGroup *on_this_computer;
-	ESourceGroup *on_the_web;
 	ESourceGroup *contacts;
-	ESourceGroup *weather;
 	ESource *personal_source;
 	ESource *birthdays_source;
-	char *base_uri, *base_uri_proto;
+	char *base_uri, *base_uri_proto, base_uri_proto_seventh;
 	const gchar *base_dir;
 	gchar *create_source;
 
-	on_this_computer = NULL;
-	on_the_web = NULL;
-	contacts = NULL;
-	weather = NULL;
 	personal_source = NULL;
 	birthdays_source = NULL;
 
@@ -187,28 +179,22 @@ ensure_sources (CalendarComponent *compo
 	base_uri = g_build_filename (base_dir, "local", NULL);
 
 	base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
+	if (strlen (base_uri_proto) > 7) {
+		/* compare only file:// part. If user home dir name changes we do not want to create
+		   one more group  */
+		base_uri_proto_seventh = base_uri_proto[7];
+		base_uri_proto[7] = 0;
+	} else {
+		base_uri_proto_seventh = -1;
+	}
 
-	groups = e_source_list_peek_groups (source_list);
-	if (groups) {
-		/* groups are already there, we need to search for things... */
-		GSList *g;
-
-		for (g = groups; g; g = g->next) {
-
-			group = E_SOURCE_GROUP (g->data);
-
-			/* compare only file:// part. If user home dir name changes we do not want to create
-			   one more group  */
-
-			if (!on_this_computer && !strncmp (base_uri_proto, e_source_group_peek_base_uri (group), 7))
-				on_this_computer = group;
-			else if (!on_the_web && !strcmp (WEB_BASE_URI, e_source_group_peek_base_uri (group)))
-				on_the_web = group;
-			else if (!contacts && !strcmp (CONTACTS_BASE_URI, e_source_group_peek_base_uri (group)))
-				contacts = group;
-			else if (!weather && !strcmp (WEATHER_BASE_URI, e_source_group_peek_base_uri (group)))
-				weather = group;
-		}
+	on_this_computer = e_source_list_ensure_group (source_list, _("On This Computer"), base_uri_proto, TRUE);
+	contacts = e_source_list_ensure_group (source_list, _("Contacts"), CONTACTS_BASE_URI, TRUE);
+	e_source_list_ensure_group (source_list, _("On The Web"), WEB_BASE_URI, FALSE);
+	e_source_list_ensure_group (source_list, _("Weather"), WEATHER_BASE_URI, FALSE);
+
+	if (base_uri_proto_seventh != -1) {
+		base_uri_proto[7] = base_uri_proto_seventh;
 	}
 
 	if (on_this_computer) {
@@ -238,16 +224,6 @@ ensure_sources (CalendarComponent *compo
 		       and too late to prevent user seeing "Can not Open ... because of invalid uri" error.*/
 		    e_source_list_sync (source_list,NULL);
 		}
-
-		/* ensure the group name is in current locale, not read from configuration */
-		e_source_group_set_name (on_this_computer, _("On This Computer"));
-	}
-	else {
-		/* create the local source group */
-		group = e_source_group_new (_("On This Computer"), base_uri_proto);
-		e_source_list_add_group (source_list, group, -1);
-
-		on_this_computer = group;
 	}
 
 	if (personal_source) {
@@ -282,17 +258,6 @@ ensure_sources (CalendarComponent *compo
 		e_source_set_color_spec (personal_source, "#BECEDD");
 	}
 
-	if (on_the_web) {
-		/* ensure the group name is in current locale, not read from configuration */
-		e_source_group_set_name (on_the_web, _("On The Web"));
-	} else {
-		/* Create the On the web source group */
-		group = e_source_group_new (_("On The Web"), WEB_BASE_URI);
-		e_source_list_add_group (source_list, group, -1);
-
-		on_the_web = group;
-	}
-
 	if (contacts) {
 		GSList *sources = e_source_group_peek_sources (contacts);
 		if (sources) {
@@ -311,14 +276,6 @@ ensure_sources (CalendarComponent *compo
 				g_slist_free (l);
 			}
 		}
-
-		/* ensure the group name is in current locale, not read from configuration */
-		e_source_group_set_name (contacts, _("Contacts"));
-	} else {
-		/* Create the contacts group */
-		group = e_source_group_new (_("Contacts"), CONTACTS_BASE_URI);
-		e_source_list_add_group (source_list, group, -1);
-		contacts = group;
 	}
 
 	create_source = e_source_group_get_property (contacts, "create_source");
@@ -341,18 +298,10 @@ ensure_sources (CalendarComponent *compo
 	if (e_source_peek_color_spec (birthdays_source) == NULL)
 		e_source_set_color_spec (birthdays_source, "#DDBECE");
 
-	if (weather) {
-		/* ensure the group name is in current locale, not read from configuration */
-		e_source_group_set_name (weather, _("Weather"));
-	} else {
-		/* Create the weather group */
-		group = e_source_group_new (_("Weather"), WEATHER_BASE_URI);
-		e_source_list_add_group (source_list, group, -1);
-		weather = group;
-	}
-
 	component->priv->source_list = source_list;
 
+	g_object_unref (on_this_computer);
+	g_object_unref (contacts);
 	g_free (base_uri_proto);
 	g_free (base_uri);
 }
Index: calendar/gui/memos-component.c
===================================================================
--- calendar/gui/memos-component.c	(revision 37191)
+++ calendar/gui/memos-component.c	(working copy)
@@ -124,17 +124,12 @@ struct _MemosComponentPrivate {
 static void
 ensure_sources (MemosComponent *component)
 {
-	GSList *groups;
 	ESourceList *source_list;
-	ESourceGroup *group;
 	ESourceGroup *on_this_computer;
-	ESourceGroup *on_the_web;
 	ESource *personal_source;
-	char *base_uri, *base_uri_proto;
+	char *base_uri, *base_uri_proto, base_uri_proto_seventh;
 	const gchar *base_dir;
 
-	on_this_computer = NULL;
-	on_the_web = NULL;
 	personal_source = NULL;
 
 	if (!e_cal_get_sources (&source_list, E_CAL_SOURCE_TYPE_JOURNAL, NULL)) {
@@ -146,24 +141,20 @@ ensure_sources (MemosComponent *componen
 	base_uri = g_build_filename (base_dir, "local", NULL);
 
 	base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
+	if (strlen (base_uri_proto) > 7) {
+		/* compare only file:// part. If user home dir name changes we do not want to create
+		   one more group  */
+		base_uri_proto_seventh = base_uri_proto[7];
+		base_uri_proto[7] = 0;
+	} else {
+		base_uri_proto_seventh = -1;
+	}
 
-	groups = e_source_list_peek_groups (source_list);
-	if (groups) {
-		/* groups are already there, we need to search for things... */
-		GSList *g;
-
-		for (g = groups; g; g = g->next) {
-
-			group = E_SOURCE_GROUP (g->data);
-
-			/* compare only file:// part. If user home dir name changes we do not want to create
-			   one more group  */
-
-			if (!on_this_computer && !strncmp (base_uri_proto, e_source_group_peek_base_uri (group), 7))
-				on_this_computer = group;
-			else if (!on_the_web && !strcmp (WEB_BASE_URI, e_source_group_peek_base_uri (group)))
-				on_the_web = group;
-		}
+	on_this_computer = e_source_list_ensure_group (source_list, _("On This Computer"), base_uri_proto, TRUE);
+	e_source_list_ensure_group (source_list, _("On The Web"), WEB_BASE_URI, FALSE);
+
+	if (base_uri_proto_seventh != -1) {
+		base_uri_proto[7] = base_uri_proto_seventh;
 	}
 
 	if (on_this_computer) {
@@ -193,16 +184,6 @@ ensure_sources (MemosComponent *componen
 		       and too late to prevent user seeing "Can not Open ... because of invalid uri" error.*/
 		    e_source_list_sync (source_list,NULL);
 		}
-
-		/* ensure the group name is in current locale, not read from configuration */
-		e_source_group_set_name (on_this_computer, _("On This Computer"));
-	}
-	else {
-		/* create the local source group */
-		group = e_source_group_new (_("On This Computer"), base_uri_proto);
-		e_source_list_add_group (source_list, group, -1);
-
-		on_this_computer = group;
 	}
 
 	if (personal_source) {
@@ -236,18 +217,9 @@ ensure_sources (MemosComponent *componen
 		personal_source = source;
 	}
 
-	if (on_the_web) {
-		/* ensure the group name is in current locale, not read from configuration */
-		e_source_group_set_name (on_the_web, _("On The Web"));
-	} else {
-		/* Create the source group */
-		group = e_source_group_new (_("On The Web"), WEB_BASE_URI);
-		e_source_list_add_group (source_list, group, -1);
-
-		on_the_web = group;
-	}
-
 	component->priv->source_list = source_list;
+
+	g_object_unref (on_this_computer);
 	g_free (base_uri_proto);
 	g_free (base_uri);
 }
Index: calendar/ChangeLog
===================================================================
--- calendar/ChangeLog	(revision 37191)
+++ calendar/ChangeLog	(working copy)
@@ -1,3 +1,12 @@
+2009-02-02  Milan Crha  <mcrha@redhat.com>
+
+	** Part of fix for bug #569652
+
+	* gui/calendar-component.c: (ensure_sources):
+	* gui/memos-component.c: (ensure_sources):
+	* gui/tasks-component.c: (ensure_sources):
+	Use new ESourceList API (simplifies code).
+
 2009-01-30  Suman Manjunath  <msuman@novell.com>
 
 	** Fix for bug #450554 (bugzilla.novell.com)
