aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-07-07 05:33:07 +0800
committerDan Winship <danw@src.gnome.org>2000-07-07 05:33:07 +0800
commit647cc8b6365be0a5b754adeb7912904ecfb655ca (patch)
tree5b2aff04c81d1665eb85d933421aaefedb05ebb8 /mail
parent5eae81928c7cb0507a4f0d5ff72bafce84baa394 (diff)
downloadgsoc2013-evolution-647cc8b6365be0a5b754adeb7912904ecfb655ca.tar
gsoc2013-evolution-647cc8b6365be0a5b754adeb7912904ecfb655ca.tar.gz
gsoc2013-evolution-647cc8b6365be0a5b754adeb7912904ecfb655ca.tar.bz2
gsoc2013-evolution-647cc8b6365be0a5b754adeb7912904ecfb655ca.tar.lz
gsoc2013-evolution-647cc8b6365be0a5b754adeb7912904ecfb655ca.tar.xz
gsoc2013-evolution-647cc8b6365be0a5b754adeb7912904ecfb655ca.tar.zst
gsoc2013-evolution-647cc8b6365be0a5b754adeb7912904ecfb655ca.zip
New function to select the first message on or after the given row that
* message-list.c (message_list_select_next): New function to select the first message on or after the given row that meets certain flag criteria. * folder-browser.c (etable_key): call message_list_select_next to select next non-deleted message after Delete. * mail-ops.c (real_fetch_mail): call message_list_select_next to select first unread message in current folder if it changes. (real_delete_msg): Remove the code to move the etable cursor. It only makes sense really if you deleted the message with the keyboard, so do it from there. svn path=/trunk/; revision=3927
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog13
-rw-r--r--mail/folder-browser.c2
-rw-r--r--mail/mail-ops.c27
-rw-r--r--mail/message-list.c31
-rw-r--r--mail/message-list.h3
5 files changed, 69 insertions, 7 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 2e584bcdbe..117309a71f 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,18 @@
2000-07-06 Dan Winship <danw@helixcode.com>
+ * message-list.c (message_list_select_next): New function to
+ select the first message on or after the given row that meets
+ certain flag criteria.
+
+ * mail-ops.c (real_fetch_mail): call message_list_select_next to
+ select first unread message in current folder if it changes.
+ (real_delete_msg): Remove the code to move the etable cursor. It
+ only makes sense really if you deleted the message with the
+ keyboard, so do it from etable_key.
+
+ * folder-browser.c (etable_key): call message_list_select_next to
+ select next non-deleted message after Delete.
+
* mail-identify.c: Add a workaround for a small gnome-vfs 0.2 bug
so we don't need to require CVS gnome-vfs.
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index ebbf6dbfcb..ccc497c6bf 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -340,6 +340,8 @@ 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);
return TRUE;
}
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index a8f60d1f6a..49fec9acc4 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -119,6 +119,15 @@ check_configured (void)
return configured;
}
+static void
+select_first_unread (CamelFolder *folder, int type, gpointer data)
+{
+ FolderBrowser *fb = data;
+
+ message_list_select_next (fb->message_list, 0,
+ 0, CAMEL_MESSAGE_SEEN);
+}
+
void
real_fetch_mail (gpointer user_data )
{
@@ -131,6 +140,7 @@ real_fetch_mail (gpointer user_data )
FilterDriver *filter = NULL;
char *userrules, *systemrules;
char *tmp_mbox = NULL, *source;
+ guint handler_id;
info = (rfm_t *) user_data;
fb = info->fb;
@@ -276,11 +286,21 @@ real_fetch_mail (gpointer user_data )
g_free (userrules);
g_free (systemrules);
+ /* Attach a handler to this folder to select the first unread
+ * message iff it changes.
+ */
+ handler_id = gtk_signal_connect (GTK_OBJECT (fb->folder),
+ "folder_changed",
+ GTK_SIGNAL_FUNC (select_first_unread),
+ fb);
+
if (filter_driver_run (filter, folder, fb->folder) == -1) {
async_mail_exception_dialog ("Unable to get new mail", ex, fb);
goto cleanup;
}
+ gtk_signal_disconnect (GTK_OBJECT (fb->folder), handler_id);
+
cleanup:
g_free(tmp_mbox);
@@ -699,13 +719,6 @@ delete_msg (GtkWidget *button, gpointer user_data)
camel_exception_clear (&ex);
return;
}
-
- /* Move the cursor down a row... FIXME: should skip other
- * deleted messages. FIXME: this implementation is a bit
- * questionable. FIXME: this behaviour is very annoying
- * too.
- */
- e_table_set_cursor_row (E_TABLE (ml->etable), cursor + 1);
}
static void real_expunge_folder (gpointer user_data)
diff --git a/mail/message-list.c b/mail/message-list.c
index f12fec302b..34f4e078a0 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -139,6 +139,37 @@ get_message_row (MessageList *message_list, const char *uid)
return -1;
}
+/**
+ * message_list_select_next:
+ * @message_list: a MessageList
+ * @row: the row to start from
+ * @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.
+ **/
+void
+message_list_select_next (MessageList *message_list, int row,
+ guint32 flags, guint32 mask)
+{
+ CamelMessageInfo *info;
+
+ while ((info = get_message_info (message_list, row))) {
+ if ((info->flags & mask) == flags) {
+ e_table_set_cursor_row (E_TABLE (message_list->etable),
+ 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);
+}
+
static gint
mark_msg_seen (gpointer data)
{
diff --git a/mail/message-list.h b/mail/message-list.h
index 0e21e69998..942436731e 100644
--- a/mail/message-list.h
+++ b/mail/message-list.h
@@ -106,5 +106,8 @@ void message_list_foreach (MessageList *message_list,
MessageListForeachFunc callback,
gpointer user_data);
+void message_list_select_next(MessageList *message_list, int row,
+ guint32 flags, guint32 mask);
+
#endif /* _MESSAGE_LIST_H_ */