[gnome-contacts] Contact: Remove display_name property.



commit 6c65b72e18c6854f531999287063f9ec2f0c6fde
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Mon Jan 22 15:37:37 2018 +0100

    Contact: Remove display_name property.
    
    It's just a shorthand for `individual.display_name`, so make that more
    explicit.

 src/contacts-avatar-selector.vala        |    2 +-
 src/contacts-contact-editor.vala         |    2 +-
 src/contacts-contact-list.vala           |    4 ++--
 src/contacts-contact-pane.vala           |    2 +-
 src/contacts-contact-sheet.vala          |    4 ++--
 src/contacts-contact.vala                |    6 +-----
 src/contacts-link-suggestion-grid.vala   |    4 ++--
 src/contacts-linked-accounts-dialog.vala |    2 +-
 src/contacts-linking.vala                |    8 ++++----
 src/contacts-window.vala                 |    8 ++++----
 10 files changed, 19 insertions(+), 23 deletions(-)
---
diff --git a/src/contacts-avatar-selector.vala b/src/contacts-avatar-selector.vala
index 7c147dd..16c1ba4 100644
--- a/src/contacts-avatar-selector.vala
+++ b/src/contacts-avatar-selector.vala
@@ -95,7 +95,7 @@ public class Contacts.AvatarSelector : Dialog {
     this.grid.attach (this.current_avatar, 0, 0);
 
     if (contact != null)
-      this.contact_name_label.label = contact.display_name;
+      this.contact_name_label.label = contact.individual.display_name;
 
 #if HAVE_CHEESE
     this.webcam_button_box.show ();
diff --git a/src/contacts-contact-editor.vala b/src/contacts-contact-editor.vala
index 0deb238..0c5de6d 100644
--- a/src/contacts-contact-editor.vala
+++ b/src/contacts-contact-editor.vala
@@ -999,7 +999,7 @@ public class Contacts.ContactEditor : Grid {
     this.name_entry.set_data ("changed", false);
 
     if (this.contact != null)
-        this.name_entry.text = this.contact.display_name;
+        this.name_entry.text = this.contact.individual.display_name;
 
     /* structured name change */
     this.name_entry.changed.connect (() => {
diff --git a/src/contacts-contact-list.vala b/src/contacts-contact-list.vala
index b7edf7e..2aa2b85 100644
--- a/src/contacts-contact-list.vala
+++ b/src/contacts-contact-list.vala
@@ -46,7 +46,7 @@ public class Contacts.ContactList : ListBox {
       grid.set_column_spacing (10);
       this.avatar = new Avatar (LIST_AVATAR_SIZE);
 
-      this.label = new Label (c.display_name);
+      this.label = new Label (c.individual.display_name);
       this.label.ellipsize = Pango.EllipsizeMode.END;
       this.label.valign = Align.CENTER;
       this.label.halign = Align.START;
@@ -70,7 +70,7 @@ public class Contacts.ContactList : ListBox {
 
     public void update () {
       // Update widgets
-      this.label.set_text (this.contact.display_name);
+      this.label.set_text (this.contact.individual.display_name);
       this.avatar.set_image.begin (this.contact.individual, this.contact);
     }
 
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index 05b2dbe..2c30710 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -103,7 +103,7 @@ public class Contacts.ContactPane : Stack {
     parent_overlay.add_overlay (this.suggestion_grid);
 
     this.suggestion_grid.suggestion_accepted.connect ( () => {
-        var linked_contact = c.display_name;
+        var linked_contact = c.individual.display_name;
         link_contacts.begin (contact, c, this.store, (obj, result) => {
             var operation = link_contacts.end (result);
             this.contacts_linked (null, linked_contact, operation);
diff --git a/src/contacts-contact-sheet.vala b/src/contacts-contact-sheet.vala
index 961005a..88c0bb1 100644
--- a/src/contacts-contact-sheet.vala
+++ b/src/contacts-contact-sheet.vala
@@ -114,7 +114,7 @@ public class Contacts.ContactSheet : Grid {
     name_label.set_selectable (true);
 
     c.keep_widget_uptodate (name_label, (w) => {
-       (w as Label).set_markup (Markup.printf_escaped ("<span font='16'>%s</span>", c.display_name));
+        (w as Label).set_markup (Markup.printf_escaped ("<span font='16'>%s</span>", 
c.individual.display_name));
       });
     attach (name_label,  1, 0, 1, 3);
 
@@ -142,7 +142,7 @@ public class Contacts.ContactSheet : Grid {
        foreach (var email in emails) {
          var button = add_row_with_button (ref i, TypeSet.email.format_type (email), email.value);
          button.clicked.connect (() => {
-             Utils.compose_mail ("%s <%s>".printf(c.display_name, email.value));
+             Utils.compose_mail ("%s <%s>".printf(c.individual.display_name, email.value));
            });
        }
       }
diff --git a/src/contacts-contact.vala b/src/contacts-contact.vala
index 5073a68..12e9a6c 100644
--- a/src/contacts-contact.vala
+++ b/src/contacts-contact.vala
@@ -34,10 +34,6 @@ public class Contacts.Contact : GLib.Object  {
 
   public Persona? fake_persona = null;
 
-  public string display_name {
-    get { return this.individual.display_name; }
-  }
-
   public static bool persona_has_writable_property (Persona persona, string property) {
     // TODO: This should check the writibility on the FakePersona store,
     // but that is not availible in folks yet
@@ -880,7 +876,7 @@ public class Contacts.FakePersona : Persona {
       prop_vals.add (v);
       Persona p = yield contact.ensure_primary_persona ();
       if (!has_full_name)
-       p.set ("full-name", contact.display_name);
+       p.set ("full-name", contact.individual.display_name);
       foreach (var pv in prop_vals) {
        yield Contact.set_persona_property (p, pv.property, pv.value);
       }
diff --git a/src/contacts-link-suggestion-grid.vala b/src/contacts-link-suggestion-grid.vala
index 54f619e..36f4a61 100644
--- a/src/contacts-link-suggestion-grid.vala
+++ b/src/contacts-link-suggestion-grid.vala
@@ -54,8 +54,8 @@ public class Contacts.LinkSuggestionGrid : Grid {
 
     this.description_label.xalign = 0; // FIXME: hack to make it actually align left.
     this.description_label.label = contact.is_main?
-          _("Is this the same person as %s from %s?").printf (contact.display_name, 
contact.format_persona_stores ())
-        : _("Is this the same person as %s?").printf (contact.display_name);
+          _("Is this the same person as %s from %s?").printf (contact.individual.display_name, 
contact.format_persona_stores ())
+        : _("Is this the same person as %s?").printf (contact.individual.display_name);
 
     var extra_info = find_extra_description (contact);
     if (extra_info != null) {
diff --git a/src/contacts-linked-accounts-dialog.vala b/src/contacts-linked-accounts-dialog.vala
index 931ec33..6bb3df6 100644
--- a/src/contacts-linked-accounts-dialog.vala
+++ b/src/contacts-linked-accounts-dialog.vala
@@ -38,7 +38,7 @@ public class Contacts.LinkedAccountsDialog : Dialog {
     any_unlinked = false;
 
     var headerbar = get_header_bar () as Gtk.HeaderBar;
-    headerbar.set_title (_("%s").printf (contact.display_name));
+    headerbar.set_title (_("%s").printf (contact.individual.display_name));
     headerbar.set_subtitle (_("Linked Accounts"));
 
     set_default_size (600, 400);
diff --git a/src/contacts-linking.vala b/src/contacts-linking.vala
index f2c9e1e..7fa6914 100644
--- a/src/contacts-linking.vala
+++ b/src/contacts-linking.vala
@@ -571,7 +571,7 @@ namespace Contacts {
       var details = new HashTable<string, Value?> (str_hash, str_equal);
       try {
        var v = Value (typeof (string));
-       v.set_string (main.display_name);
+       v.set_string (main.individual.display_name);
        details.set ("full-name", v);
        write_persona = yield Contact.create_primary_persona_for_details 
(contacts_store.aggregator.primary_store, details);
        operation.added_persona (write_persona);
@@ -676,9 +676,9 @@ namespace Contacts {
     if (main_persona == null && other_personas.size > 1) {
       var details = new HashTable<string, Value?> (str_hash, str_equal);
       try {
-       main_persona = yield contact.store.aggregator.primary_store.add_persona_from_details (details);
-       yield (main_persona as NameDetails).change_full_name (contact.display_name);
-       operation.added_persona (main_persona);
+        main_persona = yield contact.store.aggregator.primary_store.add_persona_from_details (details);
+        yield (main_persona as NameDetails).change_full_name (contact.individual.display_name);
+        operation.added_persona (main_persona);
       } catch (GLib.Error e) {
        warning ("Unable to create new persona when unlinking: %s\n", e.message);
        return operation;
diff --git a/src/contacts-window.vala b/src/contacts-window.vala
index b674399..f273003 100644
--- a/src/contacts-window.vala
+++ b/src/contacts-window.vala
@@ -155,7 +155,7 @@ public class Contacts.Window : Gtk.ApplicationWindow {
 
     this.state = UiState.UPDATING;
 
-    var name = this.contact_pane.contact.display_name;
+    var name = this.contact_pane.contact.individual.display_name;
     this.right_header.title = _("Editing %s").printf (name);
 
     this.contact_pane.set_edit_mode (true);
@@ -186,7 +186,7 @@ public class Contacts.Window : Gtk.ApplicationWindow {
     }
 
     if (this.contact_pane.contact != null) {
-      this.right_header.title = this.contact_pane.contact.display_name;
+      this.right_header.title = this.contact_pane.contact.individual.display_name;
     } else {
       this.right_header.title = "";
     }
@@ -213,7 +213,7 @@ public class Contacts.Window : Gtk.ApplicationWindow {
       this.ignore_favorite_button_toggled = false;
       this.favorite_button.tooltip_text = (c.individual.is_favourite)? _("Unmark as favorite")
                                                                      : _("Mark as favorite");
-      this.right_header.title = c.display_name;
+      this.right_header.title = c.individual.display_name;
     }
   }
 
@@ -316,7 +316,7 @@ public class Contacts.Window : Gtk.ApplicationWindow {
     this.state = UiState.NORMAL;
 
     var msg = (contacts.size > 1)? _("%d contacts deleted").printf (contacts.size)
-                                 : _("Deleted contact %s").printf (contacts[0].display_name);
+                                 : _("Deleted contact %s").printf (contacts[0].individual.display_name);
 
     var b = new Button.with_mnemonic (_("_Undo"));
 


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