1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
4 #include <libebook/libebook.h>
6 #include "ebook-test-utils.h"
8 #if 0 /* ACCOUNT_MGMT */
10 print_email (EContact *contact)
12 const gchar *file_as = e_contact_get_const (contact, E_CONTACT_FILE_AS);
13 const gchar *name_or_org = e_contact_get_const (contact, E_CONTACT_NAME_OR_ORG);
16 printf ("Contact: %s\n", file_as);
17 printf ("Name or org: %s\n", name_or_org);
18 printf ("Email addresses:\n");
19 emails = e_contact_get (contact, E_CONTACT_EMAIL);
20 for (e = emails; e; e = e->next) {
21 printf ("\t%s\n", (gchar *) e->data);
23 g_list_foreach (emails, (GFunc) g_free, NULL);
30 print_all_emails (EBook *book)
36 query = e_book_query_field_exists (E_CONTACT_FULL_NAME);
38 status = e_book_get_contacts (book, query, &cards, NULL);
40 e_book_query_unref (query);
42 if (status == FALSE) {
43 printf ("error %d getting card list\n", status);
47 for (c = cards; c; c = c->next) {
48 EContact *contact = E_CONTACT (c->data);
50 print_email (contact);
52 g_object_unref (contact);
58 print_one_email (EBook *book)
63 if (!e_book_get_contact (book, "pas-id-0002023", &contact, &error)) {
64 printf ("error %d getting card: %s\n", error->code, error->message);
65 g_clear_error (&error);
69 print_email (contact);
71 g_object_unref (contact);
73 #endif /* ACCOUNT_MGMT */
79 #if 0 /* ACCOUNT_MGMT */
85 ** the actual ebook foo
88 printf ("loading addressbook\n");
89 book = e_book_new_system_addressbook (NULL);
91 printf ("failed to create local addressbook\n");
95 ebook_test_utils_book_open (book, FALSE);
97 printf ("printing one contact\n");
98 print_one_email (book);
100 printf ("printing all contacts\n");
101 print_all_emails (book);
103 g_object_unref (book);
104 #endif /* ACCOUNT_MGMT */