1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
4 #include <libebook/libebook.h>
6 #if 0 /* ACCOUNT_MGMT */
8 print_contact (EContact *contact)
12 printf ("Contact: %s\n", (gchar *) e_contact_get_const (contact, E_CONTACT_FILE_AS));
13 printf ("UID: %s\n", (gchar *) e_contact_get_const (contact, E_CONTACT_UID));
14 printf ("Email addresses:\n");
16 emails = e_contact_get (contact, E_CONTACT_EMAIL);
17 for (e = emails; e; e = e->next) {
18 printf ("\t%s\n", (gchar *) e->data);
20 g_list_foreach (emails, (GFunc) g_free, NULL);
27 contacts_added (EBookView *book_view,
28 const GList *contacts)
32 for (l = (GList *) contacts; l; l = l->next) {
33 print_contact (l->data);
38 contacts_removed (EBookView *book_view,
43 for (l = (GList *) ids; l; l = l->next) {
44 printf ("Removed contact: %s\n", (gchar *) l->data);
49 view_complete (EBookView *book_view,
50 EBookViewStatus status,
51 const gchar *error_msg)
53 printf ("view_complete (status == %d, error_msg == %s%s%s)\n", status, error_msg ? "'" : "", error_msg ? error_msg : "NULL", error_msg ? "'" : "");
55 #endif /* ACCOUNT_MGMT */
61 #if 0 /* ACCOUNT_MGMT */
65 EBookView *view = NULL;
72 ** the actual ebook foo
75 printf ("loading addressbook\n");
76 book = e_book_new_system_addressbook (NULL);
78 printf ("failed to create ebook\n");
82 status = e_book_open (book, FALSE, NULL);
83 if (status == FALSE) {
84 printf ("failed to open local addressbook\n");
88 query = e_book_query_any_field_contains ("");
90 for (i = 0; i < 500; i++) {
91 status = e_book_get_book_view (book, query, NULL, -1, &new_view, NULL);
93 g_signal_connect (new_view, "contacts_added", G_CALLBACK (contacts_added), NULL);
94 g_signal_connect (new_view, "contacts_removed", G_CALLBACK (contacts_removed), NULL);
95 g_signal_connect (new_view, "view_complete", G_CALLBACK (view_complete), NULL);
97 e_book_view_start (new_view);
100 e_book_view_stop (view);
101 g_object_unref (view);
107 e_book_view_stop (view);
108 g_object_unref (view);
110 e_book_query_unref (query);
111 g_object_unref (book);
112 #endif /* ACCOUNT_MGMT */