[evolution] Add "image-loading-policy" setting.



commit 69cf1ede0d8dbeee486fd3693fba42f2ccea8bf6
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sun Mar 10 20:11:48 2013 -0400

    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 c3e26f3..59914ce 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 f7b21ae..b42952f 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]