[gnome-contacts] contact-list: Make Individual a property



commit e66054ce7eab59046ed6b0dc3bde3e2427944644
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Fri Jan 14 09:41:53 2022 +0100

    contact-list: Make Individual a property
    
    This is useful for 2 reasons:
    
    * We can inspect the pointer in the GtkInspector (since it can show the
      property)
    * We keep a strong reference to the `Folks.Individual` which prevents a
      sporadic crash when deleting a contact

 src/contacts-contact-list.vala | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/contacts-contact-list.vala b/src/contacts-contact-list.vala
index 0a97641c..6517a0ae 100644
--- a/src/contacts-contact-list.vala
+++ b/src/contacts-contact-list.vala
@@ -337,13 +337,14 @@ public class Contacts.ContactList : Adw.Bin {
   private class ContactDataRow : Gtk.ListBoxRow {
     private const int LIST_AVATAR_SIZE = 48;
 
-    public unowned Individual individual;
+    public Individual individual { get; construct; }
+
     private unowned Gtk.Label label;
     private unowned Avatar avatar;
     public unowned Gtk.CheckButton selector_button;
 
     public ContactDataRow (Individual i) {
-      this.individual = i;
+      Object (individual: i);
       this.individual.notify.connect (on_contact_changed);
 
       add_css_class ("contact-data-row");


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