[gnome-contacts] Folks' AvatarDetails.avatar is now a LoadableIcon rather than a File. Closes: bgo#655213



commit e49364b30102c720319473579c1e6efc3a799ae7
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sat Aug 6 16:19:09 2011 +0200

    Folks' AvatarDetails.avatar is now a LoadableIcon rather than a File.
    Closes: bgo#655213

 src/contacts-contact-pane.vala |   12 ++++++------
 src/contacts-contact.vala      |    4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index 97de6d3..9f39351 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -196,10 +196,10 @@ public class Contacts.ContactFrame : Frame {
   public void set_image (AvatarDetails? details) {
     pixbuf = null;
     if (details != null &&
-	details.avatar != null &&
-	details.avatar.get_path () != null) {
+	details.avatar != null) {
       try {
-	pixbuf = new Gdk.Pixbuf.from_file_at_scale (details.avatar.get_path (), size, size, true);
+        var stream = details.avatar.load (size, null);
+        pixbuf = new Gdk.Pixbuf.from_stream_at_scale (stream, size, size, true);
       }
       catch {
       }
@@ -281,10 +281,10 @@ public class Contacts.ContactPane : EventBox {
 
     Gdk.Pixbuf pixbuf = null;
     if (details != null &&
-	details.avatar != null &&
-	details.avatar.get_path () != null) {
+	details.avatar != null) {
       try {
-	pixbuf = new Gdk.Pixbuf.from_file_at_scale (details.avatar.get_path (), size, size, true);
+        var stream = details.avatar.load (size, null);
+        pixbuf = new Gdk.Pixbuf.from_stream_at_scale (stream, size, size, true);
       }
       catch {
       }
diff --git a/src/contacts-contact.vala b/src/contacts-contact.vala
index 099ace9..ea5b8d6 100644
--- a/src/contacts-contact.vala
+++ b/src/contacts-contact.vala
@@ -564,12 +564,12 @@ public class Contacts.Contact : GLib.Object  {
   }
 
   // TODO: This should be async, but the vala bindings are broken (bug #649875)
-  private Gdk.Pixbuf load_icon (File ?file) {
+  private Gdk.Pixbuf load_icon (LoadableIcon ?file) {
     Gdk.Pixbuf? res = fallback_avatar;
     if (file != null) {
       try {
-	var stream = file.read ();
 	Cancellable c = new Cancellable ();
+	var stream = file.load (48, null, c);
 	res = new Gdk.Pixbuf.from_stream_at_scale (stream, 48, 48, true, c);
       } catch (Error e) {
       }



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