[gnome-contacts] Better display name, if some things are not set.
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Better display name, if some things are not set.
- Date: Mon, 30 May 2011 13:08:46 +0000 (UTC)
commit 5633c9905a4dc1b3b80da75fe7711f8d8bb0ddbf
Author: Alexander Larsson <alexl redhat com>
Date: Mon May 30 08:34:08 2011 +0200
Better display name, if some things are not set.
src/contacts-contact.vala | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/contacts-contact.vala b/src/contacts-contact.vala
index 211a36e..582000c 100644
--- a/src/contacts-contact.vala
+++ b/src/contacts-contact.vala
@@ -37,11 +37,17 @@ public class Contacts.Contact : GLib.Object {
public string display_name {
get {
- unowned string name = individual.full_name;
- if (name != null)
+ unowned string? name = individual.full_name;
+ if (name != null && name.length > 0)
return name;
- if (individual.alias != null)
+ unowned string? alias = individual.alias;
+ if (alias != null && alias.length > 0)
return individual.alias;
+ foreach (var email in individual.email_addresses) {
+ string? e = email.value;
+ if (e != null && e.length > 0)
+ return email.value;
+ }
return "";
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]