[folks] e-d-s: load icon regardless of the mime type being available



commit aa50fcfa896f9102411f1f5b6772e17129f1decc
Author: Raul Gutierrez Segales <rgs collabora co uk>
Date:   Wed Oct 26 15:26:07 2011 +0100

    e-d-s: load icon regardless of the mime type being available
    
    Also, allow Edsf.MemoryIcon to be instantiated with a null
    image type. The notion of the image type not being available
    was half there (some comments mentioned the possibility), but
    it wasn't contemplated in the constructor and in the instance
    variable.
    
    Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=662770

 NEWS                               |    1 +
 backends/eds/lib/edsf-persona.vala |    2 +-
 backends/eds/lib/memory-icon.vala  |    6 +++---
 3 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/NEWS b/NEWS
index 62c1609..198891e 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ Bugs fixed:
 * Bug 662433 â AbstractFieldDetails.equal() is ambiguous about checking
   parameters.
 * Bug 660908 â Add favourites support to EDS backend
+* Bug 662770 â ContactPhotos are ignored when mime type is null
 
 API changes:
 * Add AbstractFieldDetails.id to identify instances of details
diff --git a/backends/eds/lib/edsf-persona.vala b/backends/eds/lib/edsf-persona.vala
index a7bcaf4..e316591 100644
--- a/backends/eds/lib/edsf-persona.vala
+++ b/backends/eds/lib/edsf-persona.vala
@@ -1167,7 +1167,7 @@ public class Edsf.Persona : Folks.Persona,
 
             return new FileIcon (File.new_for_uri (p.get_uri ()));
           case ContactPhotoType.INLINED:
-            if (p.get_mime_type () == null || p.get_inlined () == null)
+            if (p.get_inlined () == null)
               {
                 return null;
               }
diff --git a/backends/eds/lib/memory-icon.vala b/backends/eds/lib/memory-icon.vala
index 360f541..544339f 100644
--- a/backends/eds/lib/memory-icon.vala
+++ b/backends/eds/lib/memory-icon.vala
@@ -30,7 +30,7 @@ using GLib;
 internal class Edsf.MemoryIcon : Object, Icon, LoadableIcon
 {
   private uint8[] _image_data;
-  private string _image_type;
+  private string? _image_type;
 
   /**
    * Construct a new in-memory icon.
@@ -39,7 +39,7 @@ internal class Edsf.MemoryIcon : Object, Icon, LoadableIcon
    * @param image_data the binary data of the image
    * @since 0.6.0
    */
-  public MemoryIcon (string image_type, uint8[] image_data)
+  public MemoryIcon (string? image_type, uint8[] image_data)
     {
       this._image_data = image_data;
       this._image_type = image_type;
@@ -83,7 +83,7 @@ internal class Edsf.MemoryIcon : Object, Icon, LoadableIcon
        *
        * Basically, this is just a nul-safe version of g_str_hash(). Which is
        * calculated over both the image type and image data. */
-      uint hash = this._image_type.hash ();
+      uint hash = this._image_type != null ? this._image_type.hash () : 0;
 
       for (uint i = 0; i < this._image_data.length; i++)
         {



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