111
GSList *book_list_iterator;
112
book_data_t *book_data;
114
// Iterate throw the list
115
for (book_list_iterator = books_data; book_list_iterator != NULL; book_list_iterator
116
= book_list_iterator->next)
118
book_data = (book_data_t *) book_list_iterator->data;
119
if (book_data->active)
104
GSList *book_list_iterator;
105
book_data_t *book_data;
108
DEBUG ("Addressbook: No books data (%s:%d)", __FILE__, __LINE__);
112
// Iterate throw the list
113
for (book_list_iterator = books_data; book_list_iterator != NULL; book_list_iterator
114
= book_list_iterator->next) {
115
book_data = (book_data_t *) book_list_iterator->data;
117
if (book_data->active)
127
125
* Get a specific book data by UID
130
books_get_book_data_by_uid(gchar *uid)
128
books_get_book_data_by_uid (gchar *uid)
132
GSList *book_list_iterator;
133
book_data_t *book_data;
135
// Iterate throw the list
136
for (book_list_iterator = books_data; book_list_iterator != NULL; book_list_iterator
137
= book_list_iterator->next)
139
book_data = (book_data_t *) book_list_iterator->data;
140
if (strcmp(book_data->uid, uid) == 0)
130
GSList *book_list_iterator;
131
book_data_t *book_data;
134
DEBUG ("Addressbook: No books data (%s:%d)", __FILE__, __LINE__);
138
DEBUG ("Addressbook: Get book data by uid: %s", uid);
140
// Iterate throw the list
141
for (book_list_iterator = books_data; book_list_iterator != NULL; book_list_iterator
142
= book_list_iterator->next) {
143
book_data = (book_data_t *) book_list_iterator->data;
145
if (strcmp (book_data->uid, uid) == 0) {
146
DEBUG ("Addressbook: Book %s found", uid);
151
DEBUG ("Addressbook: Could not found Book %s", uid);
149
* Split a string of tokens separated by whitespace into an array of tokens.
158
* Create a query which looks for the specified string in a contact's full name, email addresses and
152
split_query_string(const gchar *str)
154
GArray *parts = g_array_sized_new(FALSE, FALSE, sizeof (char *), 2);
156
guint str_len = strlen (str), word_start = 0, i;
158
attrs = g_new0 (PangoLogAttr, str_len + 1);
159
/* TODO: do we need to specify a particular language or is NULL ok? */
160
pango_get_log_attrs (str, -1, -1, NULL, attrs, str_len + 1);
162
for (i = 0; i < str_len + 1; i++)
164
char *start_word, *end_word, *word;
165
if (attrs[i].is_word_end)
167
start_word = g_utf8_offset_to_pointer (str, word_start);
168
end_word = g_utf8_offset_to_pointer (str, i);
169
word = g_strndup (start_word, end_word - start_word);
170
g_array_append_val (parts, word);
172
if (attrs[i].is_word_start)
182
* Create a query which looks for the specified string in a contact's full name, email addresses and
185
161
static EBookQuery*
186
create_query(const char* s)
162
create_query (const char* s, EBookQueryTest test, AddressBook_Config *conf)
189
GArray *parts = split_query_string(s);
190
EBookQuery ***field_queries;
196
q = g_new0 (EBookQuery *, n_search_fields);
197
field_queries = g_new0 (EBookQuery **, n_search_fields);
199
for (i = 0; i < n_search_fields; i++)
201
field_queries[i] = g_new0 (EBookQuery *, parts->len);
202
for (j = 0; j < parts->len; j++)
204
field_queries[i][j] = e_book_query_field_test(search_fields[i],
205
E_BOOK_QUERY_CONTAINS, g_array_index (parts, gchar *, j));
207
q[i] = e_book_query_and(parts->len, field_queries[i], TRUE);
209
g_array_free(parts, TRUE);
211
phone = g_new0 (EBookQuery *, 3);
212
phone[0] = e_book_query_field_exists(E_CONTACT_PHONE_BUSINESS);
213
phone[1] = e_book_query_field_exists(E_CONTACT_PHONE_HOME);
214
phone[2] = e_book_query_field_exists(E_CONTACT_PHONE_MOBILE);
216
query = e_book_query_andv(e_book_query_or(n_search_fields, q, FALSE),
217
e_book_query_or(3, phone, FALSE), NULL);
219
for (i = 0; i < n_search_fields; i++)
221
g_free(field_queries[i]);
223
g_free(field_queries);
166
EBookQuery *queries[4];
171
// We could also use E_BOOK_QUERY_IS or E_BOOK_QUERY_BEGINS_WITH instead of E_BOOK_QUERY_CONTAINS
172
queries[cpt++] = e_book_query_field_test (E_CONTACT_FULL_NAME, test, s);
174
if (conf->search_phone_home)
175
queries[cpt++] = e_book_query_field_test (E_CONTACT_PHONE_HOME, test, s);
177
if (conf->search_phone_business)
178
queries[cpt++] = e_book_query_field_test (E_CONTACT_PHONE_BUSINESS, test, s);
180
if (conf->search_phone_mobile)
181
queries[cpt++] = e_book_query_field_test (E_CONTACT_PHONE_MOBILE, test, s);
183
equery = e_book_query_or (cpt, queries, TRUE);
231
189
* Retrieve the contact's picture
233
191
static GdkPixbuf*
234
pixbuf_from_contact(EContact *contact)
237
GdkPixbuf *pixbuf = NULL;
238
EContactPhoto *photo = e_contact_get(contact, E_CONTACT_PHOTO);
241
GdkPixbufLoader *loader;
243
loader = gdk_pixbuf_loader_new();
245
if (photo->type == E_CONTACT_PHOTO_TYPE_INLINED)
247
if (gdk_pixbuf_loader_write(loader,
248
(guchar *) photo->data.inlined.data, photo->data.inlined.length,
250
pixbuf = gdk_pixbuf_loader_get_pixbuf(loader);
253
// If pixbuf has been found, check size and resize if needed
257
gint width = gdk_pixbuf_get_width(pixbuf);
258
gint height = gdk_pixbuf_get_height(pixbuf);
263
scale = pixbuf_size / (double) height;
267
scale = pixbuf_size / (double) width;
272
tmp = gdk_pixbuf_scale_simple(pixbuf, width * scale, height
273
* scale, GDK_INTERP_BILINEAR);
274
g_object_unref(pixbuf);
278
e_contact_photo_free(photo);
192
pixbuf_from_contact (EContact *contact)
195
GdkPixbuf *pixbuf = NULL;
196
EContactPhoto *photo = e_contact_get (contact, E_CONTACT_PHOTO);
199
GdkPixbufLoader *loader;
201
loader = gdk_pixbuf_loader_new();
203
if (photo->type == E_CONTACT_PHOTO_TYPE_INLINED) {
204
if (gdk_pixbuf_loader_write (loader,
205
(guchar *) photo->data.inlined.data, photo->data.inlined.length,
207
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
210
// If pixbuf has been found, check size and resize if needed
213
gint width = gdk_pixbuf_get_width (pixbuf);
214
gint height = gdk_pixbuf_get_height (pixbuf);
217
if (height > width) {
218
scale = pixbuf_size / (double) height;
220
scale = pixbuf_size / (double) width;
224
tmp = gdk_pixbuf_scale_simple (pixbuf, width * scale, height
225
* scale, GDK_INTERP_BILINEAR);
226
g_object_unref (pixbuf);
231
e_contact_photo_free (photo);
238
* Final callback after all books have been processed.
241
view_finish_callback (EBookView *book_view, Search_Handler_And_Data *had)
243
SearchAsyncHandler had_handler = had->search_handler;
244
GList *had_hits = had->hits;
245
gpointer had_user_data = had->user_data;
249
DEBUG ("Addressbook: View finish");
251
if (book_view != NULL)
252
g_object_unref (book_view);
254
// Call display callback
255
had_handler (had_hits, had_user_data);
260
* Callback called after a contact have been found in EDS by search_async_by_contacts.
263
eds_query_result_cb (EBook *book, EBookStatus status, GList *contacts, gpointer user_data)
266
DEBUG ("Addressbook: Search Result callback called");
268
if (status != E_BOOK_ERROR_OK)
269
ERROR ("Addressbook: Error: Status not OK on search callback");
271
Search_Handler_And_Data *had = (Search_Handler_And_Data *) user_data;
274
DEBUG ("Addressbook: No contact found");
275
had->search_handler (NULL, user_data);
281
if (status == E_BOOK_ERROR_OK) {
285
// make sure we have a new list of hits
292
Hit *hit = g_new (Hit, 1);
296
// Get the photo contact
297
hit->photo = pixbuf_from_contact (E_CONTACT (l->data));
299
// Get business phone information
300
fetch_information_from_contact (E_CONTACT (l->data), E_CONTACT_PHONE_BUSINESS, &number);
301
hit->phone_business = g_strdup (number);
303
// Get home phone information
304
fetch_information_from_contact (E_CONTACT (l->data), E_CONTACT_PHONE_HOME, &number);
305
hit->phone_home = g_strdup (number);
307
// Get mobile phone information
308
fetch_information_from_contact (E_CONTACT (l->data), E_CONTACT_PHONE_MOBILE, &number);
309
hit->phone_mobile = g_strdup (number);
311
hit->name = g_strdup ( (char *) e_contact_get_const (E_CONTACT (l->data), E_CONTACT_NAME_OR_ORG));
317
DEBUG ("Addressbook: Contact Found");
318
DEBUG ("Addressbook: Full Name %s", hit->name);
319
DEBUG ("Addressbook: Phone Home %s", hit->phone_home);
320
DEBUG ("Addressbook: Phone Business %s", hit->phone_business);
321
DEBUG ("Addressbook: Phone Mobile %s", hit->phone_mobile);
325
had->hits = g_list_append (had->hits, hit);
328
// DEBUG ("Addressbook: max_result_remaining %d", had->max_results_remaining);
329
had->max_results_remaining--;
331
if (had->max_results_remaining <= 0)
339
view_finish_callback (NULL, had);
342
g_object_unref (book);
284
349
* Callback for asynchronous open of books
287
eds_async_open_callback(EBook *book, EBookStatus status, gpointer closure)
352
eds_async_open_callback (EBook *book, EBookStatus status, gpointer closure)
289
Open_Handler_And_Data *had = (Open_Handler_And_Data *) closure;
291
remaining_books_to_open--;
293
DEBUG("eds_async_open_callback remaining book to open: %i", remaining_books_to_open);
354
DEBUG ("Addressbook: Open book callback");
356
Search_Handler_And_Data *had = (Search_Handler_And_Data *) closure;
295
358
if (status == E_BOOK_ERROR_OK) {
297
book_data_t *book_data = g_new(book_data_t, 1);
298
book_data->active = FALSE;
299
book_data->name = g_strdup(e_source_peek_name(e_book_get_source(book)));
300
book_data->uid = g_strdup(e_source_peek_uid(e_book_get_source(book)));
301
book_data->ebook = book;
302
books_data = g_slist_prepend(books_data, book_data);
307
WARN("Got error %d when opening book", status);
360
if (!e_book_is_opened (book)) {
361
// We must open the addressbook
362
e_book_open (book, FALSE, NULL);
365
if (e_book_async_get_contacts (book, had->equery, eds_query_result_cb, had))
366
ERROR ("Addressbook: Error: While querying addressbook");
369
WARN ("Addressbook: Got error when opening book");
370
gchar *state_string = NULL;
373
case E_BOOK_ERROR_INVALID_ARG :
374
state_string = g_strdup ("E_BOOK_ERROR_INVALID_ARG");
376
case E_BOOK_ERROR_BUSY :
377
state_string = g_strdup ("E_BOOK_ERROR_BUSY");
379
case E_BOOK_ERROR_REPOSITORY_OFFLINE :
380
state_string = g_strdup ("E_BOOK_ERROR_REPOSITORY_OFFLINE");
382
case E_BOOK_ERROR_NO_SUCH_BOOK :
383
state_string = g_strdup ("E_BOOK_ERROR_NO_SUCH_BOOK");
385
case E_BOOK_ERROR_NO_SELF_CONTACT :
386
state_string = g_strdup ("E_BOOK_ERROR_NO_SELF_CONTACT");
388
case E_BOOK_ERROR_SOURCE_NOT_LOADED:
389
state_string = g_strdup ("E_BOOK_ERROR_SOURCE_NOT_LOADED");
391
case E_BOOK_ERROR_SOURCE_ALREADY_LOADED :
392
state_string = g_strdup ("E_BOOK_ERROR_SOURCE_ALREADY_LOADED");
394
case E_BOOK_ERROR_PERMISSION_DENIED :
395
state_string = g_strdup ("E_BOOK_ERROR_PERMISSION_DENIED");
397
case E_BOOK_ERROR_CONTACT_NOT_FOUND :
398
state_string = g_strdup ("E_BOOK_ERROR_CONTACT_NOT_FOUND");
400
case E_BOOK_ERROR_CONTACT_ID_ALREADY_EXISTS :
401
state_string = g_strdup ("E_BOOK_ERROR_CONTACT_ID_ALREADY_EXISTS");
403
case E_BOOK_ERROR_PROTOCOL_NOT_SUPPORTED :
404
state_string = g_strdup ("E_BOOK_ERROR_PROTOCOL_NOT_SUPPORTED");
406
case E_BOOK_ERROR_CANCELLED :
407
state_string = g_strdup ("E_BOOK_ERROR_CANCELLED");
409
case E_BOOK_ERROR_COULD_NOT_CANCEL :
410
state_string = g_strdup ("E_BOOK_ERROR_COULD_NOT_CANCEL");
412
case E_BOOK_ERROR_AUTHENTICATION_FAILED :
413
state_string = g_strdup ("E_BOOK_ERROR_AUTHENTICATION_FAILED");
415
case E_BOOK_ERROR_AUTHENTICATION_REQUIRED :
416
state_string = g_strdup ("E_BOOK_ERROR_AUTHENTICATION_REQUIRED");
418
case E_BOOK_ERROR_TLS_NOT_AVAILABLE :
419
state_string = g_strdup ("E_BOOK_ERROR_TLS_NOT_AVAILABLE");
421
case E_BOOK_ERROR_CORBA_EXCEPTION :
422
state_string = g_strdup ("E_BOOK_ERROR_CORBA_EXCEPTION");
424
case E_BOOK_ERROR_NO_SUCH_SOURCE :
425
state_string = g_strdup ("E_BOOK_ERROR_NO_SUCH_SOURCE");
427
case E_BOOK_ERROR_OFFLINE_UNAVAILABLE :
428
state_string = g_strdup ("E_BOOK_ERROR_OFFLINE_UNAVAILABLE");
430
case E_BOOK_ERROR_OTHER_ERROR :
431
state_string = g_strdup ("E_BOOK_ERROR_OTHER_ERROR");
433
case E_BOOK_ERROR_INVALID_SERVER_VERSION :
434
state_string = g_strdup ("E_BOOK_ERROR_INVALID_SERVER_VERSION");
441
ERROR ("%s", state_string);
443
g_free (state_string);
312
449
* Initialize address book
315
init(OpenAsyncHandler callback)
318
ESourceList *source_list = NULL;
319
remaining_books_to_open = 0;
322
source_list = e_source_list_new_for_gconf_default("/apps/evolution/addressbook/sources");
324
if (source_list == NULL)
326
DEBUG("Error could not initialize source list for addressbook");
330
list = e_source_list_peek_groups(source_list);
332
Open_Handler_And_Data *had = g_new (Open_Handler_And_Data, 1);
333
had->handler = callback;
335
for (l = list; l != NULL; l = l->next)
338
ESourceGroup *group = l->data;
339
GSList *sources = NULL, *m;
340
sources = e_source_group_peek_sources(group);
341
for (m = sources; m != NULL; m = m->next)
343
ESource *source = m->data;
344
EBook *book = e_book_new(source, NULL);
347
// Keep count of remaining books to open
349
DEBUG("init addressbook %i", remaining_books_to_open);
350
remaining_books_to_open++;
353
e_book_async_open(book, FALSE, eds_async_open_callback, had);
357
current_search_id = 0;
359
g_object_unref(source_list);
363
* Final callback after all books have been processed.
366
view_finish(EBookView *book_view, Search_Handler_And_Data *had)
369
SearchAsyncHandler had_handler = had->handler;
370
GList *had_hits = had->hits;
371
gpointer had_user_data = had->user_data;
372
int search_id = had->search_id;
375
if (book_view != NULL)
376
g_object_unref(book_view);
378
if (search_id == current_search_id)
380
// Reinitialize search id to prevent overflow
381
if (current_search_id > 5000)
382
current_search_id = 0;
384
// Call display callback
385
had_handler(had_hits, had_user_data);
389
// Some hits could have been processed but will not be used
390
for (i = had_hits; i != NULL; i = i->next)
396
g_list_free(had_hits);
401
* Callback called after each ebook search completed.
402
* Used to store book search results.
405
view_contacts_added_cb(EBookView *book_view, GList *contacts,
410
Search_Handler_And_Data *had = (Search_Handler_And_Data *) user_data;
412
// If it's not the last search launched, stop it
413
if (had->search_id != current_search_id)
415
e_book_view_stop(book_view);
419
// If we reached max results
420
if (had->max_results_remaining <= 0)
422
e_book_view_stop(book_view);
423
had->book_views_remaining--;
425
// All books have been computed
426
if (had->book_views_remaining == 0)
428
view_finish(book_view, had);
434
for (; contacts != NULL; contacts = g_list_next (contacts))
440
contact = E_CONTACT (contacts->data);
441
hit = g_new (Hit, 1);
443
// Get the photo contact
444
photo = pixbuf_from_contact(contact);
447
// Get business phone information
448
fetch_information_from_contact(contact, E_CONTACT_PHONE_BUSINESS, &number);
449
hit->phone_business = g_strdup(number);
451
// Get home phone information
452
fetch_information_from_contact(contact, E_CONTACT_PHONE_HOME, &number);
453
hit->phone_home = g_strdup(number);
455
// Get mobile phone information
456
fetch_information_from_contact(contact, E_CONTACT_PHONE_MOBILE, &number);
457
hit->phone_mobile = g_strdup(number);
459
hit->name = g_strdup((char*) e_contact_get_const(contact,
460
E_CONTACT_NAME_OR_ORG));
464
// Append list of contacts
465
had->hits = g_list_append(had->hits, hit);
466
had->max_results_remaining--;
468
// If we reached max results
469
if (had->max_results_remaining <= 0)
471
e_book_view_stop(book_view);
472
had->book_views_remaining--;
473
if (had->book_views_remaining == 0)
475
view_finish(book_view, had);
483
* Callback called after each ebook search completed.
484
* Used to call final callback when all books have been read.
487
view_completed_cb(EBookView *book_view, EBookViewStatus status UNUSED,
490
Search_Handler_And_Data *had = (Search_Handler_And_Data *) user_data;
491
had->book_views_remaining--;
493
// All books have been prcessed
494
if (had->book_views_remaining == 0)
496
// Call finish function
497
view_finish(book_view, had);
502
* Perform an asynchronous search
505
search_async(const char *query, int max_results, SearchAsyncHandler handler,
508
// Increment search id
512
if (strlen(query) < 1 || g_slist_length(books_data) == 0)
514
// If data displayed (from previous search), directly call callback
515
handler(NULL, user_data);
521
EBookQuery* book_query = create_query(query);
522
Search_Handler_And_Data *had = g_new (Search_Handler_And_Data, 1);
523
int search_count = 0;
525
// Initialize search data
526
had->search_id = current_search_id;
527
had->handler = handler;
528
had->user_data = user_data;
530
had->max_results_remaining = max_results;
531
had->book_views_remaining = 0;
533
// Iterate throw books data
534
for (iter = books_data; iter != NULL; iter = iter->next)
536
book_data_t *book_data = (book_data_t *) iter->data;
539
if (book_data->active)
541
EBookView *book_view = NULL;
542
e_book_get_book_view(book_data->ebook, book_query, NULL, max_results,
545
// If book view exists
546
if (book_view != NULL)
549
had->book_views_remaining++;
550
g_signal_connect (book_view, "contacts_added", (GCallback) view_contacts_added_cb, had);
551
g_signal_connect (book_view, "sequence_complete", (GCallback) view_completed_cb, had);
552
e_book_view_start(book_view);
558
e_book_query_unref(book_query);
560
// If no search has been executed (no book selected)
561
if (search_count == 0)
563
// Call last callback anyway
564
view_finish(NULL, had);
455
gchar *absuri, *reluri;
457
EBook *default_addressbook = e_book_new_default_addressbook (&err);
460
ERROR ("Addressbook: Error: Could not create new book from source: %s", err->message);
462
ESource *default_source = e_book_get_source (default_addressbook);
464
// DEBUG ("Addressbook: Default source relative uri %s", e_source_peek_relative_uri (default_source));
465
// DEBUG ("Addressbook: Default source absolute uri %s", e_source_peek_absolute_uri (default_source));
468
g_free (current_uri);
473
g_free (current_uid);
477
if (strcmp (current_name, "Default") != 0) {
478
g_free (current_name);
482
// TODO: This should work but return a NULL pointer ...
483
// if (! (group = e_source_peek_group (default_source)));
485
// ERROR ("Addressbook: Error: No group found for default addressbook");
487
absuri = g_strdup (e_source_peek_absolute_uri (default_source));
488
// absuri = g_strdup (e_source_group_peek_base_uri (group));
489
reluri = g_strdup (e_source_peek_relative_uri (default_source));
492
absuri = g_malloc (1);
497
reluri = g_malloc (1);
501
// Do not overwrite current_name for default
502
// current_name = g_strdup (e_source_peek_name (default_source));
504
current_uid = g_strdup (e_source_peek_uid (default_source));
506
if (strcmp (absuri+strlen (absuri)-1, "/") == 0)
507
current_uri = g_strjoin ("", absuri, reluri, NULL);
509
current_uri = g_strjoin ("/", absuri, reluri, NULL);
523
ESourceList *source_list = NULL;
524
remaining_books_to_open = 0;
527
source_list = e_source_list_new_for_gconf_default ("/apps/evolution/addressbook/sources");
529
if (source_list == NULL) {
530
DEBUG ("Addressbook: Error could not initialize source list for addressbook (%s:%d)", __FILE__, __LINE__);
534
list = e_source_list_peek_groups (source_list);
537
DEBUG ("Addressbook: Address Book source groups are missing (%s:%d)! Check your GConf setup.", __FILE__, __LINE__);
542
for (l = list; l != NULL; l = l->next) {
544
ESourceGroup *group = l->data;
545
GSList *sources = NULL, *m;
548
absuri = g_strdup (e_source_group_peek_base_uri (group));
550
sources = e_source_group_peek_sources (group);
552
for (m = sources; m != NULL; m = m->next) {
554
ESource *source = m->data;
556
book_data_t *book_data = g_new (book_data_t, 1);
557
book_data->active = FALSE;
558
book_data->name = g_strdup (e_source_peek_name (source));
559
book_data->uid = g_strdup (e_source_peek_uid (source));
561
const gchar *property_name = "default";
562
const gchar *prop = e_source_get_property (source, property_name);
565
if (strcmp (prop, "true") == 0)
566
book_data->isdefault = TRUE;
568
book_data->isdefault = FALSE;
570
book_data->isdefault = FALSE;
572
if (strcmp (absuri+strlen (absuri)-1, "/") == 0)
573
book_data->uri = g_strjoin ("", absuri, e_source_peek_relative_uri (source), NULL);
575
book_data->uri = g_strjoin ("/", absuri, e_source_peek_relative_uri (source), NULL);
577
books_data = g_slist_prepend (books_data, book_data);
584
g_object_unref (source_list);
588
search_async_by_contacts (const char *query, int max_results, SearchAsyncHandler handler, gpointer user_data)
593
DEBUG ("Addressbook: New search by contacts: %s, max_results %d", query, max_results);
595
if (strlen (query) < 1) {
596
DEBUG ("Addressbook: Query is empty");
597
handler (NULL, user_data);
601
Search_Handler_And_Data *had = g_new (Search_Handler_And_Data, 1);
603
// initialize search data
604
had->search_handler = handler;
605
had->user_data = user_data;
607
had->max_results_remaining = max_results;
608
had->equery = create_query (query, current_test, (AddressBook_Config *) (user_data));
611
ERROR ("Addressbook: Error: Current addressbook uri not specified uri");
614
DEBUG ("Addressbook: Opening addressbook: %s", current_uri);
615
DEBUG ("Addressbook: Opening addressbook: %s", current_name);
617
// TODO: This hack is necessary as we cannot access group's base_uri of the default book
620
if (strcmp (current_name, "Default") == 0)
621
book = e_book_new_default_addressbook (&err);
623
book = e_book_new_from_uri (current_uri, &err);
626
ERROR ("Addressbook: Error: Could not open new book: %s", err->message);
629
DEBUG ("Addressbook: Created empty book successfully");
632
e_book_async_open (book, TRUE, eds_async_open_callback, had);
634
ERROR ("Addressbook: Error: No book available");
569
640
* Fetch information for a specific contact
572
fetch_information_from_contact(EContact *contact, EContactField field,
577
to_fetch = g_strdup((char*) e_contact_get_const(contact, field));
580
to_fetch = g_strdup(EMPTY_ENTRY);
583
*info = g_strdup(to_fetch);
643
fetch_information_from_contact (EContact *contact, EContactField field, gchar **info)
647
to_fetch = g_strdup ( (char*) e_contact_get_const (contact, field));
650
to_fetch = g_strdup (EMPTY_ENTRY);
653
*info = g_strdup (to_fetch);
657
set_current_addressbook (const gchar *name)
660
GSList *book_list_iterator;
661
book_data_t *book_data;
664
DEBUG ("Addressbook: No books data (%s:%d)", __FILE__, __LINE__);
668
// Iterate throw the list
669
for (book_list_iterator = books_data; book_list_iterator != NULL; book_list_iterator
670
= book_list_iterator->next) {
671
book_data = (book_data_t *) book_list_iterator->data;
673
if (strcmp (book_data->name, name) == 0) {
674
current_uri = book_data->uri;
675
current_uid = book_data->uid;
676
current_name = book_data->name;
683
get_current_addressbook (void)
690
set_current_addressbook_test (EBookQueryTest test)
696
get_current_addressbook_test (void)