1130
1233
g_signal_connect (G_OBJECT (couchdb_backend->database), "document_deleted",
1131
1234
G_CALLBACK (document_deleted_cb), couchdb_backend);
1132
1235
couchdb_database_listen_for_changes (couchdb_backend->database);
1236
#if EDS_CHECK_VERSION(3, 1, 2)
1237
e_book_backend_notify_readonly (backend, FALSE);
1134
1239
e_book_backend_set_is_loaded (backend, TRUE);
1135
1240
e_book_backend_set_is_writable (backend, TRUE);
1136
#if EDS_CHECK_VERSION(2, 31, 0)
1242
#if EDS_CHECK_VERSION(3, 1, 2)
1243
e_book_backend_notify_online (backend, TRUE);
1244
e_book_backend_notify_opened (backend, NULL);
1245
#elif EDS_CHECK_VERSION(2, 31, 0)
1137
1246
e_book_backend_notify_connection_status (backend, TRUE);
1139
1248
return GNOME_Evolution_Addressbook_Success;
1468
1628
e_book_backend_remove_book_view (backend, book_view);
1631
#if EDS_CHECK_VERSION(3, 1, 2)
1633
e_book_backend_couchdb_authenticate_user (EBookBackend *backend,
1634
GCancellable *cancellable,
1635
ECredentials *credentials)
1640
e_book_backend_couchdb_get_backend_property (EBookBackend *backend,
1643
GCancellable *cancellable,
1644
const gchar *prop_name)
1646
g_return_if_fail (backend != NULL);
1647
g_return_if_fail (prop_name != NULL);
1649
if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_CAPABILITIES)) {
1650
e_data_book_respond_get_backend_property (book, opid, NULL, "local,do-initial-query,bulk-removes");
1651
} else if (g_str_equal (prop_name, BOOK_BACKEND_PROPERTY_REQUIRED_FIELDS)) {
1652
e_data_book_respond_get_backend_property (book, opid, NULL, e_contact_field_name (E_CONTACT_GIVEN_NAME));
1653
} else if (g_str_equal (prop_name, BOOK_BACKEND_PROPERTY_SUPPORTED_FIELDS)) {
1656
GSList *fields = NULL;
1658
for (ii = 0; ii < G_N_ELEMENTS (supported_fields); ii++) {
1659
fields = g_slist_prepend (fields, (gpointer) e_contact_field_name (supported_fields[ii]));
1661
fields = g_slist_reverse (fields);
1662
value = e_data_book_string_slist_to_comma_string (fields);
1664
e_data_book_respond_get_backend_property (book, opid, NULL, value);
1666
g_slist_free (fields);
1668
} else if (g_str_equal (prop_name, BOOK_BACKEND_PROPERTY_SUPPORTED_AUTH_METHODS)) {
1669
e_data_book_respond_get_backend_property (book, opid, NULL, "plain/password");
1671
(* E_BOOK_BACKEND_CLASS (e_book_backend_couchdb_parent_class)->get_backend_property) (backend, book, opid, cancellable, prop_name);
1676
e_book_backend_couchdb_set_online (EBookBackend *backend, gboolean is_online)
1680
#else /* EDS_CHECK_VERSION(3, 1, 2) */
1682
e_book_backend_couchdb_get_static_capabilities (EBookBackend *backend)
1684
return g_strdup ("local,do-initial-query,bulk-removes");
1472
1688
e_book_backend_couchdb_get_changes (EBookBackend *backend,
1473
1689
EDataBook *book,
1516
1732
GList *fields = NULL;
1519
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_UID)));
1520
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_GIVEN_NAME)));
1521
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_FAMILY_NAME)));
1522
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_FULL_NAME)));
1523
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_NAME)));
1524
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_NICKNAME)));
1525
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_SPOUSE)));
1526
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_BIRTH_DATE)));
1527
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_ANNIVERSARY)));
1528
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_NOTE)));
1529
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_CATEGORIES)));
1530
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_REV)));
1533
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_HOMEPAGE_URL)));
1534
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_BLOG_URL)));
1536
/* Company fields */
1537
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_ORG)));
1538
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_ORG_UNIT)));
1539
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_TITLE)));
1540
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_MANAGER)));
1541
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_ASSISTANT)));
1542
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_OFFICE)));
1544
/* Email addresses */
1545
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_EMAIL_1)));
1546
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_EMAIL_2)));
1547
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_EMAIL_3)));
1548
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_EMAIL_4)));
1551
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_PHONE_HOME)));
1552
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_PHONE_HOME_FAX)));
1553
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_PHONE_BUSINESS)));
1554
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_PHONE_BUSINESS_FAX)));
1555
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_PHONE_OTHER)));
1556
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_PHONE_OTHER_FAX)));
1557
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_PHONE_PAGER)));
1558
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_PHONE_MOBILE)));
1559
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_PHONE_ASSISTANT)));
1560
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_PHONE_CALLBACK)));
1561
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_PHONE_CAR)));
1562
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_PHONE_PRIMARY)));
1563
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_PHONE_RADIO)));
1564
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_PHONE_TELEX)));
1565
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_PHONE_COMPANY)));
1567
/* Postal addresses */
1568
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_ADDRESS_HOME)));
1569
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_ADDRESS_WORK)));
1570
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_ADDRESS_OTHER)));
1573
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_AIM)));
1574
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_GADUGADU)));
1575
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_GROUPWISE)));
1576
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_ICQ)));
1577
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_JABBER)));
1578
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_MSN)));
1579
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_SKYPE)));
1580
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_YAHOO)));
1735
for (ii = 0; ii < G_N_ELEMENTS (supported_fields); ii++) {
1736
fields = g_list_prepend (fields, (gpointer) e_contact_field_name (supported_fields[ii]));
1738
fields = g_list_reverse (fields);
1582
1740
#if EDS_CHECK_VERSION(2, 31, 0)
1583
1741
e_data_book_respond_get_supported_fields (book, opid, NULL, fields);
1677
1835
parent_class = E_BOOK_BACKEND_CLASS (klass);
1837
#if EDS_CHECK_VERSION(3, 1, 2)
1838
parent_class->open = e_book_backend_couchdb_open;
1839
parent_class->get_backend_property = e_book_backend_couchdb_get_backend_property;
1840
parent_class->set_online = e_book_backend_couchdb_set_online;
1679
1842
parent_class->load_source = e_book_backend_couchdb_load_source;
1680
1843
parent_class->get_static_capabilities = e_book_backend_couchdb_get_static_capabilities;
1844
parent_class->get_changes = e_book_backend_couchdb_get_changes;
1845
parent_class->get_required_fields = e_book_backend_couchdb_get_required_fields;
1846
parent_class->get_supported_fields = e_book_backend_couchdb_get_supported_fields;
1847
parent_class->get_supported_auth_methods = e_book_backend_couchdb_get_supported_auth_methods;
1848
parent_class->cancel_operation = e_book_backend_couchdb_cancel_operation;
1849
parent_class->set_mode = e_book_backend_couchdb_set_mode;
1682
1851
parent_class->create_contact = e_book_backend_couchdb_create_contact;
1683
1852
parent_class->remove_contacts = e_book_backend_couchdb_remove_contacts;
1684
1853
parent_class->modify_contact = e_book_backend_couchdb_modify_contact;