[evolution/account-mgmt: 22/33] Adapt modules/calendar to the new ESource API.



commit 6382a92b03da81a7497bb96f08d62374aae44bcb
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Dec 23 08:58:10 2010 -0500

    Adapt modules/calendar to the new ESource API.

 modules/Makefile.am                          |    4 +-
 modules/calendar/Makefile.am                 |    4 +-
 modules/calendar/e-cal-attachment-handler.c  |   35 ++--
 modules/calendar/e-cal-shell-backend.c       |  343 ++++----------------------
 modules/calendar/e-cal-shell-backend.h       |    8 -
 modules/calendar/e-cal-shell-migrate.c       |  223 -----------------
 modules/calendar/e-cal-shell-sidebar.c       |  198 ++++++---------
 modules/calendar/e-cal-shell-sidebar.h       |    2 +
 modules/calendar/e-cal-shell-view-actions.c  |  112 ++++-----
 modules/calendar/e-cal-shell-view-private.c  |   26 ++-
 modules/calendar/e-cal-shell-view-private.h  |    3 +-
 modules/calendar/e-calendar-preferences.c    |   81 +------
 modules/calendar/e-calendar-preferences.h    |    2 -
 modules/calendar/e-memo-shell-backend.c      |  268 +++------------------
 modules/calendar/e-memo-shell-backend.h      |    8 -
 modules/calendar/e-memo-shell-content.c      |    2 +-
 modules/calendar/e-memo-shell-migrate.c      |  248 +------------------
 modules/calendar/e-memo-shell-sidebar.c      |  135 ++++-------
 modules/calendar/e-memo-shell-view-actions.c |  105 ++++----
 modules/calendar/e-memo-shell-view-private.h |    3 +-
 modules/calendar/e-memo-shell-view.h         |    1 -
 modules/calendar/e-task-shell-backend.c      |  269 +++------------------
 modules/calendar/e-task-shell-backend.h      |    8 -
 modules/calendar/e-task-shell-content.c      |    2 +-
 modules/calendar/e-task-shell-migrate.c      |  166 -------------
 modules/calendar/e-task-shell-sidebar.c      |  135 ++++-------
 modules/calendar/e-task-shell-view-actions.c |  105 ++++----
 modules/calendar/e-task-shell-view-private.h |    3 +-
 modules/calendar/e-task-shell-view.h         |    1 -
 widgets/misc/Makefile.am                     |    2 +
 widgets/misc/e-alarm-selector.c              |  102 ++++++++
 widgets/misc/e-alarm-selector.h              |   63 +++++
 32 files changed, 655 insertions(+), 2012 deletions(-)
---
diff --git a/modules/Makefile.am b/modules/Makefile.am
index 5c95034..ae95614 100644
--- a/modules/Makefile.am
+++ b/modules/Makefile.am
@@ -18,11 +18,9 @@ if ENABLE_WINDOWS_SENS
 WINDOWS_SENS_DIR = windows-sens
 endif
 
-# ACCOUNT_MGMT: Disable SUBDIRS
-# calendar (comes after addressbook)
-
 SUBDIRS = \
 	addressbook \
+	calendar \
 	mail \
 	composer-autosave \
 	mailto-handler \
diff --git a/modules/calendar/Makefile.am b/modules/calendar/Makefile.am
index c725ded..43570f6 100644
--- a/modules/calendar/Makefile.am
+++ b/modules/calendar/Makefile.am
@@ -13,6 +13,8 @@ libevolution_module_calendar_la_CPPFLAGS =		\
 
 libevolution_module_calendar_la_SOURCES =		\
 	evolution-module-calendar.c			\
+	e-calendar-preferences.c			\
+	e-calendar-preferences.h			\
 	e-cal-attachment-handler.c			\
 	e-cal-attachment-handler.h			\
 	e-cal-config-calendar-item.c			\
@@ -51,8 +53,6 @@ libevolution_module_calendar_la_SOURCES =		\
 	e-cal-shell-view-private.c			\
 	e-cal-shell-view-private.h			\
 	e-cal-shell-view-taskpad.c			\
-	e-calendar-preferences.c			\
-	e-calendar-preferences.h			\
 	e-memo-shell-backend.c				\
 	e-memo-shell-backend.h				\
 	e-memo-shell-content.c				\
diff --git a/modules/calendar/e-cal-attachment-handler.c b/modules/calendar/e-cal-attachment-handler.c
index 14c9efb..59de789 100644
--- a/modules/calendar/e-cal-attachment-handler.c
+++ b/modules/calendar/e-cal-attachment-handler.c
@@ -25,6 +25,7 @@
 #include <libical/ical.h>
 #include <libecal/e-cal.h>
 #include <camel/camel.h>
+#include <libecal/e-source-calendar.h>
 #include <libedataserverui/e-source-selector.h>
 
 #include "calendar/common/authentication.h"
