[gnome-contacts] Show fallback avatar in contact pane too
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Show fallback avatar in contact pane too
- Date: Tue, 28 Jun 2011 08:08:08 +0000 (UTC)
commit 8b04bb90d5fbfe33e59d58b963b871c3681729ce
Author: Alexander Larsson <alexl redhat com>
Date: Tue Jun 28 09:48:12 2011 +0200
Show fallback avatar in contact pane too
src/contacts-contact-pane.vala | 2 +-
src/contacts-contact.vala | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index 880da3b..f7fbf4c 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -182,7 +182,7 @@ public class Contacts.ContactFrame : Frame {
}
if (pixbuf == null) {
- /* TODO: Set fallback image */
+ pixbuf = Contact.draw_fallback_avatar (size);
}
}
diff --git a/src/contacts-contact.vala b/src/contacts-contact.vala
index 645938a..30630bd 100644
--- a/src/contacts-contact.vala
+++ b/src/contacts-contact.vala
@@ -128,7 +128,7 @@ public class Contacts.Contact : GLib.Object {
}
static construct {
- fallback_avatar = draw_fallback_avatar ();
+ fallback_avatar = draw_fallback_avatar (48);
}
private void persona_notify_cb (ParamSpec pspec) {
@@ -634,12 +634,12 @@ public class Contacts.Contact : GLib.Object {
return Gdk.pixbuf_get_from_surface (cst, 0, 0, 52, 52);
}
- private static Gdk.Pixbuf draw_fallback_avatar () {
- var cst = new Cairo.ImageSurface (Cairo.Format.ARGB32, 48, 48);
+ public static Gdk.Pixbuf draw_fallback_avatar (int size) {
+ var cst = new Cairo.ImageSurface (Cairo.Format.ARGB32, size, size);
var cr = new Cairo.Context (cst);
try {
- var icon_info = IconTheme.get_default ().lookup_icon ("avatar-default", 48, IconLookupFlags.GENERIC_FALLBACK);
+ var icon_info = IconTheme.get_default ().lookup_icon ("avatar-default", size, IconLookupFlags.GENERIC_FALLBACK);
var image = icon_info.load_icon ();
if (image != null) {
Gdk.cairo_set_source_pixbuf (cr, image, 0, 0);
@@ -648,6 +648,6 @@ public class Contacts.Contact : GLib.Object {
} catch {
}
- return Gdk.pixbuf_get_from_surface (cst, 0, 0, 48, 48);
+ return Gdk.pixbuf_get_from_surface (cst, 0, 0, size, size);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]