aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2012-01-11 22:59:25 +0800
committerMilan Crha <mcrha@redhat.com>2012-01-11 22:59:25 +0800
commitd0f2c46a1cf7bbbfc56b1f9e835756cdf542ac75 (patch)
tree285a58f0ecc2ba6523072c1256470b1e04f3fb4c /mail
parentdd49067b2acfb72419f97a0348dc2524c3bbf56e (diff)
downloadgsoc2013-evolution-d0f2c46a1cf7bbbfc56b1f9e835756cdf542ac75.tar
gsoc2013-evolution-d0f2c46a1cf7bbbfc56b1f9e835756cdf542ac75.tar.gz
gsoc2013-evolution-d0f2c46a1cf7bbbfc56b1f9e835756cdf542ac75.tar.bz2
gsoc2013-evolution-d0f2c46a1cf7bbbfc56b1f9e835756cdf542ac75.tar.lz
gsoc2013-evolution-d0f2c46a1cf7bbbfc56b1f9e835756cdf542ac75.tar.xz
gsoc2013-evolution-d0f2c46a1cf7bbbfc56b1f9e835756cdf542ac75.tar.zst
gsoc2013-evolution-d0f2c46a1cf7bbbfc56b1f9e835756cdf542ac75.zip
Do not auto-mark-as-seen when changing filter type
Diffstat (limited to 'mail')
-rw-r--r--mail/e-mail-reader.c38
-rw-r--r--mail/e-mail-reader.h2
-rw-r--r--mail/message-list.c22
-rw-r--r--mail/message-list.h1
4 files changed, 62 insertions, 1 deletions
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 8f51972c25..5c67c62d02 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -94,6 +94,7 @@ struct _EMailReaderPrivate {
* happen when the -user- selects a message. */
guint folder_was_just_selected : 1;
guint restoring_message_selection : 1;
+ guint avoid_next_mark_as_seen : 1;
guint group_by_threads : 1;
};
@@ -2758,21 +2759,36 @@ static void
mail_reader_message_cursor_change_cb (EMailReader *reader)
{
MessageList *message_list;
+ EMailReaderPrivate *priv;
g_return_if_fail (reader != NULL);
+ priv = E_MAIL_READER_GET_PRIVATE (reader);
+ g_return_if_fail (priv != NULL);
+
message_list = MESSAGE_LIST (e_mail_reader_get_message_list (reader));
g_return_if_fail (message_list != NULL);
if (message_list->seen_id == 0 &&
E_IS_MAIL_VIEW (reader) &&
- e_mail_view_get_preview_visible (E_MAIL_VIEW (reader)))
+ e_mail_view_get_preview_visible (E_MAIL_VIEW (reader)) &&
+ !priv->avoid_next_mark_as_seen)
schedule_timeout_mark_seen (reader);
}
static void
mail_reader_emit_folder_loaded (EMailReader *reader)
{
+ EMailReaderPrivate *priv;
+ MessageList *message_list;
+
+ priv = E_MAIL_READER_GET_PRIVATE (reader);
+ message_list = MESSAGE_LIST (e_mail_reader_get_message_list (reader));
+
+ if (priv && (message_list_count (message_list) <= 0 ||
+ message_list_selected_count (message_list) <= 0))
+ priv->avoid_next_mark_as_seen = FALSE;
+
g_signal_emit (reader, signals[FOLDER_LOADED], 0);
}
@@ -2939,6 +2955,7 @@ mail_reader_message_loaded (EMailReader *reader,
/* Determine whether to mark the message as read. */
if (message != NULL &&
!priv->restoring_message_selection &&
+ !priv->avoid_next_mark_as_seen &&
schedule_timeout_mark_seen (reader)) {
g_clear_error (&error);
} else if (error != NULL) {
@@ -2948,6 +2965,8 @@ mail_reader_message_loaded (EMailReader *reader,
error->message, NULL);
g_error_free (error);
}
+
+ priv->avoid_next_mark_as_seen = FALSE;
}
static void
@@ -4419,3 +4438,20 @@ e_mail_reader_get_enable_show_folder (EMailReader *reader)
return interface->enable_show_folder (reader);
}
+
+void
+e_mail_reader_avoid_next_mark_as_seen (EMailReader *reader)
+{
+ EMailReaderPrivate *priv;
+ MessageList *message_list;
+
+ g_return_if_fail (reader != NULL);
+
+ priv = E_MAIL_READER_GET_PRIVATE (reader);
+ g_return_if_fail (priv != NULL);
+
+ message_list = MESSAGE_LIST (e_mail_reader_get_message_list (reader));
+ g_return_if_fail (message_list != NULL);
+
+ priv->avoid_next_mark_as_seen = TRUE;
+}
diff --git a/mail/e-mail-reader.h b/mail/e-mail-reader.h
index 9e362631cc..3ac0a5c6eb 100644
--- a/mail/e-mail-reader.h
+++ b/mail/e-mail-reader.h
@@ -176,6 +176,8 @@ gboolean e_mail_reader_get_enable_show_folder
(EMailReader *reader);
void e_mail_reader_enable_show_folder
(EMailReader *reader);
+void e_mail_reader_avoid_next_mark_as_seen
+ (EMailReader *reader);
G_END_DECLS
diff --git a/mail/message-list.c b/mail/message-list.c
index fd153e3e01..98fd90babb 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -4231,6 +4231,28 @@ message_list_count (MessageList *message_list)
return data.count;
}
+static void
+ml_getselcount_cb (gint model_row,
+ gpointer user_data)
+{
+ struct ml_count_data *data = user_data;
+
+ data->count++;
+}
+
+guint
+message_list_selected_count (MessageList *message_list)
+{
+ struct ml_count_data data = { message_list, 0 };
+
+ g_return_val_if_fail (message_list != NULL, 0);
+ g_return_val_if_fail (IS_MESSAGE_LIST (message_list), 0);
+
+ e_tree_selected_row_foreach (E_TREE (message_list), ml_getselcount_cb, &data);
+
+ return data.count;
+}
+
void
message_list_freeze (MessageList *ml)
{
diff --git a/mail/message-list.h b/mail/message-list.h
index ffd3a1364c..bd2e97b6f8 100644
--- a/mail/message-list.h
+++ b/mail/message-list.h
@@ -214,6 +214,7 @@ void message_list_copy (MessageList *message_list,
gboolean cut);
void message_list_paste (MessageList *message_list);
guint message_list_count (MessageList *message_list);
+guint message_list_selected_count (MessageList *message_list);
void message_list_set_threaded (MessageList *message_list,
gboolean threaded);
void message_list_set_threaded_expand_all