Merge lp:~rodrigo-moya/evolution-couchdb/fix-title-confusion into lp:evolution-couchdb

Proposed by Rodrigo Moya
Status: Merged
Approved by: Elliot Murphy
Approved revision: 134
Merge reported by: Rodrigo Moya
Merged at revision: not available
Proposed branch: lp:~rodrigo-moya/evolution-couchdb/fix-title-confusion
Merge into: lp:evolution-couchdb
Diff against target: 98 lines (+30/-11)
1 file modified
addressbook/e-book-backend-couchdb.c (+30/-11)
To merge this branch: bzr merge lp:~rodrigo-moya/evolution-couchdb/fix-title-confusion
Reviewer Review Type Date Requested Status
Elliot Murphy (community) Approve
Review via email: mp+22959@code.launchpad.net

Description of the change

Deal correctly with composed names and use correct EContact field for job_title

To post a comment you must log in.
Revision history for this message
Rodrigo Moya (rodrigo-moya) wrote :

To compile this branch, btw, you'd need to have this other branch: https://launchpad.net/~rodrigo-moya/couchdb-glib/add-missing-name-fields/+merge/22955

Revision history for this message
Elliot Murphy (statik) wrote :

Excellent! Glad to get rid of another data loss in contacts.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'addressbook/e-book-backend-couchdb.c'
--- addressbook/e-book-backend-couchdb.c 2010-04-06 18:07:58 +0000
+++ addressbook/e-book-backend-couchdb.c 2010-04-07 15:54:21 +0000
@@ -54,6 +54,7 @@
54 GSList *list, *sl;54 GSList *list, *sl;
55 GList *attr_list;55 GList *attr_list;
56 CouchdbStructField *app_annotations;56 CouchdbStructField *app_annotations;
57 EContactName contact_name;
5758
58 if (!desktopcouch_document_is_contact (document))59 if (!desktopcouch_document_is_contact (document))
59 return NULL;60 return NULL;
@@ -85,10 +86,18 @@
85 couchdb_document_get_revision (document));86 couchdb_document_get_revision (document));
8687
87 e_contact_set (contact, E_CONTACT_UID, (const gpointer) couchdb_document_get_id (document));88 e_contact_set (contact, E_CONTACT_UID, (const gpointer) couchdb_document_get_id (document));
88 e_contact_set (contact, E_CONTACT_GIVEN_NAME,89
89 (const gpointer) desktopcouch_document_contact_get_first_name (document));90 contact_name.family = desktopcouch_document_contact_get_last_name (document);
90 e_contact_set (contact, E_CONTACT_FAMILY_NAME,91 contact_name.given = desktopcouch_document_contact_get_first_name (document);
91 (const gpointer) desktopcouch_document_contact_get_last_name (document));92 contact_name.additional = desktopcouch_document_contact_get_middle_name (document);
93 contact_name.prefixes = desktopcouch_document_contact_get_title (document);
94 contact_name.suffixes = desktopcouch_document_contact_get_suffix (document);
95 e_contact_set (contact, E_CONTACT_NAME, (const gpointer) &contact_name);
96
97 str = e_contact_name_to_string (&contact_name);
98 e_contact_set (contact, E_CONTACT_FULL_NAME, (const gpointer) str);
99 g_free (str);
100
92 e_contact_set (contact, E_CONTACT_NICKNAME,101 e_contact_set (contact, E_CONTACT_NICKNAME,
93 (const gpointer) desktopcouch_document_contact_get_nick_name (document));102 (const gpointer) desktopcouch_document_contact_get_nick_name (document));
94 e_contact_set (contact, E_CONTACT_SPOUSE,103 e_contact_set (contact, E_CONTACT_SPOUSE,
@@ -99,8 +108,6 @@
99 e_contact_set (contact, E_CONTACT_ORG_UNIT,108 e_contact_set (contact, E_CONTACT_ORG_UNIT,
100 (const gpointer) desktopcouch_document_contact_get_department (document));109 (const gpointer) desktopcouch_document_contact_get_department (document));
101 e_contact_set (contact, E_CONTACT_TITLE,110 e_contact_set (contact, E_CONTACT_TITLE,
102 (const gpointer) desktopcouch_document_contact_get_title (document));
103 e_contact_set (contact, E_CONTACT_ROLE,
104 (const gpointer) desktopcouch_document_contact_get_job_title (document));111 (const gpointer) desktopcouch_document_contact_get_job_title (document));
105 e_contact_set (contact, E_CONTACT_MANAGER,112 e_contact_set (contact, E_CONTACT_MANAGER,
106 (const gpointer) desktopcouch_document_contact_get_manager_name (document));113 (const gpointer) desktopcouch_document_contact_get_manager_name (document));
@@ -724,6 +731,7 @@
724 CouchdbDocument *document;731 CouchdbDocument *document;
725 gint i;732 gint i;
726 CouchdbStructField *postal_address, *app_annotations;733 CouchdbStructField *postal_address, *app_annotations;
734 EContactName *contact_name;
727735
728 /* create the CouchDBDocument to put on the database */736 /* create the CouchDBDocument to put on the database */
729 document = desktopcouch_document_contact_new (couchdb_backend->couchdb);737 document = desktopcouch_document_contact_new (couchdb_backend->couchdb);
@@ -736,15 +744,26 @@
736 if (str)744 if (str)
737 couchdb_document_set_revision (document, str);745 couchdb_document_set_revision (document, str);
738746
739 desktopcouch_document_contact_set_first_name (document, (const char *) e_contact_get_const (contact, E_CONTACT_GIVEN_NAME));747 contact_name = (EContactName *) e_contact_get (contact, E_CONTACT_NAME);
740 desktopcouch_document_contact_set_last_name (document, (const char *) e_contact_get_const (contact, E_CONTACT_FAMILY_NAME));748 if (contact_name != NULL) {
749 if (contact_name->prefixes != NULL)
750 desktopcouch_document_contact_set_title (document, (const char *) contact_name->prefixes);
751 if (contact_name->given != NULL)
752 desktopcouch_document_contact_set_first_name (document, (const char *) contact_name->given);
753 if (contact_name->additional != NULL)
754 desktopcouch_document_contact_set_middle_name (document, (const gchar *) contact_name->additional);
755 if (contact_name->family != NULL)
756 desktopcouch_document_contact_set_last_name (document, (const char *) contact_name->family);
757 if (contact_name->suffixes != NULL)
758 desktopcouch_document_contact_set_suffix (document, (const char *) contact_name->suffixes);
759 }
760
741 desktopcouch_document_contact_set_nick_name (document, (const char *) e_contact_get_const (contact, E_CONTACT_NICKNAME));761 desktopcouch_document_contact_set_nick_name (document, (const char *) e_contact_get_const (contact, E_CONTACT_NICKNAME));
742 desktopcouch_document_contact_set_spouse_name (document, (const char *) e_contact_get_const (contact, E_CONTACT_SPOUSE));762 desktopcouch_document_contact_set_spouse_name (document, (const char *) e_contact_get_const (contact, E_CONTACT_SPOUSE));
743763
744 desktopcouch_document_contact_set_company (document, (const char *) e_contact_get_const (contact, E_CONTACT_ORG));764 desktopcouch_document_contact_set_company (document, (const char *) e_contact_get_const (contact, E_CONTACT_ORG));
745 desktopcouch_document_contact_set_department (document, (const char *) e_contact_get_const (contact, E_CONTACT_ORG_UNIT));765 desktopcouch_document_contact_set_department (document, (const char *) e_contact_get_const (contact, E_CONTACT_ORG_UNIT));
746 desktopcouch_document_contact_set_title (document, (const char *) e_contact_get_const (contact, E_CONTACT_TITLE));766 desktopcouch_document_contact_set_job_title (document, (const char *) e_contact_get_const (contact, E_CONTACT_TITLE));
747 desktopcouch_document_contact_set_job_title (document, (const char *) e_contact_get_const (contact, E_CONTACT_ROLE));
748 desktopcouch_document_contact_set_manager_name (document, (const char *) e_contact_get_const (contact, E_CONTACT_MANAGER));767 desktopcouch_document_contact_set_manager_name (document, (const char *) e_contact_get_const (contact, E_CONTACT_MANAGER));
749 desktopcouch_document_contact_set_assistant_name (document, (const char *) e_contact_get_const (contact, E_CONTACT_ASSISTANT));768 desktopcouch_document_contact_set_assistant_name (document, (const char *) e_contact_get_const (contact, E_CONTACT_ASSISTANT));
750 desktopcouch_document_contact_set_office (document, (const char *) e_contact_get_const (contact, E_CONTACT_OFFICE));769 desktopcouch_document_contact_set_office (document, (const char *) e_contact_get_const (contact, E_CONTACT_OFFICE));
@@ -1421,6 +1440,7 @@
1421 fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_GIVEN_NAME)));1440 fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_GIVEN_NAME)));
1422 fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_FAMILY_NAME)));1441 fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_FAMILY_NAME)));
1423 fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_FULL_NAME)));1442 fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_FULL_NAME)));
1443 fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_NAME)));
1424 fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_NICKNAME)));1444 fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_NICKNAME)));
1425 fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_SPOUSE)));1445 fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_SPOUSE)));
1426 fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_BIRTH_DATE)));1446 fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_BIRTH_DATE)));
@@ -1437,7 +1457,6 @@
1437 fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_ORG)));1457 fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_ORG)));
1438 fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_ORG_UNIT)));1458 fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_ORG_UNIT)));
1439 fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_TITLE)));1459 fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_TITLE)));
1440 fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_ROLE)));
1441 fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_MANAGER)));1460 fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_MANAGER)));
1442 fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_ASSISTANT)));1461 fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_ASSISTANT)));
1443 fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_OFFICE)));1462 fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_OFFICE)));

Subscribers

People subscribed via source and target branches