Index: configure.in
===================================================================
--- configure.in	(revision 9213)
+++ configure.in	(working copy)
@@ -196,11 +196,15 @@
   PKG_CHECK_MODULES(LIBEBOOK, [libebook-1.2 >= 1.7.90],
                     [AC_DEFINE([HAVE_LIBEBOOK], 1,
                     [Define if evolution-data-server libebook-1.2 is available])])
-  dnl PolicyKit-gnome is optional
+  dnl PolicyKit-gnome and libsoup are optional
   PKG_CHECK_MODULES(POLKIT_GNOME, [polkit-gnome],
   		    [AC_DEFINE([HAVE_POLKIT], 1,
   		    [Define if PolicyKit-gnome is available])],
   		    has_polkit=false)
+  PKG_CHECK_MODULES(LIBSOUP, [libsoup-2.4],
+                    [AC_DEFINE([HAVE_LIBSOUP], 1,
+                    [Define if libsoup-2.4 is available])],
+                    has_libsoup=false)
 fi
 
 AM_CONDITIONAL(BUILD_ABOUTME, test "x$enable_aboutme" = "xyes")
Index: capplets/about-me/gnome-about-me.c
===================================================================
--- capplets/about-me/gnome-about-me.c	(revision 9213)
+++ capplets/about-me/gnome-about-me.c	(working copy)
@@ -38,6 +38,10 @@
 #include <polkit-gnome/polkit-gnome.h>
 #endif
 
+#ifdef HAVE_LIBSOUP
+#include <libsoup/soup.h>
+#endif /* HAVE_LIBSOUP */
+
 #include "e-image-chooser.h"
 #include "gnome-about-me-password.h"
 #include "gnome-about-me-fingerprint.h"
@@ -149,8 +153,10 @@
 #define ATTRIBUTE_OTHER "OTHER"
 
 static void about_me_set_address_field (EContactAddress *, guint, gchar *);
+#ifdef HAVE_LIBSOUP
+static void download_gravatar (guint email_index);
+#endif /* HAVE_LIBSOUP */
 
-
 /*** Utility functions ***/
 static void
 about_me_error (GtkWindow *parent, gchar *str)
@@ -753,7 +759,89 @@
 	gtk_file_chooser_set_preview_widget_active (chooser, TRUE);
 }
 
+#ifdef HAVE_LIBSOUP
 static void
