From 497e2144ace593643f64eb4dfd48f691d205521b Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Tue, 12 Sep 2000 14:51:01 +0000 Subject: Grey out the "Filter for Mailing List" item if we cannot figure out a mailing list for the selected message. svn path=/trunk/; revision=5364 --- mail/ChangeLog | 17 ++++++++++++++ mail/mail-mlist-magic.c | 30 ++++++++++++++++--------- mail/message-list.c | 59 +++++++++++++++++++++++++++---------------------- 3 files changed, 70 insertions(+), 36 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 987bb3d49e..78e597b38a 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,20 @@ +2000-09-12 Ettore Perazzoli + + * message-list.c (on_right_click): Grey out the mailing list + filter item if `mail_mlist_magic_detect_list()' returns NULL on + this message [i.e., if we cannot figure out a mailing list for + this message]. + (filter_mlist): Good boys don't use F words. + + * mail-mlist-magic.c (check_sender): Work safely if + `header_name_return' or `header_value_return' are NULL. + (check_x_been_there): Likewise. + (check_delivered_to): Likewise. + (check_x_mailing_list): Likewise. + (check_x_loop): Likewise. + + * message-list.c (on_right_click): Mark strings for translation. + 2000-09-12 Ettore Perazzoli * folder-browser-factory.c: Use the latest, shiny, amazing TigerT diff --git a/mail/mail-mlist-magic.c b/mail/mail-mlist-magic.c index 7385688f64..10104db4d0 100644 --- a/mail/mail-mlist-magic.c +++ b/mail/mail-mlist-magic.c @@ -113,8 +113,10 @@ check_sender (CamelMimeMessage *message, if (value[6] == '\0' || value[6] == '@') return NULL; - *header_name_return = "Sender"; - *header_value_return = g_strdup (value); + if (header_name_return != NULL) + *header_name_return = "Sender"; + if (header_value_return != NULL) + *header_value_return = g_strdup (value); return extract_until_at_sign (value + 6); } @@ -130,8 +132,10 @@ check_x_been_there (CamelMimeMessage *message, if (value == NULL || *value == '@') return NULL; - *header_name_return = "X-BeenThere"; - *header_value_return = g_strdup (value); + if (header_name_return != NULL) + *header_name_return = "X-BeenThere"; + if (header_value_return != NULL) + *header_value_return = g_strdup (value); return extract_until_at_sign (value); } @@ -155,8 +159,10 @@ check_delivered_to (CamelMimeMessage *message, if (value[13] == '\0' || value[13] == '@') return NULL; - *header_name_return = "Delivered-To"; - *header_value_return = g_strdup (value); + if (header_name_return != NULL) + *header_name_return = "Delivered-To"; + if (header_value_return != NULL) + *header_value_return = g_strdup (value); return extract_until_at_sign (value + 13); } @@ -180,8 +186,10 @@ check_x_mailing_list (CamelMimeMessage *message, if (value[value_length - 1] != '>') return NULL; - *header_name_return = "X-Mailing-List"; - *header_value_return = g_strdup (value); + if (header_name_return != NULL) + *header_name_return = "X-Mailing-List"; + if (header_value_return != NULL) + *header_value_return = g_strdup (value); return extract_until_at_sign (value + 1); } @@ -200,8 +208,10 @@ check_x_loop (CamelMimeMessage *message, if (*value == '\0' || *value == '@') return NULL; - *header_name_return = "X-Loop"; - *header_value_return = g_strdup (value); + if (header_name_return != NULL) + *header_name_return = "X-Loop"; + if (header_value_return != NULL) + *header_value_return = g_strdup (value); return extract_until_at_sign (value); } diff --git a/mail/message-list.c b/mail/message-list.c index 110f96912e..305dfc664b 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -1216,10 +1216,8 @@ filter_mlist (GtkWidget *w, FolderBrowser *fb) const char *header_name; name = mail_mlist_magic_detect_list (fb->mail_display->current_message, &header_name, &header_value); - if (name == NULL) { - g_print ("No fucking mlist!\n"); + if (name == NULL) return; - } filter_gui_add_for_mailing_list (fb->mail_display->current_message, name, header_name, header_value); @@ -1234,33 +1232,42 @@ on_right_click (ETableScrolled *table, gint row, gint col, GdkEvent *event, Mess extern CamelFolder *drafts_folder; int enable_mask = 0; EPopupMenu menu[] = { - { "Open in New Window", NULL, GTK_SIGNAL_FUNC (view_msg), 0 }, - { "Edit Message", NULL, GTK_SIGNAL_FUNC (edit_msg), 1 }, - { "Print Message", NULL, GTK_SIGNAL_FUNC (print_msg), 0 }, - { "", NULL, GTK_SIGNAL_FUNC (NULL), 0 }, - { "Reply to Sender", NULL, GTK_SIGNAL_FUNC (reply_to_sender), 0 }, - { "Reply to All", NULL, GTK_SIGNAL_FUNC (reply_to_all), 0 }, - { "Forward Message", NULL, GTK_SIGNAL_FUNC (forward_msg), 0 }, - { "", NULL, GTK_SIGNAL_FUNC (NULL), 0 }, - { "Delete Message", NULL, GTK_SIGNAL_FUNC (delete_msg), 0 }, - { "Move Message", NULL, GTK_SIGNAL_FUNC (move_msg), 0 }, - { "Copy Message", NULL, GTK_SIGNAL_FUNC (copy_msg), 0 }, - { "", NULL, GTK_SIGNAL_FUNC (NULL), 0 }, - { "VFolder on Subject", NULL, GTK_SIGNAL_FUNC (vfolder_subject), 2 }, - { "VFolder on Sender", NULL, GTK_SIGNAL_FUNC (vfolder_sender), 2 }, - { "VFolder on Recipients", NULL, GTK_SIGNAL_FUNC (vfolder_recipient), 2 }, - { "", NULL, GTK_SIGNAL_FUNC (NULL), 0 }, - { "Filter on Subject", NULL, GTK_SIGNAL_FUNC (filter_subject), 2 }, - { "Filter on Sender", NULL, GTK_SIGNAL_FUNC (filter_sender), 2 }, - { "Filter on Recipients", NULL, GTK_SIGNAL_FUNC (filter_recipient), 2 }, - { "Filter on Mailing List", NULL, GTK_SIGNAL_FUNC (filter_mlist), 2 }, - { NULL, NULL, NULL, 0 } + { _("Open in New Window"), NULL, GTK_SIGNAL_FUNC (view_msg), 0 }, + { _("Edit Message"), NULL, GTK_SIGNAL_FUNC (edit_msg), 1 }, + { _("Print Message"), NULL, GTK_SIGNAL_FUNC (print_msg), 0 }, + { "", NULL, GTK_SIGNAL_FUNC (NULL), 0 }, + { _("Reply to Sender"), NULL, GTK_SIGNAL_FUNC (reply_to_sender), 0 }, + { _("Reply to All"), NULL, GTK_SIGNAL_FUNC (reply_to_all), 0 }, + { _("Forward Message"), NULL, GTK_SIGNAL_FUNC (forward_msg), 0 }, + { "", NULL, GTK_SIGNAL_FUNC (NULL), 0 }, + { _("Delete Message"), NULL, GTK_SIGNAL_FUNC (delete_msg), 0 }, + { _("Move Message"), NULL, GTK_SIGNAL_FUNC (move_msg), 0 }, + { _("Copy Message"), NULL, GTK_SIGNAL_FUNC (copy_msg), 0 }, + { "", NULL, GTK_SIGNAL_FUNC (NULL), 0 }, + { _("VFolder on Subject"), NULL, GTK_SIGNAL_FUNC (vfolder_subject), 2 }, + { _("VFolder on Sender"), NULL, GTK_SIGNAL_FUNC (vfolder_sender), 2 }, + { _("VFolder on Recipients"), NULL, GTK_SIGNAL_FUNC (vfolder_recipient), 2 }, + { "", NULL, GTK_SIGNAL_FUNC (NULL), 0 }, + { _("Filter on Subject"), NULL, GTK_SIGNAL_FUNC (filter_subject), 2 }, + { _("Filter on Sender"), NULL, GTK_SIGNAL_FUNC (filter_sender), 2 }, + { _("Filter on Recipients"), NULL, GTK_SIGNAL_FUNC (filter_recipient), 2 }, + { _("Filter on Mailing List"), NULL, GTK_SIGNAL_FUNC (filter_mlist), 6 }, + { NULL, NULL, NULL, 0 } }; if (fb->folder != drafts_folder) enable_mask |= 1; - if (fb->mail_display->current_message == NULL) - enable_mask |= 2; + + if (fb->mail_display->current_message == NULL) { + enable_mask |= 6; + } else { + char *mailing_list_name; + + mailing_list_name = mail_mlist_magic_detect_list (fb->mail_display->current_message, + NULL, NULL); + if (mailing_list_name == NULL) + enable_mask |= 4; + } e_popup_menu_run (menu, (GdkEventButton *)event, enable_mask, 0, fb); -- cgit v1.2.3