e-d-s: load icon regardless of the mime type being available
authorRaul Gutierrez Segales <rgs@collabora.co.uk>
Wed, 26 Oct 2011 14:26:07 +0000 (15:26 +0100)
committerRaul Gutierrez Segales <rgs@collabora.co.uk>
Thu, 27 Oct 2011 00:05:16 +0000 (01:05 +0100)
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
backends/eds/lib/edsf-persona.vala
backends/eds/lib/memory-icon.vala

diff --git a/NEWS b/NEWS
index 62c1609..198891e 100644 (file)
--- 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
index a7bcaf4..e316591 100644 (file)
@@ -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;
               }
index 360f541..544339f 100644 (file)
@@ -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++)
         {