From 520d69a638ea90f6114a8a7ef296317d64b65393 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Mon, 7 Aug 2000 17:03:06 +0000 Subject: Clarify that the input row is a model row, and swap it to a view row when * message-list.c (message_list_select): Clarify that the input row is a model row, and swap it to a view row when finding the next/previous row. (idle_select_row): Select view row 0, not model row 0. * mail-ops.c (select_first_unread): Start from view row 0, not model row 0. svn path=/trunk/; revision=4570 --- mail/ChangeLog | 10 ++++++++++ mail/mail-ops.c | 5 ++++- mail/message-list.c | 28 ++++++++++++++++++---------- 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 50b83ebf00..ab6a0fe208 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,13 @@ +2000-08-07 Dan Winship + + * message-list.c (message_list_select): Clarify that the input row + is a model row, and swap it to a view row when finding the + next/previous row. + (idle_select_row): Select view row 0, not model row 0. + + * mail-ops.c (select_first_unread): Start from view row 0, not + model row 0. + 2000-08-07 Jeffrey Stedfast * mail-format.c (mail_get_message_body): Renamed from reply_body() diff --git a/mail/mail-ops.c b/mail/mail-ops.c index fd3500f250..aa0323e842 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -120,8 +120,11 @@ static void select_first_unread (CamelFolder *folder, int type, gpointer data) { FolderBrowser *fb = data; + ETable *table = E_TABLE_SCROLLED (fb->message_list->etable)->table; + int mrow; - message_list_select (fb->message_list, 0, MESSAGE_LIST_SELECT_NEXT, + mrow = e_table_view_to_model_row (table, 0); + message_list_select (fb->message_list, mrow, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN); } diff --git a/mail/message-list.c b/mail/message-list.c index 91a177ffc4..2a390530e4 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -102,7 +102,7 @@ get_message_info (MessageList *message_list, int row) /** * message_list_select: * @message_list: a MessageList - * @base_row: the row to start from + * @base_row: the (model) row to start from * @direction: the direction to search in * @flags: a set of flag values * @mask: a mask for comparing against @flags @@ -121,19 +121,21 @@ message_list_select (MessageList *message_list, int base_row, guint32 flags, guint32 mask) { const CamelMessageInfo *info; - int last; + int vrow, mrow, last; + ETableScrolled *ets = E_TABLE_SCROLLED (message_list->etable); 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); + vrow = e_table_model_to_view_row (ets->table, base_row); + while (vrow != last) { + vrow += direction; + mrow = e_table_view_to_model_row (ets->table, vrow); + info = get_message_info (message_list, mrow); if (info && (info->flags & mask) == flags) { - e_table_scrolled_set_cursor_row (E_TABLE_SCROLLED (message_list->etable), - base_row); + e_table_scrolled_set_cursor_row (ets, mrow); return; } } @@ -939,15 +941,21 @@ on_cursor_change_cmd (ETableScrolled *table, int row, gpointer user_data) info = get_message_info (message_list, row); message_list->cursor_uid = info ? info->uid : NULL; - if (!message_list->idle_id) - message_list->idle_id = g_idle_add_full (G_PRIORITY_LOW, on_cursor_change_idle, message_list, NULL); + if (!message_list->idle_id) { + message_list->idle_id = + g_idle_add_full (G_PRIORITY_LOW, on_cursor_change_idle, + message_list, NULL); + } } /* FIXME: this is all a kludge. */ static gint idle_select_row (gpointer user_data) { - e_table_scrolled_set_cursor_row (user_data, 0); + ETableScrolled *ets = user_data; + int mrow = e_table_view_to_model_row (ets->table, 0); + + e_table_scrolled_set_cursor_row (ets, mrow); return FALSE; } -- cgit v1.2.3