From 03224d610f89068b30571d94dee3cae77c34f221 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Wed, 16 Oct 2002 04:07:31 +0000 Subject: Add the new-mail-notify rule to the filter driver before adding the user 2002-10-15 Jeffrey Stedfast * mail-session.c (main_get_filter_driver): Add the new-mail-notify rule to the filter driver before adding the user defined filter rules so that we can be sure that the new-mail-notify rule gets invoked. Fixes bug #32328. * mail-composer-prefs.c (mail_composer_prefs_new_signature): Make sure that name[0] cannot ever be NULL. Should maybe fix bug #32230. svn path=/trunk/; revision=18374 --- mail/ChangeLog | 11 +++++++++++ mail/mail-composer-prefs.c | 17 ++++++++++------- mail/mail-session.c | 24 ++++++++++++++---------- 3 files changed, 35 insertions(+), 17 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 3e4413d57e..ce5a0fcac1 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,14 @@ +2002-10-15 Jeffrey Stedfast + + * mail-session.c (main_get_filter_driver): Add the new-mail-notify + rule to the filter driver before adding the user defined filter + rules so that we can be sure that the new-mail-notify rule gets + invoked. Fixes bug #32328. + + * mail-composer-prefs.c (mail_composer_prefs_new_signature): Make + sure that name[0] cannot ever be NULL. Should maybe fix bug + #32230. + 2002-10-15 Dan Winship * upgrade-mailer.c (shortcuts_upgrade_xml_file): Change the type diff --git a/mail/mail-composer-prefs.c b/mail/mail-composer-prefs.c index f64e844f2c..1fc0afb05f 100644 --- a/mail/mail-composer-prefs.c +++ b/mail/mail-composer-prefs.c @@ -227,24 +227,27 @@ MailConfigSignature * mail_composer_prefs_new_signature (MailComposerPrefs *prefs, gboolean html, const gchar *script) { MailConfigSignature *sig; - char *name [1]; + char *name[1]; int row; sig = mail_config_signature_add (html, script); if (prefs) { - name [0] = e_utf8_to_gtk_string (GTK_WIDGET (prefs->sig_clist), sig->name); + if (!(name[0] = e_utf8_to_gtk_string (GTK_WIDGET (prefs->sig_clist), sig->name))) + name[0] = g_strdup (""); + if (sig->script) { - gchar *tmp; - - tmp = name [0]; - name [0] = g_strconcat (name [0], _(" [script]"), NULL); + char *tmp; + + tmp = name[0]; + name[0] = g_strconcat (tmp, _(" [script]"), NULL); g_free (tmp); } + row = gtk_clist_append (prefs->sig_clist, name); gtk_clist_set_row_data (prefs->sig_clist, row, sig); gtk_clist_select_row (GTK_CLIST (prefs->sig_clist), row, 0); - g_free (name [0]); + g_free (name[0]); /*gtk_widget_grab_focus (prefs->sig_name);*/ } diff --git a/mail/mail-session.c b/mail/mail-session.c index cb2e709a69..011f09edca 100644 --- a/mail/mail-session.c +++ b/mail/mail-session.c @@ -871,16 +871,7 @@ main_get_filter_driver (CamelSession *session, const char *type, CamelException fsearch = g_string_new (""); faction = g_string_new (""); - while ((rule = rule_context_next_rule (fc, rule, type))) { - g_string_truncate (fsearch, 0); - g_string_truncate (faction, 0); - - filter_rule_build_code (rule, fsearch); - filter_filter_build_action ((FilterFilter *)rule, faction); - - camel_filter_driver_add_rule (driver, rule->name, - fsearch->str, faction->str); - } + /* add the new-mail notification rule first to be sure that it gets invoked */ /* FIXME: we need a way to distinguish between filtering new mail and re-filtering a folder because both use the @@ -907,10 +898,23 @@ main_get_filter_driver (CamelSession *session, const char *type, CamelException camel_filter_driver_add_rule (driver, "new-mail-notification", "(begin #t)", faction->str); } + /* add the user-defined rules next */ + while ((rule = rule_context_next_rule (fc, rule, type))) { + g_string_truncate (fsearch, 0); + g_string_truncate (faction, 0); + + filter_rule_build_code (rule, fsearch); + filter_filter_build_action ((FilterFilter *)rule, faction); + + camel_filter_driver_add_rule (driver, rule->name, + fsearch->str, faction->str); + } + g_string_free (fsearch, TRUE); g_string_free (faction, TRUE); gtk_object_unref (GTK_OBJECT (fc)); + return driver; } -- cgit v1.2.3