[evolution/account-mgmt: 48/50] Adapt vcard-inline plugin to the new ESource API.



commit 10c725e16f3fcb4192c18442b3595cbb322e1be4
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon Mar 28 11:25:50 2011 -0400

    Adapt vcard-inline plugin to the new ESource API.

 plugins/vcard-inline/vcard-inline.c |   30 +++++++++++-------------------
 1 files changed, 11 insertions(+), 19 deletions(-)
---
diff --git a/plugins/vcard-inline/vcard-inline.c b/plugins/vcard-inline/vcard-inline.c
index 1b72958..b7ae0b9 100644
--- a/plugins/vcard-inline/vcard-inline.c
+++ b/plugins/vcard-inline/vcard-inline.c
@@ -24,6 +24,7 @@
 #include <glib/gi18n-lib.h>
 #include <libebook/e-book-client.h>
 #include <libebook/e-contact.h>
+#include <libebook/e-source-address-book.h>
 #include <gtkhtml/gtkhtml-embedded.h>
 #include <libedataserverui/e-client-utils.h>
 #include <libedataserverui/e-source-selector-dialog.h>
@@ -41,8 +42,7 @@ typedef struct _VCardInlinePObject VCardInlinePObject;
 struct _VCardInlinePObject {
 	EMFormatHTMLPObject object;
 
-	GSList *contact_list;
-	ESourceList *source_list;
+	GList *contact_list;
 	GtkWidget *contact_display;
 	GtkWidget *message_label;
 };
@@ -70,11 +70,6 @@ org_gnome_vcard_inline_pobject_free (EMFormatHTMLPObject *object)
 	e_client_util_free_object_slist (vcard_object->contact_list);
 	vcard_object->contact_list = NULL;
 
-	if (vcard_object->source_list != NULL) {
-		g_object_unref (vcard_object->source_list);
-		vcard_object->source_list = NULL;
-	}
-
 	if (vcard_object->contact_display != NULL) {
 		g_object_unref (vcard_object->contact_display);
 		vcard_object->contact_display = NULL;
@@ -160,13 +155,16 @@ org_gnome_vcard_inline_client_loaded_cb (GObject *source_object,
 static void
 org_gnome_vcard_inline_save_cb (VCardInlinePObject *vcard_object)
 {
+	ESourceRegistry *registry;
 	ESource *source;
-	GSList *contact_list;
+	GList *contact_list;
+	const gchar *extension_name;
 	GtkWidget *dialog;
 
-	g_return_if_fail (vcard_object->source_list != NULL);
+	registry = e_source_registry_get_default ();
+	extension_name = E_SOURCE_EXTENSION_ADDRESS_BOOK;
 
-	dialog = e_source_selector_dialog_new (NULL, vcard_object->source_list);
+	dialog = e_source_selector_dialog_new (NULL, registry, extension_name);
 
 	e_source_selector_dialog_select_default_source (
 		E_SOURCE_SELECTOR_DIALOG (dialog));
@@ -185,7 +183,8 @@ org_gnome_vcard_inline_save_cb (VCardInlinePObject *vcard_object)
 
 	contact_list = e_client_util_copy_object_slist (NULL, vcard_object->contact_list);
 
-	e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL,
+	e_client_utils_open_new (
+		source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL,
 		e_client_utils_authenticate_handler, NULL,
 		org_gnome_vcard_inline_client_loaded_cb, contact_list);
 }
@@ -300,12 +299,7 @@ org_gnome_vcard_inline_embed (EMFormatHTML *format,
 
 	widget = gtk_button_new_with_label (_("Save in Address Book"));
 	gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
-
-	/* This depends on having a source list. */
-	if (vcard_object->source_list != NULL)
-		gtk_widget_show (widget);
-	else
-		gtk_widget_hide (widget);
+	gtk_widget_show (widget);
 
 	g_signal_connect_swapped (
 		widget, "clicked",
@@ -339,8 +333,6 @@ org_gnome_vcard_inline_format (gpointer ep,
 	vcard_object->object.free = org_gnome_vcard_inline_pobject_free;
 	org_gnome_vcard_inline_decode (vcard_object, target->part);
 
-	e_book_client_get_sources (&vcard_object->source_list, NULL);
-
 	content = g_strdup_printf ("<object classid=%s></object>", classid);
 	camel_stream_write_string (target->stream, content, NULL, NULL);
 	g_free (content);



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