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.
This commit is contained in:
Matthew Barnes
2013-03-10 20:11:48 -04:00
parent 54bb7dd76c
commit 69cf1ede0d
2 changed files with 42 additions and 9 deletions

View File

@ -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>

View File

@ -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