[gnome-contacts] Show some name for the new contact in the list before one is set



commit d088060cfbf4f0e23fa363bcc2165d5e53f9f9c3
Author: Alexander Larsson <alexl redhat com>
Date:   Mon Aug 29 15:34:38 2011 +0200

    Show some name for the new contact in the list before one is set

 src/contacts-contact-pane.vala |    3 +++
 src/contacts-contact.vala      |    1 +
 src/contacts-view.vala         |    5 ++++-
 3 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index 0a66a4d..9fc9528 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -1388,6 +1388,7 @@ public class Contacts.ContactPane : EventBox {
 	}
 
 	show_contact (contact);
+	contact.is_new = true;
 	persona.set_data ("contacts-unedited", true);
 	display_edit (contact, persona, true);
 	list_pane.select_contact (contact, true);
@@ -1405,6 +1406,8 @@ public class Contacts.ContactPane : EventBox {
   }
 
   public void show_contact (Contact? new_contact, bool edit=false) {
+    if (new_contact != null)
+      new_contact.is_new = false;
     this.save_data (); // Ensure all edit data saved
 
     if (selected_contact != null)
diff --git a/src/contacts-contact.vala b/src/contacts-contact.vala
index f8484cb..c04567b 100644
--- a/src/contacts-contact.vala
+++ b/src/contacts-contact.vala
@@ -111,6 +111,7 @@ public class Contacts.Contact : GLib.Object  {
   public PresenceType presence_type;
   public string presence_message;
   public bool is_phone;
+  public bool is_new;
   struct ContactDataRef {
     void *key;
     void *data;
diff --git a/src/contacts-view.vala b/src/contacts-view.vala
index a9666e1..80810f2 100644
--- a/src/contacts-view.vala
+++ b/src/contacts-view.vala
@@ -279,7 +279,10 @@ public class Contacts.ViewWidget : TreeView {
 
 	model.get (iter, 0, out contact);
 
-	cell.set ("name", contact.display_name,
+	var name = contact.display_name;
+	if (name == "" && contact.is_new)
+	  name = _("New contact");
+	cell.set ("name", name,
 		  "presence", contact.presence_type,
 		  "message", contact.presence_message,
 		  "is_phone", contact.is_phone);



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