[evolution/account-mgmt: 16/33] Adapt mail/importers to the new ESource API.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/account-mgmt: 16/33] Adapt mail/importers to the new ESource API.
- Date: Wed, 2 Mar 2011 03:46:59 +0000 (UTC)
commit 954a39958c5dc07734c1e2c9de1275640ca6725e
Author: Matthew Barnes <mbarnes redhat com>
Date: Wed Dec 8 09:40:51 2010 -0500
Adapt mail/importers to the new ESource API.
mail/importers/pine-importer.c | 27 ++++++++++++++++++---------
1 files changed, 18 insertions(+), 9 deletions(-)
---
diff --git a/mail/importers/pine-importer.c b/mail/importers/pine-importer.c
index e7ace0b..7329448 100644
--- a/mail/importers/pine-importer.c
+++ b/mail/importers/pine-importer.c
@@ -40,6 +40,8 @@
#include <libebook/e-book.h>
#include <libebook/e-destination.h>
+#include <libebook/e-source-address-book.h>
+#include <libedataserver/e-source-registry.h>
#include "mail-importer.h"
@@ -160,18 +162,20 @@ import_contact (EBook *book, gchar *line)
static void
import_contacts (void)
{
- ESource *primary;
- ESourceList *source_list;
- EBook *book;
+ ESourceRegistry *registry;
+ EBook *book = NULL;
+ GList *list;
gchar *name;
GString *line;
FILE *fp;
gsize offset;
+ const gchar *extension_name;
printf("importing pine addressbook\n");
- if (!e_book_get_addressbooks (&source_list, NULL))
- return;
+ registry = e_source_registry_get_default ();
+ extension_name = E_SOURCE_EXTENSION_ADDRESS_BOOK;
+ list = e_source_registry_list_sources (registry, extension_name);
name = g_build_filename(g_get_home_dir(), ".addressbook", NULL);
fp = fopen(name, "r");
@@ -179,17 +183,22 @@ import_contacts (void)
if (fp == NULL)
return;
- primary = e_source_list_peek_source_any (source_list);
+ if (list != NULL) {
+ ESource *source;
+
+ source = E_SOURCE (list->data);
+ book = e_book_new (source, NULL);
+ g_list_free (list);
+ }
+
/* FIXME Better error handling */
- if ((book = e_book_new (primary,NULL)) == NULL) {
+ if (book == NULL) {
fclose (fp);
g_warning ("Could not create EBook.");
return;
}
e_book_open (book, TRUE, NULL);
- g_object_unref (primary);
- g_object_unref (source_list);
line = g_string_new("");
g_string_set_size (line, 256);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]