contact-display: Try harder to display a meaningful name

We now match individuals on other properties than alias, so take
this into account when representing a contact in search results
to avoid having them show up as "Unknown".

https://bugzilla.gnome.org/show_bug.cgi?id=660580
This commit is contained in:
Florian Müllner 2011-10-01 00:33:36 +02:00
parent 503508af41
commit 0d5618fdd1

View File

@ -26,7 +26,8 @@ function Contact(id) {
Contact.prototype = {
_init: function(id) {
this.individual = Shell.ContactSystem.get_default().get_individual(id);
this._contactSys = Shell.ContactSystem.get_default();
this.individual = this._contactSys.get_individual(id);
this.actor = new St.Bin({ style_class: 'contact',
reactive: true,
@ -56,7 +57,12 @@ Contact.prototype = {
x_align: St.Align.START,
y_align: St.Align.MIDDLE });
let aliasText = this.individual.alias || _("Unknown");
let email = this._contactSys.get_email_for_display(this.individual);
let aliasText = this.individual.alias ||
this.individual.full_name ||
this.individual.nickname ||
email ||
_("Unknown");
let aliasLabel = new St.Label({ text: aliasText,
style_class: 'contact-details-alias' });
details.add(aliasLabel, { x_fill: true,