aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorSrinivasa Ragavan <sragavan@src.gnome.org>2007-04-03 17:14:16 +0800
committerSrinivasa Ragavan <sragavan@src.gnome.org>2007-04-03 17:14:16 +0800
commit1e8c2df476794bcb93962ec65ccbe5e1e8e33f66 (patch)
tree03e885101854c1ce0d98aa9b005c856cce421c4c /mail
parent8a5e6ecc960889f624419b0e88dbb231a4b667cc (diff)
downloadgsoc2013-evolution-1e8c2df476794bcb93962ec65ccbe5e1e8e33f66.tar
gsoc2013-evolution-1e8c2df476794bcb93962ec65ccbe5e1e8e33f66.tar.gz
gsoc2013-evolution-1e8c2df476794bcb93962ec65ccbe5e1e8e33f66.tar.bz2
gsoc2013-evolution-1e8c2df476794bcb93962ec65ccbe5e1e8e33f66.tar.lz
gsoc2013-evolution-1e8c2df476794bcb93962ec65ccbe5e1e8e33f66.tar.xz
gsoc2013-evolution-1e8c2df476794bcb93962ec65ccbe5e1e8e33f66.tar.zst
gsoc2013-evolution-1e8c2df476794bcb93962ec65ccbe5e1e8e33f66.zip
Add pluggable junk filter code and move SA options to the plugins.
svn path=/trunk/; revision=33367
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog27
-rw-r--r--mail/em-folder-browser.c2
-rw-r--r--mail/em-folder-view.c2
-rw-r--r--mail/em-junk-hook.c13
-rw-r--r--mail/em-junk-hook.h2
-rw-r--r--mail/em-mailer-prefs.c162
-rw-r--r--mail/em-mailer-prefs.h6
-rw-r--r--mail/evolution-mail.schemas.in.in58
-rw-r--r--mail/mail-component.c30
-rw-r--r--mail/mail-config.glade300
-rw-r--r--mail/mail-session.c30
-rw-r--r--mail/mail-session.h4
12 files changed, 446 insertions, 190 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index b3cfbc2d1b..edc0006f28 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,30 @@
+2007-04-03 Srinivasa Ragavan <sragavan@novell.com>
+
+ Reworked the SPAM plugins with more UI options and support for
+ multiple plugins.
+
+ * em-folder-view.c:
+ * em-junk-hook.c: (emjh_construct_item), (emjh_construct):
+ * em-junk-hook.h:
+ * em-mailer-prefs.c: (junk_days_activate), (emmp_empty_junk_init),
+ (junk_plugin_changed), (junk_plugin_setup),
+ (create_combo_text_widget), (em_mailer_prefs_construct):
+ * em-mailer-prefs.h:
+ * evolution-mail.schemas.in.in:
+ * mail-component.c: (impl_createView), (mc_quit_delete),
+ (impl_quit):
+ * mail-config.glade:
+ * mail-session.c: (init), (mail_session_add_junk_plugin),
+ (mail_session_get_junk_plugins):
+ * mail-session.h:
+
+2007-04-03 Srinivasa Ragavan <sragavan@novell.com>
+
+ ** Fix for bug #411331
+
+ * em-folder-browser.c: (emfb_gui_folder_changed): Fix the message
+ selection.
+
2007-04-03 Matthew Barnes <mbarnes@redhat.com>
* evolution-mail.schemas.in.in:
diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c
index 267341c7fc..e24cb2e3a0 100644
--- a/mail/em-folder-browser.c
+++ b/mail/em-folder-browser.c
@@ -1709,7 +1709,7 @@ emfb_gui_folder_changed(CamelFolder *folder, void *dummy, EMFolderBrowser *emfb)
mi = camel_folder_get_message_info(emfb->view.folder, emfb->priv->select_uid);
if (mi) {
camel_folder_free_message_info(emfb->view.folder, mi);
- em_folder_view_set_message(&emfb->view, emfb->priv->select_uid, TRUE);
+ em_folder_view_set_message(&emfb->view, emfb->priv->select_uid, FALSE);
g_free (emfb->priv->select_uid);
emfb->priv->select_uid = NULL;
}
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index 7246895f99..0ec83e1df0 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -1882,7 +1882,7 @@ static const EMFolderViewEnable emfv_enable_map[] = {
{ "MessageMarkAsImportant", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_MARK_IMPORTANT },
{ "MessageMarkAsUnimportant", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_MARK_UNIMPORTANT },
{ "MessageMarkAsJunk", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_JUNK },
- { "MessageMarkAsNotJunk", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_NOT_JUNK },
+ { "MessageMarkAsNotJunk", EM_POPUP_SELECT_MANY },
{ "MessageFollowUpFlag", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_FLAG_FOLLOWUP },
{ "MessageFollowUpComplete", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_FLAG_COMPLETED },
{ "MessageFollowUpClear", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_FLAG_CLEAR },
diff --git a/mail/em-junk-hook.c b/mail/em-junk-hook.c
index b02bc4cb59..52fa280588 100644
--- a/mail/em-junk-hook.c
+++ b/mail/em-junk-hook.c
@@ -187,13 +187,16 @@ emjh_construct_item(EPluginHook *eph, EMJunkHookGroup *group, xmlNodePtr root)
item->report_junk = e_plugin_xml_prop(root, "report_junk");
item->report_non_junk = e_plugin_xml_prop(root, "report_non_junk");
item->commit_reports = e_plugin_xml_prop(root, "commit_reports");
+ item->validate_binary = e_plugin_xml_prop(root, "validate_binary");
+
+ item->plugin_name = e_plugin_xml_prop(root, "name");
item->hook = emjh;
if (item->check_junk == NULL || item->report_junk == NULL || item->report_non_junk == NULL || item->commit_reports == NULL)
goto error;
- /* assign the plugin to the session*/
- session->junk_plugin = CAMEL_JUNK_PLUGIN (&(item->csp));
+ /* Add the plugin to the session plugin list*/
+ mail_session_add_junk_plugin (item->plugin_name, CAMEL_JUNK_PLUGIN (&(item->csp)));
return item;
error:
@@ -242,15 +245,14 @@ static int
emjh_construct(EPluginHook *eph, EPlugin *ep, xmlNodePtr root)
{
xmlNodePtr node;
- static gboolean loaded = FALSE;
d(printf("loading junk hook\n"));
if (((EPluginHookClass *)emjh_parent_class)->construct(eph, ep, root) == -1)
return -1;
- if (!ep->enabled || loaded) {
- g_warning ("ignored this junk plugin: not enabled or we have already loaded one");
+ if (!ep->enabled) {
+ g_warning ("ignored this junk plugin: not enabled");
return -1;
}
@@ -268,7 +270,6 @@ emjh_construct(EPluginHook *eph, EPlugin *ep, xmlNodePtr root)
}
eph->plugin = ep;
- loaded = TRUE;
return 0;
}
diff --git a/mail/em-junk-hook.h b/mail/em-junk-hook.h
index 378277b3f9..df043fc1d6 100644
--- a/mail/em-junk-hook.h
+++ b/mail/em-junk-hook.h
@@ -54,6 +54,8 @@ struct _EMJunkHookItem {
char *report_junk;
char *report_non_junk;
char *commit_reports;
+ char *validate_binary;
+ char *plugin_name;
};
struct _EMJunkHookGroup {
diff --git a/mail/em-mailer-prefs.c b/mail/em-mailer-prefs.c
index 064ef1256a..d724223e88 100644
--- a/mail/em-mailer-prefs.c
+++ b/mail/em-mailer-prefs.c
@@ -57,12 +57,16 @@
#include "e-util/e-util-private.h"
#include "mail-config.h"
+#include "em-junk-hook.h"
#include "em-config.h"
+#include "mail-session.h"
static void em_mailer_prefs_class_init (EMMailerPrefsClass *class);
static void em_mailer_prefs_init (EMMailerPrefs *dialog);
static void em_mailer_prefs_finalise (GObject *obj);
+GtkWidget * create_combo_text_widget ();
+
static GtkVBoxClass *parent_class = NULL;
enum {
@@ -632,6 +636,47 @@ emmp_empty_trash_init (EMMailerPrefs *prefs)
}
static void
+junk_days_activate (GtkWidget *item, EMMailerPrefs *prefs)
+{
+ int days;
+
+ days = GPOINTER_TO_INT (g_object_get_data ((GObject *) item, "days"));
+ gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/junk/empty_on_exit_days", days, NULL);
+}
+
+static void
+emmp_empty_junk_init (EMMailerPrefs *prefs)
+{
+ int locked, days, hist = 0, i;
+ GtkWidget *menu, *item;
+
+ toggle_button_init (prefs, prefs->empty_junk, FALSE,
+ "/apps/evolution/mail/junk/empty_on_exit",
+ G_CALLBACK (toggle_button_toggled));
+
+ days = gconf_client_get_int(prefs->gconf, "/apps/evolution/mail/junk/empty_on_exit_days", NULL);
+ menu = gtk_menu_new();
+ for (i = 0; i < G_N_ELEMENTS (empty_trash_frequency); i++) {
+ if (days >= empty_trash_frequency[i].days)
+ hist = i;
+
+ item = gtk_menu_item_new_with_label (_(empty_trash_frequency[i].label));
+ g_object_set_data ((GObject *) item, "days", GINT_TO_POINTER (empty_trash_frequency[i].days));
+ g_signal_connect (item, "activate", G_CALLBACK (junk_days_activate), prefs);
+
+ gtk_widget_show (item);
+ gtk_menu_shell_append((GtkMenuShell *)menu, item);
+ }
+
+ gtk_widget_show(menu);
+ gtk_option_menu_set_menu((GtkOptionMenu *)prefs->empty_junk_days, menu);
+ gtk_option_menu_set_history((GtkOptionMenu *)prefs->empty_junk_days, hist);
+
+ locked = !gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/junk/empty_on_exit_days", NULL);
+ gtk_widget_set_sensitive ((GtkWidget *) prefs->empty_junk_days, !locked);
+}
+
+static void
http_images_changed (GtkWidget *widget, EMMailerPrefs *prefs)
{
int when;
@@ -646,6 +691,7 @@ http_images_changed (GtkWidget *widget, EMMailerPrefs *prefs)
gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/display/load_http_images", when, NULL);
}
+
static void
notify_type_changed (GtkWidget *widget, EMMailerPrefs *prefs)
{
@@ -713,6 +759,106 @@ emmp_free(EConfig *ec, GSList *items, void *data)
}
static void
+junk_plugin_changed (GtkWidget *combo, EMMailerPrefs *prefs)
+{
+ char *def_plugin = gtk_combo_box_get_active_text(combo);
+ const GList *plugins = mail_session_get_junk_plugins();
+
+ gconf_client_set_string (prefs->gconf, "/apps/evolution/mail/junk/default_plugin", def_plugin, NULL);
+ while (plugins) {
+ struct _EMJunkHookItem *item = plugins->data;;
+
+ if (item->plugin_name && def_plugin && !strcmp (item->plugin_name, def_plugin)) {
+ gboolean status;
+ session->junk_plugin = CAMEL_JUNK_PLUGIN (&(item->csp));
+ status = e_plugin_invoke(item->hook->hook.plugin, item->validate_binary, NULL);
+ if (status) {
+ char *text, *html;
+ gtk_image_set_from_stock (prefs->plugin_image, "gtk-dialog-info", GTK_ICON_SIZE_MENU);
+ text = g_strdup_printf ("%s plugin is available and the binary is installed.", item->plugin_name);
+ html = g_strdup_printf ("<i>%s</i>", text);
+ gtk_label_set_markup (prefs->plugin_status, html);
+ g_free (html);
+ g_free (text);
+ } else {
+ char *text, *html;
+ gtk_image_set_from_stock (prefs->plugin_image, "gtk-dialog-warning", GTK_ICON_SIZE_MENU);
+ text = g_strdup_printf ("%s plugin is not available. Please check whether the package is installed.", item->plugin_name);
+ html = g_strdup_printf ("<i>%s</i>", text);
+ gtk_label_set_markup (prefs->plugin_status, html);
+ g_free (html);
+ g_free (text);
+ }
+ break;
+ }
+ plugins = plugins->next;
+ }
+}
+
+static void
+junk_plugin_setup (GtkWidget *combo, EMMailerPrefs *prefs)
+{
+ int index = 0;
+ gboolean def_set = FALSE;
+ const GList *plugins = mail_session_get_junk_plugins();
+ char *pdefault = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/junk/default_plugin", NULL);
+
+ if (!plugins || !g_list_length (plugins)) {
+ gtk_combo_box_append_text (combo, _("No Junk plugin available"));
+ gtk_combo_box_set_active (combo, 0);
+ gtk_widget_set_sensitive ((GtkWidget *) combo, FALSE);
+ gtk_widget_hide (prefs->plugin_image);
+ gtk_widget_hide (prefs->plugin_status);
+ gtk_image_set_from_stock (prefs->plugin_image, NULL, 0);
+ g_free (pdefault);
+
+ return;
+ }
+
+ while (plugins) {
+ struct _EMJunkHookItem *item = plugins->data;;
+
+ gtk_combo_box_append_text (combo, item->plugin_name);
+ if (!def_set && pdefault && item->plugin_name && !strcmp(pdefault, item->plugin_name)) {
+ gboolean status;
+
+ def_set = TRUE;
+ gtk_combo_box_set_active (combo, index);
+ status = e_plugin_invoke(item->hook->hook.plugin, item->validate_binary, NULL);
+ if (status) {
+ char *text, *html;
+ gtk_image_set_from_stock (prefs->plugin_image, "gtk-dialog-info", GTK_ICON_SIZE_MENU);
+ /* May be a better text */
+ text = g_strdup_printf ("%s plugin is available and the binary is installed.", item->plugin_name);
+ html = g_strdup_printf ("<i>%s</i>", text);
+ gtk_label_set_markup (prefs->plugin_status, html);
+ g_free (html);
+ g_free (text);
+ } else {
+ char *text, *html;
+ gtk_image_set_from_stock (prefs->plugin_image, "gtk-dialog-warning", GTK_ICON_SIZE_MENU);
+ /* May be a better text */
+ text = g_strdup_printf ("%s plugin is not available. Please check whether the package is installed.", item->plugin_name);
+ html = g_strdup_printf ("<i>%s</i>", text);
+ gtk_label_set_markup (prefs->plugin_status, html);
+ g_free (html);
+ g_free (text);
+ }
+ }
+ plugins = plugins->next;
+ index++;
+ }
+
+ g_signal_connect (combo, "changed", G_CALLBACK(junk_plugin_changed), prefs);
+ g_free (pdefault);
+}
+
+GtkWidget *
+create_combo_text_widget () {
+ return gtk_combo_box_new_text ();
+}
+
+static void
em_mailer_prefs_construct (EMMailerPrefs *prefs)
{
GSList *list, *header_config_list, *header_add_list, *p;
@@ -729,7 +875,7 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs)
EMConfigTargetPrefs *target;
GSList *l;
char *gladefile;
-
+
gladefile = g_build_filename (EVOLUTION_GLADEDIR,
"mail-config.glade",
NULL);
@@ -1048,12 +1194,16 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs)
toggle_button_init (prefs, prefs->check_incoming, FALSE,
"/apps/evolution/mail/junk/check_incoming",
G_CALLBACK (toggle_button_toggled));
-
- prefs->sa_local_tests_only = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkSALocalTestsOnly"));
- toggle_button_init (prefs, prefs->sa_local_tests_only, TRUE,
- "/apps/evolution/mail/junk/sa/local_only",
- G_CALLBACK (toggle_button_toggled_not));
+ prefs->empty_junk = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "junk_empty_check"));
+ prefs->empty_junk_days = GTK_OPTION_MENU (glade_xml_get_widget (gui, "junk_empty_combo"));
+ emmp_empty_junk_init (prefs);
+
+ prefs->default_junk_plugin = GTK_COMBO_BOX (glade_xml_get_widget (gui, "default_junk_plugin"));
+ prefs->plugin_status = GTK_LABEL (glade_xml_get_widget (gui, "plugin_status"));
+ prefs->plugin_image = GTK_IMAGE (glade_xml_get_widget (gui, "plugin_image"));
+ junk_plugin_setup (prefs->default_junk_plugin, prefs);
+
/* get our toplevel widget */
target = em_config_target_new_prefs(ec, prefs->gconf);
e_config_set_target((EConfig *)ec, (EConfigTarget *)target);
diff --git a/mail/em-mailer-prefs.h b/mail/em-mailer-prefs.h
index 9a8222a3ba..f6adc4593e 100644
--- a/mail/em-mailer-prefs.h
+++ b/mail/em-mailer-prefs.h
@@ -122,8 +122,14 @@ struct _EMMailerPrefs {
/* Junk prefs */
struct _GtkToggleButton *check_incoming;
+ struct _GtkToggleButton *empty_junk;
+ struct _GtkOptionMenu *empty_junk_days;
+
struct _GtkToggleButton *sa_local_tests_only;
struct _GtkToggleButton *sa_use_daemon;
+ struct _GtkComboBox *default_junk_plugin;
+ struct _GtkLabel *plugin_status;
+ struct _GtkImage *plugin_image;
};
struct _EMMailerPrefsClass {
diff --git a/mail/evolution-mail.schemas.in.in b/mail/evolution-mail.schemas.in.in
index 1fbbd9b25f..e2f7d41abb 100644
--- a/mail/evolution-mail.schemas.in.in
+++ b/mail/evolution-mail.schemas.in.in
@@ -870,6 +870,64 @@
</schema>
<schema>
+ <key>/schemas/apps/evolution/mail/junk/empty_on_exit</key>
+ <applyto>/apps/evolution/mail/junk/empty_on_exit</applyto>
+ <owner>evolution-mail</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Empty Junk folders on exit</short>
+ <long>
+ Empty all Junk folders when exiting Evolution.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/evolution/mail/junk/empty_on_exit_days</key>
+ <applyto>/apps/evolution/mail/junk/empty_on_exit_days</applyto>
+ <owner>evolution-mail</owner>
+ <type>int</type>
+ <default>0</default>
+ <locale name="C">
+ <short>Minimum days between emptying the junk on exit</short>
+ <long>
+ Minimum time between emptying the junk on exit, in days.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/evolution/mail/junk/empty_date</key>
+ <applyto>/apps/evolution/mail/junk/empty_date</applyto>
+ <owner>evolution-mail</owner>
+ <type>int</type>
+ <default>0</default>
+ <locale name="C">
+ <short>Last time empty junk was run</short>
+ <long>
+ The last time empty junk was run, in days since the epoch.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/evolution/mail/junk/default_plugin</key>
+ <applyto>/apps/evolution/mail/junk/default_plugin</applyto>
+ <owner>evolution-mail</owner>
+ <type>string</type>
+ <default>Spamassasin</default>
+ <locale name="C">
+ <short>The default plugin for Junk hook</short>
+ <long>
+ This is the default junk plugin, even though there are multiple plugins
+ enabled. If the default listed plugin is disabled, then it wont fall back
+ to the other available plugins.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/evolution/mail/junk/sa/local_only</key>
<applyto>/apps/evolution/mail/junk/sa/local_only</applyto>
<owner>evolution-mail</owner>
diff --git a/mail/mail-component.c b/mail/mail-component.c
index efeb17dab3..c91096eec0 100644
--- a/mail/mail-component.c
+++ b/mail/mail-component.c
@@ -702,6 +702,7 @@ impl_createView (PortableServer_Servant servant,
if ((uri = em_folder_tree_model_get_selected (priv->model))) {
em_folder_tree_set_selected ((EMFolderTree *) tree_widget, uri);
+ em_folder_view_set_folder_uri (view_widget, uri);
g_free (uri);
}
@@ -784,6 +785,24 @@ mc_quit_sync(CamelStore *store, struct _store_info *si, MailComponent *mc)
mail_sync_store(store, mc->priv->quit_expunge, mc_quit_sync_done, mc);
}
+static void
+mc_quit_delete (CamelStore *store, struct _store_info *si, MailComponent *mc)
+{
+ CamelFolder *folder = camel_store_get_junk (store, NULL);
+
+ if (folder) {
+ GPtrArray *uids;
+ int i;
+
+ uids = camel_folder_get_uids (folder);
+ camel_folder_freeze(folder);
+ for (i=0;i<uids->len;i++)
+ camel_folder_set_message_flags(folder, uids->pdata[i], CAMEL_MESSAGE_DELETED|CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_DELETED|CAMEL_MESSAGE_SEEN);
+ camel_folder_thaw(folder);
+ camel_folder_free_uids (folder, uids);
+ }
+}
+
static CORBA_boolean
impl_quit(PortableServer_Servant servant, CORBA_Environment *ev)
{
@@ -793,6 +812,8 @@ impl_quit(PortableServer_Servant servant, CORBA_Environment *ev)
switch (mc->priv->quit_state) {
case MC_QUIT_START: {
int now = time(NULL)/60/60/24, days;
+ gboolean empty_junk;
+
GConfClient *gconf = mail_config_get_gconf_client();
mail_vfolder_shutdown();
@@ -801,6 +822,15 @@ impl_quit(PortableServer_Servant servant, CORBA_Environment *ev)
&& ((days = gconf_client_get_int(gconf, "/apps/evolution/mail/trash/empty_on_exit_days", NULL)) == 0
|| (days + gconf_client_get_int(gconf, "/apps/evolution/mail/trash/empty_date", NULL)) <= now);
+ empty_junk = gconf_client_get_bool(gconf, "/apps/evolution/mail/junk/empty_on_exit", NULL)
+ && ((days = gconf_client_get_int(gconf, "/apps/evolution/mail/junk/empty_on_exit_days", NULL)) == 0
+ || (days + gconf_client_get_int(gconf, "/apps/evolution/mail/junk/empty_date", NULL)) <= now);
+
+ if (empty_junk) {
+ g_hash_table_foreach(mc->priv->store_hash, (GHFunc)mc_quit_delete, mc);
+ gconf_client_set_int(gconf, "/apps/evolution/mail/junk/empty_date", now, NULL);
+ }
+
g_hash_table_foreach(mc->priv->store_hash, (GHFunc)mc_quit_sync, mc);
if (mc->priv->quit_expunge)
diff --git a/mail/mail-config.glade b/mail/mail-config.glade
index 6a1442b88b..2d94f86894 100644
--- a/mail/mail-config.glade
+++ b/mail/mail-config.glade
@@ -6569,13 +6569,13 @@ For example: &quot;Work&quot; or &quot;Personal&quot;</property>
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
- <property name="spacing">18</property>
+ <property name="spacing">6</property>
<child>
<widget class="GtkVBox" id="vbox192">
<property name="visible">True</property>
<property name="homogeneous">False</property>
- <property name="spacing">12</property>
+ <property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="label526">
@@ -6603,47 +6603,26 @@ For example: &quot;Work&quot; or &quot;Personal&quot;</property>
</child>
<child>
- <widget class="GtkHBox" id="hbox213">
+ <widget class="GtkTable" id="table34">
+ <property name="border_width">12</property>
<property name="visible">True</property>
+ <property name="n_rows">4</property>
+ <property name="n_columns">1</property>
<property name="homogeneous">False</property>
- <property name="spacing">0</property>
+ <property name="row_spacing">3</property>
+ <property name="column_spacing">0</property>
<child>
- <widget class="GtkLabel" id="label545">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox225">
+ <widget class="GtkHBox" id="hbox235">
<property name="visible">True</property>
<property name="homogeneous">False</property>
- <property name="spacing">0</property>
+ <property name="spacing">6</property>
<child>
- <widget class="GtkLabel" id="label571">
+ <widget class="GtkLabel" id="label586">
<property name="visible">True</property>
- <property name="label"> </property>
- <property name="use_underline">False</property>
+ <property name="label" translatable="yes">_Default junk plugin:</property>
+ <property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
@@ -6658,24 +6637,19 @@ For example: &quot;Work&quot; or &quot;Personal&quot;</property>
<property name="angle">0</property>
</widget>
<packing>
- <property name="padding">0</property>
+ <property name="padding">6</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="chkCheckIncomingMail">
+ <widget class="Custom" id="default_junk_plugin">
<property name="visible">True</property>
- <property name="tooltip" translatable="yes">Checks incoming mail messages to be Junk</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Check in_coming mail for junk</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
+ <property name="creation_function">create_combo_text_widget</property>
+ <property name="int1">0</property>
+ <property name="int2">0</property>
+ <property name="last_modification_time">Fri, 23 Mar 2007 09:28:55 GMT</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -6685,99 +6659,107 @@ For example: &quot;Work&quot; or &quot;Personal&quot;</property>
</child>
</widget>
<packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
</packing>
</child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- <child>
- <widget class="GtkVBox" id="vbox195">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label532">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Filter Options&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox226">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
+ <child>
+ <widget class="GtkCheckButton" id="chkCheckIncomingMail">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Checks incoming mail messages to be Junk</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Check in_coming mail for junk</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_padding">4</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
<child>
- <widget class="GtkLabel" id="label572">
+ <widget class="GtkHBox" id="hbox236">
<property name="visible">True</property>
- <property name="label"> </property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">3</property>
+
+ <child>
+ <widget class="GtkImage" id="plugin_image">
+ <property name="visible">True</property>
+ <property name="icon_size">4</property>
+ <property name="icon_name">gtk-dialog-info</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="plugin_status">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
</widget>
<packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_padding">15</property>
+ <property name="x_options">fill</property>
</packing>
</child>
<child>
- <widget class="GtkVBox" id="vbox204">
+ <widget class="GtkHBox" id="hbox237">
<property name="visible">True</property>
<property name="homogeneous">False</property>
- <property name="spacing">6</property>
+ <property name="spacing">4</property>
<child>
- <widget class="GtkCheckButton" id="chkSALocalTestsOnly">
+ <widget class="GtkCheckButton" id="junk_empty_check">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes">I_nclude remote tests</property>
+ <property name="label" translatable="yes">Delete junk mails on e_xit</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
@@ -6793,60 +6775,10 @@ For example: &quot;Work&quot; or &quot;Personal&quot;</property>
</child>
<child>
- <widget class="GtkHBox" id="hbox228">
+ <widget class="GtkOptionMenu" id="junk_empty_combo">
<property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkLabel" id="label575">
- <property name="visible">True</property>
- <property name="label"> </property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label574">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;small&gt;This will make the the filter more reliable, but slower&lt;/small&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
+ <property name="can_focus">True</property>
+ <property name="history">-1</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -6856,9 +6788,12 @@ For example: &quot;Work&quot; or &quot;Personal&quot;</property>
</child>
</widget>
<packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_padding">4</property>
+ <property name="x_options">fill</property>
</packing>
</child>
</widget>
@@ -6875,6 +6810,19 @@ For example: &quot;Work&quot; or &quot;Personal&quot;</property>
<property name="fill">False</property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox195">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="tab_expand">False</property>
diff --git a/mail/mail-session.c b/mail/mail-session.c
index ee5febe99d..174df09224 100644
--- a/mail/mail-session.c
+++ b/mail/mail-session.c
@@ -68,6 +68,7 @@ typedef struct _MailSession {
gboolean interactive;
FILE *filter_logfile;
+ GList *junk_plugins;
MailAsyncEvent *async;
} MailSession;
@@ -92,6 +93,7 @@ static void
init (MailSession *session)
{
session->async = mail_async_event_new();
+ session->junk_plugins = NULL;
}
static void
@@ -712,3 +714,31 @@ mail_session_flush_filter_log (void)
if (ms->filter_logfile)
fflush (ms->filter_logfile);
}
+
+void
+mail_session_add_junk_plugin (const char *plugin_name, CamelJunkPlugin *junk_plugin)
+{
+ MailSession *ms = (MailSession *) session;
+ GConfClient *gconf;
+ char *def_plugin;
+
+ gconf = mail_config_get_gconf_client ();
+ def_plugin = gconf_client_get_string (gconf, "/apps/evolution/mail/junk/default_plugin", NULL);
+
+ ms->junk_plugins = g_list_append(ms->junk_plugins, junk_plugin);
+ if (def_plugin && plugin_name) {
+ if (!strcmp(def_plugin, plugin_name)) {
+ printf("Loading %s as the default junk plugin\n");
+ session->junk_plugin = junk_plugin;
+ }
+ }
+
+ g_free (def_plugin);
+}
+
+const GList *
+mail_session_get_junk_plugins ()
+{
+ MailSession *ms = (MailSession *) session;
+ return ms->junk_plugins;
+}
diff --git a/mail/mail-session.h b/mail/mail-session.h
index 2a7559964c..f49d4bb559 100644
--- a/mail/mail-session.h
+++ b/mail/mail-session.h
@@ -49,6 +49,10 @@ void mail_session_forget_password (const char *key);
void mail_session_flush_filter_log (void);
+void mail_session_add_junk_plugin (const char *plugin_name, CamelJunkPlugin *junk_plugin);
+
+const GList * mail_session_get_junk_plugins ();
+
extern CamelSession *session;
#ifdef __cplusplus