[folks] Allow Edsf.PersonaStore._set_*avatar() avatar arg to be null.



commit 06ca1405ba73ee1563a54fcacf82591efd9ef004
Author: Travis Reitter <travis reitter collabora co uk>
Date:   Thu Jul 21 13:14:15 2011 -0700

    Allow Edsf.PersonaStore._set_*avatar() avatar arg to be null.
    
    Helps: bgo#655019 - Don't notify twice for nickname changes

 backends/eds/lib/edsf-persona-store.vala |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/backends/eds/lib/edsf-persona-store.vala b/backends/eds/lib/edsf-persona-store.vala
index 67fef06..a4a118e 100644
--- a/backends/eds/lib/edsf-persona-store.vala
+++ b/backends/eds/lib/edsf-persona-store.vala
@@ -471,7 +471,7 @@ public class Edsf.PersonaStore : Folks.PersonaStore
         }
     }
 
-  internal async void _set_avatar (Edsf.Persona persona, File avatar)
+  internal async void _set_avatar (Edsf.Persona persona, File? avatar)
     {
       try
         {
@@ -557,16 +557,20 @@ public class Edsf.PersonaStore : Folks.PersonaStore
     }
 
   private async void _set_contact_avatar (E.Contact contact,
-      File avatar)
+      File? avatar)
     {
       try
         {
           uint8[] photo_content;
-          yield avatar.load_contents_async (null, out photo_content);
-
           var cp = new ContactPhoto ();
-          cp.type = ContactPhotoType.INLINED;
-          cp.set_inlined (photo_content);
+
+          if (avatar != null)
+            {
+              yield avatar.load_contents_async (null, out photo_content);
+
+              cp.type = ContactPhotoType.INLINED;
+              cp.set_inlined (photo_content);
+            }
 
           contact.set (E.Contact.field_id ("photo"), cp);
         }



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