@@ -240,25 +241,29 @@ attachment_handler_run_dialog (GtkWindow *parent,
 	GtkWidget *container;
 	GtkWidget *widget;
 	GCallback callback;
+	ESourceRegistry *registry;
 	ESourceSelector *selector;
-	ESourceList *source_list;
 	ESource *source;
 	ECal *client;
+	const gchar *extension_name;
 	icalcomponent *component;
-	GError *error = NULL;
-
-	component = attachment_handler_get_component (attachment);
-	g_return_if_fail (component != NULL);
 
-	e_cal_get_sources (&source_list, source_type, &error);
-	if (error != NULL) {
-		g_warning ("%s", error->message);
-		g_error_free (error);
-		return;
+	switch (source_type) {
+		case E_CAL_SOURCE_TYPE_EVENT:
+			extension_name = E_SOURCE_EXTENSION_CALENDAR;
+			break;
+		case E_CAL_SOURCE_TYPE_TODO:
+			extension_name = E_SOURCE_EXTENSION_TASK_LIST;
+			break;
+		case E_CAL_SOURCE_TYPE_JOURNAL:
+			extension_name = E_SOURCE_EXTENSION_MEMO_LIST;
+			break;
+		default:
+			g_return_if_reached ();
 	}
 
-	source = e_source_list_peek_source_any (source_list);
-	g_return_if_fail (source != NULL);
+	component = attachment_handler_get_component (attachment);
+	g_return_if_fail (component != NULL);
 
 	dialog = gtk_dialog_new_with_buttons (
 		title, parent, GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -287,10 +292,10 @@ attachment_handler_run_dialog (GtkWindow *parent,
 
 	container = widget;
 
-	widget = e_source_selector_new (source_list);
+	registry = e_source_registry_get_default ();
+	widget = e_source_selector_new (registry, extension_name);
 	selector = E_SOURCE_SELECTOR (widget);
-	e_source_selector_set_primary_selection (selector, source);
-	e_source_selector_show_selection (selector, FALSE);
+	e_source_selector_set_show_toggles (selector, FALSE);
 	gtk_container_add (GTK_CONTAINER (container), widget);
 	gtk_widget_show (widget);
 
diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c
index d0f97ca..c3d2731 100644
--- a/modules/calendar/e-cal-shell-backend.c
+++ b/modules/calendar/e-cal-shell-backend.c
@@ -25,20 +25,21 @@
 #include <glib/gi18n.h>
 #include <libecal/e-cal.h>
 #include <libecal/e-cal-time-util.h>
+#include <libecal/e-source-calendar.h>
 #include <libedataserver/e-url.h>
 #include <libedataserver/e-source.h>
-#include <libedataserver/e-source-group.h>
 
 #include "e-util/e-import.h"
 #include "shell/e-shell.h"
 #include "shell/e-shell-backend.h"
 #include "shell/e-shell-window.h"
 #include "widgets/misc/e-preferences-window.h"
+#include "widgets/misc/e-source-config-dialog.h"
 
 #include "calendar/common/authentication.h"
 #include "calendar/gui/comp-util.h"
-#include "calendar/gui/dialogs/calendar-setup.h"
 #include "calendar/gui/dialogs/event-editor.h"
+#include "calendar/gui/e-cal-source-config.h"
 #include "calendar/gui/e-calendar-view.h"
 #include "calendar/gui/gnome-cal.h"
 #include "calendar/importers/evolution-calendar-importer.h"
@@ -52,178 +53,13 @@
 #include "e-calendar-preferences.h"
 
 struct _ECalShellBackendPrivate {
-	ESourceList *source_list;
-};
-
-enum {
-	PROP_0,
-	PROP_SOURCE_LIST
+	gint placeholder;
 };
 
 static gpointer parent_class;
 static GType cal_shell_backend_type;
 
 static void
-cal_shell_backend_ensure_sources (EShellBackend *shell_backend)
-{
-	/* XXX This is basically the same algorithm across all backends.
-	 *     Maybe we could somehow integrate this into EShellBackend? */
-
-	ECalShellBackend *cal_shell_backend;
-	ESourceGroup *on_this_computer;
-	ESourceGroup *contacts;
-	ESourceList *source_list;
-	ESource *birthdays;
-	ESource *personal;
-	EShell *shell;
-	EShellSettings *shell_settings;
-	GSList *sources, *iter;
-	const gchar *name;
-	gchar *property;
-	gboolean save_list = FALSE;
-
-	birthdays = NULL;
-	personal = NULL;
-
-	cal_shell_backend = E_CAL_SHELL_BACKEND (shell_backend);
-
-	shell = e_shell_backend_get_shell (shell_backend);
-	shell_settings = e_shell_get_shell_settings (shell);
-
-	if (!e_cal_get_sources (
-		&cal_shell_backend->priv->source_list,
-		E_CAL_SOURCE_TYPE_EVENT, NULL)) {
-		g_warning ("Could not get calendar sources from GConf!");
-		return;
-	}
-
-	source_list = cal_shell_backend->priv->source_list;
-
-	on_this_computer = e_source_list_ensure_group (
-		source_list, _("On This Computer"), "local:", TRUE);
-	contacts = e_source_list_ensure_group (
-		source_list, _("Contacts"), "contacts://", TRUE);
-	e_source_list_ensure_group (
-		source_list, _("On The Web"), "webcal://", FALSE);
-	e_source_list_ensure_group (
-		source_list, _("Weather"), "weather://", FALSE);
-
-	g_return_if_fail (on_this_computer != NULL);
-	g_return_if_fail (contacts != NULL);
-
-	sources = e_source_group_peek_sources (on_this_computer);
-
-	/* Make sure this group includes a "Personal" source. */
-	for (iter = sources; iter != NULL; iter = iter->next) {
-		ESource *source = iter->data;
-		const gchar *relative_uri;
-
-		relative_uri = e_source_peek_relative_uri (source);
-		if (g_strcmp0 (relative_uri, "system") == 0) {
-			personal = source;
-			break;
-		}
-	}
-
-	name = _("Personal");
-
-	if (personal == NULL) {
-		ESource *source;
-		GSList *selected;
-		gchar *primary;
-
-		source = e_source_new (name, "system");
-		e_source_set_color_spec (source, "#BECEDD");
-		e_source_group_add_source (on_this_computer, source, -1);
-		g_object_unref (source);
-		save_list = TRUE;
-
-		primary = e_shell_settings_get_string (
-			shell_settings, "cal-primary-calendar");
-
-		selected = e_cal_shell_backend_get_selected_calendars (
-			cal_shell_backend);
-
-		if (primary == NULL && selected == NULL) {
-			const gchar *uid;
-
-			uid = e_source_peek_uid (source);
-			selected = g_slist_prepend (NULL, g_strdup (uid));
-
-			e_shell_settings_set_string (
-				shell_settings, "cal-primary-calendar", uid);
-			e_cal_shell_backend_set_selected_calendars (
-				cal_shell_backend, selected);
-		}
-
-		g_slist_foreach (selected, (GFunc) g_free, NULL);
-		g_slist_free (selected);
-		g_free (primary);
-	} else {
-		/* Force the source name to the current locale. */
-		e_source_set_name (personal, name);
-	}
-
-	sources = e_source_group_peek_sources (contacts);
-
-	if (sources != NULL) {
-		GSList *trash;
-
-		/* There is only one source under Contacts. */
-		birthdays = E_SOURCE (sources->data);
-		sources = g_slist_next (sources);
-
-		/* Delete any other sources in this group.
-		 * Earlier versions allowed you to create
-		 * additional sources under Contacts. */
-		trash = g_slist_copy (sources);
-		while (trash != NULL) {
-			ESource *source = trash->data;
-			e_source_group_remove_source (contacts, source);
-			trash = g_slist_delete_link (trash, trash);
-			save_list = TRUE;
-		}
-	}
-
-	/* XXX e_source_group_get_property() returns a newly-allocated
-	 *     string when it could just as easily return a const string.
-	 *     Unfortunately, fixing that would break the API. */
-	property = e_source_group_get_property (contacts, "create_source");
-	if (property == NULL)
-		e_source_group_set_property (contacts, "create_source", "no");
-	g_free (property);
-
-	name = _("Birthdays & Anniversaries");
-
-	if (birthdays == NULL) {
-		ESource *source;
-
-		source = e_source_new (name, "/");
-		e_source_group_add_source (contacts, source, -1);
-		g_object_unref (source);
-		save_list = TRUE;
-
-		/* This is now a borrowed reference. */
-		birthdays = source;
-	} else {
-		/* Force the source name to the current locale. */
-		e_source_set_name (birthdays, name);
-	}
-
-	if (e_source_get_property (birthdays, "delete") == NULL)
-		e_source_set_property (birthdays, "delete", "no");
-
-	if (e_source_peek_color_spec (birthdays) == NULL)
-		e_source_set_color_spec (birthdays, "#DDBECE");
-
-	g_object_unref (on_this_computer);
-	g_object_unref (contacts);
-
-	if (save_list)
-		e_source_list_sync (source_list, NULL);
-}
-
-static void
 cal_shell_backend_new_event (ESource *source,
                              GAsyncResult *result,
                              EShell *shell,
@@ -234,10 +70,16 @@ cal_shell_backend_new_event (ESource *source,
 	ECalComponent *comp;
 	EShellSettings *shell_settings;
 	CompEditor *editor;
+	GError *error = NULL;
 
 	/* XXX Handle errors better. */
-	cal = e_load_cal_source_finish (source, result, NULL);
-	g_return_if_fail (E_IS_CAL (cal));
+	cal = e_load_cal_source_finish (source, result, &error);
+	if (error != NULL) {
+		g_warn_if_fail (cal == NULL);
+		g_warning ("%s", error->message);
+		g_error_free (error);
+		return;
+	}
 
 	shell_settings = e_shell_get_shell_settings (shell);
 
@@ -316,13 +158,12 @@ action_event_new_cb (GtkAction *action,
 {
 	EShell *shell;
 	EShellView *shell_view;
-	EShellBackend *shell_backend;
-	EShellSettings *shell_settings;
-	ESource *source = NULL;
-	ESourceList *source_list;
+	ESource *source;
+	ESourceRegistry *registry;
 	ECalSourceType source_type;
 	const gchar *action_name;
-	gchar *uid;
+
+	shell = e_shell_window_get_shell (shell_window);
 
 	/* With a 'calendar' active shell view pass the new appointment
 	 * request to it, thus the event will inherit selected time from
@@ -359,25 +200,8 @@ action_event_new_cb (GtkAction *action,
 
 	source_type = E_CAL_SOURCE_TYPE_EVENT;
 
-	shell = e_shell_window_get_shell (shell_window);
-	shell_settings = e_shell_get_shell_settings (shell);
-	shell_backend = e_shell_get_backend_by_name (shell, "calendar");
-
-	g_object_get (shell_backend, "source-list", &source_list, NULL);
-	g_return_if_fail (E_IS_SOURCE_LIST (source_list));
-
-	uid = e_shell_settings_get_string (
-		shell_settings, "cal-primary-calendar");
-
-	if (uid != NULL) {
-		source = e_source_list_peek_source_by_uid (source_list, uid);
-		g_free (uid);
-	}
-
-	if (source == NULL)
-		source = e_source_list_peek_default_source (source_list);
-
-	g_return_if_fail (E_IS_SOURCE (source));
+	registry = e_source_registry_get_default ();
+	source = e_source_registry_get_default_calendar (registry);
 
 	/* Use a callback function appropriate for the action.
 	 * FIXME Need to obtain a better default time zone. */
@@ -403,15 +227,33 @@ action_event_new_cb (GtkAction *action,
 			NULL, (GAsyncReadyCallback)
 			cal_shell_backend_event_new_cb,
 			g_object_ref (shell));
-
-	g_object_unref (source_list);
 }
 
 static void
 action_calendar_new_cb (GtkAction *action,
                         EShellWindow *shell_window)
 {
-	calendar_setup_new_calendar (GTK_WINDOW (shell_window));
+	ECalSourceType source_type;
+	ESourceRegistry *registry;
+	GtkWidget *config;
+	GtkWidget *dialog;
+	const gchar *icon_name;
+
+	source_type = E_CAL_SOURCE_TYPE_EVENT;
+	registry = e_source_registry_get_default ();
+	config = e_cal_source_config_new (registry, NULL, source_type);
+
+	dialog = e_source_config_dialog_new (
+		E_SOURCE_CONFIG (config), GTK_WINDOW (shell_window));
+
+	icon_name = gtk_action_get_icon_name (action);
+	gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name);
+
+	gtk_window_set_title (GTK_WINDOW (dialog), _("New Calendar"));
+
+	gtk_dialog_run (GTK_DIALOG (dialog));
+
+	gtk_widget_destroy (dialog);
 }
 
 static GtkActionEntry item_entries[] = {
@@ -488,7 +330,7 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
 	ECal *client;
 	ECalComponent *comp;
 	ESource *source;
-	ESourceList *source_list;
+	ESourceRegistry *registry;
 	ECalSourceType source_type;
 	EUri *euri;
 	icalcomponent *icalcomp;
@@ -585,15 +427,10 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
 	 * we successfully open it is another matter... */
 	handled = TRUE;
 
-	if (!e_cal_get_sources (&source_list, source_type, NULL)) {
-		g_printerr ("Could not get calendar sources from GConf!\n");
-		goto exit;
-	}
-
-	source = e_source_list_peek_source_by_uid (source_list, source_uid);
+	registry = e_source_registry_get_default ();
+	source = e_source_registry_lookup_by_uid (registry, source_uid);
 	if (source == NULL) {
 		g_printerr ("No source for UID '%s'\n", source_uid);
-		g_object_unref (source_list);
 		goto exit;
 	}
 
@@ -603,7 +440,6 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
 			g_printerr ("%s\n", error->message);
 			g_error_free (error);
 		}
-		g_object_unref (source_list);
 		goto exit;
 	}
 
@@ -617,7 +453,6 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
 
 	if (!e_cal_get_object (client, comp_uid, comp_rid, &icalcomp, &error)) {
 		g_printerr ("%s\n", error->message);
-		g_object_unref (source_list);
 		g_error_free (error);
 		goto exit;
 	}
@@ -647,7 +482,6 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
 present:
 	gtk_window_present (GTK_WINDOW (editor));
 
-	g_object_unref (source_list);
 	g_object_unref (client);
 
 exit:
@@ -681,40 +515,6 @@ cal_shell_backend_window_created_cb (EShellBackend *shell_backend,
 }
 
 static void
-cal_shell_backend_get_property (GObject *object,
-                                guint property_id,
-                                GValue *value,
-                                GParamSpec *pspec)
-{
-	switch (property_id) {
-		case PROP_SOURCE_LIST:
-			g_value_set_object (
-				value,
-				e_cal_shell_backend_get_source_list (
-				E_CAL_SHELL_BACKEND (object)));
-			return;
-	}
-
-	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-}
-
-static void
-cal_shell_backend_dispose (GObject *object)
-{
-	ECalShellBackendPrivate *priv;
-
-	priv = E_CAL_SHELL_BACKEND (object)->priv;
-
-	if (priv->source_list != NULL) {
-		g_object_unref (priv->source_list);
-		priv->source_list = NULL;
-	}
-
-	/* Chain up to parent's dispose() method. */
-	G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
 cal_shell_backend_constructed (GObject *object)
 {
 	EShell *shell;
@@ -724,8 +524,6 @@ cal_shell_backend_constructed (GObject *object)
 	shell_backend = E_SHELL_BACKEND (object);
 	shell = e_shell_backend_get_shell (shell_backend);
 
-	cal_shell_backend_ensure_sources (shell_backend);
-
 	g_signal_connect_swapped (
 		shell, "handle-uri",
 		G_CALLBACK (cal_shell_backend_handle_uri_cb),
@@ -765,8 +563,6 @@ cal_shell_backend_class_init (ECalShellBackendClass *class)
 	g_type_class_add_private (class, sizeof (ECalShellBackendPrivate));
 
 	object_class = G_OBJECT_CLASS (class);
-	object_class->get_property = cal_shell_backend_get_property;
-	object_class->dispose = cal_shell_backend_dispose;
 	object_class->constructed = cal_shell_backend_constructed;
 
 	shell_backend_class = E_SHELL_BACKEND_CLASS (class);
@@ -779,15 +575,8 @@ cal_shell_backend_class_init (ECalShellBackendClass *class)
 	shell_backend_class->start = NULL;
 	shell_backend_class->migrate = e_cal_shell_backend_migrate;
 
-	g_object_class_install_property (
-		object_class,
-		PROP_SOURCE_LIST,
-		g_param_spec_object (
-			"source-list",
-			"Source List",
-			"The registry of calendars",
-			E_TYPE_SOURCE_LIST,
-			G_PARAM_READABLE));
+	/* Register relevant ESource extensions. */
+	E_TYPE_SOURCE_CALENDAR;
 }
 
 static void
@@ -851,50 +640,6 @@ e_cal_shell_backend_register_type (GTypeModule *type_module)
 		"ECalShellBackend", &type_info, 0);
 }
 
-ESourceList *
-e_cal_shell_backend_get_source_list (ECalShellBackend *cal_shell_backend)
-{
-	g_return_val_if_fail (
-		E_IS_CAL_SHELL_BACKEND (cal_shell_backend), NULL);
-
-	return cal_shell_backend->priv->source_list;
-}
-
-GSList *
-e_cal_shell_backend_get_selected_calendars (ECalShellBackend *cal_shell_backend)
-{
-	GConfClient *client;
-	GSList *selected_calendars;
-	const gchar *key;
-
-	g_return_val_if_fail (
-		E_IS_CAL_SHELL_BACKEND (cal_shell_backend), NULL);
-
-	client = gconf_client_get_default ();
-	key = "/apps/evolution/calendar/display/selected_calendars";
-	selected_calendars = gconf_client_get_list (
-		client, key, GCONF_VALUE_STRING, NULL);
-	g_object_unref (client);
-
-	return selected_calendars;
-}
-
-void
-e_cal_shell_backend_set_selected_calendars (ECalShellBackend *cal_shell_backend,
-                                            GSList *selected_calendars)
-{
-	GConfClient *client;
-	const gchar *key;
-
-	g_return_if_fail (E_IS_CAL_SHELL_BACKEND (cal_shell_backend));
-
-	client = gconf_client_get_default ();
-	key = "/apps/evolution/calendar/display/selected_calendars";
-	gconf_client_set_list (
-		client, key, GCONF_VALUE_STRING, selected_calendars, NULL);
-	g_object_unref (client);
-}
-
 void
 e_cal_shell_backend_open_date_range (ECalShellBackend *cal_shell_backend,
                                      const GDate *start_date,
diff --git a/modules/calendar/e-cal-shell-backend.h b/modules/calendar/e-cal-shell-backend.h
index 32fca7f..400d769 100644
--- a/modules/calendar/e-cal-shell-backend.h
+++ b/modules/calendar/e-cal-shell-backend.h
@@ -23,7 +23,6 @@
 #define E_CAL_SHELL_BACKEND_H
 
 #include <shell/e-shell-backend.h>
-#include <libedataserver/e-source-list.h>
 
 /* Standard GObject macros */
 #define E_TYPE_CAL_SHELL_BACKEND \
@@ -62,13 +61,6 @@ struct _ECalShellBackendClass {
 GType		e_cal_shell_backend_get_type	(void);
 void		e_cal_shell_backend_register_type
 					(GTypeModule *type_module);
-ESourceList *	e_cal_shell_backend_get_source_list
-					(ECalShellBackend *cal_shell_backend);
-GSList *	e_cal_shell_backend_get_selected_calendars
-					(ECalShellBackend *cal_shell_backend);
-void		e_cal_shell_backend_set_selected_calendars
-					(ECalShellBackend *cal_shell_backend,
-					 GSList *selected_calendars);
 void		e_cal_shell_backend_open_date_range
 					(ECalShellBackend *cal_shell_backend,
 					 const GDate *start_date,
diff --git a/modules/calendar/e-cal-shell-migrate.c b/modules/calendar/e-cal-shell-migrate.c
index 710aa8f..589948e 100644
--- a/modules/calendar/e-cal-shell-migrate.c
+++ b/modules/calendar/e-cal-shell-migrate.c
@@ -21,189 +21,6 @@
 
 #include "e-cal-shell-migrate.h"
 
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-
-#include <glib/gi18n.h>
-#include <glib/gstdio.h>
-#include <libebackend/e-dbhash.h>
-#include <libedataserver/e-source.h>
-#include <libedataserver/e-source-group.h>
-#include <libedataserver/e-source-list.h>
-#include <libedataserver/e-xml-hash-utils.h>
-
-#include "e-util/e-util-private.h"
-#include "calendar/gui/calendar-config-keys.h"
-#include "calendar/gui/e-cal-event.h"
-#include "shell/e-shell.h"
-
-#include "e-cal-shell-backend.h"
-
-#define LOCAL_BASE_URI "local:"
-#define WEBCAL_BASE_URI "webcal://"
-#define CONTACTS_BASE_URI "contacts://"
-#define BAD_CONTACTS_BASE_URI "contact://"
-#define PERSONAL_RELATIVE_URI "system"
-
-static ESourceGroup *
-create_calendar_contact_source (ESourceList *source_list)
-{
-	ESourceGroup *group;
-	ESource *source;
-
-	/* Create the contacts group */
-	group = e_source_group_new (_("Contacts"), CONTACTS_BASE_URI);
-	e_source_list_add_group (source_list, group, -1);
-
-	source = e_source_new (_("Birthdays & Anniversaries"), "/");
-	e_source_group_add_source (group, source, -1);
-	g_object_unref (source);
-
-	e_source_set_color_spec (source, "#FED4D3");
-	e_source_group_set_readonly (group, TRUE);
-
-	return group;
-}
-
-static void
-create_calendar_sources (EShellBackend *shell_backend,
-			 ESourceList *source_list,
-			 ESourceGroup **on_this_computer,
-			 ESource **personal_source,
-			 ESourceGroup **on_the_web,
-			 ESourceGroup **contacts)
-{
-	EShell *shell;
-	EShellSettings *shell_settings;
-	GSList *groups;
-	ESourceGroup *group;
-
-	*on_this_computer = NULL;
-	*on_the_web = NULL;
-	*contacts = NULL;
-	*personal_source = NULL;
-
-	shell = e_shell_backend_get_shell (shell_backend);
-	shell_settings = e_shell_get_shell_settings (shell);
-
-	groups = e_source_list_peek_groups (source_list);
-	if (groups) {
-		/* groups are already there, we need to search for things... */
-		GSList *g;
-		const gchar *data_dir;
-		gchar *base_dir, *base_uri;
-
-		data_dir = e_shell_backend_get_data_dir (shell_backend);
-		base_dir = g_build_filename (data_dir, "local", NULL);
-		base_uri = g_filename_to_uri (base_dir, NULL, NULL);
-
-		for (g = groups; g; g = g->next) {
-
-			group = E_SOURCE_GROUP (g->data);
-
-			if (!strcmp (BAD_CONTACTS_BASE_URI, e_source_group_peek_base_uri (group)))
-				e_source_group_set_base_uri (group, CONTACTS_BASE_URI);
-
-			if (!strcmp (base_uri, e_source_group_peek_base_uri (group)))
-				e_source_group_set_base_uri (group, LOCAL_BASE_URI);
-
-			if (!*on_this_computer && !strcmp (LOCAL_BASE_URI,
-				e_source_group_peek_base_uri (group)))
-				*on_this_computer = g_object_ref (group);
-
-			else if (!*on_the_web && !strcmp (WEBCAL_BASE_URI,
-				e_source_group_peek_base_uri (group)))
-				*on_the_web = g_object_ref (group);
-
-			else if (!*contacts && !strcmp (CONTACTS_BASE_URI,
-				e_source_group_peek_base_uri (group)))
-				*contacts = g_object_ref (group);
-		}
-
-		g_free (base_dir);
-		g_free (base_uri);
-	}
-
-	if (*on_this_computer) {
-		/* make sure "Personal" shows up as a source under
-		   this group */
-		GSList *sources = e_source_group_peek_sources (*on_this_computer);
-		GSList *s;
-		for (s = sources; s; s = s->next) {
-			ESource *source = E_SOURCE (s->data);
-			const gchar *relative_uri;
-
-			relative_uri = e_source_peek_relative_uri (source);
-			if (relative_uri == NULL)
-				continue;
-			if (!strcmp (PERSONAL_RELATIVE_URI, relative_uri)) {
-				*personal_source = g_object_ref (source);
-				break;
-			}
-		}
-	} else {
-		/* create the local source group */
-		group = e_source_group_new (_("On This Computer"), LOCAL_BASE_URI);
-		e_source_list_add_group (source_list, group, -1);
-
-		*on_this_computer = group;
-	}
-
-	if (!*personal_source) {
-		GSList *selected;
-		gchar *primary_calendar;
-
-		/* Create the default Person calendar */
-		ESource *source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI);
-		e_source_group_add_source (*on_this_computer, source, -1);
-
-		primary_calendar = e_shell_settings_get_string (
-			shell_settings, "cal-primary-calendar");
-
-		selected = e_cal_shell_backend_get_selected_calendars (
-			E_CAL_SHELL_BACKEND (shell_backend));
-
-		if (primary_calendar == NULL && selected == NULL) {
-			GSList link;
-
-			e_shell_settings_set_string (
-				shell_settings, "cal-primary-calendar",
-				e_source_peek_uid (source));
-
-			link.data = (gpointer)e_source_peek_uid (source);
-			link.next = NULL;
-
-			e_cal_shell_backend_set_selected_calendars (
-				E_CAL_SHELL_BACKEND (shell_backend), &link);
-		}
-
-		g_slist_foreach (selected, (GFunc) g_free, NULL);
-		g_slist_free (selected);
-
-		g_free (primary_calendar);
-		e_source_set_color_spec (source, "#BECEDD");
-		*personal_source = source;
-	}
-
-	if (!*on_the_web) {
-		/* Create the Webcal source group */
-		group = e_source_group_new (_("On The Web"), WEBCAL_BASE_URI);
-		e_source_list_add_group (source_list, group, -1);
-
-		*on_the_web = group;
-	}
-
-	if (!*contacts) {
-		group = create_calendar_contact_source (source_list);
-
-		*contacts = group;
-	}
-}
-
 gboolean
 e_cal_shell_backend_migrate (EShellBackend *shell_backend,
                              gint major,
@@ -211,46 +28,6 @@ e_cal_shell_backend_migrate (EShellBackend *shell_backend,
                              gint micro,
                              GError **error)
 {
-	ESourceGroup *on_this_computer = NULL, *on_the_web = NULL, *contacts = NULL;
-	ESource *personal_source = NULL;
-	ESourceList *source_list;
-	ECalEvent *ece;
-	ECalEventTargetBackend *target;
-
-	g_object_get (shell_backend, "source-list", &source_list, NULL);
-
-	/* we call this unconditionally now - create_groups either
-	   creates the groups/sources or it finds the necessary
-	   groups/sources. */
-	create_calendar_sources (
-		shell_backend, source_list, &on_this_computer,
-		&personal_source, &on_the_web, &contacts);
-
-	e_source_list_sync (source_list, NULL);
-
-	/** @Event: component.migration
-	 * @Title: Migration step in component initialization
-	 * @Target: ECalEventTargetComponent
-	 *
-	 * component.migration is emitted during the calendar component
-	 * initialization process. This allows new calendar backend types
-	 * to be distributed as an e-d-s backend and a plugin without
-	 * reaching their grubby little fingers into migration.c
-	 */
-	/* Fire off migration event */
-	ece = e_cal_event_peek ();
-	target = e_cal_event_target_new_module (ece, shell_backend, source_list, 0);
-	e_event_emit ((EEvent *) ece, "module.migration", (EEventTarget *) target);
-
-	if (on_this_computer)
-		g_object_unref (on_this_computer);
-	if (on_the_web)
-		g_object_unref (on_the_web);
-	if (contacts)
-		g_object_unref (contacts);
-	if (personal_source)
-		g_object_unref (personal_source);
-
 	return TRUE;
 }
 
diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c
index 9f9bc45..f6fdb81 100644
--- a/modules/calendar/e-cal-shell-sidebar.c
+++ b/modules/calendar/e-cal-shell-sidebar.c
@@ -23,6 +23,7 @@
 
 #include <string.h>
 #include <glib/gi18n.h>
+#include <libecal/e-source-calendar.h>
 
 #include "e-util/e-alert-dialog.h"
 #include "e-util/gconf-bridge.h"
@@ -31,7 +32,6 @@
 #include "calendar/common/authentication.h"
 #include "calendar/gui/e-calendar-selector.h"
 #include "calendar/gui/misc.h"
-#include "calendar/gui/dialogs/calendar-setup.h"
 
 #include "e-cal-shell-view.h"
 #include "e-cal-shell-backend.h"
@@ -41,6 +41,7 @@ struct _ECalShellSidebarPrivate {
 	GtkWidget *paned;
 	GtkWidget *selector;
 	GtkWidget *date_navigator;
+	GtkWidget *new_calendar_button;
 
 	/* UID -> Client */
 	GHashTable *client_table;
@@ -120,7 +121,7 @@ cal_shell_sidebar_backend_died_cb (ECalShellSidebar *cal_shell_sidebar,
 	shell_content = e_shell_view_get_shell_content (shell_view);
 
 	source = e_cal_get_source (client);
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 
 	g_object_ref (source);
 
@@ -142,21 +143,30 @@ cal_shell_sidebar_backend_error_cb (ECalShellSidebar *cal_shell_sidebar,
 	EShellView *shell_view;
 	EShellContent *shell_content;
 	EShellSidebar *shell_sidebar;
-	ESourceGroup *source_group;
+	ESource *parent;
 	ESource *source;
+	GNode *node;
+	const gchar *parent_display_name;
+	const gchar *source_display_name;
 
 	shell_sidebar = E_SHELL_SIDEBAR (cal_shell_sidebar);
 	shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
 	shell_content = e_shell_view_get_shell_content (shell_view);
 
 	source = e_cal_get_source (client);
-	source_group = e_source_peek_group (source);
+
+	node = e_source_get_node (source);
+	g_return_if_fail (node != NULL);
+	g_return_if_fail (node->parent != NULL);
+
+	parent = E_SOURCE (node->parent->data);
+
+	parent_display_name = e_source_get_display_name (parent);
+	source_display_name = e_source_get_display_name (source);
 
 	e_alert_submit (
-		E_ALERT_SINK (shell_content),
-		"calendar:backend-error",
-		e_source_group_peek_name (source_group),
-		e_source_peek_name (source), message, NULL);
+		E_ALERT_SINK (shell_content), "calendar:backend-error",
+		parent_display_name, source_display_name, message, NULL);
 }
 
 static void
@@ -305,7 +315,7 @@ cal_shell_sidebar_set_default (ECalShellSidebar *cal_shell_sidebar,
 		priv->loading_default_client = NULL;
 	}
 
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 	client = g_hash_table_lookup (priv->client_table, uid);
 
 	/* If we already have an open connection for
@@ -354,38 +364,6 @@ cal_shell_sidebar_row_changed_cb (ECalShellSidebar *cal_shell_sidebar,
 }
 
 static void
-cal_shell_sidebar_selection_changed_cb (ECalShellSidebar *cal_shell_sidebar,
-                                        ESourceSelector *selector)
-{
-	EShellView *shell_view;
-	EShellBackend *shell_backend;
-	EShellSidebar *shell_sidebar;
-	GSList *list, *iter;
-
-	/* This signal is emitted less frequently than "row-changed",
-	 * especially when the model is being rebuilt.  So we'll take
-	 * it easy on poor GConf. */
-
-	shell_sidebar = E_SHELL_SIDEBAR (cal_shell_sidebar);
-	shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
-	shell_backend = e_shell_view_get_shell_backend (shell_view);
-
-	list = e_source_selector_get_selection (selector);
-
-	for (iter = list; iter != NULL; iter = iter->next) {
-		ESource *source = iter->data;
-
-		iter->data = (gpointer) e_source_peek_uid (source);
-		g_object_unref (source);
-	}
-
-	e_cal_shell_backend_set_selected_calendars (
-		E_CAL_SHELL_BACKEND (shell_backend), list);
-
-	g_slist_free (list);
-}
-
-static void
 cal_shell_sidebar_primary_selection_changed_cb (ECalShellSidebar *cal_shell_sidebar,
                                                 ESourceSelector *selector)
 {
@@ -407,12 +385,10 @@ cal_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
 	EShell *shell;
 	EShellBackend *shell_backend;
 	EShellSettings *shell_settings;
+	ESourceRegistry *registry;
 	ESourceSelector *selector;
-	ESourceList *source_list;
-	ESource *source;
 	GConfBridge *bridge;
 	GtkTreeModel *model;
-	GSList *list, *iter;
 	GObject *object;
 	const gchar *key;
 
@@ -427,8 +403,7 @@ cal_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
 	selector = E_SOURCE_SELECTOR (priv->selector);
 	model = gtk_tree_view_get_model (GTK_TREE_VIEW (selector));
 
-	source_list = e_cal_shell_backend_get_source_list (
-		E_CAL_SHELL_BACKEND (shell_backend));
+	registry = e_source_registry_get_default ();
 
 	g_signal_connect_swapped (
 		model, "row-changed",
@@ -447,31 +422,9 @@ cal_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
 		G_BINDING_SYNC_CREATE,
 		(GBindingTransformFunc) e_binding_transform_uid_to_source,
 		(GBindingTransformFunc) e_binding_transform_source_to_uid,
-		g_object_ref (source_list),
+		g_object_ref (registry),
 		(GDestroyNotify) g_object_unref);
 
-	list = e_cal_shell_backend_get_selected_calendars (
-		E_CAL_SHELL_BACKEND (shell_backend));
-
-	for (iter = list; iter != NULL; iter = iter->next) {
-		const gchar *uid = iter->data;
-
-		source = e_source_list_peek_source_by_uid (source_list, uid);
-
-		if (source != NULL)
-			e_source_selector_select_source (selector, source);
-	}
-
-	g_slist_foreach (list, (GFunc) g_free, NULL);
-	g_slist_free (list);
-
-	/* Listen for subsequent changes to the selector. */
-
-	g_signal_connect_swapped (
-		selector, "selection-changed",
-		G_CALLBACK (cal_shell_sidebar_selection_changed_cb),
-		shell_sidebar);
-
 	/* Bind GObject properties to GConf keys. */
 
 	bridge = gconf_bridge_get ();
@@ -535,6 +488,11 @@ cal_shell_sidebar_dispose (GObject *object)
 		priv->date_navigator = NULL;
 	}
 
+	if (priv->new_calendar_button != NULL) {
+		g_object_unref (priv->new_calendar_button);
+		priv->new_calendar_button = NULL;
+	}
+
 	if (priv->default_client != NULL) {
 		g_object_unref (priv->default_client);
 		priv->default_client = NULL;
@@ -566,19 +524,6 @@ cal_shell_sidebar_finalize (GObject *object)
 }
 
 static void
-new_calendar_clicked (GtkButton *button,
-                      EShellSidebar *shell_sidebar)
-{
-	EShellView *shell_view;
-	EShellWindow *shell_window;
-
-	shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
-	shell_window = e_shell_view_get_shell_window (shell_view);
-
-	calendar_setup_new_calendar (GTK_WINDOW (shell_window));
-}
-
-static void
 cal_shell_sidebar_constructed (GObject *object)
 {
 	ECalShellSidebarPrivate *priv;
@@ -588,7 +533,7 @@ cal_shell_sidebar_constructed (GObject *object)
 	EShellBackend *shell_backend;
 	EShellSidebar *shell_sidebar;
 	EShellSettings *shell_settings;
-	ESourceList *source_list;
+	ESourceRegistry *registry;
 	ECalendarItem *calitem;
 	GtkWidget *container;
 	GtkWidget *widget;
@@ -607,9 +552,6 @@ cal_shell_sidebar_constructed (GObject *object)
 	shell = e_shell_backend_get_shell (shell_backend);
 	shell_settings = e_shell_get_shell_settings (shell);
 
-	source_list = e_cal_shell_backend_get_source_list (
-		E_CAL_SHELL_BACKEND (shell_backend));
-
 	container = GTK_WIDGET (shell_sidebar);
 
 	widget = e_paned_new (GTK_ORIENTATION_VERTICAL);
@@ -619,34 +561,36 @@ cal_shell_sidebar_constructed (GObject *object)
 
 	container = widget;
 
+	widget = gtk_vbox_new (FALSE, 6);
+	gtk_paned_pack1 (GTK_PANED (container), widget, TRUE, TRUE);
+	gtk_widget_show (widget);
+
+	container = widget;
+
+	/* "New Calendar" button is only shown in express mode.
+	 * ECalShellView will bind the button to an appropriate
+	 * GtkAction so we don't have to reimplement it here. */
+	if (e_shell_get_express_mode (shell)) {
+		widget = gtk_button_new ();
+		gtk_box_pack_end (
+			GTK_BOX (container), widget, FALSE, FALSE, 0);
+		priv->new_calendar_button = g_object_ref (widget);
+		gtk_widget_show (widget);
+	}
+
 	widget = gtk_scrolled_window_new (NULL, NULL);
 	gtk_scrolled_window_set_policy (
 		GTK_SCROLLED_WINDOW (widget),
 		GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
 	gtk_scrolled_window_set_shadow_type (
 		GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
-	if (!e_shell_get_express_mode (shell)) {
-		gtk_paned_pack1 (GTK_PANED (container), widget, TRUE, TRUE);
-	} else {
-		GtkWidget *button;
-
-		container = gtk_vbox_new (FALSE, 6);
-		gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
-
-		button = gtk_button_new_with_mnemonic (_("_New Calendar..."));
-		gtk_box_pack_start (GTK_BOX (container), button, FALSE, FALSE, 0);
-		g_signal_connect (
-			button, "clicked",
-			G_CALLBACK (new_calendar_clicked), shell_sidebar);
-
-		gtk_paned_pack1 (GTK_PANED (priv->paned), container, TRUE, TRUE);
-		gtk_widget_show_all (container);
-	}
+	gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
 	gtk_widget_show (widget);
 
 	container = widget;
 
-	widget = e_calendar_selector_new (source_list);
+	registry = e_source_registry_get_default ();
+	widget = e_calendar_selector_new (registry);
 	e_source_selector_set_select_new (E_SOURCE_SELECTOR (widget), TRUE);
 	gtk_container_add (GTK_CONTAINER (container), widget);
 	a11y = gtk_widget_get_accessible (widget);
@@ -698,20 +642,23 @@ cal_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
 	source = e_source_selector_get_primary_selection (selector);
 
 	if (source != NULL) {
+		ESourceSelectable *extension;
 		ECal *client;
-		const gchar *uri;
-		const gchar *delete;
+		gboolean writable_hint;
+		const gchar *uid;
+
+		uid = e_source_get_uid (source);
+		is_system = (g_strcmp0 (uid, "system") == 0);
 
-		uri = e_source_peek_relative_uri (source);
-		is_system = (uri == NULL || strcmp (uri, "system") == 0);
+		extension = e_source_get_extension (
+			source, E_SOURCE_EXTENSION_CALENDAR);
+		writable_hint =
+			e_source_selectable_get_writable_hint (extension);
 
-		can_delete = !is_system;
-		delete = e_source_get_property (source, "delete");
-		can_delete &= (delete == NULL || strcmp (delete, "no") != 0);
+		can_delete = !is_system && writable_hint;
 
 		client = g_hash_table_lookup (
-			cal_shell_sidebar->priv->client_table,
-			e_source_peek_uid (source));
+			cal_shell_sidebar->priv->client_table, uid);
 		refresh_supported =
 			client && e_cal_get_refresh_supported (client);
 	}
@@ -745,8 +692,7 @@ cal_shell_sidebar_client_removed (ECalShellSidebar *cal_shell_sidebar,
 		NULL, NULL, cal_shell_sidebar);
 
 	source = e_cal_get_source (client);
-	uid = e_source_peek_uid (source);
-	g_return_if_fail (uid != NULL);
+	uid = e_source_get_uid (source);
 
 	g_hash_table_remove (client_table, uid);
 	e_source_selector_unselect_source (selector, source);
@@ -922,6 +868,15 @@ e_cal_shell_sidebar_get_default_client (ECalShellSidebar *cal_shell_sidebar)
 	return cal_shell_sidebar->priv->default_client;
 }
 
+GtkWidget *
+e_cal_shell_sidebar_get_new_calendar_button (ECalShellSidebar *cal_shell_sidebar)
+{
+	g_return_val_if_fail (
+		E_IS_CAL_SHELL_SIDEBAR (cal_shell_sidebar), NULL);
+
+	return cal_shell_sidebar->priv->new_calendar_button;
+}
+
 ESourceSelector *
 e_cal_shell_sidebar_get_selector (ECalShellSidebar *cal_shell_sidebar)
 {
@@ -946,8 +901,8 @@ e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar,
 	ECal *default_client;
 	ECal *client;
 	icaltimezone *timezone;
+	const gchar *display_name;
 	const gchar *uid;
-	const gchar *uri;
 	gchar *message;
 
 	g_return_if_fail (E_IS_CAL_SHELL_SIDEBAR (cal_shell_sidebar));
@@ -958,7 +913,7 @@ e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar,
 	default_client = cal_shell_sidebar->priv->default_client;
 	selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
 
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 	client = g_hash_table_lookup (client_table, uid);
 
 	if (client != NULL)
@@ -969,7 +924,7 @@ e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar,
 		const gchar *default_uid;
 
 		default_source = e_cal_get_source (default_client);
-		default_uid = e_source_peek_uid (default_source);
+		default_uid = e_source_get_uid (default_source);
 
 		if (g_strcmp0 (uid, default_uid) == 0)
 			client = g_object_ref (default_client);
@@ -993,9 +948,8 @@ e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar,
 	g_hash_table_insert (client_table, g_strdup (uid), client);
 	e_source_selector_select_source (selector, source);
 
-	uri = e_cal_get_uri (client);
-	/* Translators: The string field is a URI. */
-	message = g_strdup_printf (_("Opening calendar at %s"), uri);
+	display_name = e_source_get_display_name (source);
+	message = g_strdup_printf (_("Opening calendar '%s'"), display_name);
 	cal_shell_sidebar_emit_status_message (cal_shell_sidebar, message);
 	g_free (message);
 
@@ -1031,7 +985,7 @@ e_cal_shell_sidebar_remove_source (ECalShellSidebar *cal_shell_sidebar,
 
 	client_table = cal_shell_sidebar->priv->client_table;
 
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 	client = g_hash_table_lookup (client_table, uid);
 
 	if (client == NULL)
diff --git a/modules/calendar/e-cal-shell-sidebar.h b/modules/calendar/e-cal-shell-sidebar.h
index 6919d7a..c9b6945 100644
--- a/modules/calendar/e-cal-shell-sidebar.h
+++ b/modules/calendar/e-cal-shell-sidebar.h
@@ -88,6 +88,8 @@ ECalendar *	e_cal_shell_sidebar_get_date_navigator
 					(ECalShellSidebar *cal_shell_sidebar);
 ECal *		e_cal_shell_sidebar_get_default_client
 					(ECalShellSidebar *cal_shell_sidebar);
+GtkWidget *	e_cal_shell_sidebar_get_new_calendar_button
+					(ECalShellSidebar *cal_shell_sidebar);
 ESourceSelector *
 		e_cal_shell_sidebar_get_selector
 					(ECalShellSidebar *cal_shell_sidebar);
diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c
index 5e16b6d..4e59c45 100644
--- a/modules/calendar/e-cal-shell-view-actions.c
+++ b/modules/calendar/e-cal-shell-view-actions.c
@@ -54,33 +54,16 @@ static void
 action_calendar_delete_cb (GtkAction *action,
                            ECalShellView *cal_shell_view)
 {
-	ECalShellContent *cal_shell_content;
 	ECalShellSidebar *cal_shell_sidebar;
-	EShellBackend *shell_backend;
 	EShellWindow *shell_window;
 	EShellView *shell_view;
-	ECalendarView *calendar_view;
-	GnomeCalendarViewType view_type;
-	GnomeCalendar *calendar;
-	ECalModel *model;
-	ECal *client;
 	ESourceSelector *selector;
-	ESourceGroup *source_group;
-	ESourceList *source_list;
 	ESource *source;
+	GFile *file;
 	gint response;
-	gchar *uri;
-	GError *error = NULL;
 
 	shell_view = E_SHELL_VIEW (cal_shell_view);
 	shell_window = e_shell_view_get_shell_window (shell_view);
-	shell_backend = e_shell_view_get_shell_backend (shell_view);
-
-	cal_shell_content = cal_shell_view->priv->cal_shell_content;
-	calendar = e_cal_shell_content_get_calendar (cal_shell_content);
-	view_type = gnome_calendar_get_view (calendar);
-	calendar_view = gnome_calendar_get_calendar_view (calendar, view_type);
-	model = e_calendar_view_get_model (calendar_view);
 
 	cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar;
 	selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
@@ -91,39 +74,14 @@ action_calendar_delete_cb (GtkAction *action,
 	response = e_alert_run_dialog_for_args (
 		GTK_WINDOW (shell_window),
 		"calendar:prompt-delete-calendar",
-		e_source_peek_name (source), NULL);
-	if (response != GTK_RESPONSE_YES)
-		return;
+		e_source_get_display_name (source), NULL);
 
-	uri = e_source_get_uri (source);
-	client = e_cal_model_get_client_for_uri (model, uri);
-	if (client == NULL)
-		client = e_cal_new_from_uri (uri, E_CAL_SOURCE_TYPE_EVENT);
-	g_free (uri);
-
-	g_return_if_fail (client != NULL);
-
-	if (!e_cal_remove (client, &error)) {
-		g_warning ("%s", error->message);
-		g_error_free (error);
+	if (response != GTK_RESPONSE_YES)
 		return;
-	}
 
-	if (e_source_selector_source_is_selected (selector, source)) {
-		e_cal_shell_sidebar_remove_source (
-			cal_shell_sidebar, source);
-		e_source_selector_unselect_source (selector, source);
-	}
-
-	source_group = e_source_peek_group (source);
-	e_source_group_remove_source (source_group, source);
-
-	source_list = e_cal_shell_backend_get_source_list (
-		E_CAL_SHELL_BACKEND (shell_backend));
-	if (!e_source_list_sync (source_list, &error)) {
-		g_warning ("%s", error->message);
-		g_error_free (error);
-	}
+	/* FIXME Handle errors. */
+	file = e_source_get_file (source);
+	g_file_delete (file, NULL, NULL);
 }
 
 static void
@@ -189,10 +147,30 @@ action_calendar_new_cb (GtkAction *action,
 {
 	EShellView *shell_view;
 	EShellWindow *shell_window;
+	ESourceRegistry *registry;
+	ECalSourceType source_type;
+	GtkWidget *config;
+	GtkWidget *dialog;
+	const gchar *icon_name;
 
 	shell_view = E_SHELL_VIEW (cal_shell_view);
 	shell_window = e_shell_view_get_shell_window (shell_view);
-	calendar_setup_new_calendar (GTK_WINDOW (shell_window));
+
+	source_type = E_CAL_SOURCE_TYPE_EVENT;
+	registry = e_source_registry_get_default ();
+	config = e_cal_source_config_new (registry, NULL, source_type);
+
+	dialog = e_source_config_dialog_new (
+		E_SOURCE_CONFIG (config), GTK_WINDOW (shell_window));
+
+	icon_name = gtk_action_get_icon_name (action);
+	gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name);
+
+	gtk_window_set_title (GTK_WINDOW (dialog), _("New Calendar"));
+
+	gtk_dialog_run (GTK_DIALOG (dialog));
+
+	gtk_widget_destroy (dialog);
 }
 
 static void
@@ -257,11 +235,16 @@ static void
 action_calendar_properties_cb (GtkAction *action,
                                ECalShellView *cal_shell_view)
 {
-	ECalShellSidebar *cal_shell_sidebar;
 	EShellView *shell_view;
 	EShellWindow *shell_window;
+	ECalShellSidebar *cal_shell_sidebar;
+	ECalSourceType source_type;
 	ESource *source;
 	ESourceSelector *selector;
+	ESourceRegistry *registry;
+	GtkWidget *config;
+	GtkWidget *dialog;
+	const gchar *icon_name;
 
 	shell_view = E_SHELL_VIEW (cal_shell_view);
 	shell_window = e_shell_view_get_shell_window (shell_view);
@@ -269,12 +252,23 @@ action_calendar_properties_cb (GtkAction *action,
 	cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar;
 	selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
 	source = e_source_selector_get_primary_selection (selector);
-	g_return_if_fail (E_IS_SOURCE (source));
+	g_return_if_fail (source != NULL);
+
+	source_type = E_CAL_SOURCE_TYPE_EVENT;
+	registry = e_source_selector_get_registry (selector);
+	config = e_cal_source_config_new (registry, source, source_type);
 
-	/* XXX Does this -really- need a source group parameter? */
-	calendar_setup_edit_calendar (
-		GTK_WINDOW (shell_window), source,
-		e_source_peek_group (source));
+	dialog = e_source_config_dialog_new (
+		E_SOURCE_CONFIG (config), GTK_WINDOW (shell_window));
+
+	icon_name = gtk_action_get_icon_name (action);
+	gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name);
+
+	gtk_window_set_title (GTK_WINDOW (dialog), _("Calendar Properties"));
+
+	gtk_dialog_run (GTK_DIALOG (dialog));
+
+	gtk_widget_destroy (dialog);
 }
 
 static void
@@ -361,7 +355,6 @@ action_calendar_refresh_cb (GtkAction *action,
 	ECal *client;
 	ECalModel *model;
 	ESource *source;
-	gchar *uri;
 	GError *error = NULL;
 
 	cal_shell_content = cal_shell_view->priv->cal_shell_content;
@@ -373,10 +366,7 @@ action_calendar_refresh_cb (GtkAction *action,
 	source = e_source_selector_get_primary_selection (selector);
 	g_return_if_fail (E_IS_SOURCE (source));
 
-	uri = e_source_get_uri (source);
-	client = e_cal_model_get_client_for_uri (model, uri);
-	g_free (uri);
-
+	client = e_cal_model_get_client_for_source (model, source);
 	if (client == NULL)
 		return;
 
@@ -385,7 +375,7 @@ action_calendar_refresh_cb (GtkAction *action,
 	if (!e_cal_refresh (client, &error) && error) {
 		g_warning (
 			"%s: Failed to refresh '%s', %s\n",
-			G_STRFUNC, e_source_peek_name (source),
+			G_STRFUNC, e_source_get_display_name (source),
 			error->message);
 		g_error_free (error);
 	}
diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c
index 61aff5a..88a647b 100644
--- a/modules/calendar/e-cal-shell-view-private.c
+++ b/modules/calendar/e-cal-shell-view-private.c
@@ -503,6 +503,7 @@ e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view)
 	EMemoTable *memo_table;
 	ETaskTable *task_table;
 	ESourceSelector *selector;
+	GtkWidget *widget;
 	ECalModel *model;
 	gint ii;
 
@@ -530,10 +531,13 @@ e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view)
 	selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
 	date_navigator = e_cal_shell_sidebar_get_date_navigator (cal_shell_sidebar);
 
-	/* Give GnomeCalendar a handle to the date navigator, memo and task table. */
 	gnome_calendar_set_date_navigator (calendar, date_navigator);
-	gnome_calendar_set_memo_table (calendar, memo_table ? GTK_WIDGET (memo_table) : NULL);
-	gnome_calendar_set_task_table (calendar, task_table ? GTK_WIDGET (task_table) : NULL);
+	if (memo_table != NULL)
+		gnome_calendar_set_memo_table (
+			calendar, GTK_WIDGET (memo_table));
+	if (task_table != NULL)
+		gnome_calendar_set_task_table (
+			calendar, GTK_WIDGET (task_table));
 
 	e_calendar_item_set_get_time_callback (
 		date_navigator->calitem, (ECalendarItemGetTimeCallback)
@@ -652,6 +656,13 @@ e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view)
 	e_cal_shell_view_update_search_filter (cal_shell_view);
 	e_cal_shell_view_update_timezone (cal_shell_view);
 
+	/* Express mode only: Bind the "New Calendar"
+	 * sidebar button to the appropriate action. */
+	widget = e_cal_shell_sidebar_get_new_calendar_button (cal_shell_sidebar);
+	if (widget != NULL)
+		gtk_activatable_set_related_action (
+			GTK_ACTIVATABLE (widget), ACTION (CALENDAR_NEW));
+
 	/* Keep the ECalModel in sync with the sidebar. */
 	g_object_bind_property (
 		shell_sidebar, "default-client",
@@ -675,12 +686,9 @@ e_cal_shell_view_private_dispose (ECalShellView *cal_shell_view)
 	ECalShellViewPrivate *priv = cal_shell_view->priv;
 	gint i;
 
-	/* Calling calendar's save state from here, because it is too late in its dispose */
-	if (priv->cal_shell_content)
-		e_cal_shell_content_save_state (priv->cal_shell_content);
-
-	/* Calling calendar's save state from here, because it is too late in its dispose */
-	if (priv->cal_shell_content)
+	/* Calling ECalShellContent's save state from here,
+	 * because it is too late in its own dispose(). */
+	if (priv->cal_shell_content != NULL)
 		e_cal_shell_content_save_state (priv->cal_shell_content);
 
 	DISPOSE (priv->cal_shell_backend);
diff --git a/modules/calendar/e-cal-shell-view-private.h b/modules/calendar/e-cal-shell-view-private.h
index 0f92350..6e5976f 100644
--- a/modules/calendar/e-cal-shell-view-private.h
+++ b/modules/calendar/e-cal-shell-view-private.h
@@ -39,19 +39,20 @@
 #include "shell/e-shell-utils.h"
 #include "misc/e-popup-action.h"
 #include "misc/e-selectable.h"
+#include "misc/e-source-config-dialog.h"
 
 #include "calendar/common/authentication.h"
 #include "calendar/gui/calendar-config.h"
 #include "calendar/gui/comp-util.h"
 #include "calendar/gui/e-cal-list-view.h"
 #include "calendar/gui/e-cal-model-tasks.h"
+#include "calendar/gui/e-cal-source-config.h"
 #include "calendar/gui/e-calendar-view.h"
 #include "calendar/gui/e-day-view.h"
 #include "calendar/gui/e-week-view.h"
 #include "calendar/gui/gnome-cal.h"
 #include "calendar/gui/goto.h"
 #include "calendar/gui/print.h"
-#include "calendar/gui/dialogs/calendar-setup.h"
 #include "calendar/gui/dialogs/copy-source-dialog.h"
 #include "calendar/gui/dialogs/event-editor.h"
 #include "calendar/gui/dialogs/memo-editor.h"
diff --git a/modules/calendar/e-calendar-preferences.c b/modules/calendar/e-calendar-preferences.c
index 9db9f45..4607060 100644
--- a/modules/calendar/e-calendar-preferences.c
+++ b/modules/calendar/e-calendar-preferences.c
@@ -31,6 +31,7 @@
 #include "calendar/gui/e-cal-config.h"
 #include "calendar/gui/e-timezone-entry.h"
 #include "calendar/gui/calendar-config.h"
+#include "widgets/misc/e-alarm-selector.h"
 #include "widgets/misc/e-dateedit.h"
 #include "e-util/e-util.h"
 #include "e-util/e-datetime-format.h"
@@ -329,49 +330,6 @@ notify_with_tray_toggled (GtkToggleButton *toggle, ECalendarPreferences *prefs)
 }
 
 static void
-alarms_selection_changed (ESourceSelector *selector, ECalendarPreferences *prefs)
-{
-	ESourceList *source_list = prefs->alarms_list;
-	GSList *selection;
-	GSList *l;
-	GSList *groups;
-	ESource *source;
-	const gchar *alarm;
-
-	/* first we clear all the alarm flags from all sources */
-	for (groups = e_source_list_peek_groups (source_list); groups; groups = groups->next) {
-		ESourceGroup *group = E_SOURCE_GROUP (groups->data);
-		GSList *sources;
-		for (sources = e_source_group_peek_sources (group); sources; sources = sources->next) {
-			source = E_SOURCE (sources->data);
-
-			alarm = e_source_get_property (source, "alarm");
-			if (alarm && !g_ascii_strcasecmp (alarm, "never"))
-				continue;
-
-			e_source_set_property (source, "alarm", "false");
-		}
-	}
-
-	/* then we loop over the selector's selection, setting the
-	   property on those sources */
-	selection = e_source_selector_get_selection (selector);
-	for (l = selection; l; l = l->next) {
-		source = E_SOURCE (l->data);
-
-		alarm = (gchar *)e_source_get_property (source, "alarm");
-		if (alarm && !g_ascii_strcasecmp (alarm, "never"))
-			continue;
-
-		e_source_set_property (E_SOURCE (l->data), "alarm", "true");
-	}
-	e_source_selector_free_selection (selection);
-
-	/* FIXME show an error if this fails? */
-	e_source_list_sync (source_list, NULL);
-}
-
-static void
 update_system_tz_widgets (EShellSettings *shell_settings,
                           GParamSpec *pspec,
                           ECalendarPreferences *prefs)
@@ -404,41 +362,22 @@ setup_changes (ECalendarPreferences *prefs)
 	g_signal_connect (G_OBJECT (prefs->end_of_day), "changed", G_CALLBACK (end_of_day_changed), prefs);
 
 	g_signal_connect (G_OBJECT (prefs->notify_with_tray), "toggled", G_CALLBACK (notify_with_tray_toggled), prefs);
-	g_signal_connect (G_OBJECT (prefs->alarm_list_widget), "selection_changed", G_CALLBACK (alarms_selection_changed), prefs);
-}
-
-static void
-initialize_selection (ESourceSelector *selector, ESourceList *source_list)
-{
-	GSList *groups;
-
-	for (groups = e_source_list_peek_groups (source_list); groups; groups = groups->next) {
-		ESourceGroup *group = E_SOURCE_GROUP (groups->data);
-		GSList *sources;
-		for (sources = e_source_group_peek_sources (group); sources; sources = sources->next) {
-			ESource *source = E_SOURCE (sources->data);
-			const gchar *completion = e_source_get_property (source, "alarm");
-			if (!completion  || !g_ascii_strcasecmp (completion, "true")) {
-				if (!completion)
-					e_source_set_property (E_SOURCE (source), "alarm", "true");
-				e_source_selector_select_source (selector, source);
-			}
-		}
-	}
 }
 
 static void
 show_alarms_config (ECalendarPreferences *prefs)
 {
+	ESourceRegistry *registry;
 	GConfClient *gconf;
+	GtkWidget *widget;
 
-	if (e_cal_get_sources (&prefs->alarms_list, E_CAL_SOURCE_TYPE_EVENT, NULL)) {
-		prefs->alarm_list_widget = e_source_selector_new (prefs->alarms_list);
-		atk_object_set_name (gtk_widget_get_accessible (prefs->alarm_list_widget), _("Selected Calendars for Alarms"));
-		gtk_container_add (GTK_CONTAINER (prefs->scrolled_window), prefs->alarm_list_widget);
-		gtk_widget_show (prefs->alarm_list_widget);
-		initialize_selection (E_SOURCE_SELECTOR (prefs->alarm_list_widget), prefs->alarms_list);
-	}
+	registry = e_source_registry_get_default ();
+	widget = e_alarm_selector_new (registry);
+	atk_object_set_name (
+		gtk_widget_get_accessible (widget),
+		_("Selected Calendars for Alarms"));
+	gtk_container_add (GTK_CONTAINER (prefs->scrolled_window), widget);
+	gtk_widget_show (widget);
 
 	gconf = gconf_client_get_default ();
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prefs->notify_with_tray), gconf_client_get_bool (gconf, "/apps/evolution/calendar/notify/notify_with_tray", NULL));
diff --git a/modules/calendar/e-calendar-preferences.h b/modules/calendar/e-calendar-preferences.h
index ae96fc1..c8f5fe5 100644
--- a/modules/calendar/e-calendar-preferences.h
+++ b/modules/calendar/e-calendar-preferences.h
@@ -71,8 +71,6 @@ struct _ECalendarPreferences {
 	/* Alarms tab */
 	GtkWidget *notify_with_tray;
 	GtkWidget *scrolled_window;
-	ESourceList *alarms_list;
-	GtkWidget *alarm_list_widget;
 };
 
 struct _ECalendarPreferencesClass {
diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c
index 488f300..5de5674 100644
--- a/modules/calendar/e-memo-shell-backend.c
+++ b/modules/calendar/e-memo-shell-backend.c
@@ -24,19 +24,19 @@
 #include <string.h>
 #include <glib/gi18n.h>
 #include <libecal/e-cal.h>
+#include <libecal/e-source-calendar.h>
 #include <libedataserver/e-url.h>
 #include <libedataserver/e-source.h>
-#include <libedataserver/e-source-list.h>
-#include <libedataserver/e-source-group.h>
 
 #include "shell/e-shell.h"
 #include "shell/e-shell-backend.h"
 #include "shell/e-shell-window.h"
+#include "widgets/misc/e-source-config-dialog.h"
 
 #include "calendar/common/authentication.h"
 #include "calendar/gui/comp-util.h"
-#include "calendar/gui/dialogs/calendar-setup.h"
 #include "calendar/gui/dialogs/memo-editor.h"
+#include "calendar/gui/e-cal-source-config.h"
 
 #include "e-memo-shell-migrate.h"
 #include "e-memo-shell-view.h"
@@ -45,116 +45,13 @@
 #define PERSONAL_RELATIVE_URI	"system"
 
 struct _EMemoShellBackendPrivate {
-	ESourceList *source_list;
-};
-
-enum {
-	PROP_0,
-	PROP_SOURCE_LIST
+	gint placeholder;
 };
 
 static gpointer parent_class;
 static GType memo_shell_backend_type;
 
 static void
-memo_shell_backend_ensure_sources (EShellBackend *shell_backend)
-{
-	/* XXX This is basically the same algorithm across all modules.
-	 *     Maybe we could somehow integrate this into EShellBackend? */
-
-	EMemoShellBackend *memo_shell_backend;
-	ESourceGroup *on_this_computer;
-	ESourceList *source_list;
-	ESource *personal;
-	EShell *shell;
-	EShellSettings *shell_settings;
-	GSList *sources, *iter;
-	const gchar *name;
-	gboolean save_list = FALSE;
-
-	personal = NULL;
-
-	memo_shell_backend = E_MEMO_SHELL_BACKEND (shell_backend);
-
-	shell = e_shell_backend_get_shell (shell_backend);
-	shell_settings = e_shell_get_shell_settings (shell);
-
-	if (!e_cal_get_sources (
-		&memo_shell_backend->priv->source_list,
-		E_CAL_SOURCE_TYPE_JOURNAL, NULL)) {
-		g_warning ("Could not get memo sources from GConf!");
-		return;
-	}
-
-	source_list = memo_shell_backend->priv->source_list;
-
-	on_this_computer = e_source_list_ensure_group (
-		source_list, _("On This Computer"), "local:", TRUE);
-	e_source_list_ensure_group (
-		source_list, _("On The Web"), "webcal://", FALSE);
-
-	g_return_if_fail (on_this_computer);
-
-	sources = e_source_group_peek_sources (on_this_computer);
-
-	/* Make sure this group includes a "Personal" source. */
-	for (iter = sources; iter != NULL; iter = iter->next) {
-		ESource *source = iter->data;
-		const gchar *relative_uri;
-
-		relative_uri = e_source_peek_relative_uri (source);
-		if (g_strcmp0 (relative_uri, "system") == 0) {
-			personal = source;
-			break;
-		}
-	}
-
-	name = _("Personal");
-
-	if (personal == NULL) {
-		ESource *source;
-		GSList *selected;
-		gchar *primary;
-
-		source = e_source_new (name, "system");
-		e_source_set_color_spec (source, "#BECEDD");
-		e_source_group_add_source (on_this_computer, source, -1);
-		g_object_unref (source);
-		save_list = TRUE;
-
-		primary = e_shell_settings_get_string (
-			shell_settings, "cal-primary-memo-list");
-
-		selected = e_memo_shell_backend_get_selected_memo_lists (
-			memo_shell_backend);
-
-		if (primary == NULL && selected == NULL) {
-			const gchar *uid;
-
-			uid = e_source_peek_uid (source);
-			selected = g_slist_prepend (NULL, g_strdup (uid));
-
-			e_shell_settings_set_string (
-				shell_settings, "cal-primary-memo-list", uid);
-			e_memo_shell_backend_set_selected_memo_lists (
-				memo_shell_backend, selected);
-		}
-
-		g_slist_foreach (selected, (GFunc) g_free, NULL);
-		g_slist_free (selected);
-		g_free (primary);
-	} else {
-		/* Force the source name to the current locale. */
-		e_source_set_name (personal, name);
-	}
-
-	g_object_unref (on_this_computer);
-
-	if (save_list)
-		e_source_list_sync (source_list, NULL);
-}
-
-static void
 memo_shell_backend_new_memo (ESource *source,
                              GAsyncResult *result,
                              EShell *shell,
@@ -214,37 +111,19 @@ action_memo_new_cb (GtkAction *action,
                     EShellWindow *shell_window)
 {
 	EShell *shell;
-	EShellBackend *shell_backend;
-	EShellSettings *shell_settings;
-	ESource *source = NULL;
-	ESourceList *source_list;
+	ESource *source;
+	ESourceRegistry *registry;
 	ECalSourceType source_type;
 	const gchar *action_name;
-	gchar *uid;
 
 	/* This callback is used for both memos and shared memos. */
 
 	source_type = E_CAL_SOURCE_TYPE_JOURNAL;
 
 	shell = e_shell_window_get_shell (shell_window);
-	shell_settings = e_shell_get_shell_settings (shell);
-	shell_backend = e_shell_get_backend_by_name (shell, "memos");
-
-	g_object_get (shell_backend, "source-list", &source_list, NULL);
-	g_return_if_fail (E_IS_SOURCE_LIST (source_list));
 
-	uid = e_shell_settings_get_string (
-		shell_settings, "cal-primary-memo-list");
-
-	if (uid != NULL) {
-		source = e_source_list_peek_source_by_uid (source_list, uid);
-		g_free (uid);
-	}
-
-	if (source == NULL)
-		source = e_source_list_peek_default_source (source_list);
-
-	g_return_if_fail (E_IS_SOURCE (source));
+	registry = e_source_registry_get_default ();
+	source = e_source_registry_get_default_memo_list (registry);
 
 	/* Use a callback function appropriate for the action.
 	 * FIXME Need to obtain a better default time zone. */
@@ -263,15 +142,33 @@ action_memo_new_cb (GtkAction *action,
 			NULL, (GAsyncReadyCallback)
 			memo_shell_backend_memo_new_cb,
 			g_object_ref (shell));
-
-	g_object_unref (source_list);
 }
 
 static void
 action_memo_list_new_cb (GtkAction *action,
                          EShellWindow *shell_window)
 {
-	calendar_setup_new_memo_list (GTK_WINDOW (shell_window));
+	ECalSourceType source_type;
+	ESourceRegistry *registry;
+	GtkWidget *config;
+	GtkWidget *dialog;
+	const gchar *icon_name;
+
+	source_type = E_CAL_SOURCE_TYPE_JOURNAL;
+	registry = e_source_registry_get_default ();
+	config = e_cal_source_config_new (registry, NULL, source_type);
+
+	dialog = e_source_config_dialog_new (
+		E_SOURCE_CONFIG (config), GTK_WINDOW (shell_window));
+
+	icon_name = gtk_action_get_icon_name (action);
+	gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name);
+
+	gtk_window_set_title (GTK_WINDOW (dialog), _("New Memo List"));
+
+	gtk_dialog_run (GTK_DIALOG (dialog));
+
+	gtk_widget_destroy (dialog);
 }
 
 static GtkActionEntry item_entries[] = {
@@ -311,7 +208,7 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
 	ECal *client;
 	ECalComponent *comp;
 	ESource *source;
-	ESourceList *source_list;
+	ESourceRegistry *registry;
 	ECalSourceType source_type;
 	EUri *euri;
 	icalcomponent *icalcomp;
@@ -375,15 +272,10 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
 	 * we successfully open it is another matter... */
 	handled = TRUE;
 
-	if (!e_cal_get_sources (&source_list, source_type, NULL)) {
-		g_printerr ("Could not get memo sources from GConf!\n");
-		goto exit;
-	}
-
-	source = e_source_list_peek_source_by_uid (source_list, source_uid);
+	registry = e_source_registry_get_default ();
+	source = e_source_registry_lookup_by_uid (registry, source_uid);
 	if (source == NULL) {
 		g_printerr ("No source for UID '%s'\n", source_uid);
-		g_object_unref (source_list);
 		goto exit;
 	}
 
@@ -393,7 +285,6 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
 			g_printerr ("%s\n", error->message);
 			g_error_free (error);
 		}
-		g_object_unref (source_list);
 		goto exit;
 	}
 
@@ -407,7 +298,6 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
 
 	if (!e_cal_get_object (client, comp_uid, comp_rid, &icalcomp, &error)) {
 		g_printerr ("%s\n", error->message);
-		g_object_unref (source_list);
 		g_error_free (error);
 		goto exit;
 	}
@@ -429,7 +319,6 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
 present:
 	gtk_window_present (GTK_WINDOW (editor));
 
-	g_object_unref (source_list);
 	g_object_unref (client);
 
 exit:
@@ -463,40 +352,6 @@ memo_shell_backend_window_created_cb (EShellBackend *shell_backend,
 }
 
 static void
-memo_shell_backend_get_property (GObject *object,
-                                 guint property_id,
-                                 GValue *value,
-                                 GParamSpec *pspec)
-{
-	switch (property_id) {
-		case PROP_SOURCE_LIST:
-			g_value_set_object (
-				value,
-				e_memo_shell_backend_get_source_list (
-				E_MEMO_SHELL_BACKEND (object)));
-			return;
-	}
-
-	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-}
-
-static void
-memo_shell_backend_dispose (GObject *object)
-{
-	EMemoShellBackendPrivate *priv;
-
-	priv = E_MEMO_SHELL_BACKEND (object)->priv;
-
-	if (priv->source_list != NULL) {
-		g_object_unref (priv->source_list);
-		priv->source_list = NULL;
-	}
-
-	/* Chain up to parent's dispose() method. */
-	G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
 memo_shell_backend_constructed (GObject *object)
 {
 	EShell *shell;
@@ -505,8 +360,6 @@ memo_shell_backend_constructed (GObject *object)
 	shell_backend = E_SHELL_BACKEND (object);
 	shell = e_shell_backend_get_shell (shell_backend);
 
-	memo_shell_backend_ensure_sources (shell_backend);
-
 	g_signal_connect_swapped (
 		shell, "handle-uri",
 		G_CALLBACK (memo_shell_backend_handle_uri_cb),
@@ -531,8 +384,6 @@ memo_shell_backend_class_init (EMemoShellBackendClass *class)
 	g_type_class_add_private (class, sizeof (EMemoShellBackendPrivate));
 
 	object_class = G_OBJECT_CLASS (class);
-	object_class->get_property = memo_shell_backend_get_property;
-	object_class->dispose = memo_shell_backend_dispose;
 	object_class->constructed = memo_shell_backend_constructed;
 
 	shell_backend_class = E_SHELL_BACKEND_CLASS (class);
@@ -545,15 +396,8 @@ memo_shell_backend_class_init (EMemoShellBackendClass *class)
 	shell_backend_class->start = NULL;
 	shell_backend_class->migrate = e_memo_shell_backend_migrate;
 
-	g_object_class_install_property (
-		object_class,
-		PROP_SOURCE_LIST,
-		g_param_spec_object (
-			"source-list",
-			"Source List",
-			"The registry of memo lists",
-			E_TYPE_SOURCE_LIST,
-			G_PARAM_READABLE));
+	/* Register relevant ESource extensions. */
+	E_TYPE_SOURCE_MEMO_LIST;
 }
 
 static void
@@ -590,47 +434,3 @@ e_memo_shell_backend_register_type (GTypeModule *type_module)
 		type_module, E_TYPE_SHELL_BACKEND,
 		"EMemoShellBackend", &type_info, 0);
 }
-
-ESourceList *
-e_memo_shell_backend_get_source_list (EMemoShellBackend *memo_shell_backend)
-{
-	g_return_val_if_fail (
-		E_IS_MEMO_SHELL_BACKEND (memo_shell_backend), NULL);
-
-	return memo_shell_backend->priv->source_list;
-}
-
-GSList *
-e_memo_shell_backend_get_selected_memo_lists (EMemoShellBackend *memo_shell_backend)
-{
-	GConfClient *client;
-	GSList *selected_memo_lists;
-	const gchar *key;
-
-	g_return_val_if_fail (
-		E_IS_MEMO_SHELL_BACKEND (memo_shell_backend), NULL);
-
-	client = gconf_client_get_default ();
-	key = "/apps/evolution/calendar/memos/selected_memos";
-	selected_memo_lists = gconf_client_get_list (
-		client, key, GCONF_VALUE_STRING, NULL);
-	g_object_unref (client);
-
-	return selected_memo_lists;
-}
-
-void
-e_memo_shell_backend_set_selected_memo_lists (EMemoShellBackend *memo_shell_backend,
-                                              GSList *selected_memo_lists)
-{
-	GConfClient *client;
-	const gchar *key;
-
-	g_return_if_fail (E_IS_MEMO_SHELL_BACKEND (memo_shell_backend));
-
-	client = gconf_client_get_default ();
-	key = "/apps/evolution/calendar/memos/selected_memos";
-	gconf_client_set_list (
-		client, key, GCONF_VALUE_STRING, selected_memo_lists, NULL);
-	g_object_unref (client);
-}
diff --git a/modules/calendar/e-memo-shell-backend.h b/modules/calendar/e-memo-shell-backend.h
index 8a005c4..44b0384 100644
--- a/modules/calendar/e-memo-shell-backend.h
+++ b/modules/calendar/e-memo-shell-backend.h
@@ -23,7 +23,6 @@
 #define E_MEMO_SHELL_BACKEND_H
 
 #include <shell/e-shell-backend.h>
-#include <libedataserver/e-source-list.h>
 
 /* Standard GObject macros */
 #define E_TYPE_MEMO_SHELL_BACKEND \
@@ -62,13 +61,6 @@ struct _EMemoShellBackendClass {
 GType		e_memo_shell_backend_get_type	(void);
 void		e_memo_shell_backend_register_type
 					(GTypeModule *type_module);
-ESourceList *	e_memo_shell_backend_get_source_list
-					(EMemoShellBackend *memo_shell_backend);
-GSList *	e_memo_shell_backend_get_selected_memo_lists
-					(EMemoShellBackend *memo_shell_backend);
-void		e_memo_shell_backend_set_selected_memo_lists
-					(EMemoShellBackend *memo_shell_backend,
-					 GSList *selected_memo_lists);
 
 G_END_DECLS
 
diff --git a/modules/calendar/e-memo-shell-content.c b/modules/calendar/e-memo-shell-content.c
index bbf12de..1786c0c 100644
--- a/modules/calendar/e-memo-shell-content.c
+++ b/modules/calendar/e-memo-shell-content.c
@@ -112,7 +112,7 @@ memo_shell_content_table_foreach_cb (gint model_row,
 		const gchar *source_uid;
 
 		source = e_cal_get_source (comp_data->client);
-		source_uid = e_source_peek_uid (source);
+		source_uid = e_source_get_uid (source);
 
 		foreach_data->list = g_slist_prepend (
 			foreach_data->list,
diff --git a/modules/calendar/e-memo-shell-migrate.c b/modules/calendar/e-memo-shell-migrate.c
index a41c4e1..c0fab42 100644
--- a/modules/calendar/e-memo-shell-migrate.c
+++ b/modules/calendar/e-memo-shell-migrate.c
@@ -21,205 +21,6 @@
 
 #include "e-memo-shell-migrate.h"
 
-#include <string.h>
-#include <glib/gi18n.h>
-#include <camel/camel.h>
-#include <libedataserver/e-account.h>
-#include <libedataserver/e-account-list.h>
-#include <libedataserver/e-source.h>
-#include <libedataserver/e-source-group.h>
-#include <libedataserver/e-source-list.h>
-
-#include "calendar/gui/calendar-config-keys.h"
-#include "shell/e-shell.h"
-
-#include "e-memo-shell-backend.h"
-
-#define LOCAL_BASE_URI "local:"
-#define WEBCAL_BASE_URI "webcal://"
-#define PERSONAL_RELATIVE_URI "system"
-#define GROUPWISE_BASE_URI "groupwise://"
-
-static void
-create_memo_sources (EShellBackend *shell_backend,
-                     ESourceList *source_list,
-                     ESourceGroup **on_this_computer,
-                     ESourceGroup **on_the_web,
-                     ESource **personal_source)
-{
-	EShell *shell;
-	EShellSettings *shell_settings;
-	GSList *groups;
-	ESourceGroup *group;
-
-	*on_this_computer = NULL;
-	*on_the_web = NULL;
-	*personal_source = NULL;
-
-	shell = e_shell_backend_get_shell (shell_backend);
-	shell_settings = e_shell_get_shell_settings (shell);
-
-	groups = e_source_list_peek_groups (source_list);
-	if (groups) {
-		/* groups are already there, we need to search for things... */
-		GSList *g;
-		gchar *base_dir, *base_uri;
-
-		base_dir = g_build_filename (e_shell_backend_get_data_dir (shell_backend), "local", NULL);
-		base_uri = g_filename_to_uri (base_dir, NULL, NULL);
-
-		for (g = groups; g; g = g->next) {
-			group = E_SOURCE_GROUP (g->data);
-
-			if (strcmp (base_uri, e_source_group_peek_base_uri (group)) == 0)
-				e_source_group_set_base_uri (group, LOCAL_BASE_URI);
-
-			if (!*on_this_computer && !strcmp (LOCAL_BASE_URI, e_source_group_peek_base_uri (group)))
-				*on_this_computer = g_object_ref (group);
-			else if (!*on_the_web && !strcmp (WEBCAL_BASE_URI, e_source_group_peek_base_uri (group)))
-				*on_the_web = g_object_ref (group);
-		}
-
-		g_free (base_dir);
-		g_free (base_uri);
-	}
-
-	if (*on_this_computer) {
-		/* make sure "Personal" shows up as a source under
-		   this group */
-		GSList *sources = e_source_group_peek_sources (*on_this_computer);
-		GSList *s;
-		for (s = sources; s; s = s->next) {
-			ESource *source = E_SOURCE (s->data);
-			const gchar *relative_uri;
-
-			relative_uri = e_source_peek_relative_uri (source);
-			if (relative_uri == NULL)
-				continue;
-			if (!strcmp (PERSONAL_RELATIVE_URI, relative_uri)) {
-				*personal_source = g_object_ref (source);
-				break;
-			}
-		}
-	} else {
-		/* create the local source group */
-		group = e_source_group_new (_("On This Computer"), LOCAL_BASE_URI);
-		e_source_list_add_group (source_list, group, -1);
-
-		*on_this_computer = group;
-	}
-
-	if (!*personal_source) {
-		GSList *selected;
-		gchar *primary_memo_list;
-
-		/* Create the default Person memo list */
-		ESource *source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI);
-		e_source_group_add_source (*on_this_computer, source, -1);
-
-		primary_memo_list = e_shell_settings_get_string (
-			shell_settings, "cal-primary-memo-list");
-
-		selected = e_memo_shell_backend_get_selected_memo_lists (
-			E_MEMO_SHELL_BACKEND (shell_backend));
-
-		if (primary_memo_list == NULL && selected == NULL) {
-			GSList link;
-
-			e_shell_settings_set_string (
-				shell_settings, "cal-primary-memo-list",
-				e_source_peek_uid (source));
-
-			link.data = (gpointer)e_source_peek_uid (source);
-			link.next = NULL;
-
-			e_memo_shell_backend_set_selected_memo_lists (
-				E_MEMO_SHELL_BACKEND (shell_backend), &link);
-		}
-
-		g_slist_foreach (selected, (GFunc) g_free, NULL);
-		g_slist_free (selected);
-
-		e_source_set_color_spec (source, "#BECEDD");
-		*personal_source = source;
-	}
-
-	if (!*on_the_web) {
-		/* Create the Webcal source group */
-		group = e_source_group_new (_("On The Web"), WEBCAL_BASE_URI);
-		e_source_list_add_group (source_list, group, -1);
-
-		*on_the_web = group;
-	}
-}
-
-static gboolean
-is_groupwise_account (EAccount *account)
-{
-	if (account->source->url != NULL) {
-		return g_str_has_prefix (account->source->url, GROUPWISE_BASE_URI);
-	} else {
-		return FALSE;
-	}
-}
-
-static void
-add_gw_esource (ESourceList *source_list, const gchar *group_name,  const gchar *source_name, CamelURL *url, GConfClient *client)
-{
-	ESourceGroup *group;
-	ESource *source;
-	GSList *ids, *temp;
-	GError *error = NULL;
-	gchar *relative_uri;
-	const gchar *soap_port;
-	const gchar * use_ssl;
-	const gchar *poa_address;
-	const gchar *offline_sync;
-
-	poa_address = url->host;
-	if (!poa_address || strlen (poa_address) ==0)
-		return;
-	soap_port = camel_url_get_param (url, "soap_port");
-
-	if (soap_port == NULL || *soap_port == '\0')
-		soap_port = "7191";
-
-	use_ssl = camel_url_get_param (url, "use_ssl");
-	offline_sync = camel_url_get_param (url, "offline_sync");
-
-	group = e_source_group_new (group_name,  GROUPWISE_BASE_URI);
-	if (!e_source_list_add_group (source_list, group, -1))
-		return;
-	relative_uri = g_strdup_printf ("%s %s/", url->user, poa_address);
-
-	source = e_source_new (source_name, relative_uri);
-	e_source_set_property (source, "auth", "1");
-	e_source_set_property (source, "username", url->user);
-	e_source_set_property (source, "port", soap_port);
-	e_source_set_property (source, "auth-domain", "Groupwise");
-	e_source_set_property (source, "use_ssl", use_ssl);
-	e_source_set_property (source, "offline_sync", offline_sync ? "1" : "0" );
-
-	e_source_set_color_spec (source, "#EEBC60");
-	e_source_group_add_source (group, source, -1);
-
-	ids = gconf_client_get_list (client, CALENDAR_CONFIG_MEMOS_SELECTED_MEMOS, GCONF_VALUE_STRING, &error);
-	if (error != NULL) {
-		g_warning("%s (%s) %s\n", G_STRLOC, G_STRFUNC, error->message);
-		g_error_free (error);
-	}
-	ids = g_slist_append (ids, g_strdup (e_source_peek_uid (source)));
-	gconf_client_set_list (client, CALENDAR_CONFIG_MEMOS_SELECTED_MEMOS, GCONF_VALUE_STRING, ids, NULL);
-	temp  = ids;
-	for (; temp != NULL; temp = g_slist_next (temp))
-		g_free (temp->data);
-
-	g_slist_free (ids);
-	g_object_unref (source);
-	g_object_unref (group);
-	g_free (relative_uri);
-}
-
 gboolean
 e_memo_shell_backend_migrate (EShellBackend *shell_backend,
                               gint major,
@@ -227,52 +28,5 @@ e_memo_shell_backend_migrate (EShellBackend *shell_backend,
                               gint revision,
                               GError **error)
 {
-	ESourceGroup *on_this_computer = NULL;
-	ESourceGroup *on_the_web = NULL;
-	ESource *personal_source = NULL;
-	ESourceList *source_list = NULL;
-	gboolean retval = FALSE;
-
-	g_object_get (shell_backend, "source-list", &source_list, NULL);
-
-	/* we call this unconditionally now - create_groups either
-	   creates the groups/sources or it finds the necessary
-	   groups/sources. */
-	create_memo_sources (
-		shell_backend, source_list, &on_this_computer,
-		&on_the_web, &personal_source);
-
-	/* Migration for Gw accounts between versions < 2.8 */
-	if (major == 2 && minor < 8) {
-		EAccountList *al;
-		EAccount *a;
-		CamelURL *url;
-		EIterator *it;
-		GConfClient *gconf_client = gconf_client_get_default ();
-		al = e_account_list_new (gconf_client);
-		for (it = e_list_get_iterator ((EList *)al);
-				e_iterator_is_valid (it);
-				e_iterator_next (it)) {
-			a = (EAccount *) e_iterator_get (it);
-			if (!a->enabled || !is_groupwise_account (a))
-				continue;
-			url = camel_url_new (a->source->url, NULL);
-			add_gw_esource (source_list, a->name, _("Notes"), url, gconf_client);
-			camel_url_free (url);
-		}
-		g_object_unref (al);
-		g_object_unref (gconf_client);
-	}
-
-	e_source_list_sync (source_list, NULL);
-	retval = TRUE;
-
-	if (on_this_computer)
-		g_object_unref (on_this_computer);
-	if (on_the_web)
-		g_object_unref (on_the_web);
-	if (personal_source)
-		g_object_unref (personal_source);
-
-	return retval;
+	return TRUE;
 }
diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c
index 4ad5d44..0851040 100644
--- a/modules/calendar/e-memo-shell-sidebar.c
+++ b/modules/calendar/e-memo-shell-sidebar.c
@@ -24,6 +24,7 @@
 #include <string.h>
 #include <glib/gi18n.h>
 #include <libecal/e-cal.h>
+#include <libecal/e-source-calendar.h>
 
 #include "e-util/e-alert-dialog.h"
 #include "e-util/e-util.h"
@@ -115,7 +116,7 @@ memo_shell_sidebar_backend_died_cb (EMemoShellSidebar *memo_shell_sidebar,
 	shell_content = e_shell_view_get_shell_content (shell_view);
 
 	source = e_cal_get_source (client);
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 
 	g_object_ref (source);
 
@@ -137,21 +138,30 @@ memo_shell_sidebar_backend_error_cb (EMemoShellSidebar *memo_shell_sidebar,
 	EShellView *shell_view;
 	EShellContent *shell_content;
 	EShellSidebar *shell_sidebar;
-	ESourceGroup *source_group;
+	ESource *parent;
 	ESource *source;
+	GNode *node;
+	const gchar *parent_display_name;
+	const gchar *source_display_name;
 
 	shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar);
 	shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
 	shell_content = e_shell_view_get_shell_content (shell_view);
 
 	source = e_cal_get_source (client);
-	source_group = e_source_peek_group (source);
+
+	node = e_source_get_node (source);
+	g_return_if_fail (node != NULL);
+	g_return_if_fail (node->parent != NULL);
+
+	parent = E_SOURCE (node->parent->data);
+
+	parent_display_name = e_source_get_display_name (parent);
+	source_display_name = e_source_get_display_name (source);
 
 	e_alert_submit (
-		E_ALERT_SINK (shell_content),
-		"calendar:backend-error",
-		e_source_group_peek_name (source_group),
-		e_source_peek_name (source), message, NULL);
+		E_ALERT_SINK (shell_content), "calendar:backend-error",
+		parent_display_name, source_display_name, message, NULL);
 }
 
 static void
@@ -300,7 +310,7 @@ memo_shell_sidebar_set_default (EMemoShellSidebar *memo_shell_sidebar,
 		priv->loading_default_client = NULL;
 	}
 
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 	client = g_hash_table_lookup (priv->client_table, uid);
 
 	/* If we already have an open connection for
@@ -349,38 +359,6 @@ memo_shell_sidebar_row_changed_cb (EMemoShellSidebar *memo_shell_sidebar,
 }
 
 static void
-memo_shell_sidebar_selection_changed_cb (EMemoShellSidebar *memo_shell_sidebar,
-                                         ESourceSelector *selector)
-{
-	EShellView *shell_view;
-	EShellBackend *shell_backend;
-	EShellSidebar *shell_sidebar;
-	GSList *list, *iter;
-
-	/* This signal is emitted less frequently than "row-changed",
-	 * especially when the model is being rebuilt.  So we'll take
-	 * it easy on poor GConf. */
-
-	shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar);
-	shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
-	shell_backend = e_shell_view_get_shell_backend (shell_view);
-
-	list = e_source_selector_get_selection (selector);
-
-	for (iter = list; iter != NULL; iter = iter->next) {
-		ESource *source = iter->data;
-
-		iter->data = (gpointer) e_source_peek_uid (source);
-		g_object_unref (source);
-	}
-
-	e_memo_shell_backend_set_selected_memo_lists (
-		E_MEMO_SHELL_BACKEND (shell_backend), list);
-
-	g_slist_free (list);
-}
-
-static void
 memo_shell_sidebar_primary_selection_changed_cb (EMemoShellSidebar *memo_shell_sidebar,
                                                  ESourceSelector *selector)
 {
@@ -402,11 +380,9 @@ memo_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
 	EShell *shell;
 	EShellBackend *shell_backend;
 	EShellSettings *shell_settings;
+	ESourceRegistry *registry;
 	ESourceSelector *selector;
-	ESourceList *source_list;
-	ESource *source;
 	GtkTreeModel *model;
-	GSList *list, *iter;
 
 	priv = E_MEMO_SHELL_SIDEBAR (shell_sidebar)->priv;
 
@@ -419,8 +395,7 @@ memo_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
 	selector = E_SOURCE_SELECTOR (priv->selector);
 	model = gtk_tree_view_get_model (GTK_TREE_VIEW (selector));
 
-	source_list = e_memo_shell_backend_get_source_list (
-		E_MEMO_SHELL_BACKEND (shell_backend));
+	registry = e_source_registry_get_default ();
 
 	g_signal_connect_swapped (
 		model, "row-changed",
@@ -439,30 +414,8 @@ memo_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
 		G_BINDING_SYNC_CREATE,
 		(GBindingTransformFunc) e_binding_transform_uid_to_source,
 		(GBindingTransformFunc) e_binding_transform_source_to_uid,
-		g_object_ref (source_list),
+		g_object_ref (registry),
 		(GDestroyNotify) g_object_unref);
-
-	list = e_memo_shell_backend_get_selected_memo_lists (
-		E_MEMO_SHELL_BACKEND (shell_backend));
-
-	for (iter = list; iter != NULL; iter = iter->next) {
-		const gchar *uid = iter->data;
-
-		source = e_source_list_peek_source_by_uid (source_list, uid);
-
-		if (source != NULL)
-			e_source_selector_select_source (selector, source);
-	}
-
-	g_slist_foreach (list, (GFunc) g_free, NULL);
-	g_slist_free (list);
-
-	/* Listen for subsequent changes to the selector. */
-
-	g_signal_connect_swapped (
-		selector, "selection-changed",
-		G_CALLBACK (memo_shell_sidebar_selection_changed_cb),
-		shell_sidebar);
 }
 
 static void
@@ -538,9 +491,8 @@ memo_shell_sidebar_constructed (GObject *object)
 	EMemoShellSidebarPrivate *priv;
 	EShellView *shell_view;
 	EShellWindow *shell_window;
-	EShellBackend *shell_backend;
 	EShellSidebar *shell_sidebar;
-	ESourceList *source_list;
+	ESourceRegistry *registry;
 	GtkContainer *container;
 	GtkWidget *widget;
 	AtkObject *a11y;
@@ -552,12 +504,8 @@ memo_shell_sidebar_constructed (GObject *object)
 
 	shell_sidebar = E_SHELL_SIDEBAR (object);
 	shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
-	shell_backend = e_shell_view_get_shell_backend (shell_view);
 	shell_window = e_shell_view_get_shell_window (shell_view);
 
-	source_list = e_memo_shell_backend_get_source_list (
-		E_MEMO_SHELL_BACKEND (shell_backend));
-
 	container = GTK_CONTAINER (shell_sidebar);
 
 	widget = gtk_scrolled_window_new (NULL, NULL);
@@ -571,7 +519,8 @@ memo_shell_sidebar_constructed (GObject *object)
 
 	container = GTK_CONTAINER (widget);
 
-	widget = e_memo_list_selector_new (source_list);
+	registry = e_source_registry_get_default ();
+	widget = e_memo_list_selector_new (registry);
 	e_source_selector_set_select_new (E_SOURCE_SELECTOR (widget), TRUE);
 	gtk_container_add (container, widget);
 	a11y = gtk_widget_get_accessible (widget);
@@ -603,20 +552,24 @@ memo_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
 	source = e_source_selector_get_primary_selection (selector);
 
 	if (source != NULL) {
+		ESourceSelectable *extension;
 		ECal *client;
-		const gchar *uri;
-		const gchar *delete;
+		gboolean writable_hint;
+		const gchar *uid;
+
+		uid = e_source_get_uid (source);
+		is_system = (g_strcmp0 (uid, "system") == 0);
 
-		uri = e_source_peek_relative_uri (source);
-		is_system = (uri == NULL || strcmp (uri, "system") == 0);
+		extension = e_source_get_extension (
+			source, E_SOURCE_EXTENSION_MEMO_LIST);
+		writable_hint =
+			e_source_selectable_get_writable_hint (extension);
 
-		can_delete = !is_system;
-		delete = e_source_get_property (source, "delete");
-		can_delete &= (delete == NULL || strcmp (delete, "no") != 0);
+		can_delete = !is_system && writable_hint;
 
 		client = g_hash_table_lookup (
 			memo_shell_sidebar->priv->client_table,
-			e_source_peek_uid (source));
+			e_source_get_uid (source));
 		refresh_supported =
 			client && e_cal_get_refresh_supported (client);
 	}
@@ -650,8 +603,7 @@ memo_shell_sidebar_client_removed (EMemoShellSidebar *memo_shell_sidebar,
 		NULL, NULL, memo_shell_sidebar);
 
 	source = e_cal_get_source (client);
-	uid = e_source_peek_uid (source);
-	g_return_if_fail (uid != NULL);
+	uid = e_source_get_uid (source);
 
 	g_hash_table_remove (client_table, uid);
 	e_source_selector_unselect_source (selector, source);
@@ -833,8 +785,8 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar,
 	ECal *default_client;
 	ECal *client;
 	icaltimezone *timezone;
+	const gchar *display_name;
 	const gchar *uid;
-	const gchar *uri;
 	gchar *message;
 
 	g_return_if_fail (E_IS_MEMO_SHELL_SIDEBAR (memo_shell_sidebar));
@@ -845,7 +797,7 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar,
 	default_client = memo_shell_sidebar->priv->default_client;
 	selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
 
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 	client = g_hash_table_lookup (client_table, uid);
 
 	if (client != NULL)
@@ -856,7 +808,7 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar,
 		const gchar *default_uid;
 
 		default_source = e_cal_get_source (default_client);
-		default_uid = e_source_peek_uid (default_source);
+		default_uid = e_source_get_uid (default_source);
 
 		if (g_strcmp0 (uid, default_uid) == 0)
 			client = g_object_ref (default_client);
@@ -880,9 +832,8 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar,
 	g_hash_table_insert (client_table, g_strdup (uid), client);
 	e_source_selector_select_source (selector, source);
 
-	uri = e_cal_get_uri (client);
-	/* Translators: The string field is a URI. */
-	message = g_strdup_printf (_("Opening memos at %s"), uri);
+	display_name = e_source_get_display_name (source);
+	message = g_strdup_printf (_("Opening memo list '%s'"), display_name);
 	memo_shell_sidebar_emit_status_message (memo_shell_sidebar, message);
 	g_free (message);
 
@@ -918,7 +869,7 @@ e_memo_shell_sidebar_remove_source (EMemoShellSidebar *memo_shell_sidebar,
 
 	client_table = memo_shell_sidebar->priv->client_table;
 
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 	client = g_hash_table_lookup (client_table, uid);
 
 	if (client == NULL)
diff --git a/modules/calendar/e-memo-shell-view-actions.c b/modules/calendar/e-memo-shell-view-actions.c
index 660ad09..2eadecc 100644
--- a/modules/calendar/e-memo-shell-view-actions.c
+++ b/modules/calendar/e-memo-shell-view-actions.c
@@ -124,32 +124,17 @@ static void
 action_memo_list_delete_cb (GtkAction *action,
                             EMemoShellView *memo_shell_view)
 {
-	EMemoShellBackend *memo_shell_backend;
-	EMemoShellContent *memo_shell_content;
 	EMemoShellSidebar *memo_shell_sidebar;
 	EShellWindow *shell_window;
 	EShellView *shell_view;
-	EMemoTable *memo_table;
-	ECal *client;
-	ECalModel *model;
 	ESourceSelector *selector;
-	ESourceGroup *source_group;
-	ESourceList *source_list;
 	ESource *source;
+	GFile *file;
 	gint response;
-	gchar *uri;
-	GError *error = NULL;
 
 	shell_view = E_SHELL_VIEW (memo_shell_view);
 	shell_window = e_shell_view_get_shell_window (shell_view);
 
-	memo_shell_backend = memo_shell_view->priv->memo_shell_backend;
-	source_list = e_memo_shell_backend_get_source_list (memo_shell_backend);
-
-	memo_shell_content = memo_shell_view->priv->memo_shell_content;
-	memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
-	model = e_memo_table_get_model (memo_table);
-
 	memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar;
 	selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
 	source = e_source_selector_get_primary_selection (selector);
@@ -159,37 +144,14 @@ action_memo_list_delete_cb (GtkAction *action,
 	response = e_alert_run_dialog_for_args (
 		GTK_WINDOW (shell_window),
 		"calendar:prompt-delete-memo-list",
-		e_source_peek_name (source), NULL);
-	if (response != GTK_RESPONSE_YES)
-		return;
-
-	uri = e_source_get_uri (source);
-	client = e_cal_model_get_client_for_uri (model, uri);
-	if (client == NULL)
-		client = e_cal_new_from_uri (uri, E_CAL_SOURCE_TYPE_JOURNAL);
-	g_free (uri);
+		e_source_get_display_name (source), NULL);
 
-	g_return_if_fail (client != NULL);
-
-	if (!e_cal_remove (client, &error)) {
-		g_warning ("%s", error->message);
-		g_error_free (error);
+	if (response != GTK_RESPONSE_YES)
 		return;
-	}
 
-	if (e_source_selector_source_is_selected (selector, source)) {
-		e_memo_shell_sidebar_remove_source (
-			memo_shell_sidebar, source);
-		e_source_selector_unselect_source (selector, source);
-	}
-
-	source_group = e_source_peek_group (source);
-	e_source_group_remove_source (source_group, source);
-
-	if (!e_source_list_sync (source_list, &error)) {
-		g_warning ("%s", error->message);
-		g_error_free (error);
-	}
+	/* FIXME Handle errors. */
+	file = e_source_get_file (source);
+	g_file_delete (file, NULL, NULL);
 }
 
 static void
@@ -198,10 +160,30 @@ action_memo_list_new_cb (GtkAction *action,
 {
 	EShellView *shell_view;
 	EShellWindow *shell_window;
+	ESourceRegistry *registry;
+	ECalSourceType source_type;
+	GtkWidget *config;
+	GtkWidget *dialog;
+	const gchar *icon_name;
 
 	shell_view = E_SHELL_VIEW (memo_shell_view);
 	shell_window = e_shell_view_get_shell_window (shell_view);
-	calendar_setup_new_memo_list (GTK_WINDOW (shell_window));
+
+	source_type = E_CAL_SOURCE_TYPE_JOURNAL;
+	registry = e_source_registry_get_default ();
+	config = e_cal_source_config_new (registry, NULL, source_type);
+
+	dialog = e_source_config_dialog_new (
+		E_SOURCE_CONFIG (config), GTK_WINDOW (shell_window));
+
+	icon_name = gtk_action_get_icon_name (action);
+	gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name);
+
+	gtk_window_set_title (GTK_WINDOW (dialog), _("New Memo List"));
+
+	gtk_dialog_run (GTK_DIALOG (dialog));
+
+	gtk_widget_destroy (dialog);
 }
 
 static void
@@ -238,11 +220,16 @@ static void
 action_memo_list_properties_cb (GtkAction *action,
                                 EMemoShellView *memo_shell_view)
 {
-	EMemoShellSidebar *memo_shell_sidebar;
 	EShellView *shell_view;
 	EShellWindow *shell_window;
+	EMemoShellSidebar *memo_shell_sidebar;
+	ECalSourceType source_type;
 	ESource *source;
 	ESourceSelector *selector;
+	ESourceRegistry *registry;
+	GtkWidget *config;
+	GtkWidget *dialog;
+	const gchar *icon_name;
 
 	shell_view = E_SHELL_VIEW (memo_shell_view);
 	shell_window = e_shell_view_get_shell_window (shell_view);
@@ -250,9 +237,23 @@ action_memo_list_properties_cb (GtkAction *action,
 	memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar;
 	selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
 	source = e_source_selector_get_primary_selection (selector);
-	g_return_if_fail (E_IS_SOURCE (source));
+	g_return_if_fail (source != NULL);
+
+	source_type = E_CAL_SOURCE_TYPE_JOURNAL;
+	registry = e_source_selector_get_registry (selector);
+	config = e_cal_source_config_new (registry, source, source_type);
 
-	calendar_setup_edit_memo_list (GTK_WINDOW (shell_window), source);
+	dialog = e_source_config_dialog_new (
+		E_SOURCE_CONFIG (config), GTK_WINDOW (shell_window));
+
+	icon_name = gtk_action_get_icon_name (action);
+	gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name);
+
+	gtk_window_set_title (GTK_WINDOW (dialog), _("Memo List Properties"));
+
+	gtk_dialog_run (GTK_DIALOG (dialog));
+
+	gtk_widget_destroy (dialog);
 }
 
 static void
@@ -265,7 +266,6 @@ action_memo_list_refresh_cb (GtkAction *action,
 	ECal *client;
 	ECalModel *model;
 	ESource *source;
-	gchar *uri;
 	GError *error = NULL;
 
 	memo_shell_content = memo_shell_view->priv->memo_shell_content;
@@ -277,10 +277,7 @@ action_memo_list_refresh_cb (GtkAction *action,
 	source = e_source_selector_get_primary_selection (selector);
 	g_return_if_fail (E_IS_SOURCE (source));
 
-	uri = e_source_get_uri (source);
-	client = e_cal_model_get_client_for_uri (model, uri);
-	g_free (uri);
-
+	client = e_cal_model_get_client_for_source (model, source);
 	if (client == NULL)
 		return;
 
@@ -289,7 +286,7 @@ action_memo_list_refresh_cb (GtkAction *action,
 	if (!e_cal_refresh (client, &error) && error) {
 		g_warning (
 			"%s: Failed to refresh '%s', %s\n",
-			G_STRFUNC, e_source_peek_name (source),
+			G_STRFUNC, e_source_get_display_name (source),
 			error->message);
 		g_error_free (error);
 	}
diff --git a/modules/calendar/e-memo-shell-view-private.h b/modules/calendar/e-memo-shell-view-private.h
index 0a6a390..08ac2b8 100644
--- a/modules/calendar/e-memo-shell-view-private.h
+++ b/modules/calendar/e-memo-shell-view-private.h
@@ -36,12 +36,13 @@
 #include "shell/e-shell-utils.h"
 #include "misc/e-popup-action.h"
 #include "misc/e-selectable.h"
+#include "misc/e-source-config-dialog.h"
 
 #include "calendar/gui/comp-util.h"
 #include "calendar/gui/e-cal-component-preview.h"
+#include "calendar/gui/e-cal-source-config.h"
 #include "calendar/gui/e-calendar-selector.h"
 #include "calendar/gui/print.h"
-#include "calendar/gui/dialogs/calendar-setup.h"
 #include "calendar/gui/dialogs/copy-source-dialog.h"
 #include "calendar/gui/dialogs/memo-editor.h"
 
diff --git a/modules/calendar/e-memo-shell-view.h b/modules/calendar/e-memo-shell-view.h
index 686ae73..7538368 100644
--- a/modules/calendar/e-memo-shell-view.h
+++ b/modules/calendar/e-memo-shell-view.h
@@ -23,7 +23,6 @@
 #define E_MEMO_SHELL_VIEW_H
 
 #include <shell/e-shell-view.h>
-#include <libedataserver/e-source-list.h>
 
 /* Standard GObject macros */
 #define E_TYPE_MEMO_SHELL_VIEW \
diff --git a/modules/calendar/e-task-shell-backend.c b/modules/calendar/e-task-shell-backend.c
index 193f3be..778604f 100644
--- a/modules/calendar/e-task-shell-backend.c
+++ b/modules/calendar/e-task-shell-backend.c
@@ -24,19 +24,19 @@
 #include <string.h>
 #include <glib/gi18n.h>
 #include <libecal/e-cal.h>
+#include <libecal/e-source-calendar.h>
 #include <libedataserver/e-url.h>
 #include <libedataserver/e-source.h>
-#include <libedataserver/e-source-list.h>
-#include <libedataserver/e-source-group.h>
 
 #include "shell/e-shell.h"
 #include "shell/e-shell-backend.h"
 #include "shell/e-shell-window.h"
+#include "widgets/misc/e-source-config-dialog.h"
 
 #include "calendar/common/authentication.h"
 #include "calendar/gui/comp-util.h"
-#include "calendar/gui/dialogs/calendar-setup.h"
 #include "calendar/gui/dialogs/task-editor.h"
+#include "calendar/gui/e-cal-source-config.h"
 
 #include "e-task-shell-content.h"
 #include "e-task-shell-migrate.h"
@@ -44,117 +44,13 @@
 #include "e-task-shell-view.h"
 
 struct _ETaskShellBackendPrivate {
-	ESourceList *source_list;
-};
-
-enum {
-	PROP_0,
-	PROP_SOURCE_LIST
+	gint placeholder;
 };
 
 static gpointer parent_class;
 static GType task_shell_backend_type;
 
 static void
-task_shell_backend_ensure_sources (EShellBackend *shell_backend)
-{
-	/* XXX This is basically the same algorithm across all modules.
-	 *     Maybe we could somehow integrate this into EShellBackend? */
-
-	ETaskShellBackend *task_shell_backend;
-	ESourceGroup *on_this_computer;
-	ESourceList *source_list;
-	ESource *personal;
-	EShell *shell;
-	EShellSettings *shell_settings;
-	GSList *sources, *iter;
-	const gchar *name;
-	gboolean save_list = FALSE;
-
-	on_this_computer = NULL;
-	personal = NULL;
-
-	task_shell_backend = E_TASK_SHELL_BACKEND (shell_backend);
-
-	shell = e_shell_backend_get_shell (shell_backend);
-	shell_settings = e_shell_get_shell_settings (shell);
-
-	if (!e_cal_get_sources (
-		&task_shell_backend->priv->source_list,
-		E_CAL_SOURCE_TYPE_TODO, NULL)) {
-		g_warning ("Could not get task sources from GConf!");
-		return;
-	}
-
-	source_list = task_shell_backend->priv->source_list;
-
-	on_this_computer = e_source_list_ensure_group (
-		source_list, _("On This Computer"), "local:", TRUE);
-	e_source_list_ensure_group (
-		source_list, _("On The Web"), "webcal://", FALSE);
-
-	g_return_if_fail (on_this_computer);
-
-	sources = e_source_group_peek_sources (on_this_computer);
-
-	/* Make sure this group includes a "Personal" source. */
-	for (iter = sources; iter != NULL; iter = iter->next) {
-		ESource *source = iter->data;
-		const gchar *relative_uri;
-
-		relative_uri = e_source_peek_relative_uri (source);
-		if (g_strcmp0 (relative_uri, "system") == 0) {
-			personal = source;
-			break;
-		}
-	}
-
-	name = _("Personal");
-
-	if (personal == NULL) {
-		ESource *source;
-		GSList *selected;
-		gchar *primary;
-
-		source = e_source_new (name, "system");
-		e_source_set_color_spec (source, "#BECEDD");
-		e_source_group_add_source (on_this_computer, source, -1);
-		g_object_unref (source);
-		save_list = TRUE;
-
-		primary = e_shell_settings_get_string (
-			shell_settings, "cal-primary-task-list");
-
-		selected = e_task_shell_backend_get_selected_task_lists (
-			task_shell_backend);
-
-		if (primary == NULL && selected == NULL) {
-			const gchar *uid;
-
-			uid = e_source_peek_uid (source);
-			selected = g_slist_prepend (NULL, g_strdup (uid));
-
-			e_shell_settings_set_string (
-				shell_settings, "cal-primary-task-list", uid);
-			e_task_shell_backend_set_selected_task_lists (
-				task_shell_backend, selected);
-		}
-
-		g_slist_foreach (selected, (GFunc) g_free, NULL);
-		g_slist_free (selected);
-		g_free (primary);
-	} else {
-		/* Force the source name to the current locale. */
-		e_source_set_name (personal, name);
-	}
-
-	g_object_unref (on_this_computer);
-
-	if (save_list)
-		e_source_list_sync (source_list, NULL);
-}
-
-static void
 task_shell_backend_new_task (ESource *source,
                              GAsyncResult *result,
                              EShell *shell,
@@ -213,37 +109,19 @@ action_task_new_cb (GtkAction *action,
                     EShellWindow *shell_window)
 {
 	EShell *shell;
-	EShellBackend *shell_backend;
-	EShellSettings *shell_settings;
-	ESource *source = NULL;
-	ESourceList *source_list;
+	ESource *source;
+	ESourceRegistry *registry;
 	ECalSourceType source_type;
 	const gchar *action_name;
-	gchar *uid;
 
 	/* This callback is used for both tasks and assigned tasks. */
 
 	source_type = E_CAL_SOURCE_TYPE_TODO;
 
 	shell = e_shell_window_get_shell (shell_window);
-	shell_settings = e_shell_get_shell_settings (shell);
-	shell_backend = e_shell_get_backend_by_name (shell, "tasks");
-
-	g_object_get (shell_backend, "source-list", &source_list, NULL);
-	g_return_if_fail (E_IS_SOURCE_LIST (source_list));
 
-	uid = e_shell_settings_get_string (
-		shell_settings, "cal-primary-task-list");
-
-	if (uid != NULL) {
-		source = e_source_list_peek_source_by_uid (source_list, uid);
-		g_free (uid);
-	}
-
-	if (source == NULL)
-		source = e_source_list_peek_default_source (source_list);
-
-	g_return_if_fail (E_IS_SOURCE (source));
+	registry = e_source_registry_get_default ();
+	source = e_source_registry_get_default_task_list (registry);
 
 	/* Use a callback function appropriate for the action.
 	 * FIXME Need to obtain a better default time zone. */
@@ -262,15 +140,33 @@ action_task_new_cb (GtkAction *action,
 			NULL, (GAsyncReadyCallback)
 			task_shell_backend_task_new_cb,
 			g_object_ref (shell));
-
-	g_object_unref (source_list);
 }
 
 static void
 action_task_list_new_cb (GtkAction *action,
                          EShellWindow *shell_window)
 {
-	calendar_setup_new_task_list (GTK_WINDOW (shell_window));
+	ECalSourceType source_type;
+	ESourceRegistry *registry;
+	GtkWidget *config;
+	GtkWidget *dialog;
+	const gchar *icon_name;
+
+	source_type = E_CAL_SOURCE_TYPE_TODO;
+	registry = e_source_registry_get_default ();
+	config = e_cal_source_config_new (registry, NULL, source_type);
+
+	dialog = e_source_config_dialog_new (
+		E_SOURCE_CONFIG (config), GTK_WINDOW (shell_window));
+
+	icon_name = gtk_action_get_icon_name (action);
+	gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name);
+
+	gtk_window_set_title (GTK_WINDOW (dialog), _("New Task List"));
+
+	gtk_dialog_run (GTK_DIALOG (dialog));
+
+	gtk_widget_destroy (dialog);
 }
 
 static GtkActionEntry item_entries[] = {
@@ -310,7 +206,7 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
 	ECal *client;
 	ECalComponent *comp;
 	ESource *source;
-	ESourceList *source_list;
+	ESourceRegistry *registry;
 	ECalSourceType source_type;
 	EUri *euri;
 	icalcomponent *icalcomp;
@@ -375,15 +271,10 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
 	 * we successfully open it is another matter... */
 	handled = TRUE;
 
-	if (!e_cal_get_sources (&source_list, source_type, NULL)) {
-		g_printerr ("Could not get task sources from GConf!\n");
-		goto exit;
-	}
-
-	source = e_source_list_peek_source_by_uid (source_list, source_uid);
+	registry = e_source_registry_get_default ();
+	source = e_source_registry_lookup_by_uid (registry, source_uid);
 	if (source == NULL) {
 		g_printerr ("No source for UID '%s'\n", source_uid);
-		g_object_unref (source_list);
 		goto exit;
 	}
 
@@ -393,7 +284,6 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
 			g_printerr ("%s\n", error->message);
 			g_error_free (error);
 		}
-		g_object_unref (source_list);
 		goto exit;
 	}
 
@@ -407,7 +297,6 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
 
 	if (!e_cal_get_object (client, comp_uid, comp_rid, &icalcomp, &error)) {
 		g_printerr ("%s\n", error->message);
-		g_object_unref (source_list);
 		g_error_free (error);
 		goto exit;
 	}
@@ -434,7 +323,6 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
 present:
 	gtk_window_present (GTK_WINDOW (editor));
 
-	g_object_unref (source_list);
 	g_object_unref (client);
 
 exit:
@@ -468,40 +356,6 @@ task_shell_backend_window_created_cb (EShellBackend *shell_backend,
 }
 
 static void
-task_shell_backend_get_property (GObject *object,
-                                 guint property_id,
-                                 GValue *value,
-                                 GParamSpec *pspec)
-{
-	switch (property_id) {
-		case PROP_SOURCE_LIST:
-			g_value_set_object (
-				value,
-				e_task_shell_backend_get_source_list (
-				E_TASK_SHELL_BACKEND (object)));
-			return;
-	}
-
-	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-}
-
-static void
-task_shell_backend_dispose (GObject *object)
-{
-	ETaskShellBackendPrivate *priv;
-
-	priv = E_TASK_SHELL_BACKEND (object)->priv;
-
-	if (priv->source_list != NULL) {
-		g_object_unref (priv->source_list);
-		priv->source_list = NULL;
-	}
-
-	/* Chain up to parent's dispose() method. */
-	G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
 task_shell_backend_constructed (GObject *object)
 {
 	EShell *shell;
@@ -510,8 +364,6 @@ task_shell_backend_constructed (GObject *object)
 	shell_backend = E_SHELL_BACKEND (object);
 	shell = e_shell_backend_get_shell (shell_backend);
 
-	task_shell_backend_ensure_sources (shell_backend);
-
 	g_signal_connect_swapped (
 		shell, "handle-uri",
 		G_CALLBACK (task_shell_backend_handle_uri_cb),
@@ -536,8 +388,6 @@ task_shell_backend_class_init (ETaskShellBackendClass *class)
 	g_type_class_add_private (class, sizeof (ETaskShellBackendPrivate));
 
 	object_class = G_OBJECT_CLASS (class);
-	object_class->get_property = task_shell_backend_get_property;
-	object_class->dispose = task_shell_backend_dispose;
 	object_class->constructed = task_shell_backend_constructed;
 
 	shell_backend_class = E_SHELL_BACKEND_CLASS (class);
@@ -549,16 +399,6 @@ task_shell_backend_class_init (ETaskShellBackendClass *class)
 	shell_backend_class->preferences_page = "calendar-and-tasks";
 	shell_backend_class->start = NULL;
 	shell_backend_class->migrate = e_task_shell_backend_migrate;
-
-	g_object_class_install_property (
-		object_class,
-		PROP_SOURCE_LIST,
-		g_param_spec_object (
-			"source-list",
-			"Source List",
-			"The registry of task lists",
-			E_TYPE_SOURCE_LIST,
-			G_PARAM_READABLE));
 }
 
 static void
@@ -594,48 +434,7 @@ e_task_shell_backend_register_type (GTypeModule *type_module)
 	task_shell_backend_type = g_type_module_register_type (
 		type_module, E_TYPE_SHELL_BACKEND,
 		"ETaskShellBackend", &type_info, 0);
-}
-
-ESourceList *
-e_task_shell_backend_get_source_list (ETaskShellBackend *task_shell_backend)
-{
-	g_return_val_if_fail (
-		E_IS_TASK_SHELL_BACKEND (task_shell_backend), NULL);
-
-	return task_shell_backend->priv->source_list;
-}
-
-GSList *
-e_task_shell_backend_get_selected_task_lists (ETaskShellBackend *task_shell_backend)
-{
-	GConfClient *client;
-	GSList *selected_task_lists;
-	const gchar *key;
-
-	g_return_val_if_fail (
-		E_IS_TASK_SHELL_BACKEND (task_shell_backend), NULL);
-
-	client = gconf_client_get_default ();
-	key = "/apps/evolution/calendar/tasks/selected_tasks";
-	selected_task_lists = gconf_client_get_list (
-		client, key, GCONF_VALUE_STRING, NULL);
-	g_object_unref (client);
-
-	return selected_task_lists;
-}
 
-void
-e_task_shell_backend_set_selected_task_lists (ETaskShellBackend *task_shell_backend,
-                                              GSList *selected_task_lists)
-{
-	GConfClient *client;
-	const gchar *key;
-
-	g_return_if_fail (E_IS_TASK_SHELL_BACKEND (task_shell_backend));
-
-	client = gconf_client_get_default ();
-	key = "/apps/evolution/calendar/tasks/selected_tasks";
-	gconf_client_set_list (
-		client, key, GCONF_VALUE_STRING, selected_task_lists, NULL);
-	g_object_unref (client);
+	/* Register relevant ESource extensions. */
+	E_TYPE_SOURCE_TASK_LIST;
 }
diff --git a/modules/calendar/e-task-shell-backend.h b/modules/calendar/e-task-shell-backend.h
index ba56e91..a9f1085 100644
--- a/modules/calendar/e-task-shell-backend.h
+++ b/modules/calendar/e-task-shell-backend.h
@@ -23,7 +23,6 @@
 #define E_TASK_SHELL_BACKEND_H
 
 #include <shell/e-shell-backend.h>
-#include <libedataserver/e-source-list.h>
 
 /* Standard GObject macros */
 #define E_TYPE_TASK_SHELL_BACKEND \
@@ -62,13 +61,6 @@ struct _ETaskShellBackendClass {
 GType		e_task_shell_backend_get_type	(void);
 void		e_task_shell_backend_register_type
 					(GTypeModule *type_module);
-ESourceList *	e_task_shell_backend_get_source_list
-					(ETaskShellBackend *task_shell_backend);
-GSList *	e_task_shell_backend_get_selected_task_lists
-					(ETaskShellBackend *task_shell_backend);
-void		e_task_shell_backend_set_selected_task_lists
-					(ETaskShellBackend *task_shell_backend,
-					 GSList *selected_task_lists);
 
 G_END_DECLS
 
diff --git a/modules/calendar/e-task-shell-content.c b/modules/calendar/e-task-shell-content.c
index f2d10e4..aa66ecd 100644
--- a/modules/calendar/e-task-shell-content.c
+++ b/modules/calendar/e-task-shell-content.c
@@ -112,7 +112,7 @@ task_shell_content_table_foreach_cb (gint model_row,
 		const gchar *source_uid;
 
 		source = e_cal_get_source (comp_data->client);
-		source_uid = e_source_peek_uid (source);
+		source_uid = e_source_get_uid (source);
 
 		foreach_data->list = g_slist_prepend (
 			foreach_data->list,
diff --git a/modules/calendar/e-task-shell-migrate.c b/modules/calendar/e-task-shell-migrate.c
index d7daafc..33b2aeb 100644
--- a/modules/calendar/e-task-shell-migrate.c
+++ b/modules/calendar/e-task-shell-migrate.c
@@ -21,149 +21,6 @@
 
 #include "e-task-shell-migrate.h"
 
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-
-#include <glib/gi18n.h>
-#include <glib/gstdio.h>
-#include <libebackend/e-dbhash.h>
-#include <libedataserver/e-source.h>
-#include <libedataserver/e-source-group.h>
-#include <libedataserver/e-source-list.h>
-#include <libedataserver/e-xml-hash-utils.h>
-#include <libedataserver/e-xml-utils.h>
-
-#include "e-util/e-util-private.h"
-#include "calendar/gui/calendar-config-keys.h"
-#include "shell/e-shell.h"
-
-#include "e-task-shell-backend.h"
-
-#define LOCAL_BASE_URI "local:"
-#define WEBCAL_BASE_URI "webcal://"
-#define PERSONAL_RELATIVE_URI "system"
-
-static void
-create_task_sources (EShellBackend *shell_backend,
-                     ESourceList *source_list,
-                     ESourceGroup **on_this_computer,
-                     ESourceGroup **on_the_web,
-                     ESource **personal_source)
-{
-	EShell *shell;
-	EShellSettings *shell_settings;
-	GSList *groups;
-	ESourceGroup *group;
-
-	*on_this_computer = NULL;
-	*on_the_web = NULL;
-	*personal_source = NULL;
-
-	shell = e_shell_backend_get_shell (shell_backend);
-	shell_settings = e_shell_get_shell_settings (shell);
-
-	groups = e_source_list_peek_groups (source_list);
-	if (groups) {
-		/* groups are already there, we need to search for things... */
-		GSList *g;
-		const gchar *data_dir;
-		gchar *base_dir, *base_uri;
-
-		data_dir = e_shell_backend_get_data_dir (shell_backend);
-		base_dir = g_build_filename (data_dir, "local", NULL);
-		base_uri = g_filename_to_uri (base_dir, NULL, NULL);
-
-		for (g = groups; g; g = g->next) {
-			group = E_SOURCE_GROUP (g->data);
-
-			if (strcmp (base_uri, e_source_group_peek_base_uri (group)) == 0)
-				e_source_group_set_base_uri (group, LOCAL_BASE_URI);
-
-			if (!*on_this_computer && !strcmp (LOCAL_BASE_URI,
-				e_source_group_peek_base_uri (group)))
-				*on_this_computer = g_object_ref (group);
-			else if (!*on_the_web && !strcmp (WEBCAL_BASE_URI,
-				e_source_group_peek_base_uri (group)))
-				*on_the_web = g_object_ref (group);
-		}
-
-		g_free (base_dir);
-		g_free (base_uri);
-	}
-
-	if (*on_this_computer) {
-		/* make sure "Personal" shows up as a source under
-		   this group */
-		GSList *sources = e_source_group_peek_sources (*on_this_computer);
-		GSList *s;
-		for (s = sources; s; s = s->next) {
-			ESource *source = E_SOURCE (s->data);
-			const gchar *relative_uri;
-
-			relative_uri = e_source_peek_relative_uri (source);
-			if (relative_uri == NULL)
-				continue;
-			if (!strcmp (PERSONAL_RELATIVE_URI, relative_uri)) {
-				*personal_source = g_object_ref (source);
-				break;
-			}
-		}
-	} else {
-		/* create the local source group */
-		group = e_source_group_new (_("On This Computer"), LOCAL_BASE_URI);
-		e_source_list_add_group (source_list, group, -1);
-
-		*on_this_computer = group;
-	}
-
-	if (!*personal_source) {
-		GSList *selected;
-		gchar *primary_task_list;
-
-		/* Create the default Person task list */
-		ESource *source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI);
-		e_source_group_add_source (*on_this_computer, source, -1);
-
-		primary_task_list = e_shell_settings_get_string (
-			shell_settings, "cal-primary-task-list");
-
-		selected = e_task_shell_backend_get_selected_task_lists (
-			E_TASK_SHELL_BACKEND (shell_backend));
-
-		if (primary_task_list == NULL && selected == NULL) {
-			GSList link;
-
-			e_shell_settings_set_string (
-				shell_settings, "cal-primary-task-list",
-				e_source_peek_uid (source));
-
-			link.data = (gpointer)e_source_peek_uid (source);
-			link.next = NULL;
-
-			e_task_shell_backend_set_selected_task_lists (
-				E_TASK_SHELL_BACKEND (shell_backend), &link);
-		}
-
-		g_slist_foreach (selected, (GFunc) g_free, NULL);
-		g_slist_free (selected);
-
-		e_source_set_color_spec (source, "#BECEDD");
-		*personal_source = source;
-	}
-
-	if (!*on_the_web) {
-		/* Create the Webcal source group */
-		group = e_source_group_new (_("On The Web"), WEBCAL_BASE_URI);
-		e_source_list_add_group (source_list, group, -1);
-
-		*on_the_web = group;
-	}
-}
-
 gboolean
 e_task_shell_backend_migrate (EShellBackend *shell_backend,
                               gint major,
@@ -171,28 +28,5 @@ e_task_shell_backend_migrate (EShellBackend *shell_backend,
                               gint micro,
                               GError **error)
 {
-	ESourceGroup *on_this_computer = NULL;
-	ESourceGroup *on_the_web = NULL;
-	ESource *personal_source = NULL;
-	ESourceList *source_list;
-
-	g_object_get (shell_backend, "source-list", &source_list, NULL);
-
-	/* we call this unconditionally now - create_groups either
-	   creates the groups/sources or it finds the necessary
-	   groups/sources. */
-	create_task_sources (
-		shell_backend, source_list, &on_this_computer,
-		&on_the_web, &personal_source);
-
-	e_source_list_sync (source_list, NULL);
-
-	if (on_this_computer)
-		g_object_unref (on_this_computer);
-	if (on_the_web)
-		g_object_unref (on_the_web);
-	if (personal_source)
-		g_object_unref (personal_source);
-
 	return TRUE;
 }
diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c
index f152acf..286a3a9 100644
--- a/modules/calendar/e-task-shell-sidebar.c
+++ b/modules/calendar/e-task-shell-sidebar.c
@@ -24,6 +24,7 @@
 #include <string.h>
 #include <glib/gi18n.h>
 #include <libecal/e-cal.h>
+#include <libecal/e-source-calendar.h>
 
 #include "e-util/e-alert-dialog.h"
 #include "e-util/e-util.h"
@@ -115,7 +116,7 @@ task_shell_sidebar_backend_died_cb (ETaskShellSidebar *task_shell_sidebar,
 	shell_content = e_shell_view_get_shell_content (shell_view);
 
 	source = e_cal_get_source (client);
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 
 	g_object_ref (source);
 
@@ -137,21 +138,30 @@ task_shell_sidebar_backend_error_cb (ETaskShellSidebar *task_shell_sidebar,
 	EShellView *shell_view;
 	EShellContent *shell_content;
 	EShellSidebar *shell_sidebar;
-	ESourceGroup *source_group;
+	ESource *parent;
 	ESource *source;
+	GNode *node;
+	const gchar *parent_display_name;
+	const gchar *source_display_name;
 
 	shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar);
 	shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
 	shell_content = e_shell_view_get_shell_content (shell_view);
 
 	source = e_cal_get_source (client);
-	source_group = e_source_peek_group (source);
+
+	node = e_source_get_node (source);
+	g_return_if_fail (node != NULL);
+	g_return_if_fail (node->parent != NULL);
+
+	parent = E_SOURCE (node->parent->data);
+
+	parent_display_name = e_source_get_display_name (parent);
+	source_display_name = e_source_get_display_name (source);
 
 	e_alert_submit (
-		E_ALERT_SINK (shell_content),
-		"calendar:backend-error",
-		e_source_group_peek_name (source_group),
-		e_source_peek_name (source), message, NULL);
+		E_ALERT_SINK (shell_content), "calendar:backend-error",
+		parent_display_name, source_display_name, message, NULL);
 }
 
 static void
@@ -300,7 +310,7 @@ task_shell_sidebar_set_default (ETaskShellSidebar *task_shell_sidebar,
 		priv->loading_default_client = NULL;
 	}
 
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 	client = g_hash_table_lookup (priv->client_table, uid);
 
 	/* If we already have an open connection for
@@ -349,38 +359,6 @@ task_shell_sidebar_row_changed_cb (ETaskShellSidebar *task_shell_sidebar,
 }
 
 static void
-task_shell_sidebar_selection_changed_cb (ETaskShellSidebar *task_shell_sidebar,
-                                         ESourceSelector *selector)
-{
-	EShellView *shell_view;
-	EShellBackend *shell_backend;
-	EShellSidebar *shell_sidebar;
-	GSList *list, *iter;
-
-	/* This signal is emitted less frequently than "row-changed",
-	 * especially when the model is being rebuilt.  So we'll take
-	 * it easy on poor GConf. */
-
-	shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar);
-	shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
-	shell_backend = e_shell_view_get_shell_backend (shell_view);
-
-	list = e_source_selector_get_selection (selector);
-
-	for (iter = list; iter != NULL; iter = iter->next) {
-		ESource *source = iter->data;
-
-		iter->data = (gpointer) e_source_peek_uid (source);
-		g_object_unref (source);
-	}
-
-	e_task_shell_backend_set_selected_task_lists (
-		E_TASK_SHELL_BACKEND (shell_backend), list);
-
-	g_slist_free (list);
-}
-
-static void
 task_shell_sidebar_primary_selection_changed_cb (ETaskShellSidebar *task_shell_sidebar,
                                                  ESourceSelector *selector)
 {
@@ -402,11 +380,9 @@ task_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
 	EShell *shell;
 	EShellBackend *shell_backend;
 	EShellSettings *shell_settings;
+	ESourceRegistry *registry;
 	ESourceSelector *selector;
-	ESourceList *source_list;
-	ESource *source;
 	GtkTreeModel *model;
-	GSList *list, *iter;
 
 	priv = E_TASK_SHELL_SIDEBAR (shell_sidebar)->priv;
 
@@ -419,8 +395,7 @@ task_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
 	selector = E_SOURCE_SELECTOR (priv->selector);
 	model = gtk_tree_view_get_model (GTK_TREE_VIEW (selector));
 
-	source_list = e_task_shell_backend_get_source_list (
-		E_TASK_SHELL_BACKEND (shell_backend));
+	registry = e_source_registry_get_default ();
 
 	g_signal_connect_swapped (
 		model, "row-changed",
@@ -439,30 +414,8 @@ task_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
 		G_BINDING_SYNC_CREATE,
 		(GBindingTransformFunc) e_binding_transform_uid_to_source,
 		(GBindingTransformFunc) e_binding_transform_source_to_uid,
-		g_object_ref (source_list),
+		g_object_ref (registry),
 		(GDestroyNotify) g_object_unref);
-
-	list = e_task_shell_backend_get_selected_task_lists (
-		E_TASK_SHELL_BACKEND (shell_backend));
-
-	for (iter = list; iter != NULL; iter = iter->next) {
-		const gchar *uid = iter->data;
-
-		source = e_source_list_peek_source_by_uid (source_list, uid);
-
-		if (source != NULL)
-			e_source_selector_select_source (selector, source);
-	}
-
-	g_slist_foreach (list, (GFunc) g_free, NULL);
-	g_slist_free (list);
-
-	/* Listen for subsequent changes to the selector. */
-
-	g_signal_connect_swapped (
-		selector, "selection-changed",
-		G_CALLBACK (task_shell_sidebar_selection_changed_cb),
-		shell_sidebar);
 }
 
 static void
@@ -538,9 +491,8 @@ task_shell_sidebar_constructed (GObject *object)
 	ETaskShellSidebarPrivate *priv;
 	EShellView *shell_view;
 	EShellWindow *shell_window;
-	EShellBackend *shell_backend;
 	EShellSidebar *shell_sidebar;
-	ESourceList *source_list;
+	ESourceRegistry *registry;
 	GtkContainer *container;
 	GtkWidget *widget;
 	AtkObject *a11y;
@@ -552,12 +504,8 @@ task_shell_sidebar_constructed (GObject *object)
 
 	shell_sidebar = E_SHELL_SIDEBAR (object);
 	shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
-	shell_backend = e_shell_view_get_shell_backend (shell_view);
 	shell_window = e_shell_view_get_shell_window (shell_view);
 
-	source_list = e_task_shell_backend_get_source_list (
-		E_TASK_SHELL_BACKEND (shell_backend));
-
 	container = GTK_CONTAINER (shell_sidebar);
 
 	widget = gtk_scrolled_window_new (NULL, NULL);
@@ -571,7 +519,8 @@ task_shell_sidebar_constructed (GObject *object)
 
 	container = GTK_CONTAINER (widget);
 
-	widget = e_task_list_selector_new (source_list);
+	registry = e_source_registry_get_default ();
+	widget = e_task_list_selector_new (registry);
 	e_source_selector_set_select_new (E_SOURCE_SELECTOR (widget), TRUE);
 	gtk_container_add (container, widget);
 	a11y = gtk_widget_get_accessible (widget);
@@ -603,20 +552,24 @@ task_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
 	source = e_source_selector_get_primary_selection (selector);
 
 	if (source != NULL) {
+		ESourceSelectable *extension;
 		ECal *client;
-		const gchar *uri;
-		const gchar *delete;
+		gboolean writable_hint;
+		const gchar *uid;
+
+		uid = e_source_get_uid (source);
+		is_system = (g_strcmp0 (uid, "system") == 0);
 
-		uri = e_source_peek_relative_uri (source);
-		is_system = (uri == NULL || strcmp (uri, "system") == 0);
+		extension = e_source_get_extension (
+			source, E_SOURCE_EXTENSION_TASK_LIST);
+		writable_hint =
+			e_source_selectable_get_writable_hint (extension);
 
-		can_delete = !is_system;
-		delete = e_source_get_property (source, "delete");
-		can_delete &= (delete == NULL || strcmp (delete, "no") != 0);
+		can_delete = !is_system && writable_hint;
 
 		client = g_hash_table_lookup (
 			task_shell_sidebar->priv->client_table,
-			e_source_peek_uid (source));
+			e_source_get_uid (source));
 		refresh_supported =
 			client && e_cal_get_refresh_supported (client);
 	}
@@ -650,8 +603,7 @@ task_shell_sidebar_client_removed (ETaskShellSidebar *task_shell_sidebar,
 		NULL, NULL, task_shell_sidebar);
 
 	source = e_cal_get_source (client);
-	uid = e_source_peek_uid (source);
-	g_return_if_fail (uid != NULL);
+	uid = e_source_get_uid (source);
 
 	g_hash_table_remove (client_table, uid);
 	e_source_selector_unselect_source (selector, source);
@@ -833,8 +785,8 @@ e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar,
 	ECal *default_client;
 	ECal *client;
 	icaltimezone *timezone;
+	const gchar *display_name;
 	const gchar *uid;
-	const gchar *uri;
 	gchar *message;
 
 	g_return_if_fail (E_IS_TASK_SHELL_SIDEBAR (task_shell_sidebar));
@@ -845,7 +797,7 @@ e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar,
 	default_client = task_shell_sidebar->priv->default_client;
 	selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
 
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 	client = g_hash_table_lookup (client_table, uid);
 
 	if (client != NULL)
@@ -856,7 +808,7 @@ e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar,
 		const gchar *default_uid;
 
 		default_source = e_cal_get_source (default_client);
-		default_uid = e_source_peek_uid (default_source);
+		default_uid = e_source_get_uid (default_source);
 
 		if (g_strcmp0 (uid, default_uid) == 0)
 			client = g_object_ref (default_client);
@@ -880,9 +832,8 @@ e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar,
 	g_hash_table_insert (client_table, g_strdup (uid), client);
 	e_source_selector_select_source (selector, source);
 
-	uri = e_cal_get_uri (client);
-	/* Translators: The string field is a URI. */
-	message = g_strdup_printf (_("Opening tasks at %s"), uri);
+	display_name = e_source_get_display_name (source);
+	message = g_strdup_printf (_("Opening task list '%s'"), display_name);
 	task_shell_sidebar_emit_status_message (task_shell_sidebar, message);
 	g_free (message);
 
@@ -918,7 +869,7 @@ e_task_shell_sidebar_remove_source (ETaskShellSidebar *task_shell_sidebar,
 
 	client_table = task_shell_sidebar->priv->client_table;
 
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 	client = g_hash_table_lookup (client_table, uid);
 
 	if (client == NULL)
diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c
index dce77b0..51cb812 100644
--- a/modules/calendar/e-task-shell-view-actions.c
+++ b/modules/calendar/e-task-shell-view-actions.c
@@ -147,32 +147,17 @@ static void
 action_task_list_delete_cb (GtkAction *action,
                             ETaskShellView *task_shell_view)
 {
-	ETaskShellBackend *task_shell_backend;
-	ETaskShellContent *task_shell_content;
 	ETaskShellSidebar *task_shell_sidebar;
 	EShellWindow *shell_window;
 	EShellView *shell_view;
-	ETaskTable *task_table;
-	ECal *client;
-	ECalModel *model;
 	ESourceSelector *selector;
-	ESourceGroup *source_group;
-	ESourceList *source_list;
 	ESource *source;
+	GFile *file;
 	gint response;
-	gchar *uri;
-	GError *error = NULL;
 
 	shell_view = E_SHELL_VIEW (task_shell_view);
 	shell_window = e_shell_view_get_shell_window (shell_view);
 
-	task_shell_backend = task_shell_view->priv->task_shell_backend;
-	source_list = e_task_shell_backend_get_source_list (task_shell_backend);
-
-	task_shell_content = task_shell_view->priv->task_shell_content;
-	task_table = e_task_shell_content_get_task_table (task_shell_content);
-	model = e_task_table_get_model (task_table);
-
 	task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
 	selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
 	source = e_source_selector_get_primary_selection (selector);
@@ -182,37 +167,14 @@ action_task_list_delete_cb (GtkAction *action,
 	response = e_alert_run_dialog_for_args (
 		GTK_WINDOW (shell_window),
 		"calendar:prompt-delete-task-list",
-		e_source_peek_name (source), NULL);
-	if (response != GTK_RESPONSE_YES)
-		return;
-
-	uri = e_source_get_uri (source);
-	client = e_cal_model_get_client_for_uri (model, uri);
-	if (client == NULL)
-		client = e_cal_new_from_uri (uri, E_CAL_SOURCE_TYPE_JOURNAL);
-	g_free (uri);
-
-	g_return_if_fail (client != NULL);
+		e_source_get_display_name (source), NULL);
 
-	if (!e_cal_remove (client, &error)) {
-		g_warning ("%s", error->message);
-		g_error_free (error);
+	if (response != GTK_RESPONSE_YES)
 		return;
-	}
-
-	if (e_source_selector_source_is_selected (selector, source)) {
-		e_task_shell_sidebar_remove_source (
-			task_shell_sidebar, source);
-		e_source_selector_unselect_source (selector, source);
-	}
 
-	source_group = e_source_peek_group (source);
-	e_source_group_remove_source (source_group, source);
-
-	if (!e_source_list_sync (source_list, &error)) {
-		g_warning ("%s", error->message);
-		g_error_free (error);
-	}
+	/* FIXME Handle errors. */
+	file = e_source_get_file (source);
+	g_file_delete (file, NULL, NULL);
 }
 
 static void
@@ -221,10 +183,30 @@ action_task_list_new_cb (GtkAction *action,
 {
 	EShellView *shell_view;
 	EShellWindow *shell_window;
+	ESourceRegistry *registry;
+	ECalSourceType source_type;
+	GtkWidget *config;
+	GtkWidget *dialog;
+	const gchar *icon_name;
 
 	shell_view = E_SHELL_VIEW (task_shell_view);
 	shell_window = e_shell_view_get_shell_window (shell_view);
-	calendar_setup_new_task_list (GTK_WINDOW (shell_window));
+
+	source_type = E_CAL_SOURCE_TYPE_TODO;
+	registry = e_source_registry_get_default ();
+	config = e_cal_source_config_new (registry, NULL, source_type);
+
+	dialog = e_source_config_dialog_new (
+		E_SOURCE_CONFIG (config), GTK_WINDOW (shell_window));
+
+	icon_name = gtk_action_get_icon_name (action);
+	gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name);
+
+	gtk_window_set_title (GTK_WINDOW (dialog), _("New Task List"));
+
+	gtk_dialog_run (GTK_DIALOG (dialog));
+
+	gtk_widget_destroy (dialog);
 }
 
 static void
@@ -261,11 +243,16 @@ static void
 action_task_list_properties_cb (GtkAction *action,
                                 ETaskShellView *task_shell_view)
 {
-	ETaskShellSidebar *task_shell_sidebar;
 	EShellView *shell_view;
 	EShellWindow *shell_window;
+	ETaskShellSidebar *task_shell_sidebar;
+	ECalSourceType source_type;
 	ESource *source;
 	ESourceSelector *selector;
+	ESourceRegistry *registry;
+	GtkWidget *config;
+	GtkWidget *dialog;
+	const gchar *icon_name;
 
 	shell_view = E_SHELL_VIEW (task_shell_view);
 	shell_window = e_shell_view_get_shell_window (shell_view);
@@ -273,9 +260,23 @@ action_task_list_properties_cb (GtkAction *action,
 	task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
 	selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
 	source = e_source_selector_get_primary_selection (selector);
-	g_return_if_fail (E_IS_SOURCE (source));
+	g_return_if_fail (source != NULL);
+
+	source_type = E_CAL_SOURCE_TYPE_TODO;
+	registry = e_source_selector_get_registry (selector);
+	config = e_cal_source_config_new (registry, source, source_type);
+
+	dialog = e_source_config_dialog_new (
+		E_SOURCE_CONFIG (config), GTK_WINDOW (shell_window));
 
-	calendar_setup_edit_task_list (GTK_WINDOW (shell_window), source);
+	icon_name = gtk_action_get_icon_name (action);
+	gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name);
+
+	gtk_window_set_title (GTK_WINDOW (dialog), _("Task List Properties"));
+
+	gtk_dialog_run (GTK_DIALOG (dialog));
+
+	gtk_widget_destroy (dialog);
 }
 
 static void
@@ -288,7 +289,6 @@ action_task_list_refresh_cb (GtkAction *action,
 	ECal *client;
 	ECalModel *model;
 	ESource *source;
-	gchar *uri;
 	GError *error = NULL;
 
 	task_shell_content = task_shell_view->priv->task_shell_content;
@@ -300,10 +300,7 @@ action_task_list_refresh_cb (GtkAction *action,
 	source = e_source_selector_get_primary_selection (selector);
 	g_return_if_fail (E_IS_SOURCE (source));
 
-	uri = e_source_get_uri (source);
-	client = e_cal_model_get_client_for_uri (model, uri);
-	g_free (uri);
-
+	client = e_cal_model_get_client_for_source (model, source);
 	if (client == NULL)
 		return;
 
@@ -312,7 +309,7 @@ action_task_list_refresh_cb (GtkAction *action,
 	if (!e_cal_refresh (client, &error) && error) {
 		g_warning (
 			"%s: Failed to refresh '%s', %s\n",
-			G_STRFUNC, e_source_peek_name (source),
+			G_STRFUNC, e_source_get_display_name (source),
 			error->message);
 		g_error_free (error);
 	}
diff --git a/modules/calendar/e-task-shell-view-private.h b/modules/calendar/e-task-shell-view-private.h
index b7dace8..9c51099 100644
--- a/modules/calendar/e-task-shell-view-private.h
+++ b/modules/calendar/e-task-shell-view-private.h
@@ -37,15 +37,16 @@
 #include "shell/e-shell-utils.h"
 #include "misc/e-popup-action.h"
 #include "misc/e-selectable.h"
+#include "misc/e-source-config-dialog.h"
 
 #include "calendar/common/authentication.h"
 #include "calendar/gui/calendar-config.h"
 #include "calendar/gui/comp-util.h"
 #include "calendar/gui/e-cal-component-preview.h"
 #include "calendar/gui/e-cal-model-tasks.h"
+#include "calendar/gui/e-cal-source-config.h"
 #include "calendar/gui/e-calendar-selector.h"
 #include "calendar/gui/print.h"
-#include "calendar/gui/dialogs/calendar-setup.h"
 #include "calendar/gui/dialogs/copy-source-dialog.h"
 #include "calendar/gui/dialogs/task-editor.h"
 
diff --git a/modules/calendar/e-task-shell-view.h b/modules/calendar/e-task-shell-view.h
index 853d90c..d756c10 100644
--- a/modules/calendar/e-task-shell-view.h
+++ b/modules/calendar/e-task-shell-view.h
@@ -23,7 +23,6 @@
 #define E_TASK_SHELL_VIEW_H
 
 #include <shell/e-shell-view.h>
-#include <libedataserver/e-source-list.h>
 
 /* Standard GObject macros */
 #define E_TYPE_TASK_SHELL_VIEW \
diff --git a/widgets/misc/Makefile.am b/widgets/misc/Makefile.am
index 3ccb95b..124b37d 100644
--- a/widgets/misc/Makefile.am
+++ b/widgets/misc/Makefile.am
@@ -11,6 +11,7 @@ widgetsinclude_HEADERS =			\
 	e-action-combo-box.h			\
 	e-activity-bar.h			\
 	e-activity-proxy.h			\
+	e-alarm-selector.h			\
 	e-alert-bar.h				\
 	e-attachment.h				\
 	e-attachment-button.h			\
@@ -95,6 +96,7 @@ libemiscwidgets_la_SOURCES =			\
 	e-action-combo-box.c			\
 	e-activity-bar.c			\
 	e-activity-proxy.c			\
+	e-alarm-selector.c			\
 	e-alert-bar.c				\
 	e-attachment.c				\
 	e-attachment-button.c			\
diff --git a/widgets/misc/e-alarm-selector.c b/widgets/misc/e-alarm-selector.c
new file mode 100644
index 0000000..0eeeba3
--- /dev/null
+++ b/widgets/misc/e-alarm-selector.c
@@ -0,0 +1,102 @@
+/*
+ * e-alarm-selector.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#include "e-alarm-selector.h"
+
+#include <libecal/e-source-calendar.h>
+#include <libedataserver/e-source-alarms.h>
+
+G_DEFINE_TYPE (
+	EAlarmSelector,
+	e_alarm_selector,
+	E_TYPE_SOURCE_SELECTOR)
+
+static gboolean
+alarm_selector_get_source_selected (ESourceSelector *selector,
+                                    ESource *source)
+{
+	ESourceAlarms *extension;
+	const gchar *extension_name;
+
+	extension_name = e_source_selector_get_extension_name (selector);
+
+	/* Make sure this source is a calendar. */
+	if (!e_source_has_extension (source, extension_name))
+		return FALSE;
+
+	extension_name = E_SOURCE_EXTENSION_ALARMS;
+	extension = e_source_get_extension (source, extension_name);
+	g_return_val_if_fail (E_IS_SOURCE_ALARMS (extension), FALSE);
+
+	return e_source_alarms_get_include_me (extension);
+}
+
+static gboolean
+alarm_selector_set_source_selected (ESourceSelector *selector,
+                                    ESource *source,
+                                    gboolean selected)
+{
+	ESourceAlarms *extension;
+	const gchar *extension_name;
+
+	extension_name = e_source_selector_get_extension_name (selector);
+
+	/* Make sure this source is a calendar. */
+	if (!e_source_has_extension (source, extension_name))
+		return FALSE;
+
+	extension_name = E_SOURCE_EXTENSION_ALARMS;
+	extension = e_source_get_extension (source, extension_name);
+	g_return_val_if_fail (E_IS_SOURCE_ALARMS (extension), FALSE);
+
+	/* Avoid unnecessary signal emissions and disk writes. */
+	if (selected == e_source_alarms_get_include_me (extension))
+		return FALSE;
+
+	e_source_alarms_set_include_me (extension, selected);
+
+	return TRUE;
+}
+
+static void
+e_alarm_selector_class_init (EAlarmSelectorClass *class)
+{
+	ESourceSelectorClass *source_selector_class;
+
+	source_selector_class = E_SOURCE_SELECTOR_CLASS (class);
+	source_selector_class->get_source_selected =
+					alarm_selector_get_source_selected;
+	source_selector_class->set_source_selected =
+					alarm_selector_set_source_selected;
+}
+
+static void
+e_alarm_selector_init (EAlarmSelector *selector)
+{
+}
+
+GtkWidget *
+e_alarm_selector_new (ESourceRegistry *registry)
+{
+	g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
+
+	return g_object_new (
+		E_TYPE_ALARM_SELECTOR,
+		"extension-name", E_SOURCE_EXTENSION_CALENDAR,
+		"registry", registry, NULL);
+}
diff --git a/widgets/misc/e-alarm-selector.h b/widgets/misc/e-alarm-selector.h
new file mode 100644
index 0000000..2ad9c49
--- /dev/null
+++ b/widgets/misc/e-alarm-selector.h
@@ -0,0 +1,63 @@
+/*
+ * e-alarm-selector.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#ifndef E_ALARM_SELECTOR_H
+#define E_ALARM_SELECTOR_H
+
+#include <libedataserverui/e-source-selector.h>
+
+/* Standard GObject macros */
+#define E_TYPE_ALARM_SELECTOR \
+	(e_alarm_selector_get_type ())
+#define E_ALARM_SELECTOR(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), E_TYPE_ALARM_SELECTOR, EAlarmSelector))
+#define E_ALARM_SELECTOR_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), E_TYPE_ALARM_SELECTOR, EAlarmSelectorClass))
+#define E_IS_ALARM_SELECTOR(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), E_TYPE_ALARM_SELECTOR))
+#define E_IS_ALARM_SELECTOR_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), E_TYPE_ALARM_SELECTOR))
+#define E_ALARM_SELECTOR_GET_CLASS(obj) \
+	(G_TYPE_INSTANCE_GET_CLASS \
+	((obj), E_TYPE_ALARM_SELECTOR, EAlarmSelectorClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EAlarmSelector EAlarmSelector;
+typedef struct _EAlarmSelectorClass EAlarmSelectorClass;
+typedef struct _EAlarmSelectorPrivate EAlarmSelectorPrivate;
+
+struct _EAlarmSelector {
+	ESourceSelector parent;
+	EAlarmSelectorPrivate *priv;
+};
+
+struct _EAlarmSelectorClass {
+	ESourceSelectorClass parent_class;
+};
+
+GType		e_alarm_selector_get_type	(void) G_GNUC_CONST;
+GtkWidget *	e_alarm_selector_new		(ESourceRegistry *registry);
+
+G_END_DECLS
+
+#endif /* E_ALARM_SELECTOR_H */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]