[gnome-contacts] Add contacts.display_name property instead of hardcoding alias
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Add contacts.display_name property instead of hardcoding alias
- Date: Thu, 12 May 2011 19:20:09 +0000 (UTC)
commit 67e6f8e45c1e24408e115b7f4f11fd3202297239
Author: Alexander Larsson <alexl redhat com>
Date: Thu May 12 20:54:20 2011 +0200
Add contacts.display_name property instead of hardcoding alias
src/contacts-app.vala | 4 ++--
src/contacts-contact.vala | 11 +++++++++++
2 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/contacts-app.vala b/src/contacts-app.vala
index a6b62c9..cd566f5 100644
--- a/src/contacts-app.vala
+++ b/src/contacts-app.vala
@@ -59,8 +59,8 @@ public class Contacts.App : Window {
model.get (iter, 0, out contact);
- string? alias = contact.individual.alias;
- cell.set ("text", alias);
+ string name = contact.display_name;
+ cell.set ("text", name);
});
icon = new CellRendererPixbuf ();
diff --git a/src/contacts-contact.vala b/src/contacts-contact.vala
index cab1f21..0743336 100644
--- a/src/contacts-contact.vala
+++ b/src/contacts-contact.vala
@@ -56,6 +56,17 @@ public class Contacts.Contact : GLib.Object {
}
}
+ public string display_name {
+ get {
+ unowned string name = individual.full_name;
+ if (name != null)
+ return name;
+ if (individual.alias != null)
+ return individual.alias;
+ return "";
+ }
+ }
+
private string filter_data;
public static Contact from_individual (Individual i) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]