[gnome-contacts] Use nicer persona store names



commit dca1579dd639267596c50e83dbf79b911abb4eea
Author: Alexander Larsson <alexl redhat com>
Date:   Tue Aug 23 11:40:57 2011 +0200

    Use nicer persona store names

 src/contacts-contact-pane.vala |    2 +-
 src/contacts-contact.vala      |   17 +++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index 17788e4..c3c198e 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -463,7 +463,7 @@ public class Contacts.ContactPane : EventBox {
   private void update_edit_details (ContactFrame image_frame, Persona persona, bool new_contact) {
     layout.reset (false);
     image_frame.set_image (persona as AvatarDetails);
-    image_frame.set_text (persona.store.display_name, LABEL_HEIGHT);
+    image_frame.set_text (Contact.format_persona_store_name (persona.store), LABEL_HEIGHT);
 
     editing_emails = new HashSet<EmailFieldDetails>();
     editing_phones = new HashSet<PhoneFieldDetails>();
diff --git a/src/contacts-contact.vala b/src/contacts-contact.vala
index 3c853a4..a26a645 100644
--- a/src/contacts-contact.vala
+++ b/src/contacts-contact.vala
@@ -807,4 +807,21 @@ public class Contacts.Contact : GLib.Object  {
 
     return null;
   }
+
+  public static string format_persona_store_name (PersonaStore store) {
+    if (store.type_id == "eds") {
+      if (store.id == "system") {
+	return _("Local Contact");
+      }
+      if (store.id.has_suffix ("@gmail.com")) {
+	return _("Google");
+      }
+    }
+    if (store.type_id == "telepathy") {
+      var account = (store as Tpf.PersonaStore).account;
+      return format_im_service (account.service, null);
+    }
+
+    return store.display_name;
+  }
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]