[gnome-contacts] Scale the avatar in the right pane



commit a3be3b941b0bf482771909bed5728a6b67806498
Author: Alexander Larsson <alexl redhat com>
Date:   Tue May 17 19:14:38 2011 +0200

    Scale the avatar in the right pane

 src/contacts-app.vala |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/src/contacts-app.vala b/src/contacts-app.vala
index 7ebbb00..17b247e 100644
--- a/src/contacts-app.vala
+++ b/src/contacts-app.vala
@@ -180,13 +180,25 @@ public class Contacts.App : Window {
     image.set_size_request (100, 100);
     image_frame.add (image);
 
+    Gdk.Pixbuf pixbuf = null;
+
     if (contact.individual.avatar != null &&
 	contact.individual.avatar.get_path () != null) {
-      image.set_from_file (contact.individual.avatar.get_path ());
-    } else {
+      try {
+	pixbuf = new Gdk.Pixbuf.from_file_at_scale (contact.individual.avatar.get_path (), 100, 100, true);
+      }
+      catch {
+      }
+    }
+
+    if (pixbuf == null) {
       /* TODO: Set fallback image */
     }
 
+    if (pixbuf != null) {
+	image.set_from_pixbuf (pixbuf);
+    }
+
     card_grid.attach (image_frame, 0, 0, 1, 1);
 
     var g = new Grid ();



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