aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-11-06 08:53:20 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-11-06 08:53:20 +0800
commit9ca299b427db9febb37208a33d238463f7a9b3bd (patch)
treeb4ef8ff94113c5d81a800d45ed605f1739f3d49d
parent2e53ea5326b120e26d3e062897b955d95988ff4f (diff)
downloadgsoc2013-evolution-9ca299b427db9febb37208a33d238463f7a9b3bd.tar.gz
gsoc2013-evolution-9ca299b427db9febb37208a33d238463f7a9b3bd.tar.zst
gsoc2013-evolution-9ca299b427db9febb37208a33d238463f7a9b3bd.zip
Added an "Undelete" option to the right-click menu and also set a mask so
2000-11-05 Jeffrey Stedfast <fejj@helixcode.com> * folder-browser.c (on_right_click): Added an "Undelete" option to the right-click menu and also set a mask so it was only selectable if the message is marked as deleted. Also set a mask for "Mark as Read" and "Mark as Unread". * mail-callbacks.c (undelete_msg): New callback to undelete messages. svn path=/trunk/; revision=6407
-rw-r--r--mail/ChangeLog10
-rw-r--r--mail/folder-browser.c88
-rw-r--r--mail/mail-callbacks.c36
-rw-r--r--mail/mail-callbacks.h1
4 files changed, 100 insertions, 35 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 5faaab16eb..5d207a45bb 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,13 @@
+2000-11-05 Jeffrey Stedfast <fejj@helixcode.com>
+
+ * folder-browser.c (on_right_click): Added an "Undelete" option to
+ the right-click menu and also set a mask so it was only selectable
+ if the message is marked as deleted. Also set a mask for "Mark as
+ Read" and "Mark as Unread".
+
+ * mail-callbacks.c (undelete_msg): New callback to undelete
+ messages.
+
2000-11-03 Dan Winship <danw@helixcode.com>
* message-list.c (cleanup_regenerate_messagelist): don't free the
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index d72ea18a53..7009c32f45 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -473,43 +473,50 @@ static gint
on_right_click (ETableScrolled *table, gint row, gint col, GdkEvent *event, FolderBrowser *fb)
{
extern CamelFolder *drafts_folder;
+ const CamelMessageInfo *info;
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 },
- { _("Mark as Read"), NULL, GTK_SIGNAL_FUNC (mark_as_seen), 0 },
- { _("Mark as Unread"), NULL, GTK_SIGNAL_FUNC (mark_as_unseen), 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 },
- { _("Apply Filters"), NULL, GTK_SIGNAL_FUNC (apply_filters), 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 }
- };
int last_item;
char *mailing_list_name;
-
+ EPopupMenu menu[] = {
+ { _("Open"), NULL, GTK_SIGNAL_FUNC (view_msg), 0 },
+ { _("Edit"), NULL, GTK_SIGNAL_FUNC (edit_msg), 1 },
+ { _("Print"), 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"), NULL, GTK_SIGNAL_FUNC (forward_msg), 0 },
+ /*{ _("Forward as Attachment"), NULL, GTK_SIGNAL_FUNC (forward_msg), 0 },*/
+ { "", NULL, GTK_SIGNAL_FUNC (NULL), 0 },
+ { _("Mark as Read"), NULL, GTK_SIGNAL_FUNC (mark_as_seen), 4 },
+ { _("Mark as Unread"), NULL, GTK_SIGNAL_FUNC (mark_as_unseen), 8 },
+ { "", NULL, GTK_SIGNAL_FUNC (NULL), 0 },
+ { _("Move to Folder..."), NULL, GTK_SIGNAL_FUNC (move_msg), 0 },
+ { _("Copy to Folder..."), NULL, GTK_SIGNAL_FUNC (copy_msg), 0 },
+ { _("Delete"), NULL, GTK_SIGNAL_FUNC (delete_msg), 16 },
+ { _("Undelete"), NULL, GTK_SIGNAL_FUNC (undelete_msg), 32 },
+ { "", NULL, GTK_SIGNAL_FUNC (NULL), 0 },
+ /*{ _("Add Sender to Address Book"), NULL, GTK_SIGNAL_FUNC (addrbook_sender), 0 },
+ { "", NULL, GTK_SIGNAL_FUNC (NULL), 0 },*/
+ { _("Apply Filters"), NULL, GTK_SIGNAL_FUNC (apply_filters), 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), 66 },
+ { NULL, NULL, NULL, 0 }
+ };
+
/* Evil Hack. */
-
+
last_item = (sizeof (menu) / sizeof (*menu)) - 2;
-
+
if (fb->folder != drafts_folder)
enable_mask |= 1;
-
+
if (fb->mail_display->current_message == NULL) {
enable_mask |= 2;
mailing_list_name = NULL;
@@ -517,17 +524,30 @@ on_right_click (ETableScrolled *table, gint row, gint col, GdkEvent *event, Fold
mailing_list_name = mail_mlist_magic_detect_list (fb->mail_display->current_message,
NULL, NULL);
}
-
- if (mailing_list_name == 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;
+
+
+ if (mailing_list_name == NULL) {
+ enable_mask |= 64;
menu[last_item].name = g_strdup (_("Filter on Mailing List"));
} else {
menu[last_item].name = g_strdup_printf (_("Filter on Mailing List (%s)"),
mailing_list_name);
}
-
+
e_popup_menu_run (menu, (GdkEventButton *)event, enable_mask, 0, fb);
-
+
g_free (menu[last_item].name);
return TRUE;
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index e283a02d5c..114b906c78 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -663,6 +663,8 @@ edit_msg (GtkWidget *widget, gpointer user_data)
mail_do_edit_messages (fb->folder, uids, (GtkSignalFunc) composer_send_cb);
}
+/* FIXME: now that we have an undelete_msg, we should make this only
+ set the deleted flag? */
void
delete_msg (GtkWidget *button, gpointer user_data)
{
@@ -672,7 +674,7 @@ delete_msg (GtkWidget *button, gpointer user_data)
uids = g_ptr_array_new ();
message_list_foreach (ml, enumerate_msg, uids);
-
+
/*
* Toggling a flag is an "instantaneous" operation, so if
* we're only doing one, just do it and return, rather than
@@ -698,6 +700,38 @@ delete_msg (GtkWidget *button, gpointer user_data)
}
void
+undelete_msg (GtkWidget *button, gpointer user_data)
+{
+ FolderBrowser *fb = user_data;
+ MessageList *ml = fb->message_list;
+ GPtrArray *uids;
+
+ uids = g_ptr_array_new ();
+ message_list_foreach (ml, enumerate_msg, uids);
+
+ /*
+ * Toggling a flag is an "instantaneous" operation, so if
+ * we're only doing one, just do it and return, rather than
+ * queueing it for the other thread. This makes the "Delete"
+ * key work correctly (move to the next message) again.
+ * - Dan
+ */
+ if (uids->len == 1) {
+ char *uid = uids->pdata[0];
+
+ mail_tool_camel_lock_up ();
+ camel_folder_set_message_flags (ml->folder, uid,
+ CAMEL_MESSAGE_DELETED,
+ 0);
+ mail_tool_camel_lock_down ();
+ } else {
+ mail_do_flag_messages (ml->folder, uids, TRUE,
+ CAMEL_MESSAGE_DELETED,
+ 0);
+ }
+}
+
+void
expunge_folder (BonoboUIComponent *uih, void *user_data, const char *path)
{
FolderBrowser *fb = FOLDER_BROWSER(user_data);
diff --git a/mail/mail-callbacks.h b/mail/mail-callbacks.h
index 31f548f629..b1fd0b3fa2 100644
--- a/mail/mail-callbacks.h
+++ b/mail/mail-callbacks.h
@@ -43,6 +43,7 @@ void forward_msg (GtkWidget *widget, gpointer user_data);
void reply_to_sender (GtkWidget *widget, gpointer user_data);
void reply_to_all (GtkWidget *widget, gpointer user_data);
void delete_msg (GtkWidget *widget, gpointer user_data);
+void undelete_msg (GtkWidget *widget, gpointer user_data);
void move_msg (GtkWidget *widget, gpointer user_data);
void copy_msg (GtkWidget *widget, gpointer user_data);
void apply_filters (GtkWidget *widget, gpointer user_data);