Merge lp:~chipaca/ubuntuone-client/no-null-hash-lookup into lp:ubuntuone-client

Proposed by John Lenton
Status: Merged
Approved by: John Lenton
Approved revision: 506
Merged at revision: not available
Proposed branch: lp:~chipaca/ubuntuone-client/no-null-hash-lookup
Merge into: lp:ubuntuone-client
Diff against target: 53 lines (+21/-8)
1 file modified
nautilus/contacts-view.c (+21/-8)
To merge this branch: bzr merge lp:~chipaca/ubuntuone-client/no-null-hash-lookup
Reviewer Review Type Date Requested Status
Roman Yepishev (community) Approve
dobey (community) Approve
Review via email: mp+23700@code.launchpad.net

Commit message

Use email address as name if there is no name for the contact

Description of the change

Use email address as name if there is no name for the contact

This is rodrigo's branch, with a fix for an issue found by Roman.

To post a comment you must log in.
Revision history for this message
dobey (dobey) :
review: Approve
Revision history for this message
Roman Yepishev (rye) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'nautilus/contacts-view.c'
2--- nautilus/contacts-view.c 2010-04-16 11:52:46 +0000
3+++ nautilus/contacts-view.c 2010-04-19 19:51:18 +0000
4@@ -315,10 +315,12 @@
5 EContact *contact = l->data;
6 const gchar *email = NULL;
7 GList *emails_list, *al;
8+ EContactName *contact_name;
9+ gchar *full_name = NULL;
10
11- /* We add the selected items when searching, so ignore them here */
12- if (g_hash_table_lookup (selection_hash, (gconstpointer) e_contact_get_const (contact, E_CONTACT_FULL_NAME)))
13- continue;
14+ contact_name = (EContactName *) e_contact_get (contact, E_CONTACT_NAME);
15+ if (contact_name != NULL)
16+ full_name = e_contact_name_to_string (contact_name);
17
18 emails_list = e_contact_get_attributes (contact, E_CONTACT_EMAIL);
19 for (al = emails_list; al != NULL; al = al->next) {
20@@ -329,17 +331,28 @@
21 break;
22 }
23
24+ if (full_name == NULL) {
25+ if (email != NULL)
26+ full_name = g_strdup (email);
27+ else {
28+ g_warning ("Contact without name or email addresses");
29+ continue;
30+ }
31+ }
32+
33+ /* We add the selected items when searching, so ignore them here */
34+ if (g_hash_table_lookup (selection_hash, (gconstpointer) full_name))
35+ continue;
36+
37 if (email != NULL) {
38- add_one_contact (cv,
39- e_contact_get_const (contact, E_CONTACT_FULL_NAME),
40- e_contact_get_const (contact, E_CONTACT_FULL_NAME),
41- email,
42- contact);
43+ add_one_contact (cv, full_name, full_name, email, contact);
44 cv->matched_contacts += 1;
45 }
46
47 g_list_foreach (emails_list, (GFunc) e_vcard_attribute_free, NULL);
48 g_list_free (emails_list);
49+ e_contact_name_free (contact_name);
50+ g_free (full_name);
51 }
52
53 g_signal_emit_by_name (cv, "contacts-count-changed",

Subscribers

People subscribed via source and target branches