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



commit 35da0eeb6b84376a110cae70ff761b2cc7ed91ec
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Dec 8 00:16:30 2010 -0500

    Adapt EContactEditor to the new ESource API.

 addressbook/gui/contact-editor/contact-editor.ui   |    1 +
 addressbook/gui/contact-editor/e-contact-editor.c  |    3 +-
 .../gui/contact-editor/e-contact-quick-add.c       |   21 +++++++++----------
 3 files changed, 12 insertions(+), 13 deletions(-)
---
diff --git a/addressbook/gui/contact-editor/contact-editor.ui b/addressbook/gui/contact-editor/contact-editor.ui
index 2f133d4..985659d 100644
--- a/addressbook/gui/contact-editor/contact-editor.ui
+++ b/addressbook/gui/contact-editor/contact-editor.ui
@@ -232,6 +232,7 @@
                                 </child>
                                 <child>
                                   <object class="ESourceComboBox" type-func="e_source_combo_box_get_type" id="source-combo-box-source">
+                                    <property name="extension-name">Address Book</property>
                                     <property name="visible">True</property>
                                   </object>
                                   <packing>
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index 6ce9524..baf3dab 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -27,6 +27,7 @@
 #include "eab-editor.h"
 #include "e-contact-editor.h"
 
+#include <stdlib.h>
 #include <string.h>
 #include <time.h>
 #include <gtk/gtk.h>
@@ -4034,8 +4035,6 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
 		G_CALLBACK (categories_clicked), e_contact_editor);
 	widget = e_builder_get_widget (
 		e_contact_editor->builder, "source-combo-box-source");
-	e_util_set_source_combo_box_list (
-		widget, "/apps/evolution/addressbook/sources");
 	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 96af36f..bbcdefb 100644
--- a/addressbook/gui/contact-editor/e-contact-quick-add.c
+++ b/addressbook/gui/contact-editor/e-contact-quick-add.c
@@ -31,6 +31,7 @@
 #include <libebook/e-book-client.h>
 #include <libebook/e-contact.h>
 #include <libedataserverui/e-client-utils.h>
+#include <libebook/e-source-address-book.h>
 #include <libedataserverui/e-source-combo-box.h>
 #include <addressbook/util/eab-book-util.h>
 #include "e-contact-editor.h"
@@ -45,7 +46,6 @@ struct _QuickAdd {
 	gchar *vcard;
 	EContact *contact;
 	GCancellable *cancellable;
-	ESourceList *source_list;
 	ESource *source;
 
 	EContactQuickAddCallback cb;
@@ -79,8 +79,6 @@ quick_add_unref (QuickAdd *qa)
 				g_cancellable_cancel (qa->cancellable);
 				g_object_unref (qa->cancellable);
 			}
-			if (qa->source_list != NULL)
-				g_object_unref (qa->source_list);
 			g_free (qa->name);
 			g_free (qa->email);
 			g_free (qa->vcard);
@@ -161,7 +159,7 @@ merge_cb (GObject *source_object,
 		e_alert_run_dialog_for_args (
 			e_shell_get_active_window (NULL),
 			"addressbook:error-read-only",
-			e_source_peek_name (source),
+			e_source_get_display_name (source),
 			NULL);
 
 	if (qa->cb)
@@ -411,6 +409,7 @@ source_changed (ESourceComboBox *source_combo_box,
 	ESource *source;
 
 	source = e_source_combo_box_get_active (source_combo_box);
+
 	if (source != NULL) {
 		if (qa->source != NULL)
 			g_object_unref (qa->source);
@@ -423,12 +422,13 @@ source_changed (ESourceComboBox *source_combo_box,
 static GtkWidget *
 build_quick_add_dialog (QuickAdd *qa)
 {
-	GConfClient *gconf_client;
+	ESourceRegistry *registry;
 	GtkWidget *container;
 	GtkWidget *dialog;
 	GtkWidget *label;
 	GtkTable *table;
 	ESource *source;
+	const gchar *extension_name;
 	const gint xpad = 0, ypad = 0;
 
 	g_return_val_if_fail (qa != NULL, NULL);
@@ -467,12 +467,11 @@ build_quick_add_dialog (QuickAdd *qa)
 		gtk_widget_set_sensitive (qa->email_entry, FALSE);
 	}
 
-	gconf_client = gconf_client_get_default ();
-	qa->source_list = e_source_list_new_for_gconf (
-		gconf_client, "/apps/evolution/addressbook/sources");
-	source = e_source_list_peek_default_source (qa->source_list);
-	g_object_unref (gconf_client);
-	qa->combo_box = e_source_combo_box_new (qa->source_list);
+	registry = e_source_registry_get_default ();
+	extension_name = E_SOURCE_EXTENSION_ADDRESS_BOOK;
+	source = e_source_registry_get_default_address_book (registry);
+
+	qa->combo_box = e_source_combo_box_new (registry, extension_name);
 	e_source_combo_box_set_active (
 		E_SOURCE_COMBO_BOX (qa->combo_box), source);
 



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