aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSrinivasa Ragavan <sragavan@src.gnome.org>2007-04-03 17:12:29 +0800
committerSrinivasa Ragavan <sragavan@src.gnome.org>2007-04-03 17:12:29 +0800
commit8a5e6ecc960889f624419b0e88dbb231a4b667cc (patch)
tree7f653be6e7e6fa6d0dafee82183bca147f3f6741
parent8de35f87c2ba48047d8677f4035c9415a500f6d8 (diff)
downloadgsoc2013-evolution-8a5e6ecc960889f624419b0e88dbb231a4b667cc.tar
gsoc2013-evolution-8a5e6ecc960889f624419b0e88dbb231a4b667cc.tar.gz
gsoc2013-evolution-8a5e6ecc960889f624419b0e88dbb231a4b667cc.tar.bz2
gsoc2013-evolution-8a5e6ecc960889f624419b0e88dbb231a4b667cc.tar.lz
gsoc2013-evolution-8a5e6ecc960889f624419b0e88dbb231a4b667cc.tar.xz
gsoc2013-evolution-8a5e6ecc960889f624419b0e88dbb231a4b667cc.tar.zst
gsoc2013-evolution-8a5e6ecc960889f624419b0e88dbb231a4b667cc.zip
Committing reworked SA with options in the plugin.
svn path=/trunk/; revision=33366
-rw-r--r--plugins/sa-junk-plugin/ChangeLog9
-rw-r--r--plugins/sa-junk-plugin/em-junk-filter.c45
-rw-r--r--plugins/sa-junk-plugin/org-gnome-sa-junk-plugin.eplug.xml14
3 files changed, 65 insertions, 3 deletions
diff --git a/plugins/sa-junk-plugin/ChangeLog b/plugins/sa-junk-plugin/ChangeLog
index 24278d53b3..e55b01c320 100644
--- a/plugins/sa-junk-plugin/ChangeLog
+++ b/plugins/sa-junk-plugin/ChangeLog
@@ -1,3 +1,12 @@
+2007-04-03 Srinivasa Ragavan <sragavan@novell.com>
+
+ Added few more plugin callbacks and moved the UI options from core
+ mail to plugin.
+
+ * em-junk-filter.c: (em_junk_sa_validate_binary),
+ (use_remote_tests_cb), (org_gnome_sa_use_remote_tests):
+ * org-gnome-sa-junk-plugin.eplug.xml:
+
2007-04-03 Matthew Barnes <mbarnes@redhat.com>
* em-junk-filter.c (em_junk_sa_get_name):
diff --git a/plugins/sa-junk-plugin/em-junk-filter.c b/plugins/sa-junk-plugin/em-junk-filter.c
index 68ab67472b..ad5cd3c334 100644
--- a/plugins/sa-junk-plugin/em-junk-filter.c
+++ b/plugins/sa-junk-plugin/em-junk-filter.c
@@ -47,6 +47,9 @@
#include <mail/em-utils.h>
#include <e-util/e-mktemp.h>
+#include <gtk/gtk.h>
+#include "mail/em-config.h"
+
#include <gconf/gconf-client.h>
#define d(x) (camel_debug("junk")?(x):0)
@@ -62,6 +65,8 @@ gboolean em_junk_sa_check_junk (EPlugin *ep, EMJunkHookTarget *target);
void em_junk_sa_report_junk (EPlugin *ep, EMJunkHookTarget *target);
void em_junk_sa_report_non_junk (EPlugin *ep, EMJunkHookTarget *target);
void em_junk_sa_commit_reports (EPlugin *ep, EMJunkHookTarget *target);
+gboolean em_junk_sa_validate_binary (EPlugin *ep, EMJunkHookTarget *target);
+
static void em_junk_sa_init (void);
static void em_junk_sa_finalize (void);
static void em_junk_sa_kill_spamd (void);
@@ -709,6 +714,12 @@ em_junk_sa_commit_reports (EPlugin *ep, EMJunkHookTarget *target)
}
}
+gboolean
+em_junk_sa_validate_binary (EPlugin *ep, EMJunkHookTarget *target)
+{
+ return em_junk_sa_is_available ();
+}
+
static void
em_junk_sa_setting_notify(GConfClient *gconf, guint cnxn_id, GConfEntry *entry, void *data)
{
@@ -815,3 +826,37 @@ em_junk_sa_finalize (void)
g_object_unref(em_junk_sa_gconf);
em_junk_sa_kill_spamd ();
}
+
+static void
+use_remote_tests_cb (GtkWidget *widget, gpointer data)
+{
+ gboolean active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
+ gconf_client_set_bool (em_junk_sa_gconf, data, active, NULL);
+}
+
+GtkWidget *
+org_gnome_sa_use_remote_tests (struct _EPlugin *epl, struct _EConfigHookItemFactoryData *data)
+{
+ GtkWidget *check, *vbox, *label;
+ char *text = g_strdup_printf (" <small>%s</small>", _("This will make Spamassasin more reliable, but slower"));
+ guint i = ((GtkTable *)data->parent)->nrows;
+
+ if (data->old)
+ return data->old;
+
+ check = gtk_check_button_new_with_mnemonic (_("I_nclude remote tests"));
+ label = gtk_label_new (NULL);
+ gtk_label_set_markup (label, text);
+ g_free (text);
+ vbox = gtk_vbox_new (FALSE, 2);
+ gtk_box_pack_start (vbox, check, FALSE, FALSE, 0);
+ gtk_box_pack_start (vbox, label, FALSE, FALSE, 0);
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), em_junk_sa_local_only);
+ g_signal_connect (GTK_TOGGLE_BUTTON (check), "toggled", G_CALLBACK (use_remote_tests_cb), "/apps/evolution/mail/junk/sa/local_only");
+ gtk_table_attach((GtkTable *)data->parent, vbox, 0, 1, i, i+1, 0, 0, 0, 0);
+ gtk_widget_show_all (vbox);
+ return (GtkWidget *)vbox;
+}
+
+
diff --git a/plugins/sa-junk-plugin/org-gnome-sa-junk-plugin.eplug.xml b/plugins/sa-junk-plugin/org-gnome-sa-junk-plugin.eplug.xml
index a0688f7fd9..6b2489744c 100644
--- a/plugins/sa-junk-plugin/org-gnome-sa-junk-plugin.eplug.xml
+++ b/plugins/sa-junk-plugin/org-gnome-sa-junk-plugin.eplug.xml
@@ -6,13 +6,21 @@
<_description>Filters junk messages using SpamAssassin. This plugin requires SpamAssassin to be installed.</_description>
<author name="Vivek Jain" email="jvivek@novell.com"/>
<hook class="org.gnome.evolution.mail.junk:1.0">
- <group id="EMJunk">
- <item
+ <group id="EMJunk" >
+ <item name="Spamassasin"
check_junk="em_junk_sa_check_junk"
report_junk="em_junk_sa_report_junk"
report_non_junk="em_junk_sa_report_non_junk"
- commit_reports="em_junk_sa_commit_reports"/>
+ commit_reports="em_junk_sa_commit_reports"
+ validate_binary="em_junk_sa_validate_binary"/>
</group>
</hook>
+ <!-- hook into the 'mail properties' menu -->
+ <hook class="org.gnome.evolution.mail.config:1.0">
+ <group target="prefs" id="org.gnome.evolution.mail.prefs">
+ <item type="section_table" path="40.junk/10.options" label="Spamassassin Options"/>
+ <item type="item_table" path="40.junk/20.options" factory="org_gnome_sa_use_remote_tests"/>
+ </group>
+ </hook>
</e-plugin>
</e-plugin-list>