diff options
author | Not Zed <NotZed@HelixCode.com> | 2000-12-24 09:03:14 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2000-12-24 09:03:14 +0800 |
commit | fba04bdda76968d230a37b0925fa0d176c755b60 (patch) | |
tree | 758dc853a6f1adfe6421f5211c013dbb82bbbbbe /mail/mail-callbacks.c | |
parent | 5674966eeb7eecfa109ad419f1c997dba69ff0af (diff) | |
download | gsoc2013-evolution-fba04bdda76968d230a37b0925fa0d176c755b60.tar gsoc2013-evolution-fba04bdda76968d230a37b0925fa0d176c755b60.tar.gz gsoc2013-evolution-fba04bdda76968d230a37b0925fa0d176c755b60.tar.bz2 gsoc2013-evolution-fba04bdda76968d230a37b0925fa0d176c755b60.tar.lz gsoc2013-evolution-fba04bdda76968d230a37b0925fa0d176c755b60.tar.xz gsoc2013-evolution-fba04bdda76968d230a37b0925fa0d176c755b60.tar.zst gsoc2013-evolution-fba04bdda76968d230a37b0925fa0d176c755b60.zip |
Merge from camel-mt-branch.
2000-12-24 Not Zed <NotZed@HelixCode.com>
* Merge from camel-mt-branch.
svn path=/trunk/; revision=7153
Diffstat (limited to 'mail/mail-callbacks.c')
-rw-r--r-- | mail/mail-callbacks.c | 96 |
1 files changed, 24 insertions, 72 deletions
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index 5307eb976f..32104dba76 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -620,36 +620,40 @@ invert_selection (BonoboUIComponent *uih, void *user_data, const char *path) e_table_invert_selection (ml->table); } -void -mark_as_seen (BonoboUIComponent *uih, void *user_data, const char *path) +/* flag all selected messages */ +static void +flag_messages(FolderBrowser *fb, guint32 mask, guint32 set) { - FolderBrowser *fb = FOLDER_BROWSER(user_data); MessageList *ml = fb->message_list; GPtrArray *uids; - + int i; + if (ml->folder == NULL) return; - + + /* could just use specific callback but i'm lazy */ uids = g_ptr_array_new (); message_list_foreach (ml, enumerate_msg, uids); - mail_do_flag_messages (ml->folder, uids, FALSE, - CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN); + camel_folder_freeze(ml->folder); + for (i=0;i<uids->len;i++) { + camel_folder_set_message_flags(ml->folder, uids->pdata[i], mask, set); + g_free(uids->pdata[i]); + } + camel_folder_thaw(ml->folder); + + g_ptr_array_free(uids, TRUE); +} + +void +mark_as_seen (BonoboUIComponent *uih, void *user_data, const char *path) +{ + flag_messages(FOLDER_BROWSER(user_data), CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN); } void mark_as_unseen (BonoboUIComponent *uih, void *user_data, const char *path) { - FolderBrowser *fb = FOLDER_BROWSER(user_data); - MessageList *ml = fb->message_list; - GPtrArray *uids; - - if (ml->folder == NULL) - return; - - uids = g_ptr_array_new (); - message_list_foreach (ml, enumerate_msg, uids); - mail_do_flag_messages (ml->folder, uids, FALSE, - CAMEL_MESSAGE_SEEN, 0); + flag_messages(FOLDER_BROWSER(user_data), CAMEL_MESSAGE_SEEN, 0); } void @@ -764,65 +768,13 @@ save_msg (GtkWidget *widget, gpointer user_data) void delete_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, - CAMEL_MESSAGE_DELETED); - mail_tool_camel_lock_down (); - } else { - mail_do_flag_messages (ml->folder, uids, FALSE, - CAMEL_MESSAGE_DELETED, - CAMEL_MESSAGE_DELETED); - } + flag_messages(FOLDER_BROWSER(user_data), CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_DELETED); } 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, FALSE, - CAMEL_MESSAGE_DELETED, - 0); - } + flag_messages(FOLDER_BROWSER(user_data), CAMEL_MESSAGE_DELETED, 0); } void |