diff options
author | Milan Crha <mcrha@redhat.com> | 2008-04-25 21:12:22 +0800 |
---|---|---|
committer | Milan Crha <mcrha@src.gnome.org> | 2008-04-25 21:12:22 +0800 |
commit | 7ab42c2897e3b1d62bd47550d91ec85a55b651a5 (patch) | |
tree | 08d51cbc9948c95988fa47fa6024ad88062a8e75 /mail | |
parent | 2999fa6c7b07fa1a53a51cac013b56b2ace3852e (diff) | |
download | gsoc2013-evolution-7ab42c2897e3b1d62bd47550d91ec85a55b651a5.tar gsoc2013-evolution-7ab42c2897e3b1d62bd47550d91ec85a55b651a5.tar.gz gsoc2013-evolution-7ab42c2897e3b1d62bd47550d91ec85a55b651a5.tar.bz2 gsoc2013-evolution-7ab42c2897e3b1d62bd47550d91ec85a55b651a5.tar.lz gsoc2013-evolution-7ab42c2897e3b1d62bd47550d91ec85a55b651a5.tar.xz gsoc2013-evolution-7ab42c2897e3b1d62bd47550d91ec85a55b651a5.tar.zst gsoc2013-evolution-7ab42c2897e3b1d62bd47550d91ec85a55b651a5.zip |
** Fix for bug #273041
2008-04-25 Milan Crha <mcrha@redhat.com>
** Fix for bug #273041
* mail/mail.error.xml: (junk-check-error), (junk-report-error),
(junk-not-report-error): New error messages added.
* mail/em-junk-hook.h: (struct _EMJunkHookTarget), (em_junk_error_quark):
* mail/em-junk-hook.c: (manage_error), (em_junk_check_junk),
(em_junk_report_junk), (em_junk_report_non_junk):
Allow propagation of the error from the plugin in the hook target.
* plugins/bogo-junk-plugin/bf-junk-filter.c: (pipe_to_bogofilter), (em_junk_bf_check_junk),
(em_junk_bf_report_junk), (em_junk_bf_report_non_junk):
Propagate possible errors to the UI.
* sa-junk-plugin/em-junk-filter.c: (em_junk_sa_commit_reports),
(em_junk_sa_validate_binary): Fix function prototype.
* sa-junk-plugin/em-junk-filter.c: (pipe_to_sa_full), (em_junk_sa_test_spamd_running),
(em_junk_sa_test_spamassassin), (pipe_to_sa), (em_junk_sa_run_spamd),
(em_junk_sa_test_spamd), (em_junk_sa_is_available),
(em_junk_sa_check_junk), (get_spamassassin_version),
(em_junk_sa_report_junk), (em_junk_sa_report_non_junk):
Propagate possible errors to the UI.
svn path=/trunk/; revision=35415
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 11 | ||||
-rw-r--r-- | mail/em-junk-hook.c | 44 | ||||
-rw-r--r-- | mail/em-junk-hook.h | 5 | ||||
-rw-r--r-- | mail/mail.error.xml | 13 |
4 files changed, 69 insertions, 4 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 62bda655cc..8e3a8ba172 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,14 @@ +2008-04-25 Milan Crha <mcrha@redhat.com> + + ** Fix for bug #273041 + + * mail.error.xml: (junk-check-error), (junk-report-error), + (junk-not-report-error): New error messages added. + * em-junk-hook.h: (struct _EMJunkHookTarget), (em_junk_error_quark): + * em-junk-hook.c: (manage_error), (em_junk_check_junk), + (em_junk_report_junk), (em_junk_report_non_junk): + Allow propagation of the error from the plugin in the hook target. + 2008-04-23 Milan Crha <mcrha@redhat.com> * em-format-html-display.c: (efhd_update_bar): diff --git a/mail/em-junk-hook.c b/mail/em-junk-hook.c index ee4a6ed614..24341c960f 100644 --- a/mail/em-junk-hook.c +++ b/mail/em-junk-hook.c @@ -30,6 +30,8 @@ #include "em-junk-hook.h" #include "mail-session.h" #include <e-util/e-icon-factory.h> +#include "e-util/e-error.h" +#include "em-utils.h" #include <camel/camel-junk-plugin.h> #include <glib/gi18n.h> @@ -61,6 +63,15 @@ static const EPluginHookTargetKey emjh_flag_map[] = { </hook> */ + +static void manage_error (const char *msg, GError *error); + +GQuark +em_junk_error_quark (void) +{ + return g_quark_from_static_string ("em-junk-error-quark"); +} + static const char * em_junk_get_name (CamelJunkPlugin *csp); @@ -90,11 +101,17 @@ em_junk_check_junk(CamelJunkPlugin *csp, CamelMimeMessage *m) struct _EMJunkHookItem *item = (EMJunkHookItem *)csp; if (item->hook && item->hook->hook.plugin->enabled) { + gboolean res; EMJunkHookTarget target = { - m + m, + NULL }; - return e_plugin_invoke(item->hook->hook.plugin, item->check_junk, &target) != NULL; + res = e_plugin_invoke(item->hook->hook.plugin, item->check_junk, &target) != NULL; + + manage_error ("mail:junk-check-error", target.error); + + return res; } return FALSE; @@ -107,10 +124,13 @@ em_junk_report_junk(CamelJunkPlugin *csp, CamelMimeMessage *m) if (item->hook && item->hook->hook.plugin->enabled) { EMJunkHookTarget target = { - m + m, + NULL }; e_plugin_invoke(item->hook->hook.plugin, item->report_junk, &target); + + manage_error ("mail:junk-report-error", target.error); } } @@ -121,9 +141,11 @@ em_junk_report_non_junk(CamelJunkPlugin *csp, CamelMimeMessage *m) if (item->hook && item->hook->hook.plugin->enabled) { EMJunkHookTarget target = { - m + m, + NULL }; e_plugin_invoke(item->hook->hook.plugin, item->report_non_junk, &target); + manage_error ("mail:junk-not-report-error", target.error); } } @@ -279,6 +301,20 @@ emjh_construct(EPluginHook *eph, EPlugin *ep, xmlNodePtr root) return 0; } +static void +manage_error (const char *msg, GError *error) +{ + GtkWidget *w; + + if (!error) + return; + + w = e_error_new (NULL, msg, error->message, NULL); + em_utils_show_error_silent (w); + + g_error_free (error); +} + /*XXX: don't think we need here*/ static void emjh_enable(EPluginHook *eph, int state) diff --git a/mail/em-junk-hook.h b/mail/em-junk-hook.h index 952c0b914e..940607e323 100644 --- a/mail/em-junk-hook.h +++ b/mail/em-junk-hook.h @@ -43,8 +43,13 @@ typedef struct _EMJunkHookTarget EMJunkHookTarget; typedef void (*EMJunkHookFunc)(struct _EPlugin *plugin, EMJunkHookTarget *data); +GQuark em_junk_error_quark (void); + +#define EM_JUNK_ERROR em_junk_error_quark () + struct _EMJunkHookTarget { struct _CamelMimeMessage *m; + GError *error; }; struct _EMJunkHookItem { diff --git a/mail/mail.error.xml b/mail/mail.error.xml index e8ce35614d..9caf7158a6 100644 --- a/mail/mail.error.xml +++ b/mail/mail.error.xml @@ -411,6 +411,19 @@ You can choose to ignore this folder, overwrite or append its contents, or quit. <_secondary xml:space="preserve">You do not have sufficient permissions to delete this mail.</_secondary> </error> + <error id="junk-check-error" type="error"> + <_primary>Check Junk Failed</_primary> + <_secondary xml:space="preserve">{0}</_secondary> + </error> + + <error id="junk-report-error" type="error"> + <_primary>Report Junk Failed</_primary> + <_secondary xml:space="preserve">{0}</_secondary> + </error> + <error id="junk-not-report-error" type="error"> + <_primary>Report Not Junk Failed</_primary> + <_secondary xml:space="preserve">{0}</_secondary> + </error> </error-list> |