diff options
-rw-r--r-- | mail/e-mail-reader.c | 38 | ||||
-rw-r--r-- | mail/e-mail-reader.h | 2 | ||||
-rw-r--r-- | mail/message-list.c | 22 | ||||
-rw-r--r-- | mail/message-list.h | 1 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-private.c | 24 | ||||
-rw-r--r-- | shell/e-shell-view.c | 16 | ||||
-rw-r--r-- | shell/e-shell-view.h | 2 | ||||
-rw-r--r-- | widgets/table/e-tree.h | 1 |
8 files changed, 103 insertions, 3 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 diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c index 269a122efe..b7e7f9575b 100644 --- a/modules/mail/e-mail-shell-view-private.c +++ b/modules/mail/e-mail-shell-view-private.c @@ -590,6 +590,24 @@ mail_shell_view_notify_view_id_cb (EMailShellView *mail_shell_view) gal_view_instance_set_current_view_id (view_instance, view_id); } +static void +mail_shell_view_search_filter_changed_cb (EMailShellView *mail_shell_view) +{ + EMailShellContent *mail_shell_content; + EMailView *mail_view; + + g_return_if_fail (mail_shell_view != NULL); + g_return_if_fail (mail_shell_view->priv != NULL); + + if (e_shell_view_is_execute_search_blocked (E_SHELL_VIEW (mail_shell_view))) + return; + + mail_shell_content = mail_shell_view->priv->mail_shell_content; + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); + + e_mail_reader_avoid_next_mark_as_seen (E_MAIL_READER (mail_view)); +} + void e_mail_shell_view_private_init (EMailShellView *mail_shell_view, EShellViewClass *shell_view_class) @@ -685,6 +703,12 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); + combo_box = e_shell_searchbar_get_filter_combo_box (searchbar); + g_signal_connect_object ( + combo_box, "changed", + G_CALLBACK (mail_shell_view_search_filter_changed_cb), + mail_shell_view, G_CONNECT_SWAPPED); + web_view = em_format_html_get_web_view (formatter); g_signal_connect_object ( diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index 89ac929160..5d7669cc9c 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -1676,7 +1676,7 @@ e_shell_view_execute_search (EShellView *shell_view) { g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); - if (!shell_view->priv->execute_search_blocked) + if (!e_shell_view_is_execute_search_blocked (shell_view)) g_signal_emit (shell_view, signals[EXECUTE_SEARCH], 0); } @@ -1713,6 +1713,20 @@ e_shell_view_unblock_execute_search (EShellView *shell_view) } /** + * e_shell_view_is_execute_search_blocked: + * @shell_view: an #EShellView + * + * Returns whether e_shell_view_execute_search() is blocked. + **/ +gboolean +e_shell_view_is_execute_search_blocked (EShellView *shell_view) +{ + g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), FALSE); + + return shell_view->priv->execute_search_blocked > 0; +} + +/** * e_shell_view_update_actions: * @shell_view: an #EShellView * diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h index 4387082f21..6f5912d6f8 100644 --- a/shell/e-shell-view.h +++ b/shell/e-shell-view.h @@ -214,6 +214,8 @@ void e_shell_view_block_execute_search (EShellView *shell_view); void e_shell_view_unblock_execute_search (EShellView *shell_view); +gboolean e_shell_view_is_execute_search_blocked + (EShellView *shell_view); void e_shell_view_update_actions (EShellView *shell_view); void e_shell_view_block_update_actions (EShellView *shell_view); diff --git a/widgets/table/e-tree.h b/widgets/table/e-tree.h index ae5639999c..f3d1f9f6a7 100644 --- a/widgets/table/e-tree.h +++ b/widgets/table/e-tree.h @@ -231,7 +231,6 @@ void e_tree_path_foreach (ETree *e_tree, ETreeForeachFunc callback, gpointer closure); #endif -gint e_tree_selected_count (ETree *e_tree); EPrintable *e_tree_get_printable (ETree *e_tree); gint e_tree_get_next_row (ETree *e_tree, gint model_row); |