aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2010-11-26 18:24:32 +0800
committerMilan Crha <mcrha@redhat.com>2010-11-26 18:24:32 +0800
commit97b56f8aaf9497cf978b655bb5230e7b833fe006 (patch)
treefc8173fdc2e5d8f2ab70f5d389f590ffee83bf7a
parente972c5b2bc57f74d71d83fabbb821ebf646e5c03 (diff)
downloadgsoc2013-evolution-97b56f8aaf9497cf978b655bb5230e7b833fe006.tar
gsoc2013-evolution-97b56f8aaf9497cf978b655bb5230e7b833fe006.tar.gz
gsoc2013-evolution-97b56f8aaf9497cf978b655bb5230e7b833fe006.tar.bz2
gsoc2013-evolution-97b56f8aaf9497cf978b655bb5230e7b833fe006.tar.lz
gsoc2013-evolution-97b56f8aaf9497cf978b655bb5230e7b833fe006.tar.xz
gsoc2013-evolution-97b56f8aaf9497cf978b655bb5230e7b833fe006.tar.zst
gsoc2013-evolution-97b56f8aaf9497cf978b655bb5230e7b833fe006.zip
Bug #635738 - Sanitize Previous/Next buttons when not usable
-rw-r--r--mail/e-mail-reader.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index f628b657bf..dfb1ddf28c 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -2538,6 +2538,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);
@@ -2587,6 +2589,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);
@@ -2769,37 +2789,37 @@ 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);