diff -up evolution-3.12.11/data/org.gnome.evolution.mail.gschema.xml.in.gravatar-disable evolution-3.12.11/data/org.gnome.evolution.mail.gschema.xml.in --- evolution-3.12.11/data/org.gnome.evolution.mail.gschema.xml.in.gravatar-disable 2014-03-24 10:25:23.000000000 +0100 +++ evolution-3.12.11/data/org.gnome.evolution.mail.gschema.xml.in 2016-03-21 12:54:43.784212096 +0100 @@ -229,6 +229,11 @@ <_summary>Show photo of the sender <_description>Show the photo of the sender in the message reading pane. + + false + <_summary>Search gravatar.com for photo of the sender + <_description>Allow searching also at gravatar.com for photo of the sender. + true <_summary>Mark as Seen after specified timeout diff -up evolution-3.12.11/mail/mail-config.ui.gravatar-disable evolution-3.12.11/mail/mail-config.ui --- evolution-3.12.11/mail/mail-config.ui.gravatar-disable 2014-03-24 10:25:23.000000000 +0100 +++ evolution-3.12.11/mail/mail-config.ui 2016-03-21 12:54:43.785212089 +0100 @@ -2318,6 +2318,22 @@ 0 + + + Search gra_vatar.com for the photograph of sender + True + True + False + True + 0.5 + True + + + False + False + 1 + + diff -up evolution-3.12.11/modules/gravatar/e-gravatar-photo-source.c.gravatar-disable evolution-3.12.11/modules/gravatar/e-gravatar-photo-source.c --- evolution-3.12.11/modules/gravatar/e-gravatar-photo-source.c.gravatar-disable 2014-03-24 10:25:23.000000000 +0100 +++ evolution-3.12.11/modules/gravatar/e-gravatar-photo-source.c 2016-03-21 12:54:43.785212089 +0100 @@ -24,7 +24,17 @@ (G_TYPE_INSTANCE_GET_PRIVATE \ ((obj), E_TYPE_GRAVATAR_PHOTO_SOURCE, EGravatarPhotoSourcePrivate)) -#define AVATAR_BASE_URI "http://www.gravatar.com/avatar/" +#define AVATAR_BASE_URI "https://secure.gravatar.com/avatar/" + +struct _EGravatarPhotoSourcePrivate +{ + gboolean enabled; +}; + +enum { + PROP_0, + PROP_ENABLED +}; typedef struct _AsyncContext AsyncContext; @@ -68,6 +78,11 @@ gravatar_photo_source_get_photo_thread ( gchar *uri; GError *local_error = NULL; + g_return_if_fail (E_IS_GRAVATAR_PHOTO_SOURCE (source_object)); + + if (!e_gravatar_photo_source_get_enabled (E_GRAVATAR_PHOTO_SOURCE (source_object))) + return; + async_context = g_simple_async_result_get_op_res_gpointer (simple); hash = e_gravatar_get_hash (async_context->email_address); @@ -191,8 +206,61 @@ gravatar_photo_source_get_photo_finish ( } static void +gravatar_photo_source_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + case PROP_ENABLED: + e_gravatar_photo_source_set_enabled ( + E_GRAVATAR_PHOTO_SOURCE (object), + g_value_get_boolean (value)); + return; + } + + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +} + +static void +gravatar_photo_source_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + case PROP_ENABLED: + g_value_set_boolean ( + value, + e_gravatar_photo_source_get_enabled ( + E_GRAVATAR_PHOTO_SOURCE (object))); + return; + } + + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +} + +static void e_gravatar_photo_source_class_init (EGravatarPhotoSourceClass *class) { + GObjectClass *object_class; + + g_type_class_add_private (class, sizeof (EGravatarPhotoSourcePrivate)); + + object_class = G_OBJECT_CLASS (class); + object_class->set_property = gravatar_photo_source_set_property; + object_class->get_property = gravatar_photo_source_get_property; + + g_object_class_install_property ( + object_class, + PROP_ENABLED, + g_param_spec_boolean ( + "enabled", + "Enabled", + "Whether can search for contact photos", + FALSE, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); } static void @@ -210,6 +278,17 @@ e_gravatar_photo_source_interface_init ( static void e_gravatar_photo_source_init (EGravatarPhotoSource *photo_source) { + GSettings *settings; + + photo_source->priv = E_GRAVATAR_PHOTO_SOURCE_GET_PRIVATE (photo_source); + + settings = g_settings_new ("org.gnome.evolution.mail"); + + g_settings_bind (settings, "search-gravatar-for-photo", + photo_source, "enabled", + G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY); + + g_object_unref (settings); } void @@ -243,3 +322,24 @@ e_gravatar_get_hash (const gchar *email_ return hash; } +gboolean +e_gravatar_photo_source_get_enabled (EGravatarPhotoSource *photo_source) +{ + g_return_val_if_fail (E_IS_GRAVATAR_PHOTO_SOURCE (photo_source), FALSE); + + return photo_source->priv->enabled; +} + +void +e_gravatar_photo_source_set_enabled (EGravatarPhotoSource *photo_source, + gboolean enabled) +{ + g_return_if_fail (E_IS_GRAVATAR_PHOTO_SOURCE (photo_source)); + + if ((photo_source->priv->enabled ? 1 : 0) == (enabled ? 1 : 0)) + return; + + photo_source->priv->enabled = enabled; + + g_object_notify (G_OBJECT (photo_source), "enabled"); +} diff -up evolution-3.12.11/modules/gravatar/e-gravatar-photo-source.h.gravatar-disable evolution-3.12.11/modules/gravatar/e-gravatar-photo-source.h --- evolution-3.12.11/modules/gravatar/e-gravatar-photo-source.h.gravatar-disable 2014-03-24 10:25:23.000000000 +0100 +++ evolution-3.12.11/modules/gravatar/e-gravatar-photo-source.h 2016-03-21 12:54:43.785212089 +0100 @@ -60,6 +60,11 @@ void e_gravatar_photo_source_type_regis (GTypeModule *type_module); EPhotoSource * e_gravatar_photo_source_new (void); gchar * e_gravatar_get_hash (const gchar *email_address); +gboolean e_gravatar_photo_source_get_enabled + (EGravatarPhotoSource *photo_source); +void e_gravatar_photo_source_set_enabled + (EGravatarPhotoSource *photo_source, + gboolean enabled); G_END_DECLS diff -up evolution-3.12.11/modules/mail/em-mailer-prefs.c.gravatar-disable evolution-3.12.11/modules/mail/em-mailer-prefs.c --- evolution-3.12.11/modules/mail/em-mailer-prefs.c.gravatar-disable 2014-06-06 12:03:31.000000000 +0200 +++ evolution-3.12.11/modules/mail/em-mailer-prefs.c 2016-03-21 12:54:43.785212089 +0100 @@ -1066,6 +1066,16 @@ em_mailer_prefs_construct (EMMailerPrefs widget, "active", G_SETTINGS_BIND_DEFAULT); + widget = e_builder_get_widget (prefs->builder, "search_gravatar"); + g_settings_bind ( + settings, "search-gravatar-for-photo", + widget, "active", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind ( + settings, "show-sender-photo", + widget, "sensitive", + G_SETTINGS_BIND_GET); + /* always de-sensitised until the user types something in the entry */ prefs->add_header = GTK_BUTTON (e_builder_get_widget (prefs->builder, "cmdHeadersAdd")); gtk_widget_set_sensitive ((GtkWidget *) prefs->add_header, FALSE);