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



commit 50c1b92800f997fe0bc48c8e5131ff442e72b23d
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  |    2 +-
 .../gui/contact-editor/e-contact-quick-add.c       |   28 ++++++++++----------
 3 files changed, 16 insertions(+), 15 deletions(-)
---
diff --git a/addressbook/gui/contact-editor/contact-editor.ui b/addressbook/gui/contact-editor/contact-editor.ui
index 428b17a..3ef303d 100644
--- a/addressbook/gui/contact-editor/contact-editor.ui
+++ b/addressbook/gui/contact-editor/contact-editor.ui
@@ -230,6 +230,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 4c0bf2e..99a77e7 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -25,6 +25,7 @@
 #include "eab-editor.h"
 #include "e-contact-editor.h"
 
+#include <stdlib.h>
 #include <string.h>
 #include <time.h>
 #include <gtk/gtk.h>
@@ -3638,7 +3639,6 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
 	widget = e_builder_get_widget(e_contact_editor->builder, "button-categories");
 	g_signal_connect (widget, "clicked", 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);
 	label = e_builder_get_widget (e_contact_editor->builder, "where-label");
 	gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget);
diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c
index 30f0068..fd84aa8 100644
--- a/addressbook/gui/contact-editor/e-contact-quick-add.c
+++ b/addressbook/gui/contact-editor/e-contact-quick-add.c
@@ -27,6 +27,7 @@
 #include <glib/gi18n.h>
 #include <libebook/e-book.h>
 #include <libebook/e-contact.h>
+#include <libebook/e-source-address-book.h>
 #include <libedataserverui/e-book-auth-util.h>
 #include <libedataserverui/e-source-combo-box.h>
 #include <addressbook/util/eab-book-util.h>
@@ -42,7 +43,6 @@ struct _QuickAdd {
 	gchar *vcard;
 	EContact *contact;
 	GCancellable *cancellable;
-	ESourceList *source_list;
 	ESource *source;
 
 	EContactQuickAddCallback cb;
@@ -76,8 +76,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);
@@ -135,10 +133,11 @@ merge_cb (ESource *source,
 		if (e_book_is_writable (book))
 			eab_merging_book_add_contact (book, qa->contact, NULL, NULL);
 		else
-			e_alert_run_dialog_for_args (e_shell_get_active_window (NULL),
-						     "addressbook:error-read-only",
-						     e_source_peek_name (e_book_get_source (book)),
-						     NULL);
+			e_alert_run_dialog_for_args (
+				e_shell_get_active_window (NULL),
+				"addressbook:error-read-only",
+				e_source_get_name (e_book_get_source (book)),
+				NULL);
 
 		if (qa->cb)
 			qa->cb (qa->contact, qa->closure);
@@ -366,6 +365,7 @@ source_changed (ESourceComboBox *source_combo_box, QuickAdd *qa)
 	ESource *source;
 
 	source = e_source_combo_box_get_active (source_combo_box);
+
 	if (source != NULL) {
 		if (qa->source != NULL)
 			g_object_unref (qa->source);
@@ -378,12 +378,13 @@ source_changed (ESourceComboBox *source_combo_box, QuickAdd *qa)
 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);
@@ -422,12 +423,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]