[evolution/wip/webkit2] Bug 755418 - Add option to not notify about missing remote content



commit 4b223d2267c116e962c6611e647433a268a835bd
Author: Milan Crha <mcrha redhat com>
Date:   Tue Nov 3 19:08:18 2015 +0100

    Bug 755418 - Add option to not notify about missing remote content

 data/org.gnome.evolution.mail.gschema.xml.in |    5 +++++
 mail/e-mail-display.c                        |    4 ++++
 mail/e-mail-reader.c                         |   26 ++++++++++++++++++++++++++
 mail/mail-config.ui                          |   16 ++++++++++++++++
 modules/mail/em-mailer-prefs.c               |    6 ++++++
 5 files changed, 57 insertions(+), 0 deletions(-)
---
diff --git a/data/org.gnome.evolution.mail.gschema.xml.in b/data/org.gnome.evolution.mail.gschema.xml.in
index 004d08d..bee0845 100644
--- a/data/org.gnome.evolution.mail.gschema.xml.in
+++ b/data/org.gnome.evolution.mail.gschema.xml.in
@@ -249,6 +249,11 @@
       <default>'never'</default>
       <_summary>Automatically load images for HTML messages over HTTP</_summary>
     </key>
+    <key name="notify-remote-content" type="b">
+      <default>true</default>
+      <_summary>Show notification about missing remote content</_summary>
+      <_description>When the message preview shows a message which requires to download remote content, 
while the download is not allowed for the user or the site, then show a notification about it on top of the 
preview panel.</_description>
+    </key>
     <key name="animate-images" type="b">
       <default>true</default>
       <_summary>Show Animations</_summary>
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c
index 2811eed..8a6e682 100644
--- a/mail/e-mail-display.c
+++ b/mail/e-mail-display.c
@@ -155,6 +155,10 @@ e_mail_display_claim_skipped_uri (EMailDisplay *mail_display,
        g_return_if_fail (E_IS_MAIL_DISPLAY (mail_display));
        g_return_if_fail (uri != NULL);
 
+       /* Do not store anything if the user doesn't want to see the notification */
+       if (!g_settings_get_boolean (mail_display->priv->settings, "notify-remote-content"))
+               return;
+
        soup_uri = soup_uri_new (uri);
        if (!soup_uri)
                return;
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 48a7589..16549cf 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -5306,6 +5306,24 @@ e_mail_reader_remote_content_menu_activate_cb (GObject *item,
 }
 
 static void
+e_mail_reader_remote_content_disable_activate_cb (GObject *item,
+                                                 EMailReader *reader)
+{
+       EMailDisplay *mail_display;
+       GSettings *settings;
+
+       g_return_if_fail (E_IS_MAIL_READER (reader));
+
+       settings = e_util_ref_settings ("org.gnome.evolution.mail");
+       g_settings_set_boolean (settings, "notify-remote-content", FALSE);
+       g_clear_object (&settings);
+
+       mail_display = e_mail_reader_get_mail_display (reader);
+       if (mail_display)
+               e_mail_display_reload (mail_display);
+}
+
+static void
 e_mail_reader_add_remote_content_menu_item (EMailReader *reader,
                                            GtkWidget *popup_menu,
                                            const gchar *label,
@@ -5388,6 +5406,14 @@ e_mail_reader_show_remote_content_popup (EMailReader *reader,
 
        if (popup_menu) {
                GtkWidget *box = gtk_widget_get_parent (GTK_WIDGET (toggle_button));
+               GtkWidget *item;
+
+               item = gtk_separator_menu_item_new ();
+               gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item);
+
+               item = gtk_menu_item_new_with_label (_("Do not show this message again"));
+               gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item);
+               g_signal_connect (item, "activate", G_CALLBACK 
(e_mail_reader_remote_content_disable_activate_cb), reader);
 
                gtk_toggle_button_set_active (toggle_button, TRUE);
 
diff --git a/mail/mail-config.ui b/mail/mail-config.ui
index 49f7732..c5edf9b 100644
--- a/mail/mail-config.ui
+++ b/mail/mail-config.ui
@@ -2390,6 +2390,22 @@
                         <property name="position">2</property>
                       </packing>
                     </child>
+                    <child>
+                      <object class="GtkCheckButton" id="chkNotifyRemoteContent">
+                        <property name="label" translatable="yes">Notify about _missing remote content in 
the message preview</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="xalign">0.5</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">3</property>
+                      </packing>
+                    </child>
                   </object>
                 </child>
               </object>
diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c
index 24a92c2..de6ba47 100644
--- a/modules/mail/em-mailer-prefs.c
+++ b/modules/mail/em-mailer-prefs.c
@@ -1352,6 +1352,12 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs,
                widget, "toggled",
                G_CALLBACK (image_loading_policy_always_cb), NULL);
 
+       widget = e_builder_get_widget (prefs->priv->builder, "chkNotifyRemoteContent");
+       g_settings_bind (
+               settings, "notify-remote-content",
+               widget, "active",
+               G_SETTINGS_BIND_DEFAULT);
+
        widget = e_builder_get_widget (prefs->priv->builder, "chkShowAnimatedImages");
        g_settings_bind (
                settings, "show-animated-images",


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