diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 25 | ||||
-rw-r--r-- | mail/folder-browser.c | 41 | ||||
-rw-r--r-- | mail/mail-callbacks.c | 28 | ||||
-rw-r--r-- | mail/mail-callbacks.h | 28 | ||||
-rw-r--r-- | mail/message-list.c | 70 |
5 files changed, 144 insertions, 48 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index f0c521d76f..bbfbca8527 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,28 @@ +2001-12-09 Jon Trowbridge <trow@ximian.com> + + * message-list.c: #include "art/mail-need-reply.xpm". + (ml_tree_value_at): Adjust magic numbers, show "Need Reply" icon + if the message needs reply. + (message_list_create_extras): Adjust magic numbers to add new + icon. + (on_click): Changed to toggle between unread, read, and need reply + when the status icon is clicked. + + * mail-callbacks.c (mark_as_needing_reply): Added. + (mark_as_not_needing_reply): Added. Add "set" value to struct + post_send_data. + (composer_sent_cb): Use both "flags" and "set" elements of + post_send_data when setting message flags. + (mail_reply): Clear "Needs Reply" flag when we actually reply to a + message. + + * folder-browser.c: Changed flag values to be given by + bit-shifting (1<<5) vs. base-ten (32). Added + CAN_MARK_DOESNT_NEED_REPLY flag. Added "Mark as Needing Reply" + and "Mark as Not Needing Reply" elements to context menu. + (on_right_click): Hide "Mark as (Not) Needing Reply" context menu + elements as appropriate. + 2001-12-04 Jeffrey Stedfast <fejj@ximian.com> * mail-display.c (stream_write_or_redisplay_when_loaded): Check diff --git a/mail/folder-browser.c b/mail/folder-browser.c index ddcc305fe6..158ce0cc0e 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -1412,15 +1412,17 @@ hide_sender(GtkWidget *w, FolderBrowser *fb) } enum { - SELECTION_SET = 2, - CAN_MARK_READ = 4, - CAN_MARK_UNREAD = 8, - CAN_DELETE = 16, - CAN_UNDELETE = 32, - IS_MAILING_LIST = 64, - CAN_RESEND = 128, - CAN_MARK_IMPORTANT = 256, - CAN_MARK_UNIMPORTANT = 512 + SELECTION_SET = 1<<1, + CAN_MARK_READ = 1<<2, + CAN_MARK_UNREAD = 1<<3, + CAN_DELETE = 1<<4, + CAN_UNDELETE = 1<<5, + IS_MAILING_LIST = 1<<6, + CAN_RESEND = 1<<7, + CAN_MARK_IMPORTANT = 1<<8, + CAN_MARK_UNIMPORTANT = 1<<9, + CAN_MARK_NEEDS_REPLY = 1<<10, + CAN_MARK_DOESNT_NEED_REPLY = 1<<11 }; #define MLIST_VFOLDER (3) @@ -1460,6 +1462,8 @@ static EPopupMenu context_menu[] = { { N_("Mark as U_nread"), NULL, GTK_SIGNAL_FUNC (mark_as_unseen), NULL, CAN_MARK_UNREAD }, { N_("Mark as _Important"), NULL, GTK_SIGNAL_FUNC (mark_as_important), NULL, CAN_MARK_IMPORTANT }, { N_("Mark as Unim_portant"), NULL, GTK_SIGNAL_FUNC (mark_as_unimportant), NULL, CAN_MARK_UNIMPORTANT }, + { N_("Mark as Needing Reply"), NULL, GTK_SIGNAL_FUNC (mark_as_needing_reply), NULL, CAN_MARK_NEEDS_REPLY }, + { N_("Mark as Not Needing Reply"), NULL, GTK_SIGNAL_FUNC (mark_as_not_needing_reply), NULL, CAN_MARK_DOESNT_NEED_REPLY }, E_POPUP_SEPARATOR, @@ -1550,6 +1554,8 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event gboolean have_unseen = FALSE; gboolean have_important = FALSE; gboolean have_unimportant = FALSE; + gboolean have_needs_reply = FALSE; + gboolean have_doesnt_need_reply = FALSE; for (i = 0; i < uids->len; i++) { info = camel_folder_get_message_info (fb->folder, uids->pdata[i]); @@ -1570,6 +1576,11 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event have_important = TRUE; else have_unimportant = TRUE; + + if (info->flags & CAMEL_MESSAGE_NEEDS_REPLY) + have_needs_reply = TRUE; + else + have_doesnt_need_reply = TRUE; camel_folder_free_message_info (fb->folder, info); @@ -1591,6 +1602,11 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event enable_mask |= CAN_MARK_IMPORTANT; if (!have_important) enable_mask |= CAN_MARK_UNIMPORTANT; + + if (!have_needs_reply) + enable_mask |= CAN_MARK_DOESNT_NEED_REPLY; + if (!have_doesnt_need_reply) + enable_mask |= CAN_MARK_NEEDS_REPLY; /* * Hide items that wont get used. @@ -1615,6 +1631,13 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event else hide_mask |= CAN_MARK_UNIMPORTANT; } + + if (!(have_needs_reply && have_doesnt_need_reply)) { + if (have_needs_reply) + hide_mask |= CAN_MARK_NEEDS_REPLY; + else + hide_mask |= CAN_MARK_DOESNT_NEED_REPLY; + } } /* free uids */ diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index ee30562111..8942aaf283 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -118,7 +118,7 @@ e_gnome_ok_cancel_dialog_parented (const char *message, GnomeReplyCallback callb struct post_send_data { CamelFolder *folder; gchar *uid; - guint32 flags; + guint32 flags, set; }; static void @@ -420,7 +420,7 @@ composer_sent_cb (char *uri, CamelMimeMessage *message, gboolean sent, void *dat if (sent) { if (send->psd) { camel_folder_set_message_flags (send->psd->folder, send->psd->uid, - send->psd->flags, send->psd->flags); + send->psd->flags, send->psd->set); } gtk_widget_destroy (GTK_WIDGET (send->composer)); } else { @@ -646,7 +646,7 @@ composer_postpone_cb (EMsgComposer *composer, gpointer data) camel_object_unref (CAMEL_OBJECT (message)); if (psd) - camel_folder_set_message_flags (psd->folder, psd->uid, psd->flags, psd->flags); + camel_folder_set_message_flags (psd->folder, psd->uid, psd->flags, psd->set); gtk_widget_destroy (GTK_WIDGET (composer)); } @@ -1024,7 +1024,8 @@ mail_reply (CamelFolder *folder, CamelMimeMessage *msg, const char *uid, int mod psd->folder = folder; camel_object_ref (CAMEL_OBJECT (psd->folder)); psd->uid = g_strdup (uid); - psd->flags = CAMEL_MESSAGE_ANSWERED; + psd->flags = CAMEL_MESSAGE_ANSWERED | CAMEL_MESSAGE_NEEDS_REPLY; + psd->set = CAMEL_MESSAGE_ANSWERED; composer = mail_generate_reply (folder, msg, uid, mode); if (!composer) @@ -1664,6 +1665,25 @@ toggle_as_important (BonoboUIComponent *uih, void *user_data, const char *path) } void +mark_as_needing_reply (BonoboUIComponent *uih, void *user_data, const char *path) +{ + flag_messages (FOLDER_BROWSER (user_data), CAMEL_MESSAGE_DELETED, 0); + flag_messages (FOLDER_BROWSER (user_data), CAMEL_MESSAGE_NEEDS_REPLY, CAMEL_MESSAGE_NEEDS_REPLY); +} + +void +mark_as_not_needing_reply (BonoboUIComponent *uih, void *user_data, const char *path) +{ + flag_messages (FOLDER_BROWSER (user_data), CAMEL_MESSAGE_NEEDS_REPLY, 0); +} + +void +toggle_need_reply (BonoboUIComponent *uih, void *user_data, const char *path) +{ + toggle_flags (FOLDER_BROWSER (user_data), CAMEL_MESSAGE_NEEDS_REPLY); +} + +void zoom_in (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 f2bee415cf..5859411727 100644 --- a/mail/mail-callbacks.h +++ b/mail/mail-callbacks.h @@ -81,19 +81,21 @@ void resend_msg (GtkWidget *widget, gpointer user_data); void search_msg (GtkWidget *widget, gpointer user_data); void load_images (GtkWidget *widget, gpointer user_data); -void add_sender_to_addrbook (BonoboUIComponent *uih, void *user_data, const char *path); -void move_msg (BonoboUIComponent *uih, void *user_data, const char *path); -void copy_msg (BonoboUIComponent *uih, void *user_data, const char *path); -void add_sender_to_addrbook(BonoboUIComponent *uih, void *user_data, const char *path); -void select_all (BonoboUIComponent *uih, void *user_data, const char *path); -void select_thread (BonoboUIComponent *uih, void *user_data, const char *path); -void invert_selection (BonoboUIComponent *uih, void *user_data, const char *path); -void mark_as_seen (BonoboUIComponent *uih, void *user_data, const char *path); -void mark_all_as_seen (BonoboUIComponent *uih, void *user_data, const char *path); -void mark_as_unseen (BonoboUIComponent *uih, void *user_data, const char *path); -void mark_as_important (BonoboUIComponent *uih, void *user_data, const char *path); -void mark_as_unimportant (BonoboUIComponent *uih, void *user_data, const char *path); -void toggle_as_important (BonoboUIComponent *uih, void *user_data, const char *path); +void add_sender_to_addrbook (BonoboUIComponent *uih, void *user_data, const char *path); +void move_msg (BonoboUIComponent *uih, void *user_data, const char *path); +void copy_msg (BonoboUIComponent *uih, void *user_data, const char *path); +void select_all (BonoboUIComponent *uih, void *user_data, const char *path); +void select_thread (BonoboUIComponent *uih, void *user_data, const char *path); +void invert_selection (BonoboUIComponent *uih, void *user_data, const char *path); +void mark_as_seen (BonoboUIComponent *uih, void *user_data, const char *path); +void mark_all_as_seen (BonoboUIComponent *uih, void *user_data, const char *path); +void mark_as_unseen (BonoboUIComponent *uih, void *user_data, const char *path); +void mark_as_important (BonoboUIComponent *uih, void *user_data, const char *path); +void mark_as_unimportant (BonoboUIComponent *uih, void *user_data, const char *path); +void toggle_as_important (BonoboUIComponent *uih, void *user_data, const char *path); +void mark_as_needing_reply (BonoboUIComponent *uih, void *user_data, const char *path); +void mark_as_not_needing_reply (BonoboUIComponent *uih, void *user_data, const char *path); +void toggle_need_reply (BonoboUIComponent *uih, void *user_data, const char *path); void zoom_in (BonoboUIComponent *uih, void *user_data, const char *path); void zoom_out (BonoboUIComponent *uih, void *user_data, const char *path); diff --git a/mail/message-list.c b/mail/message-list.c index 61ff949ac5..02e6d234c9 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -47,6 +47,7 @@ #include "art/mail-new.xpm" #include "art/mail-read.xpm" #include "art/mail-replied.xpm" +#include "art/mail-need-reply.xpm" #include "art/attachment.xpm" #include "art/priority-high.xpm" #include "art/empty.xpm" @@ -137,6 +138,7 @@ static struct { { mail_new_xpm, NULL }, { mail_read_xpm, NULL }, { mail_replied_xpm, NULL }, + { mail_need_reply_xpm, NULL }, /* FIXME: Replace these with pixmaps for multiple_read and multiple_unread */ { mail_new_xpm, NULL }, { mail_read_xpm, NULL }, @@ -792,12 +794,14 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data) child = e_tree_model_node_get_first_child(etm, path); if (child && !e_tree_node_is_expanded(message_list->tree, path)) { if (subtree_unread(message_list, child)) - return (void *)3; - else return (void *)4; + else + return (void *)5; } - if (msg_info->flags & CAMEL_MESSAGE_ANSWERED) + if (msg_info->flags & CAMEL_MESSAGE_NEEDS_REPLY) + return GINT_TO_POINTER (3); + else if (msg_info->flags & CAMEL_MESSAGE_ANSWERED) return GINT_TO_POINTER (2); else if (msg_info->flags & CAMEL_MESSAGE_SEEN) return GINT_TO_POINTER (1); @@ -962,28 +966,28 @@ message_list_create_extras (void) extras = e_table_extras_new(); e_table_extras_add_pixbuf(extras, "status", states_pixmaps [0].pixbuf); - e_table_extras_add_pixbuf(extras, "score", states_pixmaps [13].pixbuf); - e_table_extras_add_pixbuf(extras, "attachment", states_pixmaps [6].pixbuf); - e_table_extras_add_pixbuf(extras, "flagged", states_pixmaps [7].pixbuf); + e_table_extras_add_pixbuf(extras, "score", states_pixmaps [14].pixbuf); + e_table_extras_add_pixbuf(extras, "attachment", states_pixmaps [7].pixbuf); + e_table_extras_add_pixbuf(extras, "flagged", states_pixmaps [8].pixbuf); e_table_extras_add_compare(extras, "address_compare", address_compare); e_table_extras_add_compare(extras, "subject_compare", subject_compare); - for (i = 0; i < 5; i++) + for (i = 0; i < 6; i++) images [i] = states_pixmaps [i].pixbuf; - e_table_extras_add_cell(extras, "render_message_status", e_cell_toggle_new (0, 5, images)); + e_table_extras_add_cell(extras, "render_message_status", e_cell_toggle_new (0, 6, images)); for (i = 0; i < 2; i++) - images [i] = states_pixmaps [i + 5].pixbuf; + images [i] = states_pixmaps [i + 6].pixbuf; e_table_extras_add_cell(extras, "render_attachment", e_cell_toggle_new (0, 2, images)); - images [1] = states_pixmaps [7].pixbuf; + images [1] = states_pixmaps [8].pixbuf; e_table_extras_add_cell(extras, "render_flagged", e_cell_toggle_new (0, 2, images)); for (i = 0; i < 7; i++) - images[i] = states_pixmaps [i + 7].pixbuf; + images[i] = states_pixmaps [i + 8].pixbuf; e_table_extras_add_cell(extras, "render_score", e_cell_toggle_new (0, 7, images)); @@ -2024,29 +2028,51 @@ on_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, Mess int flag; CamelMessageInfo *info; - if (col == COL_MESSAGE_STATUS) - flag = CAMEL_MESSAGE_SEEN; - else if (col == COL_FLAGGED) + if (col == COL_MESSAGE_STATUS) { + guint32 msg_flags; + + info = get_message_info (list, path); + if (info == NULL) { + return FALSE; + } + + msg_flags = camel_folder_get_message_flags (list->folder, camel_message_info_uid (info)); + + if (msg_flags & CAMEL_MESSAGE_NEEDS_REPLY) { + flag = 0; + } else if (msg_flags & CAMEL_MESSAGE_SEEN) { + flag = CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_NEEDS_REPLY; + } else { + flag = CAMEL_MESSAGE_SEEN; + } + + camel_folder_set_message_flags (list->folder, camel_message_info_uid (info), + CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_NEEDS_REPLY, flag); + + if (flag & CAMEL_MESSAGE_SEEN && list->seen_id) { + gtk_timeout_remove (list->seen_id); + list->seen_id = 0; + } + + return TRUE; + } + + if (col == COL_FLAGGED) flag = CAMEL_MESSAGE_FLAGGED; else return FALSE; - + info = get_message_info (list, path); if (info == NULL) { return FALSE; } - + /* If a message was marked as deleted and the user flags it as important, undelete it */ if (col == COL_FLAGGED && (info->flags & CAMEL_MESSAGE_DELETED)) flag |= CAMEL_MESSAGE_DELETED; camel_folder_set_message_flags (list->folder, camel_message_info_uid (info), flag, ~info->flags); - - if (flag == CAMEL_MESSAGE_SEEN && list->seen_id) { - gtk_timeout_remove (list->seen_id); - list->seen_id = 0; - } - + return TRUE; } |