Blame SOURCES/evolution-3.12.11-gravatar-disable.patch

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