[folks] e-d-s: set content type on ContactPhotos



commit fc5d0617564c77ed7e48c9a40b05930bb05aff59
Author: Raul Gutierrez Segales <rgs collabora co uk>
Date:   Wed Oct 26 16:16:23 2011 +0100

    e-d-s: set content type on ContactPhotos
    
    Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=662616

 NEWS                                     |    1 +
 backends/eds/lib/edsf-persona-store.vala |    9 +++++++++
 2 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/NEWS b/NEWS
index 198891e..6113612 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Bugs fixed:
   parameters.
 * Bug 660908 â Add favourites support to EDS backend
 * Bug 662770 â ContactPhotos are ignored when mime type is null
+* Bug 662616 â We should set mime type when setting an EContact's photo
 
 API changes:
 * Add AbstractFieldDetails.id to identify instances of details
diff --git a/backends/eds/lib/edsf-persona-store.vala b/backends/eds/lib/edsf-persona-store.vala
index 93f60ee..ea75f17 100644
--- a/backends/eds/lib/edsf-persona-store.vala
+++ b/backends/eds/lib/edsf-persona-store.vala
@@ -1295,6 +1295,15 @@ public class Edsf.PersonaStore : Folks.PersonaStore
                 }
 
               cp.set_inlined (image_data);
+
+              bool uncertain = false;
+              var mime_type = ContentType.guess (null, image_data,
+                  out uncertain);
+              if (mime_type != null && !uncertain)
+                {
+                  cp.set_mime_type (mime_type);
+                }
+
               contact.set (ContactField.PHOTO, cp);
             }
           catch (GLib.Error e1)



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