diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-03-11 08:11:48 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-03-17 20:49:12 +0800 |
commit | 69cf1ede0d8dbeee486fd3693fba42f2ccea8bf6 (patch) | |
tree | 77a2f75d2abf1f1c030bac6ec5c568f1af33d04b | |
parent | 54bb7dd76c8c698eb69bd7460cf74551c182b439 (diff) | |
download | gsoc2013-evolution-69cf1ede0d8dbeee486fd3693fba42f2ccea8bf6.tar gsoc2013-evolution-69cf1ede0d8dbeee486fd3693fba42f2ccea8bf6.tar.gz gsoc2013-evolution-69cf1ede0d8dbeee486fd3693fba42f2ccea8bf6.tar.bz2 gsoc2013-evolution-69cf1ede0d8dbeee486fd3693fba42f2ccea8bf6.tar.lz gsoc2013-evolution-69cf1ede0d8dbeee486fd3693fba42f2ccea8bf6.tar.xz gsoc2013-evolution-69cf1ede0d8dbeee486fd3693fba42f2ccea8bf6.tar.zst gsoc2013-evolution-69cf1ede0d8dbeee486fd3693fba42f2ccea8bf6.zip |
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.
-rw-r--r-- | data/org.gnome.evolution.mail.gschema.xml.in | 24 | ||||
-rw-r--r-- | 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 @@ <value nick='outlook' value='3'/> </enum> + <!-- Keep this synchronized with EMailImageLoadingPolicy. --> + <enum id="org.gnome.evolution.mail.ImageLoadingPolicy"> + <value nick='never' value='0'/> + <value nick='sometimes' value='1'/> + <value nick='always' value='2'/> + </enum> + <schema gettext-domain="evolution" id="org.gnome.evolution.mail" path="/org/gnome/evolution/mail/"> <key name="prompt-check-if-default-mailer" type="b"> <default>true</default> @@ -201,15 +208,9 @@ <_summary>Default charset in which to display messages</_summary> <_description>Default charset in which to display messages.</_description> </key> - <key name="load-http-images" type="i"> - <default>0</default> - <_summary>Load images for HTML messages over HTTP</_summary> - <_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. - </_description> + <key name="image-loading-policy" enum="org.gnome.evolution.mail.ImageLoadingPolicy"> + <default>'never'</default> + <_summary>Automatically load images for HTML messages over HTTP</_summary> </key> <key name="animate-images" type="b"> <default>true</default> @@ -563,6 +564,11 @@ <_summary>(Deprecated) Default reply style</_summary> <_description>This key was deprecated in version 3.10 and should no longer be used. Use "reply-style-name" instead.</_description> </key> + <key name="load-http-images" type="i"> + <default>0</default> + <_summary>(Deprecated) Load images for HTML messages over HTTP</_summary> + <_description>This key was deprecated in version 3.10 and should no longer be used. Use "image-loading-policy" instead.</_description> + </key> </schema> 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. */ @@ -207,6 +208,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) { ESettingsDeprecatedPrivate *priv; @@ -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 |