From: Tollef Fog Heen Date: Sun, 29 Sep 2013 13:41:01 +0000 (+0200) Subject: API updates X-Git-Tag: 0.8~6 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=37b2ebd61bc994c6c7dccebbbf93baacee3da5f1;p=eweouz API updates --- diff --git a/src/eweouz-write-addressbook.c b/src/eweouz-write-addressbook.c index fbaba2e..81cbfba 100644 --- a/src/eweouz-write-addressbook.c +++ b/src/eweouz-write-addressbook.c @@ -33,15 +33,14 @@ Notes String or `bbdb-record-raw-notes' String or Association int main(int argc, char **argv) { - EBook *book; + EBookClient *client; ESourceRegistry *eds_source_registry = NULL; EBookClient *ebc; ESource *source; - EBookQuery *query; - GList *contacts; + GSList *contacts; GList *sources; GList *g, *s; - GList *c; + GSList *c; GError *error = NULL; GOptionContext *optioncontext; @@ -129,15 +128,13 @@ int main(int argc, char **argv) } } else { char *qu = g_strdup_printf ("(is \"id\" \"%s\")", id); - query = e_book_query_from_string(qu); - sources = e_source_registry_list_sources (eds_source_registry, NULL); + sources = e_source_registry_list_sources (eds_source_registry, E_SOURCE_EXTENSION_ADDRESS_BOOK); for (s = sources ; s; s = s->next) { source = E_SOURCE(s->data); - book = e_book_new(source, &error); - e_book_open(book, TRUE, &error); - e_book_get_contacts(book, query, &contacts, &error); + client = E_BOOK_CLIENT(e_book_client_connect_sync(source, NULL, &error)); + e_book_client_get_contacts_sync(client, qu, &contacts, NULL, &error); for (c = contacts; c; c = c->next) { if (full_name) @@ -164,10 +161,9 @@ int main(int argc, char **argv) } g_object_set(E_CONTACT(c->data), "email", el, NULL); } - e_book_commit_contact(book, E_CONTACT(c->data), &error); + e_book_client_modify_contact_sync(client, E_CONTACT(c->data), NULL, &error); } } - e_book_query_unref (query); g_free(qu); } return 0;