+download_gravatar_cb (SoupSession *session, SoupMessage *message, gpointer user_data)
+{
+	GladeXML *dialog;
+	GtkWidget *image_chooser;
+	guint email_index = GPOINTER_TO_UINT (user_data);
+
+	dialog = me->dialog;
+	image_chooser = WID ("image-chooser");
+
+	if (SOUP_STATUS_IS_REDIRECTION (message->status_code)) {
+		/* Gravatar doesn't exist for this e-mail address;
+		 * move on to the next one */
+		download_gravatar (email_index + 1);
+		return;
+	}
+
+	me->have_image = TRUE;
+	me->image_changed = TRUE;
+	e_image_chooser_set_image_data (E_IMAGE_CHOOSER (image_chooser),
+					(char*) message->response_body->data,
+					message->response_body->length);
+	about_me_update_photo (me);
+
+	g_object_unref (message);
+	g_object_unref (session);
+}
+
+static void
+download_gravatar (guint email_index)
+{
+	gchar *uri, *email_md5;
+	SoupSession *session;
+	SoupMessage *message;
+
+	if (email_index >= EMAIL_SLOTS) {
+		/* We've run out of e-mail addresses without any hits */
+		GtkWidget *message_dialog, *image_chooser;
+		GladeXML *dialog;
+
+		message_dialog = gtk_message_dialog_new (GTK_WINDOW (WID ("about-me-dialog")), GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
+							 GTK_BUTTONS_OK, _("Gravatar Not Found"));
+		gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message_dialog),
+							  _("No Gravatar could be found for any of your e-mail addresses."));
+		gtk_dialog_run (GTK_DIALOG (message_dialog));
+		gtk_widget_destroy (message_dialog);
+
+		/* Set the user's face image to nothing */
+		dialog = me->dialog;
+		image_chooser = WID ("image-chooser");
+
+		me->have_image = FALSE;
+		me->image_changed = TRUE;
+		e_image_chooser_set_from_file (E_IMAGE_CHOOSER (image_chooser), me->person);
+		about_me_update_photo (me);
+
+		return;
+	}
+
+	if (me->email[email_index] == NULL) {
+		/* No e-mail address in this slot, so move on to the next */
+		download_gravatar (email_index + 1);
+		return;
+	}
+
+	/* Build the avatar URI (see http://en.gravatar.com/site/implement/url).
+	 * We set http://example.com as the default Gravatar so we can catch the
+	 * redirect to determine that an e-mail address doesn't have a Gravatar. */
+	email_md5 = g_compute_checksum_for_string (G_CHECKSUM_MD5, me->email[email_index], -1);
+	uri = g_strdup_printf ("http://www.gravatar.com/avatar/%s?s=%u&d=http%%3A%%2F%%2Fexample.com", email_md5, MAX_WIDTH);
+	g_free (email_md5);
+
+	session = soup_session_async_new ();
+	message = soup_message_new ("GET", uri);
+	soup_message_set_flags (message, SOUP_MESSAGE_NO_REDIRECT);
+	g_free (uri);
+
+	soup_session_queue_message (session, message, download_gravatar_cb, GUINT_TO_POINTER (email_index));
+}
+#endif /* HAVE_LIBSOUP */
+
+static void
 about_me_image_clicked_cb (GtkWidget *button, GnomeAboutMe *me)
 {
 	GtkFileChooser *chooser_dialog;
@@ -771,6 +859,9 @@
 	chooser_dialog = GTK_FILE_CHOOSER (
 			 gtk_file_chooser_dialog_new (_("Select Image"), GTK_WINDOW (WID ("about-me-dialog")),
 							GTK_FILE_CHOOSER_ACTION_OPEN,
+#ifdef HAVE_LIBSOUP
+							_("Use Gravatar"), 1,
+#endif /* HAVE_LIBSOUP */
 							_("No Image"), GTK_RESPONSE_NO,
 							GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 							GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
@@ -824,6 +915,11 @@
 		me->image_changed = TRUE;
 		e_image_chooser_set_from_file (E_IMAGE_CHOOSER (image_chooser), me->person);
 		about_me_update_photo (me);
+#ifdef HAVE_LIBSOUP
+	} else if (response == 1) {
+		/* Start checking our e-mail addresses to see if we have a Gravatar */
+		download_gravatar (0);
+#endif /* HAVE_LIBSOUP */
 	}
 
 	gtk_widget_destroy (GTK_WIDGET (chooser_dialog));
Index: capplets/about-me/Makefile.am
===================================================================
--- capplets/about-me/Makefile.am	(revision 9213)
+++ capplets/about-me/Makefile.am	(working copy)
@@ -28,7 +28,7 @@
 pixmapdir = $(pkgdatadir)/pixmaps
 pixmap_DATA = $(pixmap_files)
 
-gnome_about_me_LDADD = $(GNOMECC_CAPPLETS_LIBS) $(LIBEBOOK_LIBS) $(POLKIT_GNOME_LIBS)
+gnome_about_me_LDADD = $(GNOMECC_CAPPLETS_LIBS) $(LIBEBOOK_LIBS) $(POLKIT_GNOME_LIBS) $(LIBSOUP_LIBS)
 gnome_about_me_LDFLAGS = -export-dynamic
 
 @INTLTOOL_DESKTOP_RULE@
@@ -43,6 +43,7 @@
 	$(GNOMECC_CAPPLETS_CFLAGS) \
 	$(LIBEBOOK_CFLAGS) \
 	$(POLKIT_GNOME_CFLAGS) \
+	$(LIBSOUP_CFLAGS) \
 	-DDATADIR="\"$(datadir)\"" \
 	-DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \
 	-DGNOMECC_GLADE_DIR="\"$(gladedir)\"" \
