[evolution] Use EClientComboBox where appropriate.



commit 4ff90f2bfd95337040616cae4b3bdddff033b5d6
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Mar 1 14:30:14 2013 -0500

    Use EClientComboBox where appropriate.
    
    Basically any place where we use both EClient and ESourceComboBox.

 addressbook/gui/contact-editor/contact-editor.ui   |    2 +-
 addressbook/gui/contact-editor/e-contact-editor.c  |   42 ++++---
 .../gui/contact-editor/e-contact-quick-add.c       |   75 ++++++++----
 .../gui/contact-editor/e-contact-quick-add.h       |   10 +-
 .../gui/contact-list-editor/contact-list-editor.ui |    4 +-
 .../contact-list-editor/e-contact-list-editor.c    |   51 +++++----
 calendar/gui/dialogs/alarm-dialog.c                |   12 +-
 calendar/gui/dialogs/alarm-dialog.h                |    4 +-
 calendar/gui/dialogs/alarm-list-dialog.c           |   17 ++--
 calendar/gui/dialogs/alarm-list-dialog.h           |    6 +-
 calendar/gui/dialogs/e-delegate-dialog.c           |   12 +-
 calendar/gui/dialogs/e-delegate-dialog.h           |    7 +-
 calendar/gui/dialogs/event-page.c                  |   71 +++++------
 calendar/gui/dialogs/event-page.ui                 |    4 +-
 calendar/gui/dialogs/memo-page.c                   |   59 ++++-----
 calendar/gui/dialogs/memo-page.ui                  |    4 +-
 calendar/gui/dialogs/task-page.c                   |   58 ++++-----
 calendar/gui/dialogs/task-page.ui                  |    2 +-
 calendar/gui/e-meeting-list-view.c                 |    6 +-
 composer/e-composer-header-table.c                 |    4 +-
 doc/reference/libeutil/libeutil-sections.txt       |    8 +-
 e-util/e-name-selector-dialog.c                    |  125 +++++++++++---------
 e-util/e-name-selector-dialog.h                    |    7 +-
 e-util/e-name-selector-entry.c                     |  120 +++++++++++--------
 e-util/e-name-selector-entry.h                     |   11 +-
 e-util/e-name-selector-list.c                      |    8 +-
 e-util/e-name-selector-list.h                      |    4 +-
 e-util/e-name-selector.c                           |  120 ++++++++++++-------
 e-util/e-name-selector.h                           |    9 +-
 e-util/test-name-selector.c                        |   33 ++++--
 maint/evolution.xml                                |    3 +
 modules/addressbook/e-book-shell-backend.c         |   12 +-
 plugins/bbdb/bbdb.c                                |    7 +-
 plugins/pst-import/pst-importer.c                  |   37 ++++---
 34 files changed, 527 insertions(+), 427 deletions(-)
---
diff --git a/addressbook/gui/contact-editor/contact-editor.ui 
b/addressbook/gui/contact-editor/contact-editor.ui
index b12c604..f3a1848 100644
--- a/addressbook/gui/contact-editor/contact-editor.ui
+++ b/addressbook/gui/contact-editor/contact-editor.ui
@@ -234,7 +234,7 @@
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="ESourceComboBox" type-func="e_source_combo_box_get_type" 
id="source-combo-box-source">
+                                  <object class="EClientComboBox" type-func="e_client_combo_box_get_type" 
id="client-combo-box">
                                     <property name="extension-name">Address Book</property>
                                     <property name="show-colors">False</property>
                                     <property name="visible">True</property>
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c 
b/addressbook/gui/contact-editor/e-contact-editor.c
index 0f3aef0..0d994f8 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -686,7 +686,7 @@ fill_in_source_field (EContactEditor *editor)
                return;
 
        source_menu = e_builder_get_widget (
-               editor->builder, "source-combo-box-source");
+               editor->builder, "client-combo-box");
 
        e_source_combo_box_set_active (
                E_SOURCE_COMBO_BOX (source_menu),
@@ -3101,15 +3101,19 @@ init_all (EContactEditor *editor)
 }
 
 static void
