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/em-junk-hook.c | |
parent | 2999fa6c7b07fa1a53a51cac013b56b2ace3852e (diff) | |
download | gsoc2013-evolution-7ab42c2897e3b1d62bd47550d91ec85a55b651a5.tar.gz 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/em-junk-hook.c')
-rw-r--r-- | mail/em-junk-hook.c | 44 |
1 files changed, 40 insertions, 4 deletions
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) |