aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog11
-rw-r--r--mail/folder-browser.c15
-rw-r--r--mail/mail-ops.c29
-rw-r--r--mail/message-list.c38
4 files changed, 58 insertions, 35 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 9ed17f4279..c96a549a48 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,14 @@
+2000-07-10 Dan Winship <danw@helixcode.com>
+
+ * message-list.c (message_list_select): Update
+ message_list_select_next to do either next or previous.
+
+ * folder-browser.c (etable_key): Make 'n' and 'p' do next and
+ previous unread message.
+
+ * mail-ops.c (select_first_unread): Update.
+ (real_fetch_mail): clean up a bit.
+
2000-07-10 Ettore Perazzoli <ettore@helixcode.com>
* mail-ops.c (forward_msg): Initialize `fwd_subj' to NULL if
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index 201a7d9252..5fa536118e 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -8,6 +8,7 @@
* (C) 2000 Helix Code, Inc.
*/
#include <config.h>
+#include <ctype.h>
#include <gnome.h>
#include "e-util/e-util.h"
#include "e-util/e-sexp.h"
@@ -319,7 +320,7 @@ folder_browser_clear_search (FolderBrowser *fb)
static int
etable_key (ETable *table, int row, int col, GdkEvent *ev, FolderBrowser *fb)
{
- if (ev->key.state != 0)
+ if ((ev->key.state & !(GDK_SHIFT_MASK | GDK_LOCK_MASK)) != 0)
return FALSE;
if (ev->key.keyval == GDK_space || ev->key.keyval == GDK_BackSpace) {
@@ -346,9 +347,17 @@ etable_key (ETable *table, int row, int col, GdkEvent *ev, FolderBrowser *fb)
} else if (ev->key.keyval == GDK_Delete ||
ev->key.keyval == GDK_KP_Delete) {
delete_msg (NULL, fb);
- message_list_select_next (fb->message_list, row,
- 0, CAMEL_MESSAGE_DELETED);
+ message_list_select (fb->message_list, row,
+ MESSAGE_LIST_SELECT_NEXT,
+ 0, CAMEL_MESSAGE_DELETED);
return TRUE;
+ } else if (ev->key.keyval == 'n' || ev->key.keyval == 'N' ||
+ ev->key.keyval == 'p' || ev->key.keyval == 'P') {
+ message_list_select (fb->message_list, row,
+ tolower (ev->key.keyval) == 'p' ?
+ MESSAGE_LIST_SELECT_PREVIOUS :
+ MESSAGE_LIST_SELECT_NEXT,
+ 0, CAMEL_MESSAGE_SEEN);
}
return FALSE;
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index fdf3bbbf2c..63becc28b7 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -124,8 +124,8 @@ select_first_unread (CamelFolder *folder, int type, gpointer data)
{
FolderBrowser *fb = data;
- message_list_select_next (fb->message_list, 0,
- 0, CAMEL_MESSAGE_SEEN);
+ message_list_select (fb->message_list, 0, MESSAGE_LIST_SELECT_NEXT,
+ 0, CAMEL_MESSAGE_SEEN);
}
void
@@ -136,7 +136,7 @@ real_fetch_mail (gpointer user_data)
CamelException *ex;
CamelStore *store = NULL, *dest_store = NULL;
CamelFolder *folder = NULL, *dest_folder = NULL;
- char *url = NULL, *dest_url, *dest_mbox;
+ char *url = NULL, *dest_url;
FilterDriver *filter = NULL;
char *userrules, *systemrules;
char *tmp_mbox = NULL, *source;
@@ -146,6 +146,10 @@ real_fetch_mail (gpointer user_data)
fb = info->fb;
url = info->source_url;
+ /* If using IMAP, don't do anything... */
+ if (!strncmp (url, "imap:", 5))
+ return;
+
ex = camel_exception_new ();
dest_url = g_strdup_printf ("mbox://%s/local/Inbox", evolution_dir);
@@ -156,21 +160,14 @@ real_fetch_mail (gpointer user_data)
goto cleanup;
}
- dest_mbox = g_strdup_printf ("%s/local/Inbox/mbox", evolution_dir);
- dest_folder = camel_store_get_folder (dest_store,
- strrchr (dest_mbox, '/') + 1,
- FALSE, ex);
+ dest_folder = camel_store_get_folder (dest_store, "mbox", FALSE, ex);
if (!dest_folder) {
async_mail_exception_dialog ("Unable to get new mail", ex, fb);
goto cleanup;
}
-
+
tmp_mbox = g_strdup_printf ("%s/local/Inbox/movemail", evolution_dir);
- /* If using IMAP, don't do anything... */
- if (!strncmp (url, "imap:", 5))
- goto cleanup;
-
/* If fetching mail from an mbox store, safely copy it to a
* temporary store first.
*/
@@ -204,8 +201,7 @@ real_fetch_mail (gpointer user_data)
goto cleanup;
}
- folder = camel_store_get_folder (dest_store,
- strrchr (tmp_mbox, '/') + 1,
+ folder = camel_store_get_folder (dest_store, "movemail",
FALSE, ex);
if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
async_mail_exception_dialog ("Unable to move mail", ex, fb);
@@ -222,7 +218,6 @@ real_fetch_mail (gpointer user_data)
camel_service_connect (CAMEL_SERVICE (store), ex);
if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
- gtk_object_unref (GTK_OBJECT (dest_folder));
if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_USER_CANCEL)
async_mail_exception_dialog ("Unable to get new mail", ex, fb);
goto cleanup;
@@ -230,7 +225,6 @@ real_fetch_mail (gpointer user_data)
sourcefolder = camel_store_get_folder (store, "inbox", FALSE, ex);
if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
- gtk_object_unref (GTK_OBJECT (dest_folder));
async_mail_exception_dialog ("Unable to get new mail", ex, fb);
goto cleanup;
}
@@ -244,8 +238,7 @@ real_fetch_mail (gpointer user_data)
printf ("folder isn't searchable, performing movemail ...\n");
folder = camel_store_get_folder (dest_store,
- strrchr (tmp_mbox, '/') + 1,
- TRUE, ex);
+ "movemail", TRUE, ex);
if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
async_mail_exception_dialog ("Unable to move mail", ex, fb);
goto cleanup;
diff --git a/mail/message-list.c b/mail/message-list.c
index c8d757740c..97347dd87c 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -102,35 +102,45 @@ get_message_info (MessageList *message_list, int row)
}
/**
- * message_list_select_next:
+ * message_list_select:
* @message_list: a MessageList
- * @row: the row to start from
+ * @base_row: the row to start from
+ * @direction: the direction to search in
* @flags: a set of flag values
* @mask: a mask for comparing against @flags
*
- * This moves the message list selection to the first row on or after
- * @row whose flags match @flags when masked with @mask.
+ * This moves the message list selection to a suitable row. @base_row
+ * lists the first row to try, and @flags and @mask combine to specify
+ * what constitutes a suitable row. @direction is
+ * %MESSAGE_LIST_SELECT_NEXT if it should find the next matching
+ * message, or %MESSAGE_LIST_SELECT_PREVIOUS if it should find the
+ * previous. If no suitable row is found, the selection will be
+ * unchanged but the message display will be cleared.
**/
void
-message_list_select_next (MessageList *message_list, int row,
- guint32 flags, guint32 mask)
+message_list_select (MessageList *message_list, int base_row,
+ MessageListSelectDirection direction,
+ guint32 flags, guint32 mask)
{
const CamelMessageInfo *info;
+ int last;
- while (row < e_table_model_row_count (message_list->table_model)) {
- info = get_message_info (message_list, row);
+ if (direction == MESSAGE_LIST_SELECT_PREVIOUS)
+ last = 0;
+ else
+ last = e_table_model_row_count (message_list->table_model);
+
+ while (base_row != last) {
+ base_row += direction;
+ info = get_message_info (message_list, base_row);
if (info && (info->flags & mask) == flags) {
e_table_scrolled_set_cursor_row (E_TABLE_SCROLLED (message_list->etable),
- row);
+ base_row);
return;
}
- row++;
}
- /* We know "row" is out of bounds now, so this will cause the
- * MailDisplay to be cleared.
- */
- select_msg (message_list, row);
+ mail_display_set_message (message_list->parent_folder_browser->mail_display, NULL);
}
static gint