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

Proposed by Rodrigo Moya
Status: Merged
Merged at revision: not available
Proposed branch: lp:~rodrigo-moya/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:~rodrigo-moya/ubuntuone-client/no-null-hash-lookup
Reviewer Review Type Date Requested Status
Roman Yepishev (community) Needs Fixing
Review via email: mp+23681@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

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

Tested that with my Google Addressbook account and it works great.

review: Approve
Revision history for this message
Roman Yepishev (rye) wrote :

Just noticed that the string reads
Contact without name nor email addresses

I believe it should be
Contact without name and email addresses

review: Needs Fixing
Revision history for this message
dobey (dobey) wrote :

> Just noticed that the string reads
> Contact without name nor email addresses
>
> I believe it should be
> Contact without name and email addresses

Actually it should just be "or" here. If either of them is in the contact, then this warning won't be printed.

Revision history for this message
John Lenton (chipaca) wrote :

As rodrigo was AFK and we needed / wanted this in today's packages, I fixed Roman's issue here: lp:~chipaca/ubuntuone-client/no-null-hash-lookup

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 16:21:20 +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 nor 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