[evolution/wip/webkit2] Bug 687326 - Provide "Show Junk Messages" option for message list
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit2] Bug 687326 - Provide "Show Junk Messages" option for message list
- Date: Wed, 2 Mar 2016 13:23:07 +0000 (UTC)
commit f05b09d1bbb0b6a343424a046e99f96c26f768b7
Author: Milan Crha <mcrha redhat com>
Date: Fri Oct 16 18:16:52 2015 +0200
Bug 687326 - Provide "Show Junk Messages" option for message list
data/org.gnome.evolution.mail.gschema.xml.in | 5 +
e-util/e-cell-text.c | 36 +++++++
e-util/e-cell-text.h | 1 +
mail/e-mail-browser.c | 48 +++++++++
mail/e-mail-browser.h | 3 +
mail/e-mail-reader.c | 32 +------
mail/e-mail-view.c | 73 ++++++++++++++-
mail/e-mail-view.h | 6 +
mail/message-list.c | 134 +++++++++++++++++++++++---
mail/message-list.h | 6 +
modules/mail/e-mail-shell-view-actions.c | 19 ++++
modules/mail/e-mail-shell-view-actions.h | 2 +
modules/mail/e-mail-shell-view-private.h | 2 -
modules/settings/e-settings-mail-browser.c | 5 +
modules/settings/e-settings-message-list.c | 5 +
ui/evolution-mail.ui | 1 +
16 files changed, 333 insertions(+), 45 deletions(-)
---
diff --git a/data/org.gnome.evolution.mail.gschema.xml.in b/data/org.gnome.evolution.mail.gschema.xml.in
index 56ac0a4..85db8b2 100644
--- a/data/org.gnome.evolution.mail.gschema.xml.in
+++ b/data/org.gnome.evolution.mail.gschema.xml.in
@@ -294,6 +294,11 @@
<_summary>Show deleted messages in the message-list</_summary>
<_description>Show deleted messages (with a strike-through) in the message-list.</_description>
</key>
+ <key name="show-junk" type="b">
+ <default>false</default>
+ <_summary>Show junk messages in the message-list</_summary>
+ <_description>Show junk messages (with a red strike-through) in the message-list.</_description>
+ </key>
<key name="enable-unmatched" type="b">
<default>true</default>
<_summary>Enable Unmatched search folder</_summary>
diff --git a/e-util/e-cell-text.c b/e-util/e-cell-text.c
index f8ca1ac..2e49858 100644
--- a/e-util/e-cell-text.c
+++ b/e-util/e-cell-text.c
@@ -85,6 +85,7 @@ enum {
PROP_BOLD_COLUMN,
PROP_COLOR_COLUMN,
PROP_ITALIC_COLUMN,
+ PROP_STRIKEOUT_COLOR_COLUMN,
PROP_EDITABLE,
PROP_BG_COLOR_COLUMN
};
@@ -415,6 +416,7 @@ build_attr_list (ECellTextView *text_view,
ECellText *ect = E_CELL_TEXT (ecell_view->ecell);
PangoAttrList *attrs = pango_attr_list_new ();
gboolean bold, strikeout, underline, italic;
+ gint strikeout_color = 0;
bold = ect->bold_column >= 0 &&
row >= 0 &&
@@ -429,6 +431,9 @@ build_attr_list (ECellTextView *text_view,
row >= 0 &&
e_table_model_value_at (ecell_view->e_table_model, ect->italic_column, row);
+ if (ect->strikeout_color_column >= 0 && row >= 0)
+ strikeout_color = GPOINTER_TO_UINT (e_table_model_value_at (ecell_view->e_table_model,
ect->strikeout_color_column, row));
+
if (bold) {
PangoAttribute *attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
attr->start_index = 0;
@@ -457,6 +462,18 @@ build_attr_list (ECellTextView *text_view,
pango_attr_list_insert_before (attrs, attr);
}
+ if (strikeout_color) {
+ PangoAttribute *attr = pango_attr_strikethrough_color_new (
+ ((strikeout_color >> 16) & 0xFF) * 0xFF,
+ ((strikeout_color >> 8) & 0xFF) * 0xFF,
+ (strikeout_color & 0xFF) * 0xFF);
+
+ attr->start_index = 0;
+ attr->end_index = text_length;
+
+ pango_attr_list_insert_before (attrs, attr);
+ }
+
return attrs;
}
@@ -1581,6 +1598,10 @@ ect_set_property (GObject *object,
text->italic_column = g_value_get_int (value);
break;
+ case PROP_STRIKEOUT_COLOR_COLUMN:
+ text->strikeout_color_column = g_value_get_int (value);
+ break;
+
case PROP_COLOR_COLUMN:
text->color_column = g_value_get_int (value);
break;
@@ -1626,6 +1647,10 @@ ect_get_property (GObject *object,
g_value_set_int (value, text->italic_column);
break;
+ case PROP_STRIKEOUT_COLOR_COLUMN:
+ g_value_set_int (value, text->strikeout_color_column);
+ break;
+
case PROP_COLOR_COLUMN:
g_value_set_int (value, text->color_column);
break;
@@ -1751,6 +1776,16 @@ e_cell_text_class_init (ECellTextClass *class)
g_object_class_install_property (
object_class,
+ PROP_STRIKEOUT_COLOR_COLUMN,
+ g_param_spec_int (
+ "strikeout-color-column",
+ "Strikeout Color Column",
+ NULL,
+ -1, G_MAXINT, -1,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
PROP_COLOR_COLUMN,
g_param_spec_int (
"color_column",
@@ -1948,6 +1983,7 @@ e_cell_text_init (ECellText *ect)
ect->underline_column = -1;
ect->bold_column = -1;
ect->italic_column = -1;
+ ect->strikeout_color_column = -1;
ect->color_column = -1;
ect->bg_color_column = -1;
ect->editable = TRUE;
diff --git a/e-util/e-cell-text.h b/e-util/e-cell-text.h
index fe7bec5..c486cde 100644
--- a/e-util/e-cell-text.h
+++ b/e-util/e-cell-text.h
@@ -90,6 +90,7 @@ struct _ECellText {
gint underline_column;
gint bold_column;
gint italic_column;
+ gint strikeout_color_column;
/* This column in the ETable should return a string specifying a color,
* either a color name like "red" or a color spec like "rgb:F/0/0".
diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c
index 4c294a0..f7ba76e 100644
--- a/mail/e-mail-browser.c
+++ b/mail/e-mail-browser.c
@@ -62,6 +62,7 @@ struct _EMailBrowserPrivate {
gulong close_on_reply_response_handler_id;
guint show_deleted : 1;
+ guint show_junk : 1;
};
enum {
@@ -75,6 +76,7 @@ enum {
PROP_REPLY_STYLE,
PROP_MARK_SEEN_ALWAYS,
PROP_SHOW_DELETED,
+ PROP_SHOW_JUNK,
PROP_UI_MANAGER
};
@@ -455,6 +457,12 @@ mail_browser_set_property (GObject *object,
g_value_get_boolean (value));
return;
+ case PROP_SHOW_JUNK:
+ e_mail_browser_set_show_junk (
+ E_MAIL_BROWSER (object),
+ g_value_get_boolean (value));
+ return;
+
case PROP_MARK_SEEN_ALWAYS:
e_mail_reader_set_mark_seen_always (
E_MAIL_READER (object),
@@ -528,6 +536,13 @@ mail_browser_get_property (GObject *object,
E_MAIL_BROWSER (object)));
return;
+ case PROP_SHOW_JUNK:
+ g_value_set_boolean (
+ value,
+ e_mail_browser_get_show_junk (
+ E_MAIL_BROWSER (object)));
+ return;
+
case PROP_UI_MANAGER:
g_value_set_object (
value,
@@ -1021,6 +1036,17 @@ e_mail_browser_class_init (EMailBrowserClass *class)
g_object_class_install_property (
object_class,
+ PROP_SHOW_JUNK,
+ g_param_spec_boolean (
+ "show-junk",
+ "Show Junk",
+ "Show junk messages",
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
PROP_UI_MANAGER,
g_param_spec_object (
"ui-manager",
@@ -1176,6 +1202,28 @@ e_mail_browser_set_show_deleted (EMailBrowser *browser,
g_object_notify (G_OBJECT (browser), "show-deleted");
}
+gboolean
+e_mail_browser_get_show_junk (EMailBrowser *browser)
+{
+ g_return_val_if_fail (E_IS_MAIL_BROWSER (browser), FALSE);
+
+ return browser->priv->show_junk;
+}
+
+void
+e_mail_browser_set_show_junk (EMailBrowser *browser,
+ gboolean show_junk)
+{
+ g_return_if_fail (E_IS_MAIL_BROWSER (browser));
+
+ if (browser->priv->show_junk == show_junk)
+ return;
+
+ browser->priv->show_junk = show_junk;
+
+ g_object_notify (G_OBJECT (browser), "show-junk");
+}
+
GtkUIManager *
e_mail_browser_get_ui_manager (EMailBrowser *browser)
{
diff --git a/mail/e-mail-browser.h b/mail/e-mail-browser.h
index 54b6748..b0e5edd 100644
--- a/mail/e-mail-browser.h
+++ b/mail/e-mail-browser.h
@@ -78,6 +78,9 @@ EFocusTracker * e_mail_browser_get_focus_tracker
gboolean e_mail_browser_get_show_deleted (EMailBrowser *browser);
void e_mail_browser_set_show_deleted (EMailBrowser *browser,
gboolean show_deleted);
+gboolean e_mail_browser_get_show_junk (EMailBrowser *browser);
+void e_mail_browser_set_show_junk (EMailBrowser *browser,
+ gboolean show_junk);
GtkUIManager * e_mail_browser_get_ui_manager (EMailBrowser *browser);
G_END_DECLS
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index a3a8c46..48a7589 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -791,21 +791,8 @@ action_mail_mark_junk_cb (GtkAction *action,
CAMEL_MESSAGE_JUNK |
CAMEL_MESSAGE_JUNK_LEARN;
- if (e_mail_reader_mark_selected (reader, mask, set) == 1) {
- CamelFolder *folder;
- gboolean select_next_message;
-
- folder = e_mail_reader_ref_folder (reader);
-
- select_next_message =
- (folder != NULL) &&
- (folder->folder_flags & CAMEL_FOLDER_IS_JUNK);
-
- if (select_next_message)
- e_mail_reader_select_next_message (reader, TRUE);
-
- g_clear_object (&folder);
- }
+ if (e_mail_reader_mark_selected (reader, mask, set) != 0)
+ e_mail_reader_select_next_message (reader, TRUE);
}
static void
@@ -820,19 +807,8 @@ action_mail_mark_notjunk_cb (GtkAction *action,
CAMEL_MESSAGE_NOTJUNK |
CAMEL_MESSAGE_JUNK_LEARN;
- if (e_mail_reader_mark_selected (reader, mask, set) == 1) {
- CamelFolder *folder;
- gboolean select_next_message;
-
- folder = e_mail_reader_ref_folder (reader);
-
- select_next_message =
- (folder != NULL) &&
- (folder->folder_flags & CAMEL_FOLDER_IS_JUNK);
-
- if (select_next_message)
- e_mail_reader_select_next_message (reader, TRUE);
- }
+ if (e_mail_reader_mark_selected (reader, mask, set) != 0)
+ e_mail_reader_select_next_message (reader, TRUE);
}
static void
diff --git a/mail/e-mail-view.c b/mail/e-mail-view.c
index 0779eb5..f970be8 100644
--- a/mail/e-mail-view.c
+++ b/mail/e-mail-view.c
@@ -38,6 +38,7 @@ struct _EMailViewPrivate {
guint preview_visible : 1;
guint show_deleted : 1;
+ guint show_junk : 1;
};
enum {
@@ -46,7 +47,8 @@ enum {
PROP_PREVIEW_VISIBLE,
PROP_PREVIOUS_VIEW,
PROP_SHELL_VIEW,
- PROP_SHOW_DELETED
+ PROP_SHOW_DELETED,
+ PROP_SHOW_JUNK
};
enum {
@@ -106,6 +108,12 @@ mail_view_set_property (GObject *object,
E_MAIL_VIEW (object),
g_value_get_boolean (value));
return;
+
+ case PROP_SHOW_JUNK:
+ e_mail_view_set_show_junk (
+ E_MAIL_VIEW (object),
+ g_value_get_boolean (value));
+ return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -147,6 +155,12 @@ mail_view_get_property (GObject *object,
value, e_mail_view_get_show_deleted (
E_MAIL_VIEW (object)));
return;
+
+ case PROP_SHOW_JUNK:
+ g_value_set_boolean (
+ value, e_mail_view_get_show_junk (
+ E_MAIL_VIEW (object)));
+ return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -229,6 +243,24 @@ mail_view_set_show_deleted (EMailView *view,
g_object_notify (G_OBJECT (view), "show-deleted");
}
+static gboolean
+mail_view_get_show_junk (EMailView *view)
+{
+ return view->priv->show_junk;
+}
+
+static void
+mail_view_set_show_junk (EMailView *view,
+ gboolean show_junk)
+{
+ if (view->priv->show_junk == show_junk)
+ return;
+
+ view->priv->show_junk = show_junk;
+
+ g_object_notify (G_OBJECT (view), "show-junk");
+}
+
static void
e_mail_view_class_init (EMailViewClass *class)
{
@@ -247,6 +279,8 @@ e_mail_view_class_init (EMailViewClass *class)
class->set_preview_visible = mail_view_set_preview_visible;
class->get_show_deleted = mail_view_get_show_deleted;
class->set_show_deleted = mail_view_set_show_deleted;
+ class->get_show_junk = mail_view_get_show_junk;
+ class->set_show_junk = mail_view_set_show_junk;
signals[PANE_CLOSE] = g_signal_new (
"pane-close",
@@ -326,6 +360,16 @@ e_mail_view_class_init (EMailViewClass *class)
NULL,
FALSE,
G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SHOW_JUNK,
+ g_param_spec_boolean (
+ "show-junk",
+ "Show Junk",
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
}
static void
@@ -493,3 +537,30 @@ e_mail_view_set_show_deleted (EMailView *view,
class->set_show_deleted (view, show_deleted);
}
+
+gboolean
+e_mail_view_get_show_junk (EMailView *view)
+{
+ EMailViewClass *class;
+
+ g_return_val_if_fail (E_IS_MAIL_VIEW (view), FALSE);
+
+ class = E_MAIL_VIEW_GET_CLASS (view);
+ g_return_val_if_fail (class->get_show_junk != NULL, FALSE);
+
+ return class->get_show_junk (view);
+}
+
+void
+e_mail_view_set_show_junk (EMailView *view,
+ gboolean show_junk)
+{
+ EMailViewClass *class;
+
+ g_return_if_fail (E_IS_MAIL_VIEW (view));
+
+ class = E_MAIL_VIEW_GET_CLASS (view);
+ g_return_if_fail (class->set_show_junk != NULL);
+
+ class->set_show_junk (view, show_junk);
+}
diff --git a/mail/e-mail-view.h b/mail/e-mail-view.h
index b0b7f73..b0b740b 100644
--- a/mail/e-mail-view.h
+++ b/mail/e-mail-view.h
@@ -79,6 +79,9 @@ struct _EMailViewClass {
gboolean (*get_show_deleted) (EMailView *view);
void (*set_show_deleted) (EMailView *view,
gboolean show_deleted);
+ gboolean (*get_show_junk) (EMailView *view);
+ void (*set_show_junk) (EMailView *view,
+ gboolean show_junk);
};
GType e_mail_view_get_type (void);
@@ -100,6 +103,9 @@ void e_mail_view_set_previous_view (EMailView *view,
gboolean e_mail_view_get_show_deleted (EMailView *view);
void e_mail_view_set_show_deleted (EMailView *view,
gboolean show_deleted);
+gboolean e_mail_view_get_show_junk (EMailView *view);
+void e_mail_view_set_show_junk (EMailView *view,
+ gboolean show_junk);
G_END_DECLS
diff --git a/mail/message-list.c b/mail/message-list.c
index d7a43bd..eb6c9c3 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -99,6 +99,7 @@ struct _MessageListPrivate {
gboolean expanded_default;
gboolean group_by_threads;
gboolean show_deleted;
+ gboolean show_junk;
gboolean thread_latest;
gboolean thread_subject;
gboolean any_row_changed; /* save state before regen list when this is set to true */
@@ -172,6 +173,7 @@ enum {
PROP_PASTE_TARGET_LIST,
PROP_SESSION,
PROP_SHOW_DELETED,
+ PROP_SHOW_JUNK,
PROP_THREAD_LATEST,
PROP_THREAD_SUBJECT
};
@@ -294,7 +296,7 @@ static const gchar *status_map[] = {
N_("Answered"),
N_("Forwarded"),
N_("Multiple Unseen Messages"),
- N_("Multiple Messages"),
+ N_("Multiple Messages")
};
static const gchar *status_icons[] = {
@@ -330,7 +332,8 @@ static const gchar *attachment_icons[] = {
NULL, /* empty icon */
"mail-attachment",
"stock_new-meeting",
- "evolution-memos"
+ "evolution-memos",
+ "mail-mark-junk"
};
static const gchar *flagged_icons[] = {
@@ -1820,6 +1823,8 @@ ml_tree_value_at_ex (ETreeModel *etm,
str = camel_message_info_user_tag (msg_info, "follow-up");
return (gpointer)(str ? str : "");
case COL_ATTACHMENT:
+ if (camel_message_info_flags (msg_info) & CAMEL_MESSAGE_JUNK)
+ return GINT_TO_POINTER (4);
if (camel_message_info_user_flag (msg_info, E_MAIL_NOTES_USER_FLAG))
return GINT_TO_POINTER (3);
if (camel_message_info_user_flag (msg_info, "$has_cal"))
@@ -1875,6 +1880,12 @@ ml_tree_value_at_ex (ETreeModel *etm,
return GINT_TO_POINTER (camel_message_info_size (msg_info));
case COL_DELETED:
return GINT_TO_POINTER ((camel_message_info_flags (msg_info) & CAMEL_MESSAGE_DELETED) != 0);
+ case COL_DELETED_OR_JUNK:
+ return GINT_TO_POINTER ((camel_message_info_flags (msg_info) & (CAMEL_MESSAGE_DELETED |
CAMEL_MESSAGE_JUNK)) != 0);
+ case COL_JUNK:
+ return GINT_TO_POINTER ((camel_message_info_flags (msg_info) & CAMEL_MESSAGE_JUNK) != 0);
+ case COL_JUNK_STRIKEOUT_COLOR:
+ return GUINT_TO_POINTER (((camel_message_info_flags (msg_info) & CAMEL_MESSAGE_JUNK) != 0) ?
0xFF0000 : 0x0);
case COL_UNREAD: {
gboolean saw_unread = FALSE;
@@ -2143,10 +2154,18 @@ static ECell * create_composite_cell (gint col)
static void
composite_cell_set_strike_col (ECell *cell,
- gint col)
+ gint strikeout_col,
+ gint strikeout_color_col)
{
- g_object_set (g_object_get_data (G_OBJECT (cell), "cell_date"), "strikeout_column", col, NULL);
- g_object_set (g_object_get_data (G_OBJECT (cell), "cell_from"), "strikeout_column", col, NULL);
+ g_object_set (g_object_get_data (G_OBJECT (cell), "cell_date"),
+ "strikeout-column", strikeout_col,
+ "strikeout-color-column", strikeout_color_col,
+ NULL);
+
+ g_object_set (g_object_get_data (G_OBJECT (cell), "cell_from"),
+ "strikeout-column", strikeout_col,
+ "strikeout-color-column", strikeout_color_col,
+ NULL);
}
static ETableExtras *
@@ -2764,6 +2783,12 @@ message_list_set_property (GObject *object,
g_value_get_boolean (value));
return;
+ case PROP_SHOW_JUNK:
+ message_list_set_show_junk (
+ MESSAGE_LIST (object),
+ g_value_get_boolean (value));
+ return;
+
case PROP_THREAD_LATEST:
message_list_set_thread_latest (
MESSAGE_LIST (object),
@@ -2829,6 +2854,13 @@ message_list_get_property (GObject *object,
MESSAGE_LIST (object)));
return;
+ case PROP_SHOW_JUNK:
+ g_value_set_boolean (
+ value,
+ message_list_get_show_junk (
+ MESSAGE_LIST (object)));
+ return;
+
case PROP_THREAD_LATEST:
g_value_set_boolean (
value,
@@ -3153,6 +3185,9 @@ message_list_duplicate_value (ETreeModel *tree_model,
case COL_SCORE:
case COL_ATTACHMENT:
case COL_DELETED:
+ case COL_DELETED_OR_JUNK:
+ case COL_JUNK:
+ case COL_JUNK_STRIKEOUT_COLOR:
case COL_UNREAD:
case COL_SIZE:
case COL_FOLLOWUP_FLAG:
@@ -3200,6 +3235,9 @@ message_list_free_value (ETreeModel *tree_model,
case COL_SCORE:
case COL_ATTACHMENT:
case COL_DELETED:
+ case COL_DELETED_OR_JUNK:
+ case COL_JUNK:
+ case COL_JUNK_STRIKEOUT_COLOR:
case COL_UNREAD:
case COL_SIZE:
case COL_FOLLOWUP_FLAG:
@@ -3242,6 +3280,9 @@ message_list_initialize_value (ETreeModel *tree_model,
case COL_SCORE:
case COL_ATTACHMENT:
case COL_DELETED:
+ case COL_DELETED_OR_JUNK:
+ case COL_JUNK:
+ case COL_JUNK_STRIKEOUT_COLOR:
case COL_UNREAD:
case COL_SENT:
case COL_RECEIVED:
@@ -3278,6 +3319,9 @@ message_list_value_is_empty (ETreeModel *tree_model,
case COL_SCORE:
case COL_ATTACHMENT:
case COL_DELETED:
+ case COL_DELETED_OR_JUNK:
+ case COL_JUNK:
+ case COL_JUNK_STRIKEOUT_COLOR:
case COL_UNREAD:
case COL_SENT:
case COL_RECEIVED:
@@ -3326,6 +3370,9 @@ message_list_value_to_string (ETreeModel *tree_model,
case COL_ATTACHMENT:
case COL_FLAGGED:
case COL_DELETED:
+ case COL_DELETED_OR_JUNK:
+ case COL_JUNK:
+ case COL_JUNK_STRIKEOUT_COLOR:
case COL_UNREAD:
case COL_FOLLOWUP_FLAG_STATUS:
ii = GPOINTER_TO_UINT (value);
@@ -3450,6 +3497,18 @@ message_list_class_init (MessageListClass *class)
g_object_class_install_property (
object_class,
+ PROP_SHOW_JUNK,
+ g_param_spec_boolean (
+ "show-junk",
+ "Show Junk",
+ "Show messages marked as junk",
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
PROP_THREAD_LATEST,
g_param_spec_boolean (
"thread-latest",
@@ -3830,6 +3889,9 @@ message_list_get_hide_junk (MessageList *message_list,
if (folder == NULL)
return FALSE;
+ if (message_list_get_show_junk (message_list))
+ return FALSE;
+
if (!folder_store_supports_vjunk_folder (folder))
return FALSE;
@@ -4656,7 +4718,8 @@ message_list_set_folder (MessageList *message_list,
if (folder != NULL) {
CamelStore *store;
gboolean non_trash_folder;
- gint strikeout_col;
+ gboolean non_junk_folder;
+ gint strikeout_col, strikeout_color_col;
ECell *cell;
gulong handler_id;
@@ -4668,24 +4731,38 @@ message_list_set_folder (MessageList *message_list,
non_trash_folder =
((store->flags & CAMEL_STORE_VTRASH) == 0) ||
((folder->folder_flags & CAMEL_FOLDER_IS_TRASH) == 0);
-
- /* Setup the strikeout effect for non-trash folders */
- strikeout_col = non_trash_folder ? COL_DELETED : -1;
+ non_junk_folder =
+ ((store->flags & CAMEL_STORE_VJUNK) == 0) ||
+ ((folder->folder_flags & CAMEL_FOLDER_IS_JUNK) == 0);
+
+ strikeout_col = -1;
+ strikeout_color_col = -1;
+
+ /* Setup the strikeout effect for non-trash or non-junk folders */
+ if (non_trash_folder && non_junk_folder) {
+ strikeout_col = COL_DELETED_OR_JUNK;
+ strikeout_color_col = COL_JUNK_STRIKEOUT_COLOR;
+ } else if (non_trash_folder) {
+ strikeout_col = COL_DELETED;
+ } else if (non_junk_folder) {
+ strikeout_col = COL_JUNK;
+ strikeout_color_col = COL_JUNK_STRIKEOUT_COLOR;
+ }
cell = e_table_extras_get_cell (message_list->extras, "render_date");
- g_object_set (cell, "strikeout_column", strikeout_col, NULL);
+ g_object_set (cell, "strikeout-column", strikeout_col, "strikeout-color-column",
strikeout_color_col, NULL);
cell = e_table_extras_get_cell (message_list->extras, "render_text");
- g_object_set (cell, "strikeout_column", strikeout_col, NULL);
+ g_object_set (cell, "strikeout-column", strikeout_col, "strikeout-color-column",
strikeout_color_col, NULL);
cell = e_table_extras_get_cell (message_list->extras, "render_size");
- g_object_set (cell, "strikeout_column", strikeout_col, NULL);
+ g_object_set (cell, "strikeout-column", strikeout_col, "strikeout-color-column",
strikeout_color_col, NULL);
cell = e_table_extras_get_cell (message_list->extras, "render_composite_from");
- composite_cell_set_strike_col (cell, strikeout_col);
+ composite_cell_set_strike_col (cell, strikeout_col, strikeout_color_col);
cell = e_table_extras_get_cell (message_list->extras, "render_composite_to");
- composite_cell_set_strike_col (cell, strikeout_col);
+ composite_cell_set_strike_col (cell, strikeout_col, strikeout_color_col);
/* Build the etree suitable for this folder */
message_list_setup_etree (message_list);
@@ -4783,6 +4860,35 @@ message_list_set_show_deleted (MessageList *message_list,
}
gboolean
+message_list_get_show_junk (MessageList *message_list)
+{
+ g_return_val_if_fail (IS_MESSAGE_LIST (message_list), FALSE);
+
+ return message_list->priv->show_junk;
+}
+
+void
+message_list_set_show_junk (MessageList *message_list,
+ gboolean show_junk)
+{
+ g_return_if_fail (IS_MESSAGE_LIST (message_list));
+
+ if (show_junk == message_list->priv->show_junk)
+ return;
+
+ message_list->priv->show_junk = show_junk;
+
+ g_object_notify (G_OBJECT (message_list), "show-junk");
+
+ /* Invalidate the thread tree. */
+ message_list_set_thread_tree (message_list, NULL);
+
+ /* Changing this property triggers a message list regen. */
+ if (message_list->frozen == 0)
+ mail_regen_list (message_list, NULL, FALSE);
+}
+
+gboolean
message_list_get_thread_latest (MessageList *message_list)
{
g_return_val_if_fail (IS_MESSAGE_LIST (message_list), FALSE);
diff --git a/mail/message-list.h b/mail/message-list.h
index 2e7c68e..bf03712 100644
--- a/mail/message-list.h
+++ b/mail/message-list.h
@@ -82,6 +82,9 @@ enum {
/* Invisible columns */
COL_DELETED,
+ COL_DELETED_OR_JUNK,
+ COL_JUNK,
+ COL_JUNK_STRIKEOUT_COLOR,
COL_UNREAD,
COL_COLOUR,
COL_ITALIC
@@ -169,6 +172,9 @@ void message_list_set_group_by_threads
gboolean message_list_get_show_deleted (MessageList *message_list);
void message_list_set_show_deleted (MessageList *message_list,
gboolean show_deleted);
+gboolean message_list_get_show_junk (MessageList *message_list);
+void message_list_set_show_junk (MessageList *message_list,
+ gboolean show_junk);
gboolean message_list_get_thread_latest (MessageList *message_list);
void message_list_set_thread_latest (MessageList *message_list,
gboolean thread_latest);
diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c
index 71a29c3..51216a7 100644
--- a/modules/mail/e-mail-shell-view-actions.c
+++ b/modules/mail/e-mail-shell-view-actions.c
@@ -1999,6 +1999,14 @@ static GtkToggleActionEntry mail_toggle_entries[] = {
NULL, /* Handled by property bindings */
FALSE },
+ { "mail-show-junk",
+ NULL,
+ N_("Show _Junk Messages"),
+ NULL,
+ N_("Show junk messages with a red line through them"),
+ NULL, /* Handled by property bindings */
+ FALSE },
+
{ "mail-threads-group-by",
NULL,
N_("_Group By Threads"),
@@ -2270,6 +2278,11 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view)
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (
+ settings, "show-junk",
+ ACTION (MAIL_SHOW_JUNK), "active",
+ G_SETTINGS_BIND_DEFAULT);
+
+ g_settings_bind (
settings, "layout",
ACTION (MAIL_VIEW_VERTICAL), "current-value",
G_SETTINGS_BIND_DEFAULT);
@@ -2332,6 +2345,12 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view)
G_BINDING_SYNC_CREATE);
e_binding_bind_property (
+ ACTION (MAIL_SHOW_JUNK), "active",
+ mail_view, "show-junk",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE);
+
+ e_binding_bind_property (
shell_backend, "busy",
ACTION (MAIL_STOP), "sensitive",
G_BINDING_SYNC_CREATE);
diff --git a/modules/mail/e-mail-shell-view-actions.h b/modules/mail/e-mail-shell-view-actions.h
index ed1d58d..ab61498 100644
--- a/modules/mail/e-mail-shell-view-actions.h
+++ b/modules/mail/e-mail-shell-view-actions.h
@@ -184,6 +184,8 @@
E_SHELL_WINDOW_ACTION ((window), "mail-show-all-headers")
#define E_SHELL_WINDOW_ACTION_MAIL_SHOW_DELETED(window) \
E_SHELL_WINDOW_ACTION ((window), "mail-show-deleted")
+#define E_SHELL_WINDOW_ACTION_MAIL_SHOW_JUNK(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-show-junk")
#define E_SHELL_WINDOW_ACTION_MAIL_SHOW_SOURCE(window) \
E_SHELL_WINDOW_ACTION ((window), "mail-show-source")
#define E_SHELL_WINDOW_ACTION_MAIL_SMART_BACKWARD(window) \
diff --git a/modules/mail/e-mail-shell-view-private.h b/modules/mail/e-mail-shell-view-private.h
index fe43561..a176835 100644
--- a/modules/mail/e-mail-shell-view-private.h
+++ b/modules/mail/e-mail-shell-view-private.h
@@ -135,8 +135,6 @@ struct _EMailShellViewPrivate {
CamelVeeFolder *search_account_current;
GCancellable *search_account_cancel;
- guint show_deleted : 1;
-
GtkToolItem *send_receive_tool_item;
GtkToolItem *send_receive_tool_separator;
diff --git a/modules/settings/e-settings-mail-browser.c b/modules/settings/e-settings-mail-browser.c
index 3d75485..ef65f21 100644
--- a/modules/settings/e-settings-mail-browser.c
+++ b/modules/settings/e-settings-mail-browser.c
@@ -54,6 +54,11 @@ settings_mail_browser_constructed (GObject *object)
extensible, "show-deleted",
G_SETTINGS_BIND_GET);
+ g_settings_bind (
+ settings, "show-junk",
+ extensible, "show-junk",
+ G_SETTINGS_BIND_GET);
+
g_object_unref (settings);
}
diff --git a/modules/settings/e-settings-message-list.c b/modules/settings/e-settings-message-list.c
index 9725455..019f45d 100644
--- a/modules/settings/e-settings-message-list.c
+++ b/modules/settings/e-settings-message-list.c
@@ -52,6 +52,11 @@ settings_message_list_constructed (GObject *object)
G_SETTINGS_BIND_GET);
g_settings_bind (
+ settings, "show-junk",
+ message_list, "show-junk",
+ G_SETTINGS_BIND_GET);
+
+ g_settings_bind (
settings, "thread-latest",
message_list, "thread-latest",
G_SETTINGS_BIND_GET);
diff --git a/ui/evolution-mail.ui b/ui/evolution-mail.ui
index dac6a13..b58d222 100644
--- a/ui/evolution-mail.ui
+++ b/ui/evolution-mail.ui
@@ -33,6 +33,7 @@
<menuitem action='mail-threads-collapse-all'/>
<separator/>
<menuitem action='mail-show-deleted'/>
+ <menuitem action='mail-show-junk'/>
</placeholder>
</menu>
<placeholder name='custom-menus'>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]