diff options
-rw-r--r-- | mail/ChangeLog | 12 | ||||
-rw-r--r-- | mail/folder-browser-factory.c | 8 | ||||
-rw-r--r-- | mail/folder-browser.c | 56 | ||||
-rw-r--r-- | mail/mail-callbacks.c | 2 | ||||
-rw-r--r-- | mail/mail-callbacks.h | 2 |
5 files changed, 65 insertions, 15 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 5d207a45bb..846a503e69 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,15 @@ +2000-11-06 Jeffrey Stedfast <fejj@helixcode.com> + + * folder-browser-factory.c: Updated to have the same menu items as + the new right-click menu - eventually these 2 menus should be the + same. + + * folder-browser.c (on_right_click): Now correctly handles the + case of multiple selection. + + * mail-callbacks.c (enumerate_msg): Make public so it can be used + in other source files (it's a useful function!) + 2000-11-05 Jeffrey Stedfast <fejj@helixcode.com> * folder-browser.c (on_right_click): Added an "Undelete" option to diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c index 26806a8da4..ea0bde946d 100644 --- a/mail/folder-browser-factory.c +++ b/mail/folder-browser-factory.c @@ -58,12 +58,18 @@ BonoboUIVerb verbs [] = { BONOBO_UI_UNSAFE_VERB ("MessageReplySndr", reply_to_sender), BONOBO_UI_UNSAFE_VERB ("MessageReplyAll", reply_to_all), BONOBO_UI_UNSAFE_VERB ("MessageForward", forward_msg), + /*BONOBO_UI_UNSAFE_VERB ("MessageForwardAttach", forward_msg),*/ BONOBO_UI_UNSAFE_VERB ("MessageMarkAsRead", mark_as_seen), BONOBO_UI_UNSAFE_VERB ("MessageMarkAsUnRead", mark_as_unseen), - BONOBO_UI_UNSAFE_VERB ("MessageDelete", delete_msg), + BONOBO_UI_UNSAFE_VERB ("MessageMove", move_msg), BONOBO_UI_UNSAFE_VERB ("MessageCopy", copy_msg), + BONOBO_UI_UNSAFE_VERB ("MessageDelete", delete_msg), + BONOBO_UI_UNSAFE_VERB ("MessageUndelete", undelete_msg), + + /*BONOBO_UI_UNSAFE_VERB ("MessageAddSenderToAddressBook", addrbook_sender),*/ + BONOBO_UI_UNSAFE_VERB ("MessageApplyFilters", apply_filters), BONOBO_UI_UNSAFE_VERB ("MessageVFolderSubj", vfolder_subject), diff --git a/mail/folder-browser.c b/mail/folder-browser.c index 7009c32f45..8727591cb6 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -474,8 +474,9 @@ on_right_click (ETableScrolled *table, gint row, gint col, GdkEvent *event, Fold { extern CamelFolder *drafts_folder; const CamelMessageInfo *info; + GPtrArray *uids; int enable_mask = 0; - int last_item; + int last_item, i; char *mailing_list_name; EPopupMenu menu[] = { { _("Open"), NULL, GTK_SIGNAL_FUNC (view_msg), 0 }, @@ -525,18 +526,42 @@ on_right_click (ETableScrolled *table, gint row, gint col, GdkEvent *event, Fold NULL, NULL); } - /* FIXME: the following 2 should really account for when multiple messages are selected. */ - info = camel_folder_get_message_info (fb->folder, fb->message_list->cursor_uid); - if (info->flags & CAMEL_MESSAGE_SEEN) - enable_mask |= 4; - else - enable_mask |= 8; - - if (info->flags & CAMEL_MESSAGE_DELETED) - enable_mask |= 16; - else - enable_mask |= 32; - + /* get a list of uids */ + uids = g_ptr_array_new (); + message_list_foreach (fb->message_list, enumerate_msg, uids); + if (uids->len >= 1) { + /* gray-out any items we don't need */ + gboolean have_deleted = FALSE; + gboolean have_undeleted = FALSE; + gboolean have_seen = FALSE; + gboolean have_unseen = FALSE; + + for (i = 0; i < uids->len; i++) { + info = camel_folder_get_message_info (fb->folder, uids->pdata[i]); + if (info->flags & CAMEL_MESSAGE_SEEN) + have_seen = TRUE; + else + have_unseen = TRUE; + + if (info->flags & CAMEL_MESSAGE_DELETED) + have_deleted = TRUE; + else + have_undeleted = TRUE; + + if (have_seen && have_unseen && have_deleted && have_undeleted) + break; + } + + if (!have_unseen) + enable_mask |= 4; + if (!have_seen) + enable_mask |= 8; + + if (!have_undeleted) + enable_mask |= 16; + if (!have_deleted) + enable_mask |= 32; + } if (mailing_list_name == NULL) { enable_mask |= 64; @@ -546,6 +571,11 @@ on_right_click (ETableScrolled *table, gint row, gint col, GdkEvent *event, Fold mailing_list_name); } + /* free uids */ + for (i = 0; i < uids->len; i++) + g_free (uids->pdata[i]); + g_ptr_array_free (uids, TRUE); + e_popup_menu_run (menu, (GdkEventButton *)event, enable_mask, 0, fb); g_free (menu[last_item].name); diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index 114b906c78..7ccb0f9aee 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -477,7 +477,7 @@ reply_to_all (GtkWidget *widget, gpointer user_data) fb->message_list->cursor_uid, TRUE); } -static void +void enumerate_msg (MessageList *ml, const char *uid, gpointer data) { g_ptr_array_add ((GPtrArray *) data, g_strdup (uid)); diff --git a/mail/mail-callbacks.h b/mail/mail-callbacks.h index b1fd0b3fa2..7995581be2 100644 --- a/mail/mail-callbacks.h +++ b/mail/mail-callbacks.h @@ -33,6 +33,8 @@ extern "C" { #pragma } #endif /* __cplusplus }*/ +void enumerate_msg (MessageList *ml, const char *uid, gpointer data); + void fetch_mail (GtkWidget *widget, gpointer user_data); void send_queued_mail (GtkWidget *widget, gpointer user_data); void send_receieve_mail (GtkWidget *widget, gpointer user_data); |