-contact_editor_client_connect_cb (GObject *source_object,
-                                  GAsyncResult *result,
-                                  gpointer user_data)
+contact_editor_get_client_cb (GObject *source_object,
+                              GAsyncResult *result,
+                              gpointer user_data)
 {
+       EClientComboBox *combo_box;
        ConnectClosure *closure = user_data;
        EClient *client;
        GError *error = NULL;
 
-       client = e_book_client_connect_finish (result, &error);
+       combo_box = E_CLIENT_COMBO_BOX (source_object);
+
+       client = e_client_combo_box_get_client_finish (
+               combo_box, result, &error);
 
        /* Sanity check. */
        g_return_if_fail (
@@ -3123,7 +3127,6 @@ contact_editor_client_connect_cb (GObject *source_object,
                goto exit;
 
        } else if (error != NULL) {
-               GtkWidget *source_combo_box;
                GtkWindow *parent;
 
                parent = eab_editor_get_window (EAB_EDITOR (closure->editor));
@@ -3132,11 +3135,8 @@ contact_editor_client_connect_cb (GObject *source_object,
                        GTK_WIDGET (parent), NULL,
                        closure->source, error);
 
-               source_combo_box = e_builder_get_widget (
-                       closure->editor->builder,
-                       "source-combo-box-source");
                e_source_combo_box_set_active (
-                       E_SOURCE_COMBO_BOX (source_combo_box),
+                       E_SOURCE_COMBO_BOX (combo_box),
                        closure->source);
 
                g_error_free (error);
@@ -3153,7 +3153,7 @@ exit:
 }
 
 static void
-source_changed (ESourceComboBox *source_combo_box,
+source_changed (EClientComboBox *combo_box,
                 EContactEditor *editor)
 {
        ConnectClosure *closure;
@@ -3161,7 +3161,8 @@ source_changed (ESourceComboBox *source_combo_box,
        ESource *source_source;
        ESource *source;
 
-       source = e_source_combo_box_ref_active (source_combo_box);
+       source = e_source_combo_box_ref_active (
+               E_SOURCE_COMBO_BOX (combo_box));
        g_return_if_fail (source != NULL);
 
        if (editor->cancellable != NULL) {
@@ -3189,9 +3190,10 @@ source_changed (ESourceComboBox *source_combo_box,
        closure->editor = g_object_ref (editor);
        closure->source = g_object_ref (source);
 
-       e_book_client_connect (
-               source, editor->cancellable,
-               contact_editor_client_connect_cb,
+       e_client_combo_box_get_client (
+               combo_box, source,
+               editor->cancellable,
+               contact_editor_get_client_cb,
                closure);
 
 exit:
@@ -4062,7 +4064,7 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
 {
        GtkBuilder *builder;
        EShell *shell;
-       ESourceRegistry *registry;
+       EClientCache *client_cache;
        GtkWidget *container;
        GtkWidget *widget, *label;
        GtkEntryCompletion *completion;
@@ -4070,7 +4072,7 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
        /* FIXME The shell should be obtained
         *       through a constructor property. */
        shell = e_shell_get_default ();
-       registry = e_shell_get_registry (shell);
+       client_cache = e_shell_get_client_cache (shell);
 
        e_contact_editor->name = e_contact_name_new ();
 
@@ -4122,9 +4124,9 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
                widget, "clicked",
                G_CALLBACK (categories_clicked), e_contact_editor);
        widget = e_builder_get_widget (
-               e_contact_editor->builder, "source-combo-box-source");
-       e_source_combo_box_set_registry (
-               E_SOURCE_COMBO_BOX (widget), registry);
+               e_contact_editor->builder, "client-combo-box");
+       e_client_combo_box_set_client_cache (
+               E_CLIENT_COMBO_BOX (widget), client_cache);
        g_signal_connect (
                widget, "changed",
                G_CALLBACK (source_changed), e_contact_editor);
diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c 
b/addressbook/gui/contact-editor/e-contact-quick-add.c
index 0bfa46b..5814205 100644
--- a/addressbook/gui/contact-editor/e-contact-quick-add.c
+++ b/addressbook/gui/contact-editor/e-contact-quick-add.c
@@ -41,7 +41,7 @@ struct _QuickAdd {
        gchar *vcard;
        EContact *contact;
        GCancellable *cancellable;
-       ESourceRegistry *registry;
+       EClientCache *client_cache;
        ESource *source;
 
        EContactQuickAddCallback cb;
@@ -57,11 +57,11 @@ struct _QuickAdd {
 };
 
 static QuickAdd *
-quick_add_new (ESourceRegistry *registry)
+quick_add_new (EClientCache *client_cache)
 {
        QuickAdd *qa = g_new0 (QuickAdd, 1);
        qa->contact = e_contact_new ();
-       qa->registry = g_object_ref (registry);
+       qa->client_cache = g_object_ref (client_cache);
        qa->refs = 1;
        return qa;
 }
@@ -80,7 +80,7 @@ quick_add_unref (QuickAdd *qa)
                        g_free (qa->email);
                        g_free (qa->vcard);
                        g_object_unref (qa->contact);
-                       g_object_unref (qa->registry);
+                       g_object_unref (qa->client_cache);
                        g_free (qa);
                }
        }
@@ -128,7 +128,8 @@ merge_cb (GObject *source_object,
        EClient *client;
        GError *error = NULL;
 
-       client = e_book_client_connect_finish (result, &error);
+       client = e_client_cache_get_client_finish (
+               E_CLIENT_CACHE (source_object), result, &error);
 
        /* Sanity check. */
        g_return_if_fail (
@@ -151,11 +152,17 @@ merge_cb (GObject *source_object,
                return;
        }
 
-       if (!e_client_is_readonly (client))
+       if (!e_client_is_readonly (client)) {
+               ESourceRegistry *registry;
+
+               registry = e_client_cache_ref_registry (qa->client_cache);
+
                eab_merging_book_add_contact (
-                       qa->registry, E_BOOK_CLIENT (client),
+                       registry, E_BOOK_CLIENT (client),
                        qa->contact, NULL, NULL);
-       else {
+
+               g_object_unref (registry);
+       } else {
                ESource *source = e_client_get_source (client);
 
                e_alert_run_dialog_for_args (
@@ -183,7 +190,10 @@ quick_add_merge_contact (QuickAdd *qa)
 
        qa->cancellable = g_cancellable_new ();
 
-       e_book_client_connect (qa->source, qa->cancellable, merge_cb, qa);
+       e_client_cache_get_client (
+               qa->client_cache, qa->source,
+               E_SOURCE_EXTENSION_ADDRESS_BOOK,
+               qa->cancellable, merge_cb, qa);
 }
 
 /* Raise a contact editor with all fields editable,
@@ -283,9 +293,11 @@ ce_have_book (GObject *source_object,
 {
        QuickAdd *qa = user_data;
        EClient *client;
+       ESourceRegistry *registry;
        GError *error = NULL;
 
-       client = e_book_client_connect_finish (result, &error);
+       client = e_client_cache_get_client_finish (
+               E_CLIENT_CACHE (source_object), result, &error);
 
        /* Sanity check. */
        g_return_if_fail (
@@ -307,9 +319,13 @@ ce_have_book (GObject *source_object,
                return;
        }
 
+       registry = e_client_cache_ref_registry (qa->client_cache);
+
        eab_merging_book_find_contact (
-               qa->registry, E_BOOK_CLIENT (client),
+               registry, E_BOOK_CLIENT (client),
                qa->contact, ce_have_contact, qa);
+
+       g_object_unref (registry);
 }
 
 static void
@@ -322,7 +338,10 @@ edit_contact (QuickAdd *qa)
 
        qa->cancellable = g_cancellable_new ();
 
-       e_book_client_connect (qa->source, qa->cancellable, ce_have_book, qa);
+       e_client_cache_get_client (
+               qa->client_cache, qa->source,
+               E_SOURCE_EXTENSION_ADDRESS_BOOK,
+               qa->cancellable, ce_have_book, qa);
 }
 
 #define QUICK_ADD_RESPONSE_EDIT_FULL 2
@@ -425,6 +444,7 @@ build_quick_add_dialog (QuickAdd *qa)
        GtkWidget *label;
        GtkTable *table;
        ESource *source;
+       ESourceRegistry *registry;
        const gchar *extension_name;
        const gint xpad = 0, ypad = 0;
 
@@ -467,9 +487,12 @@ build_quick_add_dialog (QuickAdd *qa)
        }
 
        extension_name = E_SOURCE_EXTENSION_ADDRESS_BOOK;
-       source = e_source_registry_ref_default_address_book (qa->registry);
+       registry = e_client_cache_ref_registry (qa->client_cache);
+       source = e_source_registry_ref_default_address_book (registry);
+       g_object_unref (registry);
 
-       qa->combo_box = e_source_combo_box_new (qa->registry, extension_name);
+       qa->combo_box = e_client_combo_box_new (
+               qa->client_cache, extension_name);
        e_source_combo_box_set_active (
                E_SOURCE_COMBO_BOX (qa->combo_box), source);
 
@@ -533,7 +556,7 @@ build_quick_add_dialog (QuickAdd *qa)
 }
 
 void
-e_contact_quick_add (ESourceRegistry *registry,
+e_contact_quick_add (EClientCache *client_cache,
                      const gchar *in_name,
                      const gchar *email,
                      EContactQuickAddCallback cb,
@@ -544,7 +567,7 @@ e_contact_quick_add (ESourceRegistry *registry,
        gchar *name = NULL;
        gint len;
 
-       g_return_if_fail (E_IS_SOURCE_REGISTRY (registry));
+       g_return_if_fail (E_IS_CLIENT_CACHE (client_cache));
 
        /* We need to have *something* to work with. */
        if (in_name == NULL && email == NULL) {
@@ -567,7 +590,7 @@ e_contact_quick_add (ESourceRegistry *registry,
                g_strstrip (name);
        }
 
-       qa = quick_add_new (registry);
+       qa = quick_add_new (client_cache);
        qa->cb = cb;
        qa->closure = closure;
        if (name)
@@ -582,7 +605,7 @@ e_contact_quick_add (ESourceRegistry *registry,
 }
 
 void
-e_contact_quick_add_free_form (ESourceRegistry *registry,
+e_contact_quick_add_free_form (EClientCache *client_cache,
                                const gchar *text,
                                EContactQuickAddCallback cb,
                                gpointer closure)
@@ -591,10 +614,10 @@ e_contact_quick_add_free_form (ESourceRegistry *registry,
        const gchar *last_at, *s;
        gboolean in_quote;
 
-       g_return_if_fail (E_IS_SOURCE_REGISTRY (registry));
+       g_return_if_fail (E_IS_CLIENT_CACHE (client_cache));
 
        if (text == NULL) {
-               e_contact_quick_add (registry, NULL, NULL, cb, closure);
+               e_contact_quick_add (client_cache, NULL, NULL, cb, closure);
                return;
        }
 
@@ -658,14 +681,14 @@ e_contact_quick_add_free_form (ESourceRegistry *registry,
                        g_strstrip (email);
        }
 
-       e_contact_quick_add (registry, name, email, cb, closure);
+       e_contact_quick_add (client_cache, name, email, cb, closure);
 
        g_free (name);
        g_free (email);
 }
 
 void
-e_contact_quick_add_email (ESourceRegistry *registry,
+e_contact_quick_add_email (EClientCache *client_cache,
                            const gchar *email,
                            EContactQuickAddCallback cb,
                            gpointer closure)
@@ -688,14 +711,14 @@ e_contact_quick_add_email (ESourceRegistry *registry,
                addr = g_strdup (email);
        }
 
-       e_contact_quick_add (registry, name, addr, cb, closure);
+       e_contact_quick_add (client_cache, name, addr, cb, closure);
 
        g_free (name);
        g_free (addr);
 }
 
 void
-e_contact_quick_add_vcard (ESourceRegistry *registry,
+e_contact_quick_add_vcard (EClientCache *client_cache,
                            const gchar *vcard,
                            EContactQuickAddCallback cb,
                            gpointer closure)
@@ -704,7 +727,7 @@ e_contact_quick_add_vcard (ESourceRegistry *registry,
        GtkWidget *dialog;
        EContact *contact;
 
-       g_return_if_fail (E_IS_SOURCE_REGISTRY (registry));
+       g_return_if_fail (E_IS_CLIENT_CACHE (client_cache));
 
        /* We need to have *something* to work with. */
        if (vcard == NULL) {
@@ -713,7 +736,7 @@ e_contact_quick_add_vcard (ESourceRegistry *registry,
                return;
        }
 
-       qa = quick_add_new (registry);
+       qa = quick_add_new (client_cache);
        qa->cb = cb;
        qa->closure = closure;
        quick_add_set_vcard (qa, vcard);
diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.h 
b/addressbook/gui/contact-editor/e-contact-quick-add.h
index cd5d8ba..abc94fd 100644
--- a/addressbook/gui/contact-editor/e-contact-quick-add.h
+++ b/addressbook/gui/contact-editor/e-contact-quick-add.h
@@ -25,23 +25,25 @@
 
 #include <libebook/libebook.h>
 
+#include <e-util/e-util.h>
+
 typedef void   (*EContactQuickAddCallback)     (EContact *new_contact,
                                                 gpointer closure);
 
-void           e_contact_quick_add             (ESourceRegistry *registry,
+void           e_contact_quick_add             (EClientCache *client_cache,
                                                 const gchar *name,
                                                 const gchar *email,
                                                 EContactQuickAddCallback cb,
                                                 gpointer closure);
-void           e_contact_quick_add_free_form   (ESourceRegistry *registry,
+void           e_contact_quick_add_free_form   (EClientCache *client_cache,
                                                 const gchar *text,
                                                 EContactQuickAddCallback cb,
                                                 gpointer closure);
-void           e_contact_quick_add_email       (ESourceRegistry *registry,
+void           e_contact_quick_add_email       (EClientCache *client_cache,
                                                 const gchar *email,
                                                 EContactQuickAddCallback cb,
                                                 gpointer closure);
-void           e_contact_quick_add_vcard       (ESourceRegistry *registry,
+void           e_contact_quick_add_vcard       (EClientCache *client_cache,
                                                 const gchar *vcard,
                                                 EContactQuickAddCallback cb,
                                                 gpointer closure);
diff --git a/addressbook/gui/contact-list-editor/contact-list-editor.ui 
b/addressbook/gui/contact-list-editor/contact-list-editor.ui
index eb30184..d6a1978 100644
--- a/addressbook/gui/contact-list-editor/contact-list-editor.ui
+++ b/addressbook/gui/contact-list-editor/contact-list-editor.ui
@@ -61,7 +61,7 @@
                     <property name="xalign">1</property>
                     <property name="label" translatable="yes">_Where:</property>
                     <property name="use_underline">True</property>
-                   <property name="mnemonic_widget">source-combo-box</property>
+                   <property name="mnemonic_widget">client-combo-box</property>
                   </object>
                   <packing>
                     <property name="top_attach">1</property>
@@ -82,7 +82,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="ESourceComboBox" type-func="e_source_combo_box_get_type" 
id="source-combo-box">
+                  <object class="EClientComboBox" type-func="e_client_combo_box_get_type" 
id="client-combo-box">
                     <property name="extension-name">Address Book</property>
                     <property name="show-colors">False</property>
                     <property name="visible">True</property>
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c 
b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
index 08c92d7..d7437d3 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -61,6 +61,8 @@
        CONTACT_LIST_EDITOR_WIDGET ((editor), "add-button")
 #define CONTACT_LIST_EDITOR_WIDGET_CHECK_BUTTON(editor) \
        CONTACT_LIST_EDITOR_WIDGET ((editor), "check-button")
+#define CONTACT_LIST_EDITOR_WIDGET_CLIENT_COMBO_BOX(editor) \
+       CONTACT_LIST_EDITOR_WIDGET ((editor), "client-combo-box")
 #define CONTACT_LIST_EDITOR_WIDGET_DIALOG(editor) \
        CONTACT_LIST_EDITOR_WIDGET ((editor), "dialog")
 #define CONTACT_LIST_EDITOR_WIDGET_EMAIL_ENTRY(editor) \
@@ -73,8 +75,6 @@
        CONTACT_LIST_EDITOR_WIDGET ((editor), "ok-button")
 #define CONTACT_LIST_EDITOR_WIDGET_REMOVE_BUTTON(editor) \
        CONTACT_LIST_EDITOR_WIDGET ((editor), "remove-button")
-#define CONTACT_LIST_EDITOR_WIDGET_SOURCE_MENU(editor) \
-       CONTACT_LIST_EDITOR_WIDGET ((editor), "source-combo-box")
 #define CONTACT_LIST_EDITOR_WIDGET_TREE_VIEW(editor) \
        CONTACT_LIST_EDITOR_WIDGET ((editor), "tree-view")
 #define CONTACT_LIST_EDITOR_WIDGET_TOP_BUTTON(editor) \
@@ -189,7 +189,7 @@ contact_list_editor_update (EContactListEditor *editor)
                priv->allows_contact_lists);
 
        gtk_widget_set_sensitive (
-               WIDGET (SOURCE_MENU), priv->is_new_list);
+               WIDGET (CLIENT_COMBO_BOX), priv->is_new_list);
 }
 
 static void
@@ -318,19 +318,23 @@ contact_list_editor_add_email (EContactListEditor *editor,
 }
 
 static void
-contact_list_editor_client_connect_cb (GObject *source_object,
-                                       GAsyncResult *result,
-                                       gpointer user_data)
+contact_list_editor_get_client_cb (GObject *source_object,
+                                   GAsyncResult *result,
+                                   gpointer user_data)
 {
        ConnectClosure *closure = user_data;
        EContactListEditor *editor = closure->editor;
+       EClientComboBox *combo_box;
        EContactStore *contact_store;
        ENameSelectorEntry *entry;
        EClient *client;
        EBookClient *book_client;
        GError *error = NULL;
 
-       client = e_book_client_connect_finish (result, &error);
+       combo_box = E_CLIENT_COMBO_BOX (source_object);
+
+       client = e_client_combo_box_get_client_finish (
+               combo_box, result, &error);
 
        /* Sanity check. */
        g_return_if_fail (
@@ -347,7 +351,7 @@ contact_list_editor_client_connect_cb (GObject *source_object,
                        closure->source, error);
 
                e_source_combo_box_set_active (
-                       E_SOURCE_COMBO_BOX (WIDGET (SOURCE_MENU)),
+                       E_SOURCE_COMBO_BOX (combo_box),
                        closure->source);
 
                g_error_free (error);
@@ -976,10 +980,10 @@ contact_list_editor_select_button_clicked_cb (GtkWidget *widget)
 }
 
 void
-contact_list_editor_source_menu_changed_cb (GtkWidget *widget);
+contact_list_editor_combo_box_changed_cb (GtkWidget *widget);
 
 void
-contact_list_editor_source_menu_changed_cb (GtkWidget *widget)
+contact_list_editor_combo_box_changed_cb (GtkWidget *widget)
 {
        ESourceComboBox *combo_box;
        EContactListEditor *editor;
@@ -997,9 +1001,10 @@ contact_list_editor_source_menu_changed_cb (GtkWidget *widget)
        client_source = e_client_get_source (client);
 
        if (!e_source_equal (client_source, active_source))
-               e_book_client_connect (
+               e_client_combo_box_get_client (
+                       E_CLIENT_COMBO_BOX (widget),
                        active_source, NULL,
-                       contact_list_editor_client_connect_cb,
+                       contact_list_editor_get_client_cb,
                        g_object_ref (editor));
 
        g_object_unref (active_source);
@@ -1224,7 +1229,7 @@ static void
 setup_custom_widgets (EContactListEditor *editor)
 {
        EShell *shell;
-       ESourceRegistry *registry;
+       EClientCache *client_cache;
        GtkWidget *combo_box;
        ENameSelectorEntry *name_selector_entry;
        GtkWidget *old, *parent;
@@ -1236,16 +1241,16 @@ setup_custom_widgets (EContactListEditor *editor)
        priv = E_CONTACT_LIST_EDITOR_GET_PRIVATE (editor);
 
        shell = eab_editor_get_shell (EAB_EDITOR (editor));
-       registry = e_shell_get_registry (shell);
+       client_cache = e_shell_get_client_cache (shell);
 
-       combo_box = WIDGET (SOURCE_MENU);
+       combo_box = WIDGET (CLIENT_COMBO_BOX);
 
-       e_source_combo_box_set_registry (
-               E_SOURCE_COMBO_BOX (combo_box), registry);
+       e_client_combo_box_set_client_cache (
+               E_CLIENT_COMBO_BOX (combo_box), client_cache);
 
        g_signal_connect (
                combo_box, "changed", G_CALLBACK (
-               contact_list_editor_source_menu_changed_cb), NULL);
+               contact_list_editor_combo_box_changed_cb), NULL);
 
        old = CONTACT_LIST_EDITOR_WIDGET (editor, "email-entry");
        g_return_if_fail (old != NULL);
@@ -1407,7 +1412,7 @@ contact_list_editor_constructed (GObject *object)
        GtkCellRenderer *renderer;
        GtkTreeView *view;
        GtkTreeSelection *selection;
-       ESourceRegistry *registry;
+       EClientCache *client_cache;
        EShell *shell;
 
        editor = E_CONTACT_LIST_EDITOR (object);
@@ -1417,7 +1422,7 @@ contact_list_editor_constructed (GObject *object)
                constructed (object);
 
        shell = eab_editor_get_shell (EAB_EDITOR (editor));
-       registry = e_shell_get_registry (shell);
+       client_cache = e_shell_get_client_cache (shell);
 
        editor->priv->editable = TRUE;
        editor->priv->allows_contact_lists = TRUE;
@@ -1456,7 +1461,7 @@ contact_list_editor_constructed (GObject *object)
                column, renderer, (GtkTreeCellDataFunc)
                contact_list_editor_render_destination, NULL, NULL);
 
-       editor->priv->name_selector = e_name_selector_new (registry);
+       editor->priv->name_selector = e_name_selector_new (client_cache);
 
        e_name_selector_model_add_section (
                e_name_selector_peek_model (editor->priv->name_selector),
@@ -1916,10 +1921,10 @@ e_contact_list_editor_set_contact (EContactListEditor *editor,
 
        if (priv->book_client != NULL) {
                e_source_combo_box_set_active (
-                       E_SOURCE_COMBO_BOX (WIDGET (SOURCE_MENU)),
+                       E_SOURCE_COMBO_BOX (WIDGET (CLIENT_COMBO_BOX)),
                        e_client_get_source (E_CLIENT (priv->book_client)));
                gtk_widget_set_sensitive (
-                       WIDGET (SOURCE_MENU), priv->is_new_list);
+                       WIDGET (CLIENT_COMBO_BOX), priv->is_new_list);
        }
 
        priv->changed = FALSE;
diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c
index d88fd12..42411f9 100644
--- a/calendar/gui/dialogs/alarm-dialog.c
+++ b/calendar/gui/dialogs/alarm-dialog.c
@@ -35,8 +35,6 @@
 
 #include <libical/icalattach.h>
 
-#include "e-util/e-util.h"
-
 #include "../calendar-config.h"
 #include "comp-editor-util.h"
 #include "alarm-dialog.h"
@@ -50,7 +48,7 @@ typedef struct {
        /* The client */
        ECalClient *cal_client;
 
-       ESourceRegistry *registry;
+       EClientCache *client_cache;
 
        /* Toplevel */
        GtkWidget *toplevel;
@@ -911,7 +909,7 @@ setup_select_names (Dialog *dialog)
        ENameSelectorModel *name_selector_model;
        ENameSelectorDialog *name_selector_dialog;
 
-       dialog->name_selector = e_name_selector_new (dialog->registry);
+       dialog->name_selector = e_name_selector_new (dialog->client_cache);
        e_name_selector_load_books (dialog->name_selector);
        name_selector_model = e_name_selector_peek_model (dialog->name_selector);
 
@@ -1216,7 +1214,7 @@ init_widgets (Dialog *dialog)
 
 gboolean
 alarm_dialog_run (GtkWidget *parent,
-                  ESourceRegistry *registry,
+                  EClientCache *client_cache,
                   ECalClient *cal_client,
                   ECalComponentAlarm *alarm)
 {
@@ -1224,12 +1222,12 @@ alarm_dialog_run (GtkWidget *parent,
        GtkWidget *container;
        gint response_id;
 
-       g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FALSE);
+       g_return_val_if_fail (E_IS_CLIENT_CACHE (client_cache), FALSE);
        g_return_val_if_fail (alarm != NULL, FALSE);
 
        dialog.alarm = alarm;
        dialog.cal_client = cal_client;
-       dialog.registry = registry;
+       dialog.client_cache = client_cache;
 
        dialog.builder = gtk_builder_new ();
        e_load_ui_builder_definition (dialog.builder, "alarm-dialog.ui");
diff --git a/calendar/gui/dialogs/alarm-dialog.h b/calendar/gui/dialogs/alarm-dialog.h
index 79c85bf..14653b3 100644
--- a/calendar/gui/dialogs/alarm-dialog.h
+++ b/calendar/gui/dialogs/alarm-dialog.h
@@ -32,10 +32,12 @@
 
 #include <libecal/libecal.h>
 
+#include <e-util/e-util.h>
+
 G_BEGIN_DECLS
 
 gboolean       alarm_dialog_run                (GtkWidget *parent,
-                                                ESourceRegistry *registry,
+                                                EClientCache *client_cache,
                                                 ECalClient *cal_client,
                                                 ECalComponentAlarm *alarm);
 
diff --git a/calendar/gui/dialogs/alarm-list-dialog.c b/calendar/gui/dialogs/alarm-list-dialog.c
index 78c53a3..ea17b92 100644
--- a/calendar/gui/dialogs/alarm-list-dialog.c
+++ b/calendar/gui/dialogs/alarm-list-dialog.c
@@ -34,14 +34,13 @@
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
 
-#include "e-util/e-util.h"
 #include "e-util/e-util-private.h"
 #include "alarm-dialog.h"
 #include "alarm-list-dialog.h"
 
 typedef struct {
        GtkBuilder *builder;
-       ESourceRegistry *registry;
+       EClientCache *client_cache;
 
        /* The client */
        ECalClient *cal_client;
@@ -125,7 +124,7 @@ add_clicked_cb (GtkButton *button,
        icalproperty_set_x_name (icalprop, "X-EVOLUTION-NEEDS-DESCRIPTION");
        icalcomponent_add_property (icalcomp, icalprop);
 
-       if (alarm_dialog_run (dialog->toplevel, dialog->registry, dialog->cal_client, alarm)) {
+       if (alarm_dialog_run (dialog->toplevel, dialog->client_cache, dialog->cal_client, alarm)) {
                e_alarm_list_append (dialog->list_store, &iter, alarm);
                gtk_tree_selection_select_iter (gtk_tree_view_get_selection (view), &iter);
        } else {
@@ -158,7 +157,7 @@ edit_clicked_cb (GtkButton *button,
        alarm = (ECalComponentAlarm *) e_alarm_list_get_alarm (dialog->list_store, &iter);
        path = gtk_tree_model_get_path (GTK_TREE_MODEL (dialog->list_store), &iter);
 
-       if (alarm_dialog_run (dialog->toplevel, dialog->registry, dialog->cal_client, alarm)) {
+       if (alarm_dialog_run (dialog->toplevel, dialog->client_cache, dialog->cal_client, alarm)) {
                gtk_tree_selection_select_iter (gtk_tree_view_get_selection (view), &iter);
                gtk_tree_model_row_changed (GTK_TREE_MODEL (dialog->list_store), path, &iter);
        }
@@ -264,7 +263,7 @@ init_widgets (Dialog *dialog)
 
 gboolean
 alarm_list_dialog_run (GtkWidget *parent,
-                       ESourceRegistry *registry,
+                       EClientCache *client_cache,
                        ECalClient *cal_client,
                        EAlarmList *list_store)
 {
@@ -272,9 +271,9 @@ alarm_list_dialog_run (GtkWidget *parent,
        GtkWidget *container;
        gint response_id;
 
-       g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FALSE);
+       g_return_val_if_fail (E_IS_CLIENT_CACHE (client_cache), FALSE);
 
-       dialog.registry = registry;
+       dialog.client_cache = client_cache;
        dialog.cal_client = cal_client;
        dialog.list_store = list_store;
 
@@ -315,14 +314,14 @@ alarm_list_dialog_run (GtkWidget *parent,
 }
 
 GtkWidget *
-alarm_list_dialog_peek (ESourceRegistry *registry,
+alarm_list_dialog_peek (EClientCache *client_cache,
                         ECalClient *cal_client,
                         EAlarmList *list_store)
 {
        Dialog *dialog;
 
        dialog = (Dialog *) g_new (Dialog, 1);
-       dialog->registry = registry;
+       dialog->client_cache = client_cache;
        dialog->cal_client = cal_client;
        dialog->list_store = list_store;
 
diff --git a/calendar/gui/dialogs/alarm-list-dialog.h b/calendar/gui/dialogs/alarm-list-dialog.h
index 289d887..5fc8aa3 100644
--- a/calendar/gui/dialogs/alarm-list-dialog.h
+++ b/calendar/gui/dialogs/alarm-list-dialog.h
@@ -32,15 +32,17 @@
 
 #include <libecal/libecal.h>
 
+#include <e-util/e-util.h>
+
 #include "../e-alarm-list.h"
 
 G_BEGIN_DECLS
 
 gboolean       alarm_list_dialog_run           (GtkWidget *parent,
-                                                ESourceRegistry *registry,
+                                                EClientCache *client_cache,
                                                 ECalClient *cal_client,
                                                 EAlarmList *list_store);
-GtkWidget *    alarm_list_dialog_peek          (ESourceRegistry *registry,
+GtkWidget *    alarm_list_dialog_peek          (EClientCache *client_cache,
                                                 ECalClient *cal_client,
                                                 EAlarmList *list_store);
 void           alarm_list_dialog_set_client    (GtkWidget *dlg_box,
diff --git a/calendar/gui/dialogs/e-delegate-dialog.c b/calendar/gui/dialogs/e-delegate-dialog.c
index 9c5e17f..366d978 100644
--- a/calendar/gui/dialogs/e-delegate-dialog.c
+++ b/calendar/gui/dialogs/e-delegate-dialog.c
@@ -101,7 +101,7 @@ e_delegate_dialog_init (EDelegateDialog *edd)
 
 EDelegateDialog *
 e_delegate_dialog_construct (EDelegateDialog *edd,
-                             ESourceRegistry *registry,
+                             EClientCache *client_cache,
                              const gchar *name,
                              const gchar *address)
 {
@@ -112,7 +112,7 @@ e_delegate_dialog_construct (EDelegateDialog *edd,
        ENameSelectorDialog *name_selector_dialog;
 
        g_return_val_if_fail (E_IS_DELEGATE_DIALOG (edd), NULL);
-       g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
+       g_return_val_if_fail (E_IS_CLIENT_CACHE (client_cache), NULL);
 
        priv = edd->priv;
 
@@ -126,7 +126,7 @@ e_delegate_dialog_construct (EDelegateDialog *edd,
                goto error;
        }
 
-       priv->name_selector = e_name_selector_new (registry);
+       priv->name_selector = e_name_selector_new (client_cache);
        e_name_selector_load_books (priv->name_selector);
        name_selector_model = e_name_selector_peek_model (priv->name_selector);
        e_name_selector_model_add_section (name_selector_model, section_name, section_name, NULL);
@@ -214,18 +214,18 @@ addressbook_response_cb (GtkWidget *widget,
  * editor could not be created.
  **/
 EDelegateDialog *
-e_delegate_dialog_new (ESourceRegistry *registry,
+e_delegate_dialog_new (EClientCache *client_cache,
                        const gchar *name,
                        const gchar *address)
 {
        EDelegateDialog *edd;
 
-       g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
+       g_return_val_if_fail (E_IS_CLIENT_CACHE (client_cache), NULL);
 
        edd = g_object_new (E_TYPE_DELEGATE_DIALOG, NULL);
 
        return e_delegate_dialog_construct (
-               E_DELEGATE_DIALOG (edd), registry, name, address);
+               E_DELEGATE_DIALOG (edd), client_cache, name, address);
 }
 
 gchar *
diff --git a/calendar/gui/dialogs/e-delegate-dialog.h b/calendar/gui/dialogs/e-delegate-dialog.h
index 245e1fe..8a9b38e 100644
--- a/calendar/gui/dialogs/e-delegate-dialog.h
+++ b/calendar/gui/dialogs/e-delegate-dialog.h
@@ -24,8 +24,7 @@
 #ifndef E_DELEGATE_DIALOG_H
 #define E_DELEGATE_DIALOG_H
 
-#include <gtk/gtk.h>
-#include <libedataserver/libedataserver.h>
+#include <e-util/e-util.h>
 
 /* Standard GObject macros */
 #define E_TYPE_DELEGATE_DIALOG \
@@ -64,11 +63,11 @@ struct _EDelegateDialogClass {
 GType          e_delegate_dialog_get_type      (void);
 EDelegateDialog *
                e_delegate_dialog_construct     (EDelegateDialog *etd,
-                                                ESourceRegistry *registry,
+                                                EClientCache *client_cache,
                                                 const gchar *name,
                                                 const gchar *address);
 EDelegateDialog *
-               e_delegate_dialog_new           (ESourceRegistry *registry,
+               e_delegate_dialog_new           (EClientCache *client_cache,
                                                 const gchar *name,
                                                 const gchar *address);
 gchar *                e_delegate_dialog_get_delegate  (EDelegateDialog *etd);
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index dfe3368..6225eb7 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -141,7 +141,7 @@ struct _EventPagePrivate {
        GtkWidget *categories_btn;
        GtkWidget *categories;
 
-       GtkWidget *source_combo_box;
+       GtkWidget *client_combo_box;
 
        /* Meeting related items */
        GtkWidget *list_box;
@@ -681,7 +681,7 @@ sensitize_widgets (EventPage *epage)
        gtk_editable_set_editable (GTK_EDITABLE (priv->categories), !read_only);
 
        if (delegate) {
-               gtk_widget_set_sensitive (priv->source_combo_box, FALSE);
+               gtk_widget_set_sensitive (priv->client_combo_box, FALSE);
        }
 
        gtk_widget_set_sensitive (priv->organizer, !read_only);
@@ -707,7 +707,7 @@ sensitize_widgets (EventPage *epage)
                gtk_widget_hide (priv->attendee_box);
                gtk_widget_hide (priv->organizer);
                gtk_label_set_text_with_mnemonic ((GtkLabel *) priv->org_cal_label, _("_Calendar:"));
-               gtk_label_set_mnemonic_widget ((GtkLabel *) priv->org_cal_label, priv->source_combo_box);
+               gtk_label_set_mnemonic_widget ((GtkLabel *) priv->org_cal_label, priv->client_combo_box);
        } else {
                gtk_widget_show (priv->calendar_label);
                gtk_widget_show (priv->list_box);
@@ -1369,7 +1369,7 @@ event_page_fill_widgets (CompEditorPage *page,
 
        /* Source */
        e_source_combo_box_set_active (
-               E_SOURCE_COMBO_BOX (priv->source_combo_box),
+               E_SOURCE_COMBO_BOX (priv->client_combo_box),
                e_client_get_source (E_CLIENT (client)));
 
        e_cal_component_get_uid (comp, &uid);
@@ -2535,7 +2535,7 @@ static gboolean
 get_widgets (EventPage *epage)
 {
        EShell *shell;
-       ESourceRegistry *registry;
+       EClientCache *client_cache;
        CompEditor *editor;
        CompEditorPage *page = COMP_EDITOR_PAGE (epage);
        GtkEntryCompletion *completion;
@@ -2552,7 +2552,7 @@ get_widgets (EventPage *epage)
 
        editor = comp_editor_page_get_editor (page);
        shell = comp_editor_get_shell (editor);
-       registry = e_shell_get_registry (shell);
+       client_cache = e_shell_get_client_cache (shell);
 
        priv->main = GW ("event-page");
        if (!priv->main)
@@ -2645,9 +2645,9 @@ get_widgets (EventPage *epage)
 
        priv->description = GW ("description");
 
-       priv->source_combo_box = GW ("source");
-       e_source_combo_box_set_registry (
-               E_SOURCE_COMBO_BOX (priv->source_combo_box), registry);
+       priv->client_combo_box = GW ("client-combo-box");
+       e_client_combo_box_set_client_cache (
+               E_CLIENT_COMBO_BOX (priv->client_combo_box), client_cache);
 
        completion = e_category_completion_new ();
        gtk_entry_set_completion (GTK_ENTRY (priv->categories), completion);
@@ -2971,7 +2971,7 @@ event_page_send_options_clicked_cb (EventPage *epage)
        if (!priv->sod) {
                priv->sod = e_send_options_dialog_new ();
                source = e_source_combo_box_ref_active (
-                       E_SOURCE_COMBO_BOX (priv->source_combo_box));
+                       E_SOURCE_COMBO_BOX (priv->client_combo_box));
                e_send_options_utils_set_default_data (
                        priv->sod, source, "calendar");
                priv->sod->data->initialized = TRUE;
@@ -2987,18 +2987,21 @@ event_page_send_options_clicked_cb (EventPage *epage)
 }
 
 static void
-epage_client_connect_cb (GObject *source_object,
-                         GAsyncResult *result,
-                         gpointer user_data)
+epage_get_client_cb (GObject *source_object,
+                     GAsyncResult *result,
+                     gpointer user_data)
 {
        EClient *client;
+       EClientComboBox *combo_box;
        EventPage *epage = user_data;
        EventPagePrivate *priv;
        CompEditor *editor;
        GError *error = NULL;
 
-       client = e_client_cache_get_client_finish (
-               E_CLIENT_CACHE (source_object), result, &error);
+       combo_box = E_CLIENT_COMBO_BOX (source_object);
+
+       client = e_client_combo_box_get_client_finish (
+               combo_box, result, &error);
 
        /* Sanity check. */
        g_return_if_fail (
@@ -3021,7 +3024,7 @@ epage_client_connect_cb (GObject *source_object,
                old_client = comp_editor_get_client (editor);
 
                e_source_combo_box_set_active (
-                       E_SOURCE_COMBO_BOX (priv->source_combo_box),
+                       E_SOURCE_COMBO_BOX (combo_box),
                        e_client_get_source (E_CLIENT (old_client)));
 
                dialog = gtk_message_dialog_new (
@@ -3064,19 +3067,16 @@ epage_client_connect_cb (GObject *source_object,
 }
 
 static void
-source_changed_cb (ESourceComboBox *source_combo_box,
-                   EventPage *epage)
+combo_box_changed_cb (ESourceComboBox *combo_box,
+                      EventPage *epage)
 {
        EventPagePrivate *priv = epage->priv;
-       EClientCache *client_cache;
-       CompEditor *editor;
        ESource *source;
-       EShell *shell;
 
        if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (epage)))
                return;
 
-       source = e_source_combo_box_ref_active (source_combo_box);
+       source = e_source_combo_box_ref_active (combo_box);
        g_return_if_fail (source != NULL);
 
        if (priv->connect_cancellable != NULL) {
@@ -3085,15 +3085,10 @@ source_changed_cb (ESourceComboBox *source_combo_box,
        }
        priv->connect_cancellable = g_cancellable_new ();
 
-       editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
-       shell = comp_editor_get_shell (editor);
-       client_cache = e_shell_get_client_cache (shell);
-
-       e_client_cache_get_client (
-               client_cache, source,
-               E_SOURCE_EXTENSION_CALENDAR,
-               priv->connect_cancellable,
-               epage_client_connect_cb, epage);
+       e_client_combo_box_get_client (
+               E_CLIENT_COMBO_BOX (combo_box),
+               source, priv->connect_cancellable,
+               epage_get_client_cb, epage);
 
        g_object_unref (source);
 }
@@ -3259,7 +3254,7 @@ init_widgets (EventPage *epage)
        EventPagePrivate *priv = epage->priv;
        EShell *shell;
        CompEditor *editor;
-       ESourceRegistry *registry;
+       EClientCache *client_cache;
        GtkTextBuffer *text_buffer;
        icaltimezone *zone;
        gchar *combo_label = NULL;
@@ -3275,7 +3270,7 @@ init_widgets (EventPage *epage)
        shell = comp_editor_get_shell (editor);
        client = comp_editor_get_client (editor);
 
-       registry = e_shell_get_registry (shell);
+       client_cache = e_shell_get_client_cache (shell);
 
        /* Make sure the EDateEdit widgets use our timezones to get the
         * current time. */
@@ -3318,10 +3313,10 @@ init_widgets (EventPage *epage)
                priv->categories_btn, "clicked",
                G_CALLBACK (categories_clicked_cb), epage);
 
-       /* Source selector */
+       /* Client selector */
        g_signal_connect (
-               priv->source_combo_box, "changed",
-               G_CALLBACK (source_changed_cb), epage);
+               priv->client_combo_box, "changed",
+               G_CALLBACK (combo_box_changed_cb), epage);
 
        /* Alarms */
        priv->alarm_list_store = e_alarm_list_new ();
@@ -3401,7 +3396,7 @@ init_widgets (EventPage *epage)
                priv->alarm_dialog, "delete-event",
                G_CALLBACK (alarm_dialog_delete_event_cb), priv->alarm_dialog);
        priv->alarm_list_dlg_widget = alarm_list_dialog_peek (
-               registry, client, priv->alarm_list_store);
+               client_cache, client, priv->alarm_list_store);
        gtk_widget_reparent (priv->alarm_list_dlg_widget, priv->alarm_box);
        gtk_widget_show_all (priv->alarm_list_dlg_widget);
        gtk_widget_hide (priv->alarm_dialog);
@@ -3528,7 +3523,7 @@ init_widgets (EventPage *epage)
                priv->categories, "changed",
                G_CALLBACK (comp_editor_page_changed), epage);
        g_signal_connect_swapped (
-               priv->source_combo_box, "changed",
+               priv->client_combo_box, "changed",
                G_CALLBACK (comp_editor_page_changed), epage);
        g_signal_connect_swapped (
                priv->start_timezone, "changed",
diff --git a/calendar/gui/dialogs/event-page.ui b/calendar/gui/dialogs/event-page.ui
index c1c328b..8044575 100644
--- a/calendar/gui/dialogs/event-page.ui
+++ b/calendar/gui/dialogs/event-page.ui
@@ -767,7 +767,7 @@
                             <property name="yalign">0.5</property>
                             <property name="xpad">0</property>
                             <property name="ypad">0</property>
-                            <property name="mnemonic_widget">source</property>
+                            <property name="mnemonic_widget">client-combo-box</property>
                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
                             <property name="single_line_mode">False</property>
                             <property name="angle">0</property>
@@ -779,7 +779,7 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="ESourceComboBox" type-func="e_source_combo_box_get_type" 
id="source">
+                          <object class="EClientComboBox" type-func="e_client_combo_box_get_type" 
id="client-combo-box">
                             <property name="extension-name">Calendar</property>
                             <property name="show-colors">True</property>
                             <property name="visible">True</property>
diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c
index 9224d5c..7c33ec6 100644
--- a/calendar/gui/dialogs/memo-page.c
+++ b/calendar/gui/dialogs/memo-page.c
@@ -78,7 +78,7 @@ struct _MemoPagePrivate {
        GtkWidget *categories_btn;
        GtkWidget *categories;
 
-       GtkWidget *source_combo_box;
+       GtkWidget *client_combo_box;
 
        gchar **address_strings;
        gchar *fallback_address;
@@ -367,7 +367,7 @@ memo_page_fill_widgets (CompEditorPage *page,
 
        /* Source */
        e_source_combo_box_set_active (
-               E_SOURCE_COMBO_BOX (priv->source_combo_box),
+               E_SOURCE_COMBO_BOX (priv->client_combo_box),
                e_client_get_source (E_CLIENT (client)));
 
        if (priv->to_entry && (flags & COMP_EDITOR_IS_SHARED) && !(flags & COMP_EDITOR_NEW_ITEM))
@@ -840,7 +840,7 @@ static gboolean
 get_widgets (MemoPage *mpage)
 {
        EShell *shell;
-       ESourceRegistry *registry;
+       EClientCache *client_cache;
        CompEditor *editor;
        CompEditorPage *page = COMP_EDITOR_PAGE (mpage);
        GtkEntryCompletion *completion;
@@ -855,7 +855,7 @@ get_widgets (MemoPage *mpage)
 
        editor = comp_editor_page_get_editor (page);
        shell = comp_editor_get_shell (editor);
-       registry = e_shell_get_registry (shell);
+       client_cache = e_shell_get_client_cache (shell);
 
        priv->main = GW ("memo-page");
        if (!priv->main) {
@@ -897,9 +897,9 @@ get_widgets (MemoPage *mpage)
        priv->categories_btn = GW ("categories-button");
        priv->categories = GW ("categories");
 
-       priv->source_combo_box = GW ("source");
-       e_source_combo_box_set_registry (
-               E_SOURCE_COMBO_BOX (priv->source_combo_box), registry);
+       priv->client_combo_box = GW ("client-combo-box");
+       e_client_combo_box_set_client_cache (
+               E_CLIENT_COMBO_BOX (priv->client_combo_box), client_cache);
 #undef GW
 
        completion = e_category_completion_new ();
@@ -941,18 +941,20 @@ categories_clicked_cb (GtkWidget *button,
 }
 
 static void
-mpage_client_connect_cb (GObject *source_object,
-                         GAsyncResult *result,
-                         gpointer user_data)
+mpage_get_client_cb (GObject *source_object,
+                     GAsyncResult *result,
+                     gpointer user_data)
 {
        EClient *client;
+       EClientComboBox *combo_box;
        MemoPage *mpage = user_data;
-       MemoPagePrivate *priv;
        CompEditor *editor;
        GError *error = NULL;
 
-       client = e_client_cache_get_client_finish (
-               E_CLIENT_CACHE (source_object), result, &error);
+       combo_box = E_CLIENT_COMBO_BOX (source_object);
+
+       client = e_client_combo_box_get_client_finish (
+               combo_box, result, &error);
 
        /* Sanity check. */
        g_return_if_fail (
@@ -966,7 +968,6 @@ mpage_client_connect_cb (GObject *source_object,
        }
 
        editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (mpage));
-       priv = mpage->priv;
 
        if (error != NULL) {
                GtkWidget *dialog;
@@ -975,7 +976,7 @@ mpage_client_connect_cb (GObject *source_object,
                old_client = comp_editor_get_client (editor);
 
                e_source_combo_box_set_active (
-                       E_SOURCE_COMBO_BOX (priv->source_combo_box),
+                       E_SOURCE_COMBO_BOX (combo_box),
                        e_client_get_source (E_CLIENT (old_client)));
 
                dialog = gtk_message_dialog_new (
@@ -1016,19 +1017,16 @@ mpage_client_connect_cb (GObject *source_object,
 }
 
 static void
-source_changed_cb (ESourceComboBox *source_combo_box,
+source_changed_cb (ESourceComboBox *combo_box,
                    MemoPage *mpage)
 {
        MemoPagePrivate *priv = mpage->priv;
-       EClientCache *client_cache;
-       CompEditor *editor;
        ESource *source;
-       EShell *shell;
 
        if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (mpage)))
                return;
 
-       source = e_source_combo_box_ref_active (source_combo_box);
+       source = e_source_combo_box_ref_active (combo_box);
        g_return_if_fail (source != NULL);
 
        if (priv->connect_cancellable != NULL) {
@@ -1037,15 +1035,10 @@ source_changed_cb (ESourceComboBox *source_combo_box,
        }
        priv->connect_cancellable = g_cancellable_new ();
 
-       editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (mpage));
-       shell = comp_editor_get_shell (editor);
-       client_cache = e_shell_get_client_cache (shell);
-
-       e_client_cache_get_client (
-               client_cache, source,
-               E_SOURCE_EXTENSION_MEMO_LIST,
-               priv->connect_cancellable,
-               mpage_client_connect_cb, mpage);
+       e_client_combo_box_get_client (
+               E_CLIENT_COMBO_BOX (combo_box),
+               source, priv->connect_cancellable,
+               mpage_get_client_cb, mpage);
 
        g_object_unref (source);
 }
@@ -1123,7 +1116,7 @@ init_widgets (MemoPage *mpage)
 
        /* Source selector */
        g_signal_connect (
-               priv->source_combo_box, "changed",
+               priv->client_combo_box, "changed",
                G_CALLBACK (source_changed_cb), mpage);
 
        /* Connect the default signal handler to use to make sure the "changed"
@@ -1143,7 +1136,7 @@ init_widgets (MemoPage *mpage)
                G_CALLBACK (comp_editor_page_changed), mpage);
 
        g_signal_connect_swapped (
-               priv->source_combo_box, "changed",
+               priv->client_combo_box, "changed",
                G_CALLBACK (comp_editor_page_changed), mpage);
 
        g_signal_connect_swapped (
@@ -1239,6 +1232,7 @@ memo_page_construct (MemoPage *mpage)
        CompEditor *editor;
        CompEditorFlags flags;
        ESourceRegistry *registry;
+       EClientCache *client_cache;
 
        priv = mpage->priv;
 
@@ -1248,6 +1242,7 @@ memo_page_construct (MemoPage *mpage)
        shell = comp_editor_get_shell (editor);
 
        registry = e_shell_get_registry (shell);
+       client_cache = e_shell_get_client_cache (shell);
 
        /* Make sure our custom widget classes are registered with
         * GType before we load the GtkBuilder definition file. */
@@ -1291,7 +1286,7 @@ memo_page_construct (MemoPage *mpage)
                gtk_widget_show (priv->org_label);
                gtk_widget_show (priv->org_combo);
 
-               priv->name_selector = e_name_selector_new (registry);
+               priv->name_selector = e_name_selector_new (client_cache);
                priv->to_entry = get_to_entry (priv->name_selector);
                gtk_container_add ((GtkContainer *) priv->to_hbox, priv->to_entry);
                gtk_widget_show (priv->to_hbox);
diff --git a/calendar/gui/dialogs/memo-page.ui b/calendar/gui/dialogs/memo-page.ui
index c0e25d9..e10e8fa 100644
--- a/calendar/gui/dialogs/memo-page.ui
+++ b/calendar/gui/dialogs/memo-page.ui
@@ -183,7 +183,7 @@
                     <property name="homogeneous">False</property>
                     <property name="spacing">0</property>
                     <child>
-                      <object class="ESourceComboBox" type-func="e_source_combo_box_get_type" id="source">
+                      <object class="EClientComboBox" type-func="e_client_combo_box_get_type" 
id="client-combo-box">
                         <property name="extension-name">Memo List</property>
                         <property name="show-colors">True</property>
                         <property name="visible">True</property>
@@ -240,7 +240,7 @@
                     <property name="yalign">0.5</property>
                     <property name="xpad">0</property>
                     <property name="ypad">0</property>
-                    <property name="mnemonic_widget">source</property>
+                    <property name="mnemonic_widget">client-combo-box</property>
                     <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
                     <property name="single_line_mode">False</property>
                     <property name="angle">0</property>
diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c
index 31f99f8..8cd35bd 100644
--- a/calendar/gui/dialogs/task-page.c
+++ b/calendar/gui/dialogs/task-page.c
@@ -86,7 +86,7 @@ struct _TaskPagePrivate {
        GtkWidget *categories_btn;
        GtkWidget *categories;
 
-       GtkWidget *source_combo_box;
+       GtkWidget *client_combo_box;
 
        /* Meeting related items */
        GtkWidget *list_box;
@@ -334,7 +334,7 @@ sensitize_widgets (TaskPage *tpage)
                gtk_widget_hide (priv->organizer);
                gtk_widget_hide (priv->invite);
                gtk_label_set_text_with_mnemonic (GTK_LABEL (priv->org_cal_label), _("_List:"));
-               gtk_label_set_mnemonic_widget (GTK_LABEL (priv->org_cal_label), priv->source_combo_box);
+               gtk_label_set_mnemonic_widget (GTK_LABEL (priv->org_cal_label), priv->client_combo_box);
        } else {
                gtk_widget_show (priv->invite);
                gtk_widget_show (priv->calendar_label);
@@ -637,7 +637,7 @@ task_page_fill_widgets (CompEditorPage *page,
 
        /* Source */
        e_source_combo_box_set_active (
-               E_SOURCE_COMBO_BOX (priv->source_combo_box),
+               E_SOURCE_COMBO_BOX (priv->client_combo_box),
                e_client_get_source (E_CLIENT (client)));
 
        e_client_get_backend_property_sync (E_CLIENT (client), CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS, 
&backend_addr, NULL, NULL);
@@ -1450,7 +1450,7 @@ static gboolean
 get_widgets (TaskPage *tpage)
 {
        EShell *shell;
-       ESourceRegistry *registry;
+       EClientCache *client_cache;
        CompEditor *editor;
        CompEditorPage *page = COMP_EDITOR_PAGE (tpage);
        GtkEntryCompletion *completion;
@@ -1465,7 +1465,7 @@ get_widgets (TaskPage *tpage)
 
        editor = comp_editor_page_get_editor (page);
        shell = comp_editor_get_shell (editor);
-       registry = e_shell_get_registry (shell);
+       client_cache = e_shell_get_client_cache (shell);
 
        priv->main = e_builder_get_widget (priv->builder, "task-page");
        if (!priv->main)
@@ -1528,11 +1528,12 @@ get_widgets (TaskPage *tpage)
        gtk_container_add (GTK_CONTAINER (sw), GTK_WIDGET (priv->list_view));
        gtk_box_pack_start (GTK_BOX (priv->list_box), sw, TRUE, TRUE, 0);
 
-       priv->source_combo_box = e_builder_get_widget (priv->builder, "source");
-       e_source_combo_box_set_registry (
-               E_SOURCE_COMBO_BOX (priv->source_combo_box), registry);
+       priv->client_combo_box = e_builder_get_widget (
+               priv->builder, "client-combo-box");
+       e_client_combo_box_set_client_cache (
+               E_CLIENT_COMBO_BOX (priv->client_combo_box), client_cache);
 
-       gtk_label_set_mnemonic_widget (GTK_LABEL (priv->calendar_label), priv->source_combo_box);
+       gtk_label_set_mnemonic_widget (GTK_LABEL (priv->calendar_label), priv->client_combo_box);
 
        completion = e_category_completion_new ();
        gtk_entry_set_completion (GTK_ENTRY (priv->categories), completion);
@@ -1784,18 +1785,21 @@ due_date_changed_cb (TaskPage *tpage)
 }
 
 static void
-tpage_client_connect_cb (GObject *source_object,
-                         GAsyncResult *result,
-                         gpointer user_data)
+tpage_get_client_cb (GObject *source_object,
+                     GAsyncResult *result,
+                     gpointer user_data)
 {
        EClient *client;
+       EClientComboBox *combo_box;
        TaskPage *tpage = user_data;
        TaskPagePrivate *priv;
        CompEditor *editor;
        GError *error = NULL;
 
-       client = e_client_cache_get_client_finish (
-               E_CLIENT_CACHE (source_object), result, &error);
+       combo_box = E_CLIENT_COMBO_BOX (source_object);
+
+       client = e_client_combo_box_get_client_finish (
+               combo_box, result, &error);
 
        /* Sanity check. */
        g_return_if_fail (
@@ -1817,7 +1821,7 @@ tpage_client_connect_cb (GObject *source_object,
                old_client = comp_editor_get_client (editor);
 
                e_source_combo_box_set_active (
-                       E_SOURCE_COMBO_BOX (priv->source_combo_box),
+                       E_SOURCE_COMBO_BOX (combo_box),
                        e_client_get_source (E_CLIENT (old_client)));
 
                dialog = gtk_message_dialog_new (
@@ -1861,19 +1865,16 @@ tpage_client_connect_cb (GObject *source_object,
 }
 
 static void
-source_changed_cb (ESourceComboBox *source_combo_box,
+source_changed_cb (ESourceComboBox *combo_box,
                    TaskPage *tpage)
 {
        TaskPagePrivate *priv = tpage->priv;
-       EClientCache *client_cache;
-       CompEditor *editor;
        ESource *source;
-       EShell *shell;
 
        if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (tpage)))
                return;
 
-       source = e_source_combo_box_ref_active (source_combo_box);
+       source = e_source_combo_box_ref_active (combo_box);
        g_return_if_fail (source != NULL);
 
        if (priv->connect_cancellable != NULL) {
@@ -1882,15 +1883,10 @@ source_changed_cb (ESourceComboBox *source_combo_box,
        }
        priv->connect_cancellable = g_cancellable_new ();
 
-       editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (tpage));
-       shell = comp_editor_get_shell (editor);
-       client_cache = e_shell_get_client_cache (shell);
-
-       e_client_cache_get_client (
-               client_cache, source,
-               E_SOURCE_EXTENSION_TASK_LIST,
-               priv->connect_cancellable,
-               tpage_client_connect_cb, tpage);
+       e_client_combo_box_get_client (
+               E_CLIENT_COMBO_BOX (combo_box),
+               source, priv->connect_cancellable,
+               tpage_get_client_cb, tpage);
 
        g_object_unref (source);
 }
@@ -1919,7 +1915,7 @@ task_page_send_options_clicked_cb (TaskPage *tpage)
                priv->sod = e_send_options_dialog_new ();
                priv->sod->data->initialized = TRUE;
                source = e_source_combo_box_ref_active (
-                       E_SOURCE_COMBO_BOX (priv->source_combo_box));
+                       E_SOURCE_COMBO_BOX (priv->client_combo_box));
                e_send_options_utils_set_default_data (
                        priv->sod, source, "task");
                g_object_unref (source);
@@ -1996,7 +1992,7 @@ init_widgets (TaskPage *tpage)
 
        /* Source selector */
        g_signal_connect (
-               priv->source_combo_box, "changed",
+               priv->client_combo_box, "changed",
                G_CALLBACK (source_changed_cb), tpage);
 
        /* Connect the default signal handler to use to make sure the "changed"
diff --git a/calendar/gui/dialogs/task-page.ui b/calendar/gui/dialogs/task-page.ui
index 0603f44..79ab450 100644
--- a/calendar/gui/dialogs/task-page.ui
+++ b/calendar/gui/dialogs/task-page.ui
@@ -438,7 +438,7 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="ESourceComboBox" type-func="e_source_combo_box_get_type" 
id="source">
+                          <object class="EClientComboBox" type-func="e_client_combo_box_get_type" 
id="client-combo-box">
                             <property name="extension-name">Task List</property>
                             <property name="show-colors">True</property>
                             <property name="visible">True</property>
diff --git a/calendar/gui/e-meeting-list-view.c b/calendar/gui/e-meeting-list-view.c
index 50999c7..6d6414a 100644
--- a/calendar/gui/e-meeting-list-view.c
+++ b/calendar/gui/e-meeting-list-view.c
@@ -143,7 +143,7 @@ static void
 e_meeting_list_view_init (EMeetingListView *view)
 {
        ENameSelectorDialog *name_selector_dialog;
-       ESourceRegistry *registry;
+       EClientCache *client_cache;
        EShell *shell;
        gint i;
 
@@ -153,9 +153,9 @@ e_meeting_list_view_init (EMeetingListView *view)
 
        /* FIXME Refactor this so we don't need e_shell_get_default(). */
        shell = e_shell_get_default ();
-       registry = e_shell_get_registry (shell);
+       client_cache = e_shell_get_client_cache (shell);
 
-       view->priv->name_selector = e_name_selector_new (registry);
+       view->priv->name_selector = e_name_selector_new (client_cache);
 
        for (i = 0; sections[i]; i++)
                add_section (view->priv->name_selector, sections[i]);
diff --git a/composer/e-composer-header-table.c b/composer/e-composer-header-table.c
index 297f815..5269ff4 100644
--- a/composer/e-composer-header-table.c
+++ b/composer/e-composer-header-table.c
@@ -811,6 +811,7 @@ composer_header_table_constructed (GObject *object)
 {
        EComposerHeaderTable *table;
        ENameSelector *name_selector;
+       EClientCache *client_cache;
        ESourceRegistry *registry;
        EComposerHeader *header;
        GtkWidget *widget;
@@ -825,11 +826,12 @@ composer_header_table_constructed (GObject *object)
 
        table = E_COMPOSER_HEADER_TABLE (object);
        shell = e_composer_header_table_get_shell (table);
+       client_cache = e_shell_get_client_cache (shell);
        registry = e_composer_header_table_get_registry (table);
 
        small_screen_mode = e_shell_get_small_screen_mode (shell);
 
-       name_selector = e_name_selector_new (registry);
+       name_selector = e_name_selector_new (client_cache);
        table->priv->name_selector = name_selector;
 
        header = e_composer_from_header_new (registry, _("Fr_om:"));
diff --git a/doc/reference/libeutil/libeutil-sections.txt b/doc/reference/libeutil/libeutil-sections.txt
index cf691bc..1a3e8a2 100644
--- a/doc/reference/libeutil/libeutil-sections.txt
+++ b/doc/reference/libeutil/libeutil-sections.txt
@@ -2259,7 +2259,7 @@ e_mkdtemp
 <TITLE>ENameSelector</TITLE>
 ENameSelector
 e_name_selector_new
-e_name_selector_get_registry
+e_name_selector_ref_client_cache
 e_name_selector_peek_model
 e_name_selector_peek_dialog
 e_name_selector_peek_section_entry
@@ -2285,7 +2285,7 @@ ENameSelectorPrivate
 <TITLE>ENameSelectorDialog</TITLE>
 ENameSelectorDialog
 e_name_selector_dialog_new
-e_name_selector_dialog_get_registry
+e_name_selector_dialog_ref_client_cache
 e_name_selector_dialog_peek_model
 e_name_selector_dialog_set_model
 e_name_selector_dialog_set_destination_index
@@ -2310,8 +2310,8 @@ ENameSelectorDialogPrivate
 <TITLE>ENameSelectorEntry</TITLE>
 ENameSelectorEntry
 e_name_selector_entry_new
-e_name_selector_entry_get_registry
-e_name_selector_entry_set_registry
+e_name_selector_entry_ref_client_cache
+e_name_selector_entry_set_client_cache
 e_name_selector_entry_get_minimum_query_length
 e_name_selector_entry_set_minimum_query_length
 e_name_selector_entry_get_show_address
diff --git a/e-util/e-name-selector-dialog.c b/e-util/e-name-selector-dialog.c
index fd72818..e40c673 100644
--- a/e-util/e-name-selector-dialog.c
+++ b/e-util/e-name-selector-dialog.c
@@ -33,7 +33,7 @@
 #include <libebook/libebook.h>
 #include <libebackend/libebackend.h>
 
-#include "e-source-combo-box.h"
+#include "e-client-combo-box.h"
 #include "e-destination-store.h"
 #include "e-contact-store.h"
 #include "e-name-selector-dialog.h"
@@ -61,7 +61,7 @@ typedef struct {
 } SelData;
 
 struct _ENameSelectorDialogPrivate {
-       ESourceRegistry *registry;
+       EClientCache *client_cache;
        ENameSelectorModel *name_selector_model;
        GtkTreeModelSort *contact_sort;
        GCancellable *cancellable;
@@ -83,11 +83,12 @@ struct _ENameSelectorDialogPrivate {
 
 enum {
        PROP_0,
-       PROP_REGISTRY
+       PROP_CLIENT_CACHE
 };
 
 static void     search_changed                (ENameSelectorDialog *name_selector_dialog);
-static void     source_changed                (ENameSelectorDialog *name_selector_dialog, ESourceComboBox 
*source_combo_box);
+static void     source_changed                (ENameSelectorDialog *name_selector_dialog,
+                                              EClientComboBox *combo_box);
 static void     transfer_button_clicked       (ENameSelectorDialog *name_selector_dialog, GtkButton 
*transfer_button);
 static void     contact_selection_changed     (ENameSelectorDialog *name_selector_dialog);
 static void     setup_name_selector_model     (ENameSelectorDialog *name_selector_dialog);
@@ -146,13 +147,13 @@ name_selector_dialog_populate_categories (ENameSelectorDialog *name_selector_dia
 }
 
 static void
-name_selector_dialog_set_registry (ENameSelectorDialog *name_selector_dialog,
-                                   ESourceRegistry *registry)
+name_selector_dialog_set_client_cache (ENameSelectorDialog *name_selector_dialog,
+                                       EClientCache *client_cache)
 {
-       g_return_if_fail (E_IS_SOURCE_REGISTRY (registry));
-       g_return_if_fail (name_selector_dialog->priv->registry == NULL);
+       g_return_if_fail (E_IS_CLIENT_CACHE (client_cache));
+       g_return_if_fail (name_selector_dialog->priv->client_cache == NULL);
 
-       name_selector_dialog->priv->registry = g_object_ref (registry);
+       name_selector_dialog->priv->client_cache = g_object_ref (client_cache);
 }
 
 static void
@@ -162,8 +163,8 @@ name_selector_dialog_set_property (GObject *object,
                                    GParamSpec *pspec)
 {
        switch (property_id) {
-               case PROP_REGISTRY:
-                       name_selector_dialog_set_registry (
+               case PROP_CLIENT_CACHE:
+                       name_selector_dialog_set_client_cache (
                                E_NAME_SELECTOR_DIALOG (object),
                                g_value_get_object (value));
                        return;
@@ -179,10 +180,10 @@ name_selector_dialog_get_property (GObject *object,
                                    GParamSpec *pspec)
 {
        switch (property_id) {
-               case PROP_REGISTRY:
-                       g_value_set_object (
+               case PROP_CLIENT_CACHE:
+                       g_value_take_object (
                                value,
-                               e_name_selector_dialog_get_registry (
+                               e_name_selector_dialog_ref_client_cache (
                                E_NAME_SELECTOR_DIALOG (object)));
                        return;
        }
@@ -200,10 +201,7 @@ name_selector_dialog_dispose (GObject *object)
        remove_books (E_NAME_SELECTOR_DIALOG (object));
        shutdown_name_selector_model (E_NAME_SELECTOR_DIALOG (object));
 
-       if (priv->registry != NULL) {
-               g_object_unref (priv->registry);
-               priv->registry = NULL;
-       }
+       g_clear_object (&priv->client_cache);
 
        /* Chain up to parent's dispose() method. */
        G_OBJECT_CLASS (e_name_selector_dialog_parent_class)->dispose (object);
@@ -235,6 +233,7 @@ name_selector_dialog_constructed (GObject *object)
        GtkTreeViewColumn *column;
        GtkCellRenderer   *cell_renderer;
        GtkTreeSelection  *selection;
+       ESourceRegistry *registry;
        ESource *source;
        gchar *tmp_str;
        GtkWidget *name_selector_grid;
@@ -259,7 +258,7 @@ name_selector_dialog_constructed (GObject *object)
        GtkWidget *source_tree_view;
        GtkWidget *destination_vgrid;
        GtkWidget *status_message;
-       GtkWidget *source_combo;
+       GtkWidget *client_combo;
        const gchar *extension_name;
 
        priv = E_NAME_SELECTOR_DIALOG_GET_PRIVATE (object);
@@ -514,18 +513,22 @@ name_selector_dialog_constructed (GObject *object)
        /* Create source menu */
 
        extension_name = E_SOURCE_EXTENSION_ADDRESS_BOOK;
-       source_combo = e_source_combo_box_new (priv->registry, extension_name);
+       client_combo = e_client_combo_box_new (
+               priv->client_cache, extension_name);
        g_signal_connect_swapped (
-               source_combo, "changed",
+               client_combo, "changed",
                G_CALLBACK (source_changed), object);
 
-       source_changed (E_NAME_SELECTOR_DIALOG (object), E_SOURCE_COMBO_BOX (source_combo));
+       source_changed (
+               E_NAME_SELECTOR_DIALOG (object),
+               E_CLIENT_COMBO_BOX (client_combo));
 
-       gtk_label_set_mnemonic_widget (GTK_LABEL (AddressBookLabel), source_combo);
-       gtk_widget_show (source_combo);
-       gtk_widget_set_hexpand (source_combo, TRUE);
-       gtk_widget_set_halign (source_combo, GTK_ALIGN_FILL);
-       gtk_container_add (GTK_CONTAINER (source_menu_hgrid), source_combo);
+       gtk_label_set_mnemonic_widget (
+               GTK_LABEL (AddressBookLabel), client_combo);
+       gtk_widget_show (client_combo);
+       gtk_widget_set_hexpand (client_combo, TRUE);
+       gtk_widget_set_halign (client_combo, GTK_ALIGN_FILL);
+       gtk_container_add (GTK_CONTAINER (source_menu_hgrid), client_combo);
 
        name_selector_dialog_populate_categories (
                E_NAME_SELECTOR_DIALOG (object));
@@ -538,10 +541,12 @@ name_selector_dialog_constructed (GObject *object)
 
        /* Display initial source */
 
-       source = e_source_registry_ref_default_address_book (priv->registry);
+       registry = e_client_cache_ref_registry (priv->client_cache);
+       source = e_source_registry_ref_default_address_book (registry);
        e_source_combo_box_set_active (
-               E_SOURCE_COMBO_BOX (source_combo), source);
+               E_SOURCE_COMBO_BOX (client_combo), source);
        g_object_unref (source);
+       g_object_unref (registry);
 
        /* Set up dialog defaults */
 
@@ -592,14 +597,19 @@ e_name_selector_dialog_class_init (ENameSelectorDialogClass *class)
        object_class->finalize = name_selector_dialog_finalize;
        object_class->constructed = name_selector_dialog_constructed;
 
+       /**
+        * ENameSelectorDialog:client-cache:
+        *
+        * Cache of shared #EClient instances.
+        **/
        g_object_class_install_property (
                object_class,
-               PROP_REGISTRY,
+               PROP_CLIENT_CACHE,
                g_param_spec_object (
-                       "registry",
-                       "Registry",
-                       "Data source registry",
-                       E_TYPE_SOURCE_REGISTRY,
+                       "client-cache",
+                       "Client Cache",
+                       "Cache of shared EClient instances",
+                       E_TYPE_CLIENT_CACHE,
                        G_PARAM_READWRITE |
                        G_PARAM_CONSTRUCT_ONLY |
                        G_PARAM_STATIC_STRINGS));
@@ -614,40 +624,42 @@ e_name_selector_dialog_init (ENameSelectorDialog *name_selector_dialog)
 
 /**
  * e_name_selector_dialog_new:
- * @registry: an #ESourceRegistry
+ * @client_cache: an #EClientCache
  *
  * Creates a new #ENameSelectorDialog.
  *
  * Returns: A new #ENameSelectorDialog.
  **/
 ENameSelectorDialog *
-e_name_selector_dialog_new (ESourceRegistry *registry)
+e_name_selector_dialog_new (EClientCache *client_cache)
 {
-       g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
+       g_return_val_if_fail (E_IS_CLIENT_CACHE (client_cache), NULL);
 
        return g_object_new (
                E_TYPE_NAME_SELECTOR_DIALOG,
-               "registry", registry, NULL);
+               "client-cache", client_cache, NULL);
 }
 
 /**
- * e_name_selector_dialog_get_registry:
+ * e_name_selector_dialog_ref_client_cache:
  * @name_selector_dialog: an #ENameSelectorDialog
  *
- * Returns the #ESourceRegistry that was passed to
- * e_name_selector_dialog_new().
+ * Returns the #EClientCache passed to e_name_selector_dialog_new().
+ *
+ * The returned #EClientCache is referenced for thread-safety and must be
+ * unreferenced with g_object_unref() when finished with it.
  *
- * Returns: the #ESourceRegistry
+ * Returns: an #EClientCache
  *
- * Since: 3.6
+ * Since: 3.8
  **/
-ESourceRegistry *
-e_name_selector_dialog_get_registry (ENameSelectorDialog *name_selector_dialog)
+EClientCache *
+e_name_selector_dialog_ref_client_cache (ENameSelectorDialog *name_selector_dialog)
 {
        g_return_val_if_fail (
                E_IS_NAME_SELECTOR_DIALOG (name_selector_dialog), NULL);
 
-       return name_selector_dialog->priv->registry;
+       return g_object_ref (name_selector_dialog->priv->client_cache);
 }
 
 /* --------- *
@@ -1133,9 +1145,9 @@ stop_client_view_cb (EContactStore *store,
 }
 
 static void
-book_client_connect_cb (GObject *source_object,
-                        GAsyncResult *result,
-                        gpointer user_data)
+name_selector_dialog_get_client_cb (GObject *source_object,
+                                    GAsyncResult *result,
+                                    gpointer user_data)
 {
        ENameSelectorDialog *name_selector_dialog = user_data;
        EClient *client;
@@ -1144,7 +1156,8 @@ book_client_connect_cb (GObject *source_object,
        ENameSelectorModel *model;
        GError *error = NULL;
 
-       client = e_book_client_connect_finish (result, &error);
+       client = e_client_combo_box_get_client_finish (
+               E_CLIENT_COMBO_BOX (source_object), result, &error);
 
        /* Sanity check. */
        g_return_if_fail (
@@ -1181,13 +1194,13 @@ book_client_connect_cb (GObject *source_object,
 
 static void
 source_changed (ENameSelectorDialog *name_selector_dialog,
-                ESourceComboBox *source_combo_box)
+                EClientComboBox *combo_box)
 {
        GCancellable *cancellable;
        ESource *source;
        gpointer parent;
 
-       source = e_source_combo_box_ref_active (source_combo_box);
+       source = e_source_combo_box_ref_active (E_SOURCE_COMBO_BOX (combo_box));
 
        parent = gtk_widget_get_toplevel (GTK_WIDGET (name_selector_dialog));
        parent = gtk_widget_is_toplevel (parent) ? parent : NULL;
@@ -1201,10 +1214,10 @@ source_changed (ENameSelectorDialog *name_selector_dialog,
        cancellable = g_cancellable_new ();
        name_selector_dialog->priv->cancellable = cancellable;
 
-       /* Connect to the selected book. */
-       e_book_client_connect (
-               source, cancellable,
-               book_client_connect_cb,
+       /* Connect to the selected source. */
+       e_client_combo_box_get_client (
+               combo_box, source, cancellable,
+               name_selector_dialog_get_client_cb,
                g_object_ref (name_selector_dialog));
 
        g_object_unref (source);
diff --git a/e-util/e-name-selector-dialog.h b/e-util/e-name-selector-dialog.h
index 69bd969..c5e8d65 100644
--- a/e-util/e-name-selector-dialog.h
+++ b/e-util/e-name-selector-dialog.h
@@ -29,8 +29,8 @@
 #define E_NAME_SELECTOR_DIALOG_H
 
 #include <gtk/gtk.h>
-#include <libedataserver/libedataserver.h>
 
+#include <e-util/e-client-cache.h>
 #include <e-util/e-contact-store.h>
 #include <e-util/e-name-selector-model.h>
 
@@ -70,9 +70,8 @@ struct _ENameSelectorDialogClass {
 
 GType          e_name_selector_dialog_get_type (void) G_GNUC_CONST;
 ENameSelectorDialog *
-               e_name_selector_dialog_new      (ESourceRegistry *registry);
-ESourceRegistry *
-               e_name_selector_dialog_get_registry
+               e_name_selector_dialog_new      (EClientCache *client_cache);
+EClientCache * e_name_selector_dialog_ref_client_cache
                                                (ENameSelectorDialog *name_selector_dialog);
 ENameSelectorModel *
                e_name_selector_dialog_peek_model
diff --git a/e-util/e-name-selector-entry.c b/e-util/e-name-selector-entry.c
index a8a1b23..78b82f2 100644
--- a/e-util/e-name-selector-entry.c
+++ b/e-util/e-name-selector-entry.c
@@ -35,8 +35,7 @@
        ((obj), E_TYPE_NAME_SELECTOR_ENTRY, ENameSelectorEntryPrivate))
 
 struct _ENameSelectorEntryPrivate {
-
-       ESourceRegistry *registry;
+       EClientCache *client_cache;
        gint minimum_query_length;
        gboolean show_address;
 
@@ -70,7 +69,7 @@ struct _ENameSelectorEntryPrivate {
 
 enum {
        PROP_0,
-       PROP_REGISTRY,
+       PROP_CLIENT_CACHE,
        PROP_MINIMUM_QUERY_LENGTH,
        PROP_SHOW_ADDRESS
 };
@@ -119,8 +118,8 @@ name_selector_entry_set_property (GObject *object,
                                   GParamSpec *pspec)
 {
        switch (property_id) {
-               case PROP_REGISTRY:
-                       e_name_selector_entry_set_registry (
+               case PROP_CLIENT_CACHE:
+                       e_name_selector_entry_set_client_cache (
                                E_NAME_SELECTOR_ENTRY (object),
                                g_value_get_object (value));
                        return;
@@ -148,10 +147,10 @@ name_selector_entry_get_property (GObject *object,
                                   GParamSpec *pspec)
 {
        switch (property_id) {
-               case PROP_REGISTRY:
-                       g_value_set_object (
+               case PROP_CLIENT_CACHE:
+                       g_value_take_object (
                                value,
-                               e_name_selector_entry_get_registry (
+                               e_name_selector_entry_ref_client_cache (
                                E_NAME_SELECTOR_ENTRY (object)));
                        return;
 
@@ -180,9 +179,9 @@ name_selector_entry_dispose (GObject *object)
 
        priv = E_NAME_SELECTOR_ENTRY_GET_PRIVATE (object);
 
-       if (priv->registry != NULL) {
-               g_object_unref (priv->registry);
-               priv->registry = NULL;
+       if (priv->client_cache != NULL) {
+               g_object_unref (priv->client_cache);
+               priv->client_cache = NULL;
        }
 
        if (priv->attr_list != NULL) {
@@ -327,14 +326,19 @@ e_name_selector_entry_class_init (ENameSelectorEntryClass *class)
        widget_class->realize = name_selector_entry_realize;
        widget_class->drag_data_received = name_selector_entry_drag_data_received;
 
+       /**
+        * ENameSelectorEntry:client-cache:
+        *
+        * Cache of shared #EClient instances.
+        **/
        g_object_class_install_property (
                object_class,
-               PROP_REGISTRY,
+               PROP_CLIENT_CACHE,
                g_param_spec_object (
-                       "registry",
-                       "Registry",
-                       "Data source registry",
-                       E_TYPE_SOURCE_REGISTRY,
+                       "client-cache",
+                       "Client Cache",
+                       "Cache of shared EClient instances",
+                       E_TYPE_CLIENT_CACHE,
                        G_PARAM_READWRITE |
                        G_PARAM_CONSTRUCT |
                        G_PARAM_STATIC_STRINGS));
@@ -2219,16 +2223,17 @@ setup_contact_store (ENameSelectorEntry *name_selector_entry)
 }
 
 static void
-book_client_connect_cb (GObject *source_object,
-                        GAsyncResult *result,
-                        gpointer user_data)
+name_selector_entry_get_client_cb (GObject *source_object,
+                                   GAsyncResult *result,
+                                   gpointer user_data)
 {
        EContactStore *contact_store = user_data;
        EBookClient *book_client;
        EClient *client;
        GError *error = NULL;
 
-       client = e_book_client_connect_finish (result, &error);
+       client = e_client_cache_get_client_finish (
+               E_CLIENT_CACHE (source_object), result, &error);
 
        /* Sanity check. */
        g_return_if_fail (
@@ -2259,6 +2264,7 @@ book_client_connect_cb (GObject *source_object,
 static void
 setup_default_contact_store (ENameSelectorEntry *name_selector_entry)
 {
+       EClientCache *client_cache;
        ESourceRegistry *registry;
        EContactStore *contact_store;
        GList *list, *iter;
@@ -2272,10 +2278,8 @@ setup_default_contact_store (ENameSelectorEntry *name_selector_entry)
        name_selector_entry->priv->contact_store = contact_store;
 
        extension_name = E_SOURCE_EXTENSION_ADDRESS_BOOK;
-       registry = e_name_selector_entry_get_registry (name_selector_entry);
-
-       /* An ESourceRegistry should have been set by now. */
-       g_return_if_fail (registry != NULL);
+       client_cache = e_name_selector_entry_ref_client_cache (name_selector_entry);
+       registry = e_client_cache_ref_registry (client_cache);
 
        list = e_source_registry_list_sources (registry, extension_name);
 
@@ -2302,14 +2306,19 @@ setup_default_contact_store (ENameSelectorEntry *name_selector_entry)
                        &name_selector_entry->priv->cancellables,
                        cancellable);
 
-               e_book_client_connect (
-                       source, cancellable,
-                       book_client_connect_cb,
+               e_client_cache_get_client (
+                       client_cache, source,
+                       E_SOURCE_EXTENSION_ADDRESS_BOOK,
+                       cancellable,
+                       name_selector_entry_get_client_cb,
                        g_object_ref (contact_store));
        }
 
        g_list_free_full (list, (GDestroyNotify) g_object_unref);
 
+       g_object_unref (registry);
+       g_object_unref (client_cache);
+
        setup_contact_store (name_selector_entry);
 }
 
@@ -3308,73 +3317,80 @@ e_name_selector_entry_init (ENameSelectorEntry *name_selector_entry)
 
 /**
  * e_name_selector_entry_new:
+ * @client_cache: an #EClientCache
  *
  * Creates a new #ENameSelectorEntry.
  *
  * Returns: A new #ENameSelectorEntry.
  **/
-ENameSelectorEntry *
-e_name_selector_entry_new (ESourceRegistry *registry)
+GtkWidget *
+e_name_selector_entry_new (EClientCache *client_cache)
 {
-       g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
+       g_return_val_if_fail (E_IS_CLIENT_CACHE (client_cache), NULL);
 
        return g_object_new (
                E_TYPE_NAME_SELECTOR_ENTRY,
-               "registry", registry, NULL);
+               "client-cache", client_cache, NULL);
 }
 
 /**
- * e_name_selector_entry_get_registry:
+ * e_name_selector_entry_ref_client_cache:
  * @name_selector_entry: an #ENameSelectorEntry
  *
- * Returns the #ESourceRegistry used to query address books.
+ * Returns the #EClientCache passed to e_name_selector_entry_new().
  *
- * Returns: the #ESourceRegistry, or %NULL
+ * The returned #EClientCache is referenced for thread-safety and must be
+ * unreferenced with g_object_unref() when finished with it.
  *
- * Since: 3.6
+ * Returns: an #EClientCache
+ *
+ * Since: 3.8
  **/
-ESourceRegistry *
-e_name_selector_entry_get_registry (ENameSelectorEntry *name_selector_entry)
+EClientCache *
+e_name_selector_entry_ref_client_cache (ENameSelectorEntry *name_selector_entry)
 {
        g_return_val_if_fail (
                E_IS_NAME_SELECTOR_ENTRY (name_selector_entry), NULL);
 
-       return name_selector_entry->priv->registry;
+       if (name_selector_entry->priv->client_cache == NULL)
+               return NULL;
+
+       return g_object_ref (name_selector_entry->priv->client_cache);
 }
 
 /**
- * e_name_selector_entry_set_registry:
+ * e_name_selector_entry_set_client_cache:
  * @name_selector_entry: an #ENameSelectorEntry
- * @registry: an #ESourceRegistry
+ * @client_cache: an #EClientCache
  *
- * Sets the #ESourceRegistry used to query address books.
+ * Sets the #EClientCache used to query address books.
  *
  * This function is intended for cases where @name_selector_entry is
- * instantiated by a #GtkBuilder and has to be given an #EsourceRegistry
+ * instantiated by a #GtkBuilder and has to be given an #EClientCache
  * after it is fully constructed.
  *
  * Since: 3.6
  **/
 void
-e_name_selector_entry_set_registry (ENameSelectorEntry *name_selector_entry,
-                                    ESourceRegistry *registry)
+e_name_selector_entry_set_client_cache (ENameSelectorEntry *name_selector_entry,
+                                        EClientCache *client_cache)
 {
        g_return_if_fail (E_IS_NAME_SELECTOR_ENTRY (name_selector_entry));
 
-       if (name_selector_entry->priv->registry == registry)
+       if (client_cache == name_selector_entry->priv->client_cache)
                return;
 
-       if (registry != NULL) {
-               g_return_if_fail (E_IS_SOURCE_REGISTRY (registry));
-               g_object_ref (registry);
+       if (client_cache != NULL) {
+               g_return_if_fail (E_IS_CLIENT_CACHE (client_cache));
+               g_object_ref (client_cache);
        }
 
-       if (name_selector_entry->priv->registry != NULL)
-               g_object_unref (name_selector_entry->priv->registry);
+       if (name_selector_entry->priv->client_cache != NULL)
+               g_object_unref (name_selector_entry->priv->client_cache);
 
-       name_selector_entry->priv->registry = registry;
+       name_selector_entry->priv->client_cache = client_cache;
 
-       g_object_notify (G_OBJECT (name_selector_entry), "registry");
+       g_object_notify (G_OBJECT (name_selector_entry), "client-cache");
 }
 
 /**
diff --git a/e-util/e-name-selector-entry.h b/e-util/e-name-selector-entry.h
index 6aa0943..ce48aa6 100644
--- a/e-util/e-name-selector-entry.h
+++ b/e-util/e-name-selector-entry.h
@@ -31,6 +31,7 @@
 #include <gtk/gtk.h>
 #include <libebook/libebook.h>
 
+#include <e-util/e-client-cache.h>
 #include <e-util/e-contact-store.h>
 #include <e-util/e-destination-store.h>
 #include <e-util/e-tree-model-generator.h>
@@ -75,14 +76,12 @@ struct _ENameSelectorEntryClass {
 };
 
 GType          e_name_selector_entry_get_type  (void) G_GNUC_CONST;
-ENameSelectorEntry *
-               e_name_selector_entry_new       (ESourceRegistry *registry);
-ESourceRegistry *
-               e_name_selector_entry_get_registry
+GtkWidget *    e_name_selector_entry_new       (EClientCache *client_cache);
+EClientCache * e_name_selector_entry_ref_client_cache
                                                (ENameSelectorEntry *name_selector_entry);
-void           e_name_selector_entry_set_registry
+void           e_name_selector_entry_set_client_cache
                                                (ENameSelectorEntry *name_selector_entry,
-                                                ESourceRegistry *registry);
+                                                EClientCache *client_cache);
 gint           e_name_selector_entry_get_minimum_query_length
                                                (ENameSelectorEntry *name_selector_entry);
 void           e_name_selector_entry_set_minimum_query_length
diff --git a/e-util/e-name-selector-list.c b/e-util/e-name-selector-list.c
index 180dfbf..52516a5 100644
--- a/e-util/e-name-selector-list.c
+++ b/e-util/e-name-selector-list.c
@@ -780,12 +780,12 @@ e_name_selector_list_init (ENameSelectorList *list)
 
 }
 
-ENameSelectorList *
-e_name_selector_list_new (ESourceRegistry *registry)
+GtkWidget *
+e_name_selector_list_new (EClientCache *client_cache)
 {
-       g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
+       g_return_val_if_fail (E_IS_CLIENT_CACHE (client_cache), NULL);
 
        return g_object_new (
                E_TYPE_NAME_SELECTOR_LIST,
-               "registry", registry, NULL);
+               "client-cache", client_cache, NULL);
 }
diff --git a/e-util/e-name-selector-list.h b/e-util/e-name-selector-list.h
index 28f7451..008f991 100644
--- a/e-util/e-name-selector-list.h
+++ b/e-util/e-name-selector-list.h
@@ -32,6 +32,7 @@
 #include <gtk/gtk.h>
 #include <libebook/libebook.h>
 
+#include <e-util/e-client-cache.h>
 #include <e-util/e-contact-store.h>
 #include <e-util/e-destination-store.h>
 #include <e-util/e-tree-model-generator.h>
@@ -72,8 +73,7 @@ struct _ENameSelectorListClass {
 };
 
 GType          e_name_selector_list_get_type   (void) G_GNUC_CONST;
-ENameSelectorList *
-               e_name_selector_list_new        (ESourceRegistry *registry);
+GtkWidget *    e_name_selector_list_new        (EClientCache *client_cache);
 void           e_name_selector_list_expand_clicked
                                                (ENameSelectorList *list);
 
diff --git a/e-util/e-name-selector.c b/e-util/e-name-selector.c
index 38ade81..f6e6658 100644
--- a/e-util/e-name-selector.c
+++ b/e-util/e-name-selector.c
@@ -50,7 +50,7 @@ typedef struct {
 } SourceBook;
 
 struct _ENameSelectorPrivate {
-       ESourceRegistry *registry;
+       EClientCache *client_cache;
        ENameSelectorModel *model;
        ENameSelectorDialog *dialog;
 
@@ -63,7 +63,7 @@ struct _ENameSelectorPrivate {
 
 enum {
        PROP_0,
-       PROP_REGISTRY
+       PROP_CLIENT_CACHE
 };
 
 G_DEFINE_TYPE (ENameSelector, e_name_selector, G_TYPE_OBJECT)
@@ -90,9 +90,9 @@ reset_pointer_cb (gpointer data,
 }
 
 static void
-name_selector_book_client_connect_cb (GObject *source_object,
-                                      GAsyncResult *result,
-                                      gpointer user_data)
+name_selector_get_client_cb (GObject *source_object,
+                             GAsyncResult *result,
+                             gpointer user_data)
 {
        ENameSelector *name_selector = user_data;
        EBookClient *book_client;
@@ -102,7 +102,8 @@ name_selector_book_client_connect_cb (GObject *source_object,
        guint ii;
        GError *error = NULL;
 
-       client = e_book_client_connect_finish (result, &error);
+       client = e_client_cache_get_client_finish (
+               E_CLIENT_CACHE (source_object), result, &error);
 
        /* Sanity check. */
        g_return_if_fail (
@@ -160,6 +161,7 @@ name_selector_book_client_connect_cb (GObject *source_object,
 void
 e_name_selector_load_books (ENameSelector *name_selector)
 {
+       EClientCache *client_cache;
        ESourceRegistry *registry;
        GList *list, *iter;
        const gchar *extension_name;
@@ -167,7 +169,9 @@ e_name_selector_load_books (ENameSelector *name_selector)
        g_return_if_fail (E_IS_NAME_SELECTOR (name_selector));
 
        extension_name = E_SOURCE_EXTENSION_ADDRESS_BOOK;
-       registry = e_name_selector_get_registry (name_selector);
+       client_cache = e_name_selector_ref_client_cache (name_selector);
+       registry = e_client_cache_ref_registry (client_cache);
+
        list = e_source_registry_list_sources (registry, extension_name);
 
        for (iter = list; iter != NULL; iter = g_list_next (iter)) {
@@ -187,13 +191,21 @@ e_name_selector_load_books (ENameSelector *name_selector)
                if (!e_source_autocomplete_get_include_me (extension))
                        continue;
 
-               e_book_client_connect (
-                       source, name_selector->priv->cancellable,
-                       name_selector_book_client_connect_cb,
+               /* FIXME GCancellable is only to be used for one
+                *       operation at a time, not for multiple
+                *       concurrent operations like this. */
+               e_client_cache_get_client (
+                       client_cache, source,
+                       E_SOURCE_EXTENSION_ADDRESS_BOOK,
+                       name_selector->priv->cancellable,
+                       name_selector_get_client_cb,
                        g_object_ref (name_selector));
        }
 
        g_list_free_full (list, (GDestroyNotify) g_object_unref);
+
+       g_object_unref (registry);
+       g_object_unref (client_cache);
 }
 
 /**
@@ -215,13 +227,13 @@ e_name_selector_cancel_loading (ENameSelector *name_selector)
 }
 
 static void
-name_selector_set_registry (ENameSelector *name_selector,
-                            ESourceRegistry *registry)
+name_selector_set_client_cache (ENameSelector *name_selector,
+                                EClientCache *client_cache)
 {
-       g_return_if_fail (E_IS_SOURCE_REGISTRY (registry));
-       g_return_if_fail (name_selector->priv->registry == NULL);
+       g_return_if_fail (E_IS_CLIENT_CACHE (client_cache));
+       g_return_if_fail (name_selector->priv->client_cache == NULL);
 
-       name_selector->priv->registry = g_object_ref (registry);
+       name_selector->priv->client_cache = g_object_ref (client_cache);
 }
 
 static void
@@ -231,8 +243,8 @@ name_selector_set_property (GObject *object,
                             GParamSpec *pspec)
 {
        switch (property_id) {
-               case PROP_REGISTRY:
-                       name_selector_set_registry (
+               case PROP_CLIENT_CACHE:
+                       name_selector_set_client_cache (
                                E_NAME_SELECTOR (object),
                                g_value_get_object (value));
                        return;
@@ -248,10 +260,10 @@ name_selector_get_property (GObject *object,
                             GParamSpec *pspec)
 {
        switch (property_id) {
-               case PROP_REGISTRY:
-                       g_value_set_object (
+               case PROP_CLIENT_CACHE:
+                       g_value_take_object (
                                value,
-                               e_name_selector_get_registry (
+                               e_name_selector_ref_client_cache (
                                E_NAME_SELECTOR (object)));
                        return;
        }
@@ -337,14 +349,19 @@ e_name_selector_class_init (ENameSelectorClass *class)
        object_class->dispose = name_selector_dispose;
        object_class->finalize = name_selector_finalize;
 
+       /**
+        * ENameSelector:client-cache:
+        *
+        * Cache of shared #EClient instances.
+        **/
        g_object_class_install_property (
                object_class,
-               PROP_REGISTRY,
+               PROP_CLIENT_CACHE,
                g_param_spec_object (
-                       "registry",
-                       "Registry",
-                       "Data source registry",
-                       E_TYPE_SOURCE_REGISTRY,
+                       "client-cache",
+                       "Client Cache",
+                       "Cache of shared EClient instances",
+                       E_TYPE_CLIENT_CACHE,
                        G_PARAM_READWRITE |
                        G_PARAM_CONSTRUCT_ONLY |
                        G_PARAM_STATIC_STRINGS));
@@ -369,38 +386,41 @@ e_name_selector_init (ENameSelector *name_selector)
 
 /**
  * e_name_selector_new:
- * @registry: an #ESourceRegistry
+ * @client_cache: an #EClientCache
  *
  * Creates a new #ENameSelector.
  *
  * Returns: A new #ENameSelector.
  **/
 ENameSelector *
-e_name_selector_new (ESourceRegistry *registry)
+e_name_selector_new (EClientCache *client_cache)
 {
-       g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
+       g_return_val_if_fail (E_IS_CLIENT_CACHE (client_cache), NULL);
 
        return g_object_new (
                E_TYPE_NAME_SELECTOR,
-               "registry", registry, NULL);
+               "client-cache", client_cache, NULL);
 }
 
 /**
- * e_name_selector_get_registry:
+ * e_name_selector_ref_client_cache:
  * @name_selector: an #ENameSelector
  *
- * Returns the #ESourceRegistry passed to e_name_selector_new().
+ * Returns the #EClientCache passed to e_name_selector_new().
  *
- * Returns: the #ESourceRegistry
+ * The returned #EClientCache is referenced for thread-safety and must be
+ * unreferenced with g_object_unref() when finished with it.
  *
- * Since: 3.6
+ * Returns: an #EClientCache
+ *
+ * Since: 3.8
  **/
-ESourceRegistry *
-e_name_selector_get_registry (ENameSelector *name_selector)
+EClientCache *
+e_name_selector_ref_client_cache (ENameSelector *name_selector)
 {
        g_return_val_if_fail (E_IS_NAME_SELECTOR (name_selector), NULL);
 
-       return name_selector->priv->registry;
+       return g_object_ref (name_selector->priv->client_cache);
 }
 
 /* ------- *
@@ -479,13 +499,14 @@ e_name_selector_peek_dialog (ENameSelector *name_selector)
        g_return_val_if_fail (E_IS_NAME_SELECTOR (name_selector), NULL);
 
        if (name_selector->priv->dialog == NULL) {
-               ESourceRegistry *registry;
+               EClientCache *client_cache;
                ENameSelectorDialog *dialog;
                ENameSelectorModel *model;
 
-               registry = e_name_selector_get_registry (name_selector);
-               dialog = e_name_selector_dialog_new (registry);
+               client_cache = e_name_selector_ref_client_cache (name_selector);
+               dialog = e_name_selector_dialog_new (client_cache);
                name_selector->priv->dialog = dialog;
+               g_object_unref (client_cache);
 
                model = e_name_selector_peek_model (name_selector);
                e_name_selector_dialog_set_model (dialog, model);
@@ -563,13 +584,17 @@ e_name_selector_peek_section_entry (ENameSelector *name_selector,
        section = &g_array_index (name_selector->priv->sections, Section, n);
 
        if (!section->entry) {
-               ESourceRegistry *registry;
+               EClientCache *client_cache;
                EContactStore *contact_store;
+               GtkWidget *widget;
                gchar         *text;
                gint           i;
 
-               registry = e_name_selector_get_registry (name_selector);
-               section->entry = e_name_selector_entry_new (registry);
+               client_cache = e_name_selector_ref_client_cache (name_selector);
+               widget = e_name_selector_entry_new (client_cache);
+               section->entry = E_NAME_SELECTOR_ENTRY (widget);
+               g_object_unref (client_cache);
+
                g_object_weak_ref (G_OBJECT (section->entry), reset_pointer_cb, name_selector);
                if (pango_parse_markup (name, -1, '_', NULL,
                                        &text, NULL, NULL))  {
@@ -635,13 +660,16 @@ e_name_selector_peek_section_list (ENameSelector *name_selector,
 
        if (!section->entry) {
                EContactStore *contact_store;
-               ESourceRegistry *registry;
+               EClientCache *client_cache;
+               GtkWidget *widget;
                gchar         *text;
                gint           i;
 
-               registry = name_selector->priv->registry;
-               section->entry = (ENameSelectorEntry *)
-                       e_name_selector_list_new (registry);
+               client_cache = e_name_selector_ref_client_cache (name_selector);
+               widget = e_name_selector_list_new (client_cache);
+               section->entry = E_NAME_SELECTOR_ENTRY (widget);
+               g_object_unref (client_cache);
+
                g_object_weak_ref (G_OBJECT (section->entry), reset_pointer_cb, name_selector);
                if (pango_parse_markup (name, -1, '_', NULL,
                                        &text, NULL, NULL))  {
diff --git a/e-util/e-name-selector.h b/e-util/e-name-selector.h
index c6949c5..eb4dc79 100644
--- a/e-util/e-name-selector.h
+++ b/e-util/e-name-selector.h
@@ -27,8 +27,7 @@
 #ifndef E_NAME_SELECTOR_H
 #define E_NAME_SELECTOR_H
 
-#include <libedataserver/libedataserver.h>
-
+#include <e-util/e-client-cache.h>
 #include <e-util/e-name-selector-model.h>
 #include <e-util/e-name-selector-dialog.h>
 #include <e-util/e-name-selector-entry.h>
@@ -69,9 +68,9 @@ struct _ENameSelectorClass {
 };
 
 GType          e_name_selector_get_type        (void) G_GNUC_CONST;
-ENameSelector *        e_name_selector_new             (ESourceRegistry *registry);
-ESourceRegistry *
-               e_name_selector_get_registry    (ENameSelector *name_selector);
+ENameSelector *        e_name_selector_new             (EClientCache *client_cache);
+EClientCache * e_name_selector_ref_client_cache
+                                               (ENameSelector *name_selector);
 ENameSelectorModel *
                e_name_selector_peek_model      (ENameSelector *name_selector);
 ENameSelectorDialog *
diff --git a/e-util/test-name-selector.c b/e-util/test-name-selector.c
index 3744ad9..b8cbee8 100644
--- a/e-util/test-name-selector.c
+++ b/e-util/test-name-selector.c
@@ -39,12 +39,12 @@ close_dialog (GtkWidget *widget,
 }
 
 static gboolean
-start_test (ESourceRegistry *registry)
+start_test (EClientCache *client_cache)
 {
-       ENameSelectorModel  *name_selector_model;
-       ENameSelectorEntry  *name_selector_entry;
-       EDestinationStore   *destination_store;
-       GtkWidget           *container;
+       ENameSelectorModel *name_selector_model;
+       EDestinationStore *destination_store;
+       GtkWidget *name_selector_entry;
+       GtkWidget *container;
 
        destination_store = e_destination_store_new ();
        name_selector_model = e_name_selector_model_new ();
@@ -53,18 +53,23 @@ start_test (ESourceRegistry *registry)
        e_name_selector_model_add_section (name_selector_model, "cc", "Cc", NULL);
        e_name_selector_model_add_section (name_selector_model, "bcc", "Bcc", NULL);
 
-       name_selector_dialog = e_name_selector_dialog_new (registry);
+       name_selector_dialog = e_name_selector_dialog_new (client_cache);
        e_name_selector_dialog_set_model (name_selector_dialog, name_selector_model);
        gtk_window_set_modal (GTK_WINDOW (name_selector_dialog), FALSE);
 
-       name_selector_entry = e_name_selector_entry_new (registry);
-       e_name_selector_entry_set_destination_store (name_selector_entry, destination_store);
+       name_selector_entry = e_name_selector_entry_new (client_cache);
+       e_name_selector_entry_set_destination_store (
+               E_NAME_SELECTOR_ENTRY (name_selector_entry),
+               destination_store);
+
+       g_signal_connect (
+               name_selector_dialog, "response",
+               G_CALLBACK (close_dialog), name_selector_dialog);
 
-       g_signal_connect (name_selector_dialog, "response", G_CALLBACK (close_dialog), name_selector_dialog);
        gtk_widget_show (GTK_WIDGET (name_selector_dialog));
 
        container = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-       gtk_container_add (GTK_CONTAINER (container), GTK_WIDGET (name_selector_entry));
+       gtk_container_add (GTK_CONTAINER (container), name_selector_entry);
        gtk_widget_show_all (container);
 
        name_selector_entry_window = container;
@@ -79,6 +84,7 @@ main (gint argc,
       gchar **argv)
 {
        ESourceRegistry *registry;
+       EClientCache *client_cache;
        GError *error = NULL;
 
        gtk_init (&argc, &argv);
@@ -94,9 +100,14 @@ main (gint argc,
                g_assert_not_reached ();
        }
 
-       g_idle_add ((GSourceFunc) start_test, registry);
+       client_cache = e_client_cache_new (registry);
+
+       g_idle_add ((GSourceFunc) start_test, client_cache);
 
        gtk_main ();
 
+       g_object_unref (registry);
+       g_object_unref (client_cache);
+
        return 0;
 }
diff --git a/maint/evolution.xml b/maint/evolution.xml
index 1fb4f03..afe4945 100644
--- a/maint/evolution.xml
+++ b/maint/evolution.xml
@@ -4,6 +4,8 @@
 
     <glade-widget-class name="EAuthComboBox" generic-name="auth-combo-box" title="Authentication Combo Box" 
get-type-function="e_auth_combo_box_get_type"/>
 
+    <glade-widget-class name="EClientComboBox" generic-name="client-combo-box" title="Client Combo Box"/>
+
     <glade-widget-class name="EDateEdit" generic-name="date-edit" title="Date Edit">
       <property id="allow-no-date-set"/>
       <property id="set-none"/>
@@ -40,6 +42,7 @@
 
   <glade-widget-group name="evolution-widgets" title="Evolution">
     <glade-widget-class-ref name="EAuthComboBox"/>
+    <glade-widget-class-ref name="EClientComboBox"/>
     <glade-widget-class-ref name="EDateEdit"/>
     <glade-widget-class-ref name="EImageChooser"/>
     <glade-widget-class-ref name="EMailJunkOptions"/>
diff --git a/modules/addressbook/e-book-shell-backend.c b/modules/addressbook/e-book-shell-backend.c
index 30a8691..8d309a8 100644
--- a/modules/addressbook/e-book-shell-backend.c
+++ b/modules/addressbook/e-book-shell-backend.c
@@ -326,26 +326,26 @@ static void
 book_shell_backend_quick_add_email_cb (EShell *shell,
                                        const gchar *email)
 {
-       ESourceRegistry *registry;
+       EClientCache *client_cache;
 
        /* XXX This is an ugly hack but it's the only way I could think
         *     of to integrate this feature with other shell modules. */
 
-       registry = e_shell_get_registry (shell);
-       e_contact_quick_add_email (registry, email, NULL, NULL);
+       client_cache = e_shell_get_client_cache (shell);
+       e_contact_quick_add_email (client_cache, email, NULL, NULL);
 }
 
 static void
 book_shell_backend_quick_add_vcard_cb (EShell *shell,
                                        const gchar *vcard)
 {
-       ESourceRegistry *registry;
+       EClientCache *client_cache;
 
        /* XXX This is an ugly hack but it's the only way I could think
         *     of to integrate this feature with other shell modules. */
 
-       registry = e_shell_get_registry (shell);
-       e_contact_quick_add_vcard (registry, vcard, NULL, NULL);
+       client_cache = e_shell_get_client_cache (shell);
+       e_contact_quick_add_vcard (client_cache, vcard, NULL, NULL);
 }
 
 static gboolean
diff --git a/plugins/bbdb/bbdb.c b/plugins/bbdb/bbdb.c
index 568bd90..0d9bac9 100644
--- a/plugins/bbdb/bbdb.c
+++ b/plugins/bbdb/bbdb.c
@@ -370,6 +370,7 @@ bbdb_create_book_client (gint type)
        EShell *shell;
        ESource *source = NULL;
        ESourceRegistry *registry;
+       EClientCache *client_cache;
        EClient *client = NULL;
        GSettings *settings;
        gboolean enable = TRUE;
@@ -397,6 +398,7 @@ bbdb_create_book_client (gint type)
 
        shell = e_shell_get_default ();
        registry = e_shell_get_registry (shell);
+       client_cache = e_shell_get_client_cache (shell);
 
        if (uid != NULL) {
                source = e_source_registry_ref_source (registry, uid);
@@ -406,7 +408,10 @@ bbdb_create_book_client (gint type)
        if (source == NULL)
                source = e_source_registry_ref_builtin_address_book (registry);
 
-       client = e_book_client_connect_sync (source, NULL, &error);
+       client = e_client_cache_get_client_sync (
+               client_cache, source,
+               E_SOURCE_EXTENSION_ADDRESS_BOOK,
+               NULL, &error);
        if (client == NULL) {
                g_warning (
                        "bbdb: Failed to get addressbook: %s\n",
diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c
index 17f9eed..25ce921 100644
--- a/plugins/pst-import/pst-importer.c
+++ b/plugins/pst-import/pst-importer.c
@@ -370,12 +370,13 @@ get_source_combo_key (const gchar *extension_name)
 static void
 add_source_list_with_check (GtkWidget *frame,
                             const gchar *caption,
-                            ESourceRegistry *registry,
+                            EClientCache *client_cache,
                             const gchar *extension_name,
                             GCallback toggle_callback,
                             EImportTarget *target,
                             gboolean active)
 {
+       ESourceRegistry *registry;
        ESource *source = NULL;
        GtkWidget *check, *hbox;
        GtkWidget *combo = NULL;
@@ -384,8 +385,10 @@ add_source_list_with_check (GtkWidget *frame,
        g_return_if_fail (caption != NULL);
        g_return_if_fail (toggle_callback != NULL);
 
+       registry = e_client_cache_ref_registry (client_cache);
        source = e_source_registry_ref_default_for_extension_name (
                registry, extension_name);
+       g_object_unref (registry);
        g_return_if_fail (source != NULL);
 
        hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
@@ -395,7 +398,7 @@ add_source_list_with_check (GtkWidget *frame,
        g_signal_connect (check, "toggled", toggle_callback, target);
        gtk_box_pack_start ((GtkBox *) hbox, check, FALSE, FALSE, 0);
 
-       combo = e_source_combo_box_new (registry, extension_name);
+       combo = e_client_combo_box_new (client_cache, extension_name);
        e_source_combo_box_set_active (E_SOURCE_COMBO_BOX (combo), source);
 
        gtk_box_pack_end ((GtkBox *) hbox, combo, FALSE, FALSE, 0);
@@ -511,7 +514,7 @@ org_credativ_evolution_readpst_getwidget (EImport *ei,
                                           EImportImporter *im)
 {
        EShell *shell;
-       ESourceRegistry *registry;
+       EClientCache *client_cache;
        EShellBackend *shell_backend;
        EMailBackend *backend;
        EMailSession *session;
@@ -532,7 +535,7 @@ org_credativ_evolution_readpst_getwidget (EImport *ei,
        gtk_box_pack_start ((GtkBox *) hbox, check, FALSE, FALSE, 0);
 
        shell = e_shell_get_default ();
-       registry = e_shell_get_registry (shell);
+       client_cache = e_shell_get_client_cache (shell);
        shell_backend = e_shell_get_backend_by_name (shell, "mail");
 
        backend = E_MAIL_BACKEND (shell_backend);
@@ -564,22 +567,22 @@ org_credativ_evolution_readpst_getwidget (EImport *ei,
 
        add_source_list_with_check (
                framebox, _("_Address Book"),
-               registry, E_SOURCE_EXTENSION_ADDRESS_BOOK,
+               client_cache, E_SOURCE_EXTENSION_ADDRESS_BOOK,
                G_CALLBACK (checkbox_addr_toggle_cb), target,
                GPOINTER_TO_INT (g_datalist_get_data (&target->data, "pst-do-addr")));
        add_source_list_with_check (
                framebox, _("A_ppointments"),
-               registry, E_SOURCE_EXTENSION_CALENDAR,
+               client_cache, E_SOURCE_EXTENSION_CALENDAR,
                G_CALLBACK (checkbox_appt_toggle_cb), target,
                GPOINTER_TO_INT (g_datalist_get_data (&target->data, "pst-do-appt")));
        add_source_list_with_check (
                framebox, _("_Tasks"),
-               registry, E_SOURCE_EXTENSION_TASK_LIST,
+               client_cache, E_SOURCE_EXTENSION_TASK_LIST,
                G_CALLBACK (checkbox_task_toggle_cb), target,
                GPOINTER_TO_INT (g_datalist_get_data (&target->data, "pst-do-task")));
        add_source_list_with_check (
                framebox, _("_Journal entries"),
-               registry, E_SOURCE_EXTENSION_MEMO_LIST,
+               client_cache, E_SOURCE_EXTENSION_MEMO_LIST,
                G_CALLBACK (checkbox_journal_toggle_cb), target,
                GPOINTER_TO_INT (g_datalist_get_data (&target->data, "pst-do-journal")));
 
@@ -591,7 +594,7 @@ org_credativ_evolution_readpst_getwidget (EImport *ei,
 }
 
 static void
-client_connect_cb (GObject *source_object,
+pst_get_client_cb (GObject *source_object,
                    GAsyncResult *result,
                    gpointer user_data)
 {
@@ -603,7 +606,8 @@ client_connect_cb (GObject *source_object,
        g_return_if_fail (m != NULL);
        g_return_if_fail (m->waiting_open > 0);
 
-       client = e_book_client_connect_finish (result, &error);
+       client = e_client_combo_box_get_client_finish (
+               E_CLIENT_COMBO_BOX (source_object), result, &error);
 
        /* Sanity check. */
        g_return_if_fail (
@@ -649,20 +653,23 @@ static void
 open_client (PstImporter *m,
              const gchar *extension_name)
 {
-       ESourceComboBox *combo;
+       ESourceComboBox *combo_box;
        ESource *source;
        const gchar *key;
 
        key = get_source_combo_key (extension_name);
-       combo = g_datalist_get_data (&m->target->data, key);
-       g_return_if_fail (combo != NULL);
+       combo_box = g_datalist_get_data (&m->target->data, key);
+       g_return_if_fail (combo_box != NULL);
 
-       source = e_source_combo_box_ref_active (combo);
+       source = e_source_combo_box_ref_active (combo_box);
        g_return_if_fail (source != NULL);
 
        m->waiting_open++;
 
-       e_book_client_connect (source, m->cancellable, client_connect_cb, m);
+       e_client_combo_box_get_client (
+               E_CLIENT_COMBO_BOX (combo_box),
+               source, m->cancellable,
+               pst_get_client_cb, m);
 
        g_object_unref (source);
 }


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