[evolution/account-mgmt: 9/51] Adapt EContactListEditor to the new ESource API.



commit 8240e0026db2e1e7aea2dd0f52fa502fd671ff7c
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Dec 8 00:16:45 2010 -0500

    Adapt EContactListEditor to the new ESource API.

 .../gui/contact-list-editor/contact-list-editor.ui |    1 +
 .../contact-list-editor/e-contact-list-editor.c    |   32 ++++++++------------
 2 files changed, 14 insertions(+), 19 deletions(-)
---
diff --git a/addressbook/gui/contact-list-editor/contact-list-editor.ui b/addressbook/gui/contact-list-editor/contact-list-editor.ui
index 6cef3e2..2abb7e2 100644
--- a/addressbook/gui/contact-list-editor/contact-list-editor.ui
+++ b/addressbook/gui/contact-list-editor/contact-list-editor.ui
@@ -83,6 +83,7 @@
                 </child>
                 <child>
                   <object class="ESourceComboBox" type-func="e_source_combo_box_get_type" id="source-combo-box">
+                    <property name="extension-name">Address Book</property>
                     <property name="visible">True</property>
                   </object>
                   <packing>
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 42099d1..449f543 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -946,8 +946,6 @@ contact_list_editor_source_menu_changed_cb (GtkWidget *widget)
 
 	e_client_utils_open_new (
 		source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL,
-		e_client_utils_authenticate_handler,
-		eab_editor_get_window (EAB_EDITOR (editor)),
 		contact_list_editor_book_loaded_cb,
 		g_object_ref (editor));
 }
@@ -1171,11 +1169,9 @@ static void
 setup_custom_widgets (EContactListEditor *editor)
 {
 	GtkWidget *combo_box;
-	ESourceList *source_list;
 	ENameSelectorEntry *name_selector_entry;
 	GtkWidget *old, *parent;
 	EContactListEditorPrivate *priv;
-	GError *error = NULL;
 	guint ba = 0, la = 0, ra = 0, ta = 0, xo = 0, xp = 0, yo = 0, yp = 0;
 
 	g_return_if_fail (editor != NULL);
@@ -1183,18 +1179,6 @@ setup_custom_widgets (EContactListEditor *editor)
 	priv = E_CONTACT_LIST_EDITOR_GET_PRIVATE (editor);
 
 	combo_box = WIDGET (SOURCE_MENU);
-	if (!e_book_client_get_sources (&source_list, &error))
-		source_list = NULL;
-	g_object_set (combo_box, "source-list", source_list, NULL);
-	if (source_list)
-		g_object_unref (source_list);
-
-	if (error) {
-		g_warning (
-			"%s: Failed to get sources: %s",
-			G_STRFUNC, error->message);
-		g_error_free (error);
-	}
 
 	g_signal_connect (
 		combo_box, "changed", G_CALLBACK (
@@ -1359,12 +1343,17 @@ contact_list_editor_constructed (GObject *object)
 	GtkCellRenderer *renderer;
 	GtkTreeView *view;
 	GtkTreeSelection *selection;
+	ESourceRegistry *registry;
+	EShell *shell;
 
 	editor = E_CONTACT_LIST_EDITOR (object);
 
 	/* Chain up to parent's constructed() method. */
 	G_OBJECT_CLASS (parent_class)->constructed (object);
 
+	shell = eab_editor_get_shell (EAB_EDITOR (editor));
+	registry = e_shell_get_registry (shell);
+
 	editor->priv->editable = TRUE;
 	editor->priv->allows_contact_lists = TRUE;
 
@@ -1402,7 +1391,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 ();
+	editor->priv->name_selector = e_name_selector_new (registry);
 
 	e_name_selector_model_add_section (
 		e_name_selector_peek_model (editor->priv->name_selector),
@@ -1454,8 +1443,13 @@ contact_list_editor_save_contact (EABEditor *eab_editor,
 {
 	EContactListEditor *editor = E_CONTACT_LIST_EDITOR (eab_editor);
 	EContactListEditorPrivate *priv = editor->priv;
+	ESourceRegistry *registry;
 	EditorCloseStruct *ecs;
 	EContact *contact;
+	EShell *shell;
+
+	shell = eab_editor_get_shell (eab_editor);
+	registry = e_shell_get_registry (shell);
 
 	contact = e_contact_list_editor_get_contact (editor);
 
@@ -1471,11 +1465,11 @@ contact_list_editor_save_contact (EABEditor *eab_editor,
 
 	if (priv->is_new_list)
 		eab_merging_book_add_contact (
-			priv->book_client, contact,
+			registry, priv->book_client, contact,
 			contact_list_editor_list_added_cb, ecs);
 	else
 		eab_merging_book_modify_contact (
-			priv->book_client, contact,
+			registry, priv->book_client, contact,
 			contact_list_editor_list_modified_cb, ecs);
 
 	priv->changed = FALSE;



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