diff options
author | Milan Crha <mcrha@redhat.com> | 2010-11-26 18:24:02 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2010-11-26 18:24:02 +0800 |
commit | b0ec19555204c560d192258a99511f50b6da52bc (patch) | |
tree | 08db3248612381f38ef3220f0c2faeb4323d7087 | |
parent | f3e171349c429f4ed25fd0cadba391e04220c380 (diff) | |
download | gsoc2013-evolution-b0ec19555204c560d192258a99511f50b6da52bc.tar gsoc2013-evolution-b0ec19555204c560d192258a99511f50b6da52bc.tar.gz gsoc2013-evolution-b0ec19555204c560d192258a99511f50b6da52bc.tar.bz2 gsoc2013-evolution-b0ec19555204c560d192258a99511f50b6da52bc.tar.lz gsoc2013-evolution-b0ec19555204c560d192258a99511f50b6da52bc.tar.xz gsoc2013-evolution-b0ec19555204c560d192258a99511f50b6da52bc.tar.zst gsoc2013-evolution-b0ec19555204c560d192258a99511f50b6da52bc.zip |
Bug #635738 - Sanitize Previous/Next buttons when not usable
-rw-r--r-- | mail/e-mail-reader.c | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index 0649a43d2f..6a96afdd3d 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -2950,6 +2950,8 @@ mail_reader_update_actions (EMailReader *reader, gboolean selection_has_unread_messages; gboolean selection_is_mailing_list; gboolean single_message_selected; + gboolean first_message_selected = FALSE; + gboolean last_message_selected = FALSE; priv = E_MAIL_READER_GET_PRIVATE (reader); @@ -3003,6 +3005,24 @@ mail_reader_update_actions (EMailReader *reader, any_messages_selected = (single_message_selected || multiple_messages_selected); + if (any_messages_selected) { + MessageList *message_list; + gint row = -1, count = -1; + ETreeTableAdapter *etta; + ETreePath node; + + message_list = MESSAGE_LIST (e_mail_reader_get_message_list (reader)); + etta = e_tree_get_table_adapter (E_TREE (message_list)); + + if (message_list->cursor_uid != NULL && (node = g_hash_table_lookup (message_list->uid_nodemap, message_list->cursor_uid)) != NULL) { + row = e_tree_table_adapter_row_of_node (etta, node); + count = e_table_model_row_count (E_TABLE_MODEL (etta)); + } + + first_message_selected = row <= 0; + last_message_selected = row < 0 || row + 1 >= count; + } + action_name = "mail-add-sender"; sensitive = single_message_selected; action = e_mail_reader_get_action (reader, action_name); @@ -3185,37 +3205,42 @@ mail_reader_update_actions (EMailReader *reader, gtk_action_set_sensitive (action, sensitive); action_name = "mail-next"; - sensitive = any_messages_selected; + sensitive = any_messages_selected && !last_message_selected; action = e_mail_reader_get_action (reader, action_name); gtk_action_set_sensitive (action, sensitive); action_name = "mail-next-important"; - sensitive = single_message_selected; + sensitive = single_message_selected && !last_message_selected; action = e_mail_reader_get_action (reader, action_name); gtk_action_set_sensitive (action, sensitive); action_name = "mail-next-thread"; - sensitive = single_message_selected; + sensitive = single_message_selected && !last_message_selected; action = e_mail_reader_get_action (reader, action_name); gtk_action_set_sensitive (action, sensitive); action_name = "mail-next-unread"; - sensitive = any_messages_selected; + sensitive = any_messages_selected && !last_message_selected; action = e_mail_reader_get_action (reader, action_name); gtk_action_set_sensitive (action, sensitive); action_name = "mail-previous"; - sensitive = any_messages_selected; + sensitive = any_messages_selected && !first_message_selected; action = e_mail_reader_get_action (reader, action_name); gtk_action_set_sensitive (action, sensitive); action_name = "mail-previous-important"; - sensitive = single_message_selected; + sensitive = single_message_selected && !first_message_selected; action = e_mail_reader_get_action (reader, action_name); gtk_action_set_sensitive (action, sensitive); action_name = "mail-previous-unread"; - sensitive = any_messages_selected; + sensitive = any_messages_selected && !first_message_selected; + action = e_mail_reader_get_action (reader, action_name); + gtk_action_set_sensitive (action, sensitive); + + action_name = "mail-previous-thread"; + sensitive = any_messages_selected && !first_message_selected; action = e_mail_reader_get_action (reader, action_name); gtk_action_set_sensitive (action, sensitive); |