Commit 300bdfd4 authored by Milan Crha's avatar Milan Crha

Bug 687326 - Provide "Show Junk Messages" option for message list

parent fc3567c5
......@@ -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>
......
......@@ -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;
......@@ -1749,6 +1774,16 @@ e_cell_text_class_init (ECellTextClass *class)
-1, G_MAXINT, -1,
G_PARAM_READWRITE));
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,
......@@ -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;
......
......@@ -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".
......
......@@ -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,
......@@ -1057,6 +1072,17 @@ e_mail_browser_class_init (EMailBrowserClass *class)
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
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,
......@@ -1214,6 +1240,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)
{
......
......@@ -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
......
......@@ -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
......
......@@ -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);
}
......@@ -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
......
......@@ -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);
......@@ -3448,6 +3495,18 @@ message_list_class_init (MessageListClass *class)
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS));
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,
......@@ -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);
......@@ -4782,6 +4859,35 @@ message_list_set_show_deleted (MessageList *message_list,
mail_regen_list (message_list, NULL, FALSE);
}
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)
{
......
......@@ -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);
......
......@@ -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"),
......@@ -2269,6 +2277,11 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view)
ACTION (MAIL_SHOW_DELETED), "active",
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",
......@@ -2331,6 +2344,12 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view)
G_BINDING_BIDIRECTIONAL |
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",
......
......@@ -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) \
......
......@@ -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;
......
......@@ -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