From 69cf1ede0d8dbeee486fd3693fba42f2ccea8bf6 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 10 Mar 2013 20:11:48 -0400 Subject: Add "image-loading-policy" setting. Replaces the "load-http-images" setting, which is now deprecated. The new setting uses an enum type compatible with EMailImageLoadingPolicy. --- data/org.gnome.evolution.mail.gschema.xml.in | 24 +++++++++++++++--------- modules/settings/e-settings-deprecated.c | 27 +++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 9 deletions(-) diff --git a/data/org.gnome.evolution.mail.gschema.xml.in b/data/org.gnome.evolution.mail.gschema.xml.in index c3e26f313c..59914ce09f 100644 --- a/data/org.gnome.evolution.mail.gschema.xml.in +++ b/data/org.gnome.evolution.mail.gschema.xml.in @@ -15,6 +15,13 @@ + + + + + + + true @@ -201,15 +208,9 @@ <_summary>Default charset in which to display messages <_description>Default charset in which to display messages. - - 0 - <_summary>Load images for HTML messages over HTTP - <_description> - Load images for HTML messages over HTTP(S). Possible values are: - "0" - Never load images off the net. - "1" - Load images in messages from contacts. - "2" - Always load images off the net. - + + 'never' + <_summary>Automatically load images for HTML messages over HTTP true @@ -563,6 +564,11 @@ <_summary>(Deprecated) Default reply style <_description>This key was deprecated in version 3.10 and should no longer be used. Use "reply-style-name" instead. + + 0 + <_summary>(Deprecated) Load images for HTML messages over HTTP + <_description>This key was deprecated in version 3.10 and should no longer be used. Use "image-loading-policy" instead. + diff --git a/modules/settings/e-settings-deprecated.c b/modules/settings/e-settings-deprecated.c index f7b21ae573..b42952f67c 100644 --- a/modules/settings/e-settings-deprecated.c +++ b/modules/settings/e-settings-deprecated.c @@ -44,6 +44,7 @@ struct _ESettingsDeprecatedPrivate { GSettings *mail_settings; gulong forward_style_name_handler_id; gulong reply_style_name_handler_id; + gulong image_loading_policy_handler_id; }; /* Flag values used in the "working-days" key. */ @@ -206,6 +207,16 @@ settings_deprecated_reply_style_name_cb (GSettings *settings, } } +static void +settings_deprecated_image_loading_policy_cb (GSettings *settings, + const gchar *key) +{ + EMailImageLoadingPolicy policy; + + policy = g_settings_get_enum (settings, "image-loading-policy"); + g_settings_set_int (settings, "load-http-images", policy); +} + static void settings_deprecated_dispose (GObject *object) { @@ -283,6 +294,13 @@ settings_deprecated_dispose (GObject *object) priv->reply_style_name_handler_id = 0; } + if (priv->image_loading_policy_handler_id > 0) { + g_signal_handler_disconnect ( + priv->mail_settings, + priv->image_loading_policy_handler_id); + priv->image_loading_policy_handler_id = 0; + } + g_clear_object (&priv->calendar_settings); g_clear_object (&priv->mail_settings); @@ -372,6 +390,11 @@ settings_deprecated_constructed (GObject *object) break; } + int_value = g_settings_get_int ( + priv->mail_settings, "load-http-images"); + g_settings_set_enum ( + priv->mail_settings, "image-loading-policy", int_value); + /* Write changes back to the deprecated keys. */ handler_id = g_signal_connect ( @@ -423,6 +446,10 @@ settings_deprecated_constructed (GObject *object) priv->mail_settings, "changed::reply-style-name", G_CALLBACK (settings_deprecated_reply_style_name_cb), NULL); priv->reply_style_name_handler_id = handler_id; + + handler_id = g_signal_connect ( + priv->mail_settings, "changed::image-loading-policy", + G_CALLBACK (settings_deprecated_image_loading_policy_cb), NULL); } static void -- cgit v1.2.3