[gnome-contacts] avatar: Use unowned references when casting



commit 8f3da0f2b7b9f98b5f8aab3a81fd013955d28a88
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Sat Nov 7 12:31:44 2020 +0100

    avatar: Use unowned references when casting
    
    And don't use `using Gtk;`, since some names of types can clash.

 src/contacts-avatar.vala | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/src/contacts-avatar.vala b/src/contacts-avatar.vala
index fb758dfb..cfb32cdd 100644
--- a/src/contacts-avatar.vala
+++ b/src/contacts-avatar.vala
@@ -15,7 +15,6 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-using Gtk;
 using Folks;
 using Gee;
 
@@ -23,10 +22,10 @@ using Gee;
  * The Avatar of a Contact is responsible for showing an {@link Folks.Individual}'s
  * avatar, or a fallback if it's not available.
  */
-public class Contacts.Avatar : Bin {
+public class Contacts.Avatar : Gtk.Bin {
   private Hdy.Avatar widget;
 
-  private Individual? individual = null;
+  private unowned Individual? individual = null;
 
   public Avatar (int size, Individual? individual = null) {
     this.individual = individual;
@@ -103,7 +102,7 @@ public class Contacts.Avatar : Bin {
   }
 
   private string look_up_alias_for_display_name (Persona? p) {
-    var a = p as AliasDetails;
+    unowned var a = p as AliasDetails;
     if (a != null && a.alias != null)
       return a.alias;
 
@@ -111,7 +110,7 @@ public class Contacts.Avatar : Bin {
   }
 
   private string look_up_name_details_for_display_name (Persona? p) {
-    var n = p as NameDetails;
+    unowned var n = p as NameDetails;
     if (n != null) {
       if (n.full_name != null && n.full_name != "")
         return n.full_name;


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