aboutsummaryrefslogtreecommitdiffstats
path: root/mail/folder-browser.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-11-07 04:05:25 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-11-07 04:05:25 +0800
commitd893466560f87581cb14322a39446d14d9c405f3 (patch)
tree2df38b2359f76bee5d8da41f902fd1d334b0406f /mail/folder-browser.c
parent85eeb237455da92df0019afdcadbf767a548a365 (diff)
downloadgsoc2013-evolution-d893466560f87581cb14322a39446d14d9c405f3.tar.gz
gsoc2013-evolution-d893466560f87581cb14322a39446d14d9c405f3.tar.zst
gsoc2013-evolution-d893466560f87581cb14322a39446d14d9c405f3.zip
Updated to have the same menu items as the new right-click menu -
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!) svn path=/trunk/; revision=6419
Diffstat (limited to 'mail/folder-browser.c')
-rw-r--r--mail/folder-browser.c56
1 files changed, 43 insertions, 13 deletions